:root {
  --ink: #172033;
  --muted: #64748b;
  --line: #d8dee8;
  --panel: #f8fafc;
  --paper: #ffffff;
  --blue: #2563eb;
  --teal: #0f766e;
  --rose: #e11d48;
  --amber: #b45309;
  --green: #15803d;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(135deg, #eef6ff 0%, #f8fafc 40%, #fff7ed 100%);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
button {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}
button:hover { border-color: var(--blue); color: var(--blue); }
button:disabled { cursor: not-allowed; opacity: .62; }
button:disabled:hover { border-color: var(--line); color: inherit; }
button.active, button.primary { background: var(--blue); color: white; border-color: var(--blue); }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  background: white;
}
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}
.stage, .side {
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(216, 222, 232, .9);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, .08);
  backdrop-filter: blur(14px);
}
.stage { display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.topbar strong { display: block; font-size: 18px; }
.topbar span { color: var(--muted); font-size: 13px; }
#connectionLabel {
  display: inline-block;
  margin-left: 8px;
  color: var(--teal);
}
.top-actions { display: flex; gap: 8px; }
.join-panel {
  min-height: 520px;
  display: grid;
  place-items: center;
  gap: 28px;
  padding: 36px;
}
.brand { max-width: 680px; text-align: center; }
.brand h1 { margin: 14px 0 10px; font-size: clamp(34px, 5vw, 68px); line-height: 1.02; letter-spacing: 0; }
.brand p { margin: 0 auto; max-width: 620px; color: var(--muted); font-size: 18px; line-height: 1.7; }
.pulse {
  display: inline-block;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #67e8f9, #2563eb 55%, #172033);
  box-shadow: 0 0 0 18px rgba(37, 99, 235, .08), 0 18px 50px rgba(37, 99, 235, .28);
}
.join-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  width: min(760px, 100%);
}
.join-form label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.join-form button { align-self: end; background: var(--ink); color: white; border-color: var(--ink); min-width: 120px; }
.room-panel { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.voice-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  align-content: start;
  gap: 12px;
  padding: 16px;
  overflow: auto;
}
.peer {
  min-height: 150px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.avatar {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-weight: 800;
  font-size: 20px;
}
.peer-name { font-weight: 700; margin-top: 10px; word-break: break-word; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; }
.caption { color: var(--teal); font-size: 13px; min-height: 20px; margin-top: 10px; }
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: rgba(248, 250, 252, .88);
}
.controls button.output-warning {
  border-color: var(--amber);
  color: var(--amber);
}
.side { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.tabs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 9px 6px; }
.tab-page { display: none; min-height: 0; flex: 1; }
.tab-page.active { display: flex; flex-direction: column; }
.messages, .list {
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.message, .item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.meta { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 8px; }
.body { margin-top: 6px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.reactions { display: flex; gap: 6px; margin-top: 8px; }
.reaction { padding: 3px 7px; font-size: 12px; }
.composer {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}
.stack-form { display: grid; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.stack-form button { background: var(--teal); color: white; border-color: var(--teal); }
.summary-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.summary-presets button {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}
.summary-scope {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}
.summary-scope label {
  display: flex;
  align-items: center;
  gap: 5px;
}
.mine-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mine-tools button {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}
.content-picker {
  max-height: 220px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}
.content-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.content-choice span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 3px;
}
.poll-option {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}
#notesBox {
  flex: 1;
  margin: 12px;
  resize: none;
  line-height: 1.6;
}
.ai-result {
  flex: 1;
  overflow: auto;
  padding: 14px;
}
.ai-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.empty {
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
  padding: 24px 12px;
}
.ai-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}
.ai-card p, .ai-card li {
  line-height: 1.55;
}
.empty {
  color: var(--muted);
  text-align: center;
  padding: 40px 12px;
}
.hidden { display: none !important; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; padding: 10px; }
  .side { min-height: 520px; }
  .join-form { grid-template-columns: 1fr; }
  .composer { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; }
  .top-actions button { flex: 1; }
  .voice-grid { grid-template-columns: 1fr; padding: 10px; }
  .controls { position: sticky; bottom: 0; z-index: 5; gap: 8px; padding: 10px; }
  .controls button, .controls select { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .tabs { grid-template-columns: repeat(3, 1fr); }
  .side { min-height: 58vh; }
  .summary-presets, .mine-tools { grid-template-columns: 1fr; }
}
.account-link { color: inherit; text-decoration: none; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.08); }
.account-btn.signed-in { border-color: #34d399; color: #a7f3d0; }
.account-hint { padding: 10px 12px; border-radius: 10px; background: rgba(59,130,246,.12); color: #bfdbfe; font-size: 13px; }
.account-dialog { width: min(92vw, 390px); border: 1px solid rgba(148,163,184,.25); border-radius: 18px; padding: 0; color: #e5e7eb; background: #101827; box-shadow: 0 24px 80px rgba(0,0,0,.55); }
.account-dialog::backdrop { background: rgba(2,6,23,.72); backdrop-filter: blur(5px); }
.account-dialog form { display: grid; gap: 13px; padding: 22px; }
.account-dialog-head { display: flex; align-items: center; justify-content: space-between; font-size: 19px; }
.account-dialog-head button { font-size: 25px; padding: 0 8px; background: transparent; }
.account-dialog p { margin: 0; color: #94a3b8; font-size: 14px; }
.account-dialog label { display: grid; gap: 6px; font-size: 14px; }
.account-dialog input { width: 100%; box-sizing: border-box; }
.account-dialog .link-button { background: transparent; border: 0; color: #93c5fd; }
.account-error { min-height: 20px; color: #fca5a5; font-size: 13px; }

/* 2026 mobile usability pass */
button, select, input, textarea, .account-link { touch-action: manipulation; }
@media (max-width: 640px) {
  body { min-height: 100dvh; }
  .shell { gap: 10px; padding: 8px; min-height: 100dvh; }
  .stage, .side { border-radius: 12px; }
  .topbar { padding: 11px 12px; gap: 9px; }
  .topbar > div:first-child { width: 100%; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
  .topbar strong { width: 100%; font-size: 17px; }
  #connectionLabel { margin-left: 0; }
  .top-actions { overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .top-actions::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
  .top-actions > * { flex: 0 0 auto !important; min-height: 40px; white-space: nowrap; }
  .join-panel { min-height: auto; display: block; padding: 28px 16px 22px; }
  .brand { margin: 0 auto 24px; }
  .brand h1 { font-size: clamp(30px, 9vw, 42px); line-height: 1.08; }
  .brand p { font-size: 14px; line-height: 1.65; }
  .join-form { gap: 10px; padding: 14px; }
  .join-form input, .join-form button { min-height: 48px; font-size: 16px; }
  .room-panel { min-height: 58dvh; }
  .voice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; }
  .peer { min-height: 112px; padding: 12px; }
  .controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 8px; gap: 6px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .controls button, .controls select { width: 100%; min-height: 44px; padding: 8px 5px; font-size: 12px; }
  .side { min-height: 66dvh; max-height: 82dvh; }
  .tabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px; scroll-snap-type: x proximity; }
  .tabs button { flex: 0 0 auto; min-width: 72px; min-height: 42px; padding: 8px 12px; scroll-snap-align: start; }
  .messages, .list { padding: 10px; }
  .composer { position: sticky; bottom: 0; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 6px; padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); }
  .composer input, .composer select, .composer button { min-height: 44px; min-width: 0; }
  .stack-form { padding: 12px; }
  .account-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 24px); overflow: auto; }
}

@media (max-width: 370px) {
  .voice-grid { grid-template-columns: 1fr; }
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composer { grid-template-columns: 78px minmax(0, 1fr); }
  .composer button { grid-column: 2; }
}

/* 2026 visual refresh: deep voice lounge */
:root {
  --ink: #edf4ff;
  --muted: #91a4bf;
  --line: rgba(148, 163, 184, .18);
  --panel: #101c31;
  --paper: #14233b;
  --blue: #6d7cff;
  --teal: #2dd4bf;
  --rose: #fb7185;
  --amber: #fbbf24;
  --green: #34d399;
}
body {
  background:
    radial-gradient(circle at 8% 8%, rgba(109,124,255,.22), transparent 32%),
    radial-gradient(circle at 88% 82%, rgba(45,212,191,.14), transparent 34%),
    linear-gradient(145deg, #07111f, #0b1628 48%, #10182b);
  background-attachment: fixed;
}
button { background: rgba(20,35,59,.86); box-shadow: inset 0 1px rgba(255,255,255,.04); }
button:hover { background: rgba(109,124,255,.13); }
button.active, button.primary { background: linear-gradient(135deg, #6574f7, #7c5ce7); box-shadow: 0 9px 24px rgba(101,116,247,.25); }
input,select,textarea { color: var(--ink); background: rgba(8,19,35,.82); border-color: rgba(148,163,184,.22); }
input::placeholder,textarea::placeholder { color: #637792; }
input:focus,textarea:focus,select:focus { border-color: #7c8cff; box-shadow: 0 0 0 3px rgba(109,124,255,.18); }
.stage,.side { background: linear-gradient(155deg, rgba(18,32,54,.94), rgba(10,22,39,.92)); border-color: rgba(148,163,184,.16); box-shadow: 0 24px 80px rgba(0,0,0,.28); }
.stage { position: relative; }
.stage:before { content:""; position:absolute; inset:0; pointer-events:none; background:linear-gradient(115deg,rgba(109,124,255,.05),transparent 35%); }
.topbar { position: relative; background: rgba(8,19,35,.48); }
.topbar strong { letter-spacing: .02em; }
#connectionLabel { color: #5eead4; }
.account-link { color:#c7d2fe; background:rgba(109,124,255,.1); border:1px solid rgba(129,140,248,.18); }
.join-panel { position:relative; }
.brand h1 { background:linear-gradient(90deg,#f8fafc 10%,#c7d2fe 54%,#99f6e4); -webkit-background-clip:text; background-clip:text; color:transparent; letter-spacing:-.035em; }
.pulse { animation:voicePulse 2.6s ease-in-out infinite; background:radial-gradient(circle at 35% 30%,#99f6e4,#6d7cff 52%,#172554); box-shadow:0 0 0 16px rgba(109,124,255,.08),0 22px 60px rgba(45,212,191,.2); }
@keyframes voicePulse { 50% { transform:scale(1.055); box-shadow:0 0 0 24px rgba(109,124,255,.035),0 24px 70px rgba(109,124,255,.3); } }
.join-form { padding:16px; border:1px solid rgba(148,163,184,.14); border-radius:16px; background:rgba(7,17,31,.5); box-shadow:0 18px 50px rgba(0,0,0,.18); }
.join-form button { background:linear-gradient(135deg,#2dd4bf,#4f7cff); border:0; color:white; font-weight:800; }
.peer { border-radius:16px; background:linear-gradient(145deg,rgba(25,42,69,.94),rgba(15,29,50,.94)); box-shadow:0 12px 34px rgba(0,0,0,.16); transition:.2s transform,.2s border-color; }
.peer:hover { transform:translateY(-2px); border-color:rgba(109,124,255,.45); }
.avatar { box-shadow:0 8px 24px rgba(0,0,0,.24); }
.badge { background:rgba(148,163,184,.08); }
.caption { color:#5eead4; }
.controls { background:rgba(7,17,31,.78); backdrop-filter:blur(16px); }
.tabs { background:rgba(7,17,31,.42); }
.tabs button { color:#91a4bf; border-color:transparent; background:transparent; }
.tabs button.active { color:white; background:rgba(109,124,255,.2); border-color:rgba(129,140,248,.22); box-shadow:none; }
.message,.item,.ai-result,.content-picker { background:rgba(19,34,57,.88); border-color:rgba(148,163,184,.15); }
.composer,.stack-form { background:rgba(8,19,35,.64); }
.account-hint { color:#bfdbfe; background:rgba(59,130,246,.12); }
.assistant-console { margin:12px 12px 0; border:1px solid rgba(129,140,248,.2); border-radius:16px; overflow:hidden; background:rgba(7,17,31,.55); }
.assistant-console-head { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px; border-bottom:1px solid var(--line); }
.assistant-console-head small { display:block; color:var(--muted); margin-top:3px; }
.assistant-console-head>div:last-child { display:flex; gap:6px; }
.assistant-console-head button { padding:7px 10px; font-size:12px; }
.assistant-timeline { max-height:240px; overflow:auto; padding:10px; display:grid; gap:8px; }
.assistant-event { display:grid; grid-template-columns:48px 1fr; gap:9px; padding:9px; border:1px solid var(--line); border-radius:12px; background:rgba(20,35,59,.72); }
.assistant-event-label { align-self:start; text-align:center; border-radius:999px; padding:3px 6px; font-size:11px; color:#c7d2fe; background:rgba(109,124,255,.18); }
.assistant-event.highlight .assistant-event-label { color:#fde68a; background:rgba(245,158,11,.17); }
.assistant-event.mistake .assistant-event-label { color:#fecaca; background:rgba(239,68,68,.14); }
.assistant-event p { margin:3px 0; line-height:1.45; }
.assistant-event small { color:var(--muted); }
@media(max-width:640px){.assistant-console{margin:8px 8px 0}.assistant-console-head{align-items:flex-start;flex-direction:column}.assistant-console-head>div:last-child{width:100%}.assistant-console-head button{flex:1;min-height:40px}.assistant-timeline{max-height:210px}}
@media (prefers-reduced-motion: reduce) { *,*:before,*:after { animation-duration:.01ms!important; animation-iteration-count:1!important; scroll-behavior:auto!important; } }
.app-toast{position:fixed;left:50%;bottom:24px;z-index:3000;max-width:min(90vw,520px);padding:11px 16px;border:1px solid rgba(129,140,248,.35);border-radius:999px;color:#fff;background:rgba(7,17,31,.94);box-shadow:0 18px 50px rgba(0,0,0,.36);transform:translate(-50%,20px);opacity:0;pointer-events:none;transition:.2s ease}.app-toast.show{transform:translate(-50%,0);opacity:1}.app-toast.error{border-color:rgba(248,113,113,.5);color:#fecaca}button:disabled{opacity:.55;cursor:wait}button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:3px solid rgba(94,234,212,.6);outline-offset:2px}
