:root {
  --bg: #0a0a0a;
  --bg-header: #000000;
  --bg-chat: #0a0a0a;
  --bg-input: #171717;
  --bg-assistant: #171717;
  --border: #1e1e1e;
  --border-light: #2a2a2a;
  --text: #ffffff;
  --text-sub: #888;
  --text-hint: #444;
  --accent: #4FD1C5;
}

body.light {
  --bg: #e5e5e5;
  --bg-header: #dcdcdc;
  --bg-chat: #e5e5e5;
  --bg-input: #ffffff;
  --bg-assistant: #ffffff;
  --border: #c8c8c8;
  --border-light: #d1d1d1;
  --text: #111111;
  --text-sub: #666;
  --text-hint: #999;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  transition: background .2s, color .2s;
}



/* ===== ヘッダー 完全固定版 ===== */
header {
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-header);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  overflow: hidden;
  flex-shrink: 0;
  white-space: nowrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 0 auto;
  overflow: hidden;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: flex-end;
  overflow: hidden;
}

header h1 {
  font-size: 13px;
  margin: 0;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

#model-select {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11px;
  outline: none;
  flex-shrink: 0;
}
#model-select:focus { border-color: var(--accent); }

#download-btn {
  background: var(--accent);
  color: #000;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}
#download-btn:active { transform: scale(0.96); }
#download-btn:disabled { opacity:.35; cursor: not-allowed; }
#download-btn.ready {
  background: var(--bg-input);
  color: var(--accent);
  border: 1px solid var(--accent);
}

#status {
  font-size: 11px;
  color: var(--text-sub);
  background: none!important;
  border: none!important;
  padding: 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 38vw;
  flex: 0 1 auto;
  line-height: 1;
}
#status.ready { color: var(--accent); font-weight: 600; }
#status.loading { color: var(--accent); }

#progress-wrap { height: 3px; background: var(--border); flex-shrink: 0; }
#progress-bar { height: 100%; width: 0%; background: var(--accent); transition: width .2s; }

#chat {
  flex: 1;
  overflow-y: auto;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-chat);
  position: relative;
}

.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #000;
  font-weight: 600;
  border-bottom-right-radius: 6px;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--bg-assistant);
  border: 1px solid var(--border-light);
  color: var(--text);
  border-bottom-left-radius: 6px;
}
.msg.system {
  align-self: center;
  background: var(--bg-input);
  border: 1px dashed var(--border-light);
  color: var(--text-sub);
  font-size: 11px;
  max-width: 90%;
}

#loading-view {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex: 1;
  padding: 40px 0;
  text-align: center;
}
#loading-view.show { display: flex; }
.loading-icon {
  width: 200px;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}
#loading-icon-dark { display: block; }
#loading-icon-light { display: none; }
body.light #loading-icon-dark { display: none; }
body.light #loading-icon-light { display: block; }

#loading-text {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.6;
  white-space: pre-wrap;
  max-width: 80%;
}
#chat.is-first-loading .msg { display: none; }

#composer {
  padding: 10px 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  min-width: 0;
}
#composer > button {
  flex-shrink: 0;
}
#input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 15px;
  outline: none;
  background: var(--bg-input);
  color: var(--text);
}
#input::placeholder { color: var(--text-sub); }
#input:focus { border-color: var(--accent); }

#send, #settings-btn, #mic-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.12s, opacity 0.12s, background 0.15s, border-color 0.15s;
}
#send { background: var(--accent); color: #000; }
#send:disabled { opacity:.4; }
#send:active:not(:disabled) { transform: scale(0.96); }
#send svg { transform: translateX(1px); }

#settings-btn {
  background: var(--bg-input);
  color: var(--text-sub);
  border: 1px solid var(--border-light);
}
#settings-btn:hover { color: var(--text); }
#settings-btn:active { transform: scale(0.96); }

