/* 明るめ調整（必要なら） */
:root{
  --bg:#ffffff;
  --panel:#1a2130;
  --user:#222c3e;
  --bot:#1c2433;
  --border:rgba(255,255,255,.09);
  --text:rgba(245,247,255,.92);
  --muted:rgba(210,216,230,.70);
  --primary:#2f6df6;
  --primaryText:#fff;
  --radius:14px;
}


*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a{ color: rgba(255,255,255,.85); }
a:hover{ opacity:.9; }

.topbar{
  position: sticky;
  top:0;
  z-index: 10;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 10px 12px;
  background: rgba(15,22,32,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand{ font-weight: 700; letter-spacing: .3px; }

.topbar-actions{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap: wrap; /* スマホで折り返す */
}

.app{
  height: calc(100% - 52px);
  display:flex;
  justify-content:center;
  padding: 12px;
}

.chat{
  width: min(860px, 100%);
  display:flex;
  flex-direction:column;
  gap:10px;
}

.chat-log{
  flex:1;
  overflow:auto;
  padding: 8px;
  border: 1px solid var(--border);
  background: rgba(15,22,32,.55);
  border-radius: var(--radius);
}

.bubble-row{ display:flex; margin: 8px 0; }
.bubble-row.user{ justify-content:flex-end; }
.bubble-row.bot{ justify-content:flex-start; }

.bubble{
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bot);
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
}

.bubble-row.user .bubble{ background: var(--user); }

.text{ white-space: pre-wrap; line-height: 1.55; }

.sources{
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid var(--border);
  display:flex;
  flex-direction:column;
  gap:6px;
}
.sources-title{ color: var(--muted); font-size: 12px; }
.sources a{ word-break: break-all; text-decoration: none; font-size: 12px; opacity: .95; }

.actions{ margin-top:10px; display:flex; gap:8px; flex-wrap: wrap; }

.composer{
  display:flex;
  gap:8px;
  align-items:center;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(15,22,32,.65);
}

.msg{
  flex:1;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.20);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.msg::placeholder{ color: rgba(255,255,255,.45); }

.btn{
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor: pointer;
  user-select:none;
}

.btn:active{ transform: translateY(1px); }

.btn-primary{
  background: var(--primary);
  border-color: rgba(255,255,255,.12);
  color: var(--primaryText);
  font-weight: 700;
}

.btn-ghost{ background: rgba(255,255,255,.06); }

.btn.is-on{
  background: rgba(59,130,246,.25);
  outline: 2px solid rgba(59,130,246,.55);
}

.btn[disabled]{ opacity:.45; cursor:not-allowed; }

#micBtn.is-on{ outline: 2px solid rgba(59,130,246,.65); }

.hint{ color: var(--muted); font-size: 12px; padding: 0 4px; }

@media (max-width: 520px){
  .app{ padding: 10px; }
  .composer{ padding: 8px; }
  .btn{ padding: 0 12px; }
  .bubble{ max-width: 100%; }
  .msg{ height: 46px; }
}