.hint { font-size: 10px; color: var(--text-hint); text-align: center; padding: 4px 12px 8px; background: var(--bg); }

/* 設定パネル */
#settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 20;
}
#settings-overlay.show { opacity: 1; pointer-events: auto; }
body.light #settings-overlay { background: rgba(0,0,0,.25); }

#settings-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  max-height: 82vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.32,.72,0,1);
  z-index: 21;
  padding-bottom: env(safe-area-inset-bottom);
}
#settings-panel.show { transform: translateY(0); }

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-header);
}
.settings-header h2 { font-size: 14px; margin: 0; color: var(--text); }
#settings-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-input);
  color: var(--text);
  cursor: pointer;
}

.settings-body { padding: 14px 18px 24px; display: flex; flex-direction: column; gap: 22px; }
.settings-section { display: flex; flex-direction: column; gap: 8px; }
.settings-label { font-size: 12px; font-weight: 600; color: var(--text); }
.settings-desc { font-size: 11px; color: var(--text-sub); }

#system-prompt-input {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
}
#system-prompt-input:focus { border-color: var(--accent); }

.settings-row { display: flex; gap: 8px; }
.primary-btn {
  background: var(--accent);
  color: #000;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.primary-btn:active { transform: scale(0.97); }
.secondary-btn {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px;
  cursor: pointer;
}

.theme-options { display: flex; gap: 8px; }
.theme-opt {
  flex: 1;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--bg-input);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.theme-opt.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}


/* === Voice === */
#mic-btn {
  background: var(--bg-input);
  color: var(--text-sub);
  border: 1px solid var(--border-light);
}
#mic-btn.on {
  background: #ef4444; border-color: #ef4444; color: #fff;
  animation: pulse 1.2s infinite;
}
#mic-btn.muted { opacity:.5; }
#mic-btn.speak { background: #8b5cf6; border-color: #8b5cf6; color: #fff; }
@keyframes pulse {
  0%{ box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  70%{ box-shadow: 0 0 0 10px rgba(239,68,68,0); }
  100%{ box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

@media (max-width: 380px) {
  #composer { gap: 6px; padding: 10px 8px; }
  #mic-btn, #send, #settings-btn { width: 36px; height: 36px; }
}

/* チャット背景 - 修正版 */
#chat {
  position: relative;
  background-size: cover;
  background-position: center;
}
#chat.has-custom-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent; /* 暗幕なし = 写真そのまま */
  z-index: 0;
  pointer-events: none;
}
body.light #chat.has-custom-bg::before {
  background: rgba(229,229,229,var(--chat-bg-overlay, 0.4));
}
/* ←ここスペース入れるのが重要 */
#chat.has-custom-bg .msg,
#chat.has-custom-bg #loading-view {
  position: relative;
  z-index: 1;
}

/* アイコンのモヤはそのままでOK */
.loading-icon {
  width: 200px;
  height: 200px;
  border-radius: 36px;
  -webkit-mask-image: radial-gradient(ellipse at center, black 60%, transparent 88%);
  mask-image: radial-gradient(ellipse at center, black 60%, transparent 88%);
  box-shadow: 0 0 45px 18px var(--bg, #0a0a0a);
}



#menu-btn{
  width: auto;
  height: auto;
  border: none;
  background: none;
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 0;
}
#menu-btn:hover{ opacity: 0.6; }
#menu-btn:active{ opacity: 0.4; }

#room-drawer{
  position:fixed; top:0; left:0; bottom:0; width:280px;
  background:var(--bg, #0a0a0a); z-index:100;
  transform:translateX(-100%); transition:transform 0.25s ease;
  overflow-y:auto; border-right:1px solid #222;
}
#room-drawer.open{ transform:translateX(0); }
#room-overlay{
  position:fixed; inset:0; background:rgba(0,0,0,0.5);
  z-index:99; display:none;
}
#room-overlay.open{ display:block; }

.room-item{
  padding:12px 16px;
  border-bottom:1px solid var(--border);
  cursor:pointer;
  color: var(--text);
  background: transparent;
}
.room-item:hover{ background: var(--bg-input); }
.room-item.active{
  background: var(--bg-input);
  border-left:3px solid var(--accent, #4FD1C5);
}
.room-del-btn{
  width:24px; height:24px; border-radius:50%;
  border:1px solid var(--border-light);
  background:transparent;
  color: var(--text-sub);
  cursor:pointer; flex-shrink:0;
}
/* ===== ドロワー内 ブランディング ===== */
.drawer-branding {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.drawer-branding .brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* デフォルト（ダークモード）では Light 用を隠す */
.drawer-branding .brand-icon-light {
  display: none;
}

/* ライトモード時は Dark 用を隠し、Light 用を表示する */
body.light .drawer-branding .brand-icon-dark {
  display: none;
}
body.light .drawer-branding .brand-icon-light {
  display: block;
}

.drawer-branding .brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin: 0;
  white-space: nowrap;
  /* テキストにグラデーションをかけてかっこよくする */
  background: linear-gradient(135deg, var(--text) 20%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* 微かな影で浮き上がりを表現 */
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

/* ライトモード時の影の微調整 */
body.light .drawer-branding .brand-title {
  filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.5));
}
.room-del-btn:hover{ color: var(--text); border-color: var(--text-sub); }

/* ライトモード上書き */
body.light .room-item{ border-bottom-color: #ddd; }
body.light .room-item:hover{ background:#f0f0f0; }
body.light .room-item.active{ background:#ffffff; }



.settings-group{
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:14px 0 18px;
  border-bottom:1px solid var(--border);
}
.settings-group:last-of-type{ border-bottom:none; }
.settings-group-title{
  font-size:11px;
  font-weight:700;
  letter-spacing:0.08em;
  color: var(--text-sub);
  text-transform: uppercase;
  opacity:0.9;
}


.settings-group{ border-bottom:1px solid var(--border); }
.settings-group-btn{
  width:100%; display:flex; justify-content:space-between; align-items:center;
  background:none; border:none; color:var(--text);
  font-size:14px; font-weight:600; padding:16px 2px;
  cursor:pointer;
}
.settings-group-btn .arrow{ transition:transform .2s; opacity:0.5; }
.settings-group.open .settings-group-btn .arrow{ transform:rotate(90deg); }
.settings-group-content{ display:none; flex-direction:column; gap:14px; padding:0 0 18px; }
.settings-group.open .settings-group-content{ display:flex; }

/* ===== モデル選択UI (mp-) ===== */
#mp-trigger{
  display:inline-flex; align-items:center; gap:6px;
  width:auto; height:auto; max-width:130px; flex-shrink:0;
  background:var(--bg-input); color:var(--text);
  border:1px solid var(--border-light); border-radius:999px;
  padding:6px 10px 6px 12px; font-size:11px; font-weight:600; cursor:pointer;
}
#mp-trigger-label{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#mp-trigger:active{ border-color:var(--accent); }

#mp-overlay{
  position:fixed; inset:0; background:rgba(0,0,0,.5);
  opacity:0; pointer-events:none; transition:opacity .2s; z-index:40;
}
#mp-overlay.open{ opacity:1; pointer-events:auto; }
body.light #mp-overlay{ background:rgba(0,0,0,.25); }

#mp-sheet{
  position:fixed; left:0; right:0; bottom:0;
  background:var(--bg-header); border-top:1px solid var(--border);
  border-radius:18px 18px 0 0; max-height:78vh;
  display:flex; flex-direction:column;
  transform:translateY(100%);
  transition:transform .28s cubic-bezier(.32,.72,0,1);
  z-index:41; padding-bottom:env(safe-area-inset-bottom);
}
#mp-sheet.open{ transform:translateY(0); }

.mp-head{ display:flex; justify-content:space-between; align-items:center; padding:14px 16px; border-bottom:1px solid var(--border); }
.mp-title{ font-size:14px; font-weight:600; color:var(--text); }
#mp-close{ width:auto; height:auto; background:none; border:none; color:var(--text-sub); font-size:22px; line-height:1; cursor:pointer; padding:0 4px; }

#mp-list{ overflow-y:auto; padding:10px 12px; display:flex; flex-direction:column; gap:8px; }
.mp-item{
  display:flex; align-items:center; gap:12px; width:100%; height:auto; text-align:left;
  background:var(--bg-input); color:var(--text);
  border:1px solid var(--border-light); border-radius:14px;
  padding:12px 14px; cursor:pointer;
}
.mp-item:active{ transform:scale(.98); }
.mp-item.selected{ border-color:var(--accent); }
.mp-item-main{ flex:1; min-width:0; display:flex; flex-direction:column; gap:3px; }
.mp-item-name{ font-size:14px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mp-item-desc{ font-size:11px; color:var(--text-sub); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mp-badges{ display:flex; gap:6px; flex-shrink:0; }
.mp-badge{ font-size:10px; padding:2px 8px; border-radius:999px; border:1px solid var(--border-light); color:var(--text-sub); }
.mp-badge.live{ background:var(--accent); border-color:var(--accent); color:#000; font-weight:700; }
.mp-check{ width:18px; height:18px; border-radius:50%; border:2px solid var(--border-light); flex-shrink:0; }
.mp-item.selected .mp-check{ border-color:var(--accent); background:var(--accent); box-shadow:inset 0 0 0 3px var(--bg-input); }
.mp-foot{ font-size:10px; color:var(--text-hint); text-align:center; padding:8px 12px 12px; }

/* ===== コンテキスト設定 ===== */
#context-size {
  width: 100%;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12px;
  outline: none;
}

#context-size:focus {
  border-color: var(--accent);
}


#tts-voice-select {
  width: 100%;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 30px 8px 10px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
#tts-voice-select:focus { border-color: var(--accent); }

/* ===== リピートペナルティ ===== */
#repeat-penalty-slider {
  width: 100%;
}

/*パーソナルモードスイッチ*/
.personal-mode-btn {
  display: block;
  margin: 12px;
  padding: 12px 16px;

  border: 1px solid var(--border-light);
  border-radius: 999px;

  background: var(--bg-input);
  color: var(--text);

  text-align: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;

  transition: background .15s, border-color .15s, transform .12s;
}

.personal-mode-btn:hover {
  border-color: var(--accent);
}

.personal-mode-btn:active {
  transform: scale(.97);
}


/* ===== 初回チュートリアル ===== */

#tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);

  opacity: 0;
  pointer-events: none;

  transition: opacity .25s ease;
  z-index: 200;
}

#tutorial-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

#tutorial-panel {
  position: fixed;
  left: 50%;
  top: 50%;

  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);

  transform: translate(-50%, -46%) scale(.96);

  background: var(--bg-header);
  color: var(--text);

  border: 1px solid var(--border-light);
  border-radius: 20px;

  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);

  opacity: 0;
  pointer-events: none;

  transition:
    opacity .25s ease,
    transform .25s cubic-bezier(.32,.72,0,1);

  z-index: 201;

  overflow-y: auto;
}

#tutorial-panel.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.tutorial-content {
  padding: 26px 22px 22px;
}

#tutorial-title {
  margin: 0 0 20px;
  font-size: 21px;
  line-height: 1.4;
  font-weight: 700;
}

.tutorial-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
}

.tutorial-text p {
  margin: 0 0 14px;
}

.tutorial-text p:last-child {
  margin-bottom: 22px;
}

.tutorial-text strong {
  color: var(--accent);
  font-weight: 700;
}

#tutorial-start-btn {
  width: 100%;
  padding: 12px 18px;
  font-size: 14px;
}

/* ライトモード */
body.light #tutorial-overlay {
  background: rgba(0, 0, 0, .35);
}

/* ===== コンテキスト設定 / スレッド数 ===== */
#context-size,
#thread-count {
  width: 100%;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12px;
  outline: none;
}

#context-size:focus,
#thread-count:focus {
  border-color: var(--accent);
}

/* ===== PC/タブレット（横長）時のレスポンシブ対応 ===== */
@media (min-width: 768px) {
  /* ドロワーを常時表示 */
  #room-drawer {
    transform: translateX(0) !important;
    box-shadow: 1px 0 0 var(--border);
  }

  /* オーバーレイは不要なので非表示 */
  #room-overlay {
    display: none !important;
  }

  /* メニューボタン（≡）は非表示 */
  #menu-btn {
    display: none;
  }

  /* メインエリアをドロワーの幅（280px）分ずらす */
  header,
  #progress-wrap,
  #chat,
  #voice-preview,
  .hint,
  #composer {
    margin-left: 280px;
    width: calc(100% - 280px);
    max-width: calc(100% - 280px);
  }

  /* 設定パネルとモデル選択パネルはドロワーの右側で中央寄せ */
  #settings-panel,
  #mp-sheet {
    left: 280px;
    right: 0;
    width: auto;
    max-width: 640px;
    margin: 0 auto;
  }

  /* チュートリアルパネルは画面全体に対して中央配置（元に戻す） */
  #tutorial-panel {
    left: 50% !important;
    right: auto !important;
    width: min(440px, calc(100vw - 32px));
  }
}

/* さらに大きい画面（大型PC）での微調整 */
@media (min-width: 1200px) {
  #room-drawer {
    width: 320px;
  }
  header,
  #progress-wrap,
  #chat,
  #voice-preview,
  .hint,
  #composer {
    margin-left: 320px;
    width: calc(100% - 320px);
    max-width: calc(100% - 320px);
  }
  #settings-panel,
  #mp-sheet {
    left: 320px;
  }
  /* チュートリアルは大型画面でも中央固定 */
  #tutorial-panel {
    left: 50% !important;
  }
}

/* ===== 回答生成中の待機UI ===== */
.msg.assistant.pending {
  border-style: dashed;
  opacity: .9;
}

.pending-answer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-sub);
  font-size: 13px;
  line-height: 1.5;
}

.pending-icon {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  animation: pending-spin 0.9s linear infinite;
}

.pending-text {
  animation: pending-blink 1.4s ease-in-out infinite;
}

@keyframes pending-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pending-blink {
  0%, 100% {
    opacity: .55;
  }
  50% {
    opacity: 1;
  }
}

/* ===== PWA対策：テキストボックスを強制で下に戻す ===== */

/* PWA表示時は高さを安全側に */
@media (display-mode: standalone) {
  body {
    height: 100svh;
  }
}

/* テキストボックスを画面下に固定 */
#composer {
  position: fixed !important;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 !important;
  width: auto !important;
  max-width: none !important;
  z-index: 12;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

/* ヒント文を復活させ、テキストボックスの真上に置く */
.hint {
  display: block;
  margin-bottom: calc(61px + env(safe-area-inset-bottom));
}

/* PC/タブレット：ドロワー常時表示時の位置調整 */
@media (min-width: 768px) {
  #composer {
    left: 280px;
    right: 0;
  }
}

@media (min-width: 1200px) {
  #composer {
    left: 320px;
  }
}

/* ===== ライトモード時のドロワーロゴ影対策 ===== */

body.light #room-drawer {
  background: var(--bg-chat);
}

body.light .drawer-branding {
  background: var(--bg-chat);
  border-bottom-color: var(--border-light);
}

body.light .drawer-branding .brand-icon {
  box-shadow: none;
}

body.light .drawer-branding .brand-title {
  filter: none;
}
