:root {
  --bg: #fbf8f2;
  --bg-2: #f5efe4;
  --panel: #ffffff;
  --fg: #1d1a16;
  --muted: #6f685d;
  --line: #ebe4d6;
  --soft: #f3ede2;
  --grad: linear-gradient(135deg, #ff8a1f 0%, #e8366f 100%);
  --accent: #f0562f;
  --accent-fg: #ffffff;
  --glass: rgb(251 248 242 / 0.78);
  --shadow-sm: 0 1px 2px rgb(40 30 10 / 0.06);
  --shadow: 0 1px 2px rgb(40 30 10 / 0.05), 0 8px 24px rgb(40 30 10 / 0.07);
  --shadow-lg: 0 2px 4px rgb(40 30 10 / 0.05), 0 20px 48px rgb(40 30 10 / 0.12);
  --radius: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14120f;
    --bg-2: #1b1814;
    --panel: #201d19;
    --fg: #f4efe6;
    --muted: #a69e90;
    --line: #2f2a24;
    --soft: #29251f;
    --accent: #ff7a45;
    --accent-fg: #ffffff;
    --glass: rgb(20 18 15 / 0.78);
    --shadow-sm: none;
    --shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset, 0 8px 24px rgb(0 0 0 / 0.35);
    --shadow-lg: 0 20px 48px rgb(0 0 0 / 0.5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "PingFang TC", "Noto Sans CJK TC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; }
.hidden { display: none !important; }

/* ------------------------------------------------------------ brand */
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; letter-spacing: -0.03em; }
.brand img { width: 32px; height: 32px; border-radius: 10px; }
.brand span { font-size: 20px; }
.brand span::after { content: "."; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 22px; background: var(--grad); color: #fff; font-weight: 700;
  box-shadow: 0 6px 18px rgb(232 54 111 / 0.28); transition: transform 0.15s, box-shadow 0.15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgb(232 54 111 / 0.34); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 42px; height: 42px; border-radius: 999px; border: 0; background: transparent; color: var(--muted);
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.icon-btn:hover { background: var(--soft); color: var(--fg); }
.icon-btn:disabled { opacity: 0.35; cursor: default; background: none; }
.icon-btn.primary { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgb(232 54 111 / 0.3); }
.icon-btn.primary:hover { transform: scale(1.05); }
.icon-btn svg { width: 20px; height: 20px; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; background: var(--fg); color: var(--bg); font-size: 12px; font-weight: 600;
  padding: 5px 9px; border-radius: 8px; pointer-events: none; z-index: 10;
}
.field {
  width: 100%; border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
  color: var(--fg); font: inherit; padding: 12px 14px; outline: none; resize: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.field:focus { border-color: #f59e7a; box-shadow: 0 0 0 4px rgb(240 86 47 / 0.12); }
.error { color: #e03131; font-size: 14px; }

/* avatars: the bean characters */
.av {
  flex: none; width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  background: var(--soft); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px var(--c, var(--line));
}
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.sm { width: 30px; height: 30px; box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--c, var(--line)); }
.av.human { display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 800; font-size: 14px; box-shadow: 0 0 0 2px var(--panel); }

/* ------------------------------------------------------------ start page */
.start-top { display: flex; align-items: center; justify-content: space-between; max-width: 72rem; margin: 0 auto; padding: 18px 20px; }
.start { max-width: 72rem; margin: 0 auto; padding: 8px 20px 64px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.start h1 { font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.02; letter-spacing: -0.045em; margin: 8px 0 12px; font-weight: 850; }
.start h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.start .lead { color: var(--muted); font-size: 18px; margin: 0 0 24px; }
.ask {
  background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 8px; box-shadow: var(--shadow-lg);
}
.ask textarea { border: 0; box-shadow: none !important; font-size: 18px; padding: 14px 14px 6px; min-height: 84px; }
.ask-bar { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 10px; }
.ask-bar .picked { display: flex; align-items: center; flex: 1; min-width: 0; }
.ask-bar .picked .av { margin-left: -8px; }
.ask-bar .picked .av:first-child { margin-left: 0; }
.ask-bar .count { margin-left: 10px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 2px 0; }
.examples button {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
}
.examples button:hover { color: var(--fg); border-color: #f59e7a; }
.cast-pick { margin-top: 28px; }
.cast-pick h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 12px; }
.chips { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.chip {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px 10px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--panel); transition: transform 0.15s, border-color 0.15s, opacity 0.15s;
}
.chip:hover { transform: translateY(-2px); }
.chip img { width: 64px; height: 64px; border-radius: 50%; }
.chip b { font-size: 14px; line-height: 1.1; }
.chip small { font-size: 11px; color: var(--muted); line-height: 1.1; }
.chip .tick {
  position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c); color: #fff; font-size: 12px; font-weight: 900; transform: scale(0); transition: transform 0.15s;
}
.chip[aria-pressed="true"] { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), var(--shadow-sm); }
.chip[aria-pressed="true"] .tick { transform: scale(1); }
.chip[aria-pressed="false"] { opacity: 0.5; filter: grayscale(0.4); }
.who-row { margin-top: 20px; display: flex; gap: 10px; align-items: center; }
.who-row .field { max-width: 16rem; border-radius: 999px; padding: 10px 16px; }

/* the live demo beside the form */
.demo {
  position: relative; border-radius: 28px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}
.demo .art { width: 100%; height: auto; aspect-ratio: 1200 / 648; object-fit: cover; }
.demo .chat { padding: 4px 16px 18px; display: flex; flex-direction: column; gap: 8px; height: 172px; justify-content: flex-end; overflow: hidden; }
.demo .line { display: flex; gap: 8px; align-items: flex-end; animation: rise 0.35s ease-out both; }
.demo .line .bubble { font-size: 14px; padding: 8px 12px; }
.demo .badge { position: absolute; top: 14px; left: 14px; display: inline-flex; align-items: center; gap: 6px; background: var(--glass); backdrop-filter: blur(10px);
  border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700; }
.demo .badge i { width: 8px; height: 8px; border-radius: 50%; background: #e8366f; animation: live 1.4s infinite; }
@keyframes live { 50% { opacity: 0.3; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
footer.powered { color: var(--muted); font-size: 13px; text-align: center; padding: 24px; }
@media (max-width: 860px) {
  .start { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .demo { order: -1; }
  .chips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* presets: pick a room (preset groups, saved mixes, mix your own) */
.cast-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cast-head h2 { margin: 0 !important; }
.shelves { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.shelves::-webkit-scrollbar { display: none; }
.shelves button {
  flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 12px;
  font-size: 13px; font-weight: 600; color: var(--muted); transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.shelves button:hover { color: var(--fg); }
.shelves button[aria-selected="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.shelves.small { margin: 4px 0 12px; }
.groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; transition: opacity 0.2s; }
.room-card {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 14px 12px; min-height: 132px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; text-align: left; outline: none;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.room-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 52px; border-radius: 20px 20px 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 16%, transparent), transparent); pointer-events: none;
}
.room-card:hover, .room-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow); }
.room-card[aria-pressed="true"] { border-color: var(--c); box-shadow: 0 0 0 1.5px var(--c), var(--shadow); }
.room-card b { position: relative; font-size: 15px; line-height: 1.2; margin-top: 6px; letter-spacing: -0.01em; }
.room-card b .edited { font-style: normal; font-size: 11px; font-weight: 700; color: var(--c); margin-left: 6px; }
.room-card small { position: relative; font-size: 12.5px; color: var(--muted); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.room-card .card-act { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; opacity: 0; background: var(--panel); box-shadow: var(--shadow); }
.room-card .card-act svg { width: 16px; height: 16px; }
.room-card:hover .card-act, .room-card[aria-pressed="true"] .card-act, .room-card:focus-within .card-act { opacity: 1; }
.room-card.mix-card { border-style: dashed; }
.room-card.mix-card .card-act { opacity: 1; background: var(--soft); }
.beans { position: relative; display: flex; align-items: center; min-height: 40px; }
.beans .av { width: 36px; height: 36px; margin-left: -12px; box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px var(--c); }
.beans .av:first-child { margin-left: 0; }
.ask-bar .beans .av { width: 30px; height: 30px; margin-left: -8px; box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--c); }
.ask-bar .beans .av:first-child { margin-left: 0; }
.mixer { margin-top: 0; scroll-margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 22px; background: var(--bg-2); animation: rise 0.25s ease-out both; }
.mixer-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mixer-head b { font-size: 16px; letter-spacing: -0.01em; }
.mixer-head .count { font-size: 13px; color: var(--muted); margin-right: auto; }
.mixer-head .mix-name { width: 11rem; border-radius: 999px; padding: 8px 14px; font-size: 14px; }
.mixer .chips { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.mixer .chip { padding: 10px 2px 8px; }
.mixer .chip img { width: 52px; height: 52px; }
.mixer .chip[aria-pressed="false"] { opacity: 0.8; filter: none; }
.mixer .chip:disabled { cursor: not-allowed; opacity: 0.4; }
.mixer .chip[data-tip]:hover::after { white-space: normal; width: 13rem; text-align: center; }
@media (max-width: 860px) {
  .groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mixer .chips { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .room-card { min-height: 124px; padding: 12px 12px 10px; }
  .beans .av { width: 32px; height: 32px; margin-left: -11px; }
  .mixer .chips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mixer-head .mix-name { width: 100%; order: 5; }
}
/* end presets */

/* ------------------------------------------------------------ room */
.room { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); height: 100dvh; }
.room > * { min-width: 0; }
.top {
  position: relative; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--glass); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line);
}
.top .brand span { display: none; }
.phone-only, .room-menu .phone-only { display: none; }
.wide-only { display: contents; }
@media (max-width: 640px) {
  .top { gap: 8px; padding: 8px 10px; }
  .top .tuck, .top .install-btn { display: none !important; }
  .phone-only { display: contents; }
  .room-menu .phone-only { display: flex; }
  .room-menu hr.phone-only { display: block; }
  .wide-only { display: none; }
}
.top .titles { flex: 1; min-width: 0; }
.top .topic { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.01em; }
.top .sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.top .sub i { width: 7px; height: 7px; border-radius: 50%; background: #2f9e44; }
.top .sub i.done { background: var(--muted); }
.top .sub #sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.left-chip { position: relative; flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 6px; border-radius: 999px; background: var(--soft); color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; cursor: default; outline: none; }
.left-chip svg { width: 13px; height: 13px; }
.left-chip.low { background: color-mix(in srgb, #e8366f 16%, var(--panel)); color: #c2255c; }
.left-chip.out { background: #e8366f; color: #fff; }
.left-chip[data-tip]:hover::after, .left-chip[data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; top: calc(100% + 8px); bottom: auto; left: 0; transform: none; white-space: nowrap; background: var(--fg); color: var(--bg); font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 8px; pointer-events: none; z-index: 10; }
.meter { display: flex; align-items: center; gap: 8px; }
.meter .ring { width: 28px; height: 28px; border-radius: 50%; background: conic-gradient(#e8366f var(--p, 0%), var(--soft) 0); display: grid; place-items: center; }
.meter .ring::after { content: ""; width: 20px; height: 20px; border-radius: 50%; background: var(--panel); }

.stage { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); min-height: 0; max-width: 52rem; width: 100%; margin: 0 auto; }
.cast { display: flex; gap: 14px; padding: 14px 16px 6px; overflow-x: auto; scrollbar-width: none; justify-content: center; }
.member { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; padding: 2px; width: 64px; }
.member .av { width: 48px; height: 48px; transition: transform 0.2s; }
.member b { font-size: 12px; line-height: 1; }
.member small { font-size: 10px; color: var(--muted); line-height: 1; }
.member:hover .av { transform: translateY(-2px); }
.member.speaking .av { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--c); animation: talk 0.9s ease-in-out infinite; }
.member .hand { position: absolute; top: -4px; right: 4px; font-size: 16px; transform: scale(0); transition: transform 0.2s; }
.member.raised .hand { transform: scale(1); animation: wave 0.9s ease-in-out infinite; }
@keyframes talk { 50% { transform: scale(1.07); box-shadow: 0 0 0 2px var(--panel), 0 0 0 7px color-mix(in srgb, var(--c) 35%, transparent); } }
@keyframes wave { 50% { rotate: 16deg; } }

.feed { overflow-y: auto; padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 4px; scroll-behavior: smooth; }
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 100%; margin-top: 10px; animation: rise 0.25s ease-out both; }
.msg.cont { margin-top: 0; }
.msg.cont .av { visibility: hidden; }
.msg.cont .name { display: none; }
.msg .body { min-width: 0; max-width: min(34rem, 82%); display: flex; flex-direction: column; }
.msg .name { font-size: 12px; color: var(--muted); margin: 0 0 3px 12px; }
.msg .name b { color: var(--c, var(--fg)); font-weight: 700; }
.bubble {
  background: var(--panel); border-radius: 20px; padding: 9px 14px; white-space: pre-wrap; overflow-wrap: anywhere;
  box-shadow: var(--shadow-sm); border: 1px solid var(--line);
}
.msg.agent .bubble {
  background: color-mix(in srgb, var(--c) 9%, var(--panel)); border-color: color-mix(in srgb, var(--c) 22%, var(--line));
  border-bottom-left-radius: 6px;
}
.msg.agent.cont .bubble { border-top-left-radius: 8px; }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .name { text-align: right; margin: 0 12px 3px 0; }
.msg.mine .body { align-items: flex-end; }
.msg.mine .bubble { background: var(--grad); color: #fff; border: 0; border-bottom-right-radius: 6px; box-shadow: 0 4px 14px rgb(232 54 111 / 0.22); }
.msg.human:not(.mine) .bubble { border-bottom-left-radius: 6px; }
.msg.first { justify-content: center; margin: 4px 0 8px; }
.msg.first .av, .msg.first .name { display: none; }
.msg.first .body { max-width: 100%; align-items: center; }
.msg.first .bubble {
  background: var(--panel); color: var(--fg); font-size: 19px; font-weight: 750; letter-spacing: -0.01em; text-align: center;
  border-radius: 22px; padding: 16px 22px; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.msg.first .bubble::before { content: var(--q-label, "The question"); display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.msg.streaming .bubble:empty::before, .typing-dots { display: inline-flex; gap: 4px; }
.msg.streaming .bubble:empty { width: 64px; height: 38px; position: relative; }
.msg.streaming .bubble:empty::before {
  content: ""; position: absolute; left: 16px; top: 15px; width: 7px; height: 7px; border-radius: 50%; background: var(--c);
  box-shadow: 12px 0 0 var(--c), 24px 0 0 var(--c); animation: dots 1s infinite;
}
.msg.streaming .bubble:not(:empty)::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 4px; border-radius: 50%; background: var(--c); animation: live 0.8s infinite; }
@keyframes dots { 50% { opacity: 0.35; } }

.dock { position: relative; max-width: 52rem; width: 100%; margin: 0 auto; padding: 0 12px 14px; }
.hands { display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 14px; margin: 0 -4px; scrollbar-width: none; }
.hand-card {
  flex: none; display: flex; align-items: center; gap: 8px; max-width: min(22rem, 85vw); text-align: left; padding: 6px 12px 6px 6px;
  border: 1px solid color-mix(in srgb, var(--c) 35%, var(--line)); border-radius: 999px; background: var(--panel); box-shadow: var(--shadow);
  animation: rise 0.25s ease-out both;
}
.hand-card .why { min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hand-card .why b { color: var(--c); }
.hand-card .go { flex: none; font-size: 11px; font-weight: 800; color: #fff; background: var(--c); border-radius: 999px; padding: 3px 8px; }
.status { min-height: 20px; padding: 0 14px 6px; font-size: 12px; color: var(--muted); }
.composer {
  display: flex; gap: 4px; align-items: flex-end; padding: 6px; border-radius: 28px; background: var(--panel);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}
.composer .field::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer .field { border: 0; box-shadow: none !important; min-height: 42px; max-height: 140px; padding: 10px 12px; background: transparent; }

/* verdict card */
.verdict { margin: 20px 0 6px; border-radius: 26px; background: var(--panel); box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--line); animation: rise 0.4s ease-out both; }
.verdict.old { opacity: 0.7; }
.verdict header { background: var(--grad); color: #fff; padding: 18px 20px 16px; position: relative; overflow: hidden; }
.verdict header .kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.9; }
.verdict header h2 { font-size: 21px; line-height: 1.25; margin: 4px 0 0; letter-spacing: -0.02em; max-width: 80%; }
.verdict header .beans { position: absolute; right: -6px; bottom: -10px; display: flex; }
.verdict header .beans img { width: 46px; height: 46px; margin-left: -14px; border-radius: 50%; box-shadow: 0 0 0 2px rgb(255 255 255 / 0.85); }
.verdict .inner { padding: 18px 20px 16px; }
.vote { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; margin-bottom: 12px; }
.vote .label { font-weight: 700; }
.vote .count { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.vote .count .mini { display: flex; }
.vote .count .mini img { width: 20px; height: 20px; border-radius: 50%; margin-left: -6px; box-shadow: 0 0 0 1.5px var(--panel); }
.vote .bar { grid-column: 1 / -1; height: 10px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.vote .bar i { display: block; height: 100%; background: var(--grad); border-radius: inherit; transition: width 0.8s cubic-bezier(.2,.8,.2,1); }
.vote.win .label::after { content: " ✓"; color: #2f9e44; }
.stances { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 10px; }
.stances li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.stances .tag { font-weight: 800; color: var(--c); margin-right: 4px; }
.verdict dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.verdict dl > div { background: var(--soft); border-radius: 16px; padding: 12px; }
.verdict dt { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.verdict dd { margin: 4px 0 0; font-size: 14px; }
.verdict .foot { margin-top: 14px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.verdict .foot .brand img { width: 20px; height: 20px; border-radius: 6px; }
.verdict .foot .brand span { font-size: 13px; }
@media (max-width: 640px) { .verdict dl { grid-template-columns: minmax(0, 1fr); } }
.thinking { align-self: center; margin-top: 16px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; padding: 8px 16px 8px 8px; border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); }
.thinking .beans { display: flex; }
.thinking .beans img { width: 26px; height: 26px; border-radius: 50%; margin-left: -8px; box-shadow: 0 0 0 2px var(--panel); animation: talk-sm 1.2s ease-in-out infinite; }
.thinking .beans img:first-child { margin-left: 0; }
.thinking .beans img:nth-child(2) { animation-delay: 0.15s; } .thinking .beans img:nth-child(3) { animation-delay: 0.3s; } .thinking .beans img:nth-child(4) { animation-delay: 0.45s; }
@keyframes talk-sm { 50% { transform: translateY(-4px); } }

/* join dialog */
.overlay { position: fixed; inset: 0; background: rgb(20 15 10 / 0.4); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; z-index: 20; }
.dialog { width: min(24rem, 100%); background: var(--panel); border-radius: 26px; padding: 22px; box-shadow: var(--shadow-lg); text-align: center; }
.dialog .beans { display: flex; justify-content: center; margin-bottom: 10px; }
.dialog .beans img { width: 44px; height: 44px; border-radius: 50%; margin-left: -10px; box-shadow: 0 0 0 3px var(--panel); }
.dialog h2 { margin: 0 0 14px; font-size: 20px; letter-spacing: -0.02em; }
.dialog .actions { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 12px; font-size: 14px; z-index: 30; }
.feed > * { flex: none; }

/* markdown in bubbles */
.bubble.md { white-space: normal; }
.bubble.md > * { margin: 0; }
.bubble.md > * + * { margin-top: 8px; }
.bubble.md h4 { font-size: 1em; font-weight: 800; }
.bubble.md ul, .bubble.md ol { padding-left: 1.3em; }
.bubble.md blockquote { border-left: 3px solid color-mix(in srgb, var(--c, var(--accent)) 50%, transparent); padding-left: 10px; color: var(--muted); }
.bubble.md a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.bubble.md code { font: 0.88em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: color-mix(in srgb, var(--fg) 8%, transparent); padding: 1px 5px; border-radius: 6px; }
.msg.mine .bubble.md code { background: rgb(255 255 255 / 0.2); }
.md-code { margin-left: -6px; margin-right: -6px; border-radius: 14px; background: #16130f; color: #f4efe6; overflow: hidden; }
.md-code-bar { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 4px 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #a69e90; }
.md-code pre { margin: 0; padding: 4px 14px 12px; overflow-x: auto; }
.bubble.md .md-code code { background: none; padding: 0; color: inherit; font-size: 13px; white-space: pre; }
.md-copy { position: relative; width: 30px; height: 30px; border: 0; border-radius: 9px; background: transparent; color: #a69e90; display: grid; place-items: center; cursor: pointer; }
.md-copy:hover { background: rgb(255 255 255 / 0.08); color: #fff; }
.md-copy.done { color: #9be37a; }
.md-copy svg { width: 15px; height: 15px; }
.md-table { overflow-x: auto; }
.md-table table { border-collapse: collapse; font-size: 14px; }
.md-table th, .md-table td { border: 1px solid var(--line); padding: 4px 10px; text-align: left; }
.md-table th { background: color-mix(in srgb, var(--fg) 5%, transparent); }

/* photos and videos */
.media { display: grid; gap: 4px; width: min(22rem, 70vw); margin-bottom: 4px; border-radius: 18px; overflow: hidden; }
.media.n2, .media.n4 { grid-template-columns: 1fr 1fr; }
.media.n3 { grid-template-columns: 1fr 1fr; }
.media.n3 > :first-child { grid-column: span 2; }
.media .shot, .media .clip { position: relative; display: block; padding: 0; border: 0; background: var(--soft); cursor: zoom-in; aspect-ratio: 4 / 3; overflow: hidden; }
.media.n1 .shot, .media.n1 .clip { aspect-ratio: auto; max-height: 22rem; }
.media img, .media video { display: block; width: 100%; height: 100%; object-fit: cover; }
.media .clip { cursor: pointer; background: #000; }
.media .play { position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%; border: 0; background: rgb(0 0 0 / 0.55); color: #fff; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(6px); }
.media .play svg { width: 24px; height: 24px; margin-left: 3px; }
.media .clip.playing .play { opacity: 0; }
.lightbox { position: fixed; inset: 0; z-index: 40; background: rgb(10 8 6 / 0.88); display: grid; place-items: center; padding: 24px; cursor: zoom-out; animation: rise 0.18s ease-out both; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 14px; box-shadow: 0 20px 60px rgb(0 0 0 / 0.5); }
.tray { display: flex; gap: 8px; padding: 0 6px 10px; overflow-x: auto; }
.thumb { position: relative; flex: none; width: 64px; height: 64px; border-radius: 14px; overflow: hidden; background: var(--soft); box-shadow: var(--shadow); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.is-video::after { content: ""; position: absolute; left: 6px; bottom: 6px; border: 6px solid transparent; border-left: 9px solid #fff; filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.5)); }
.thumb.loading img, .thumb.loading video { opacity: 0.45; }
.thumb.loading::before { content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid #fff; border-top-color: transparent; animation: spin 0.8s linear infinite; z-index: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgb(0 0 0 / 0.6); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.thumb .x svg { width: 12px; height: 12px; }
body.dropping .composer { outline: 2.5px dashed var(--accent); outline-offset: 4px; }
/* code colors (highlight.js classes), tuned for the dark code block */
.md-code .hljs-keyword, .md-code .hljs-selector-tag, .md-code .hljs-meta .hljs-keyword { color: #ff8fa8; }
.md-code .hljs-string, .md-code .hljs-regexp, .md-code .hljs-addition { color: #b8e986; }
.md-code .hljs-number, .md-code .hljs-literal, .md-code .hljs-symbol { color: #ffb86b; }
.md-code .hljs-title, .md-code .hljs-title.function_, .md-code .hljs-section { color: #8fd0ff; }
.md-code .hljs-built_in, .md-code .hljs-type, .md-code .hljs-title.class_ { color: #d7b8ff; }
.md-code .hljs-attr, .md-code .hljs-attribute, .md-code .hljs-variable, .md-code .hljs-property { color: #ffd479; }
.md-code .hljs-comment, .md-code .hljs-quote { color: #8a8274; font-style: italic; }
.md-code .hljs-deletion { color: #ff8080; }
.md-code .hljs-meta, .md-code .hljs-tag { color: #a6c8e0; }

/* thinking and typing */
.member.pondering .av { animation: think 1.1s ease-in-out infinite; }
.member.pondering::after {
  content: ""; position: absolute; top: -2px; left: 4px; width: 22px; height: 12px; border-radius: 999px; background: var(--panel);
  box-shadow: var(--shadow); background-image: radial-gradient(circle, var(--c) 2px, transparent 2.5px); background-size: 7px 12px; background-position: 1px center;
  animation: dots 1s infinite;
}
@keyframes think { 50% { transform: translateY(-3px) rotate(-4deg); } }
.msg.streaming .bubble:empty { width: 118px; }
.msg.streaming .bubble:empty::after {
  content: var(--thinking-label, "thinking"); position: absolute; left: 56px; top: 9px; font-size: 13px; font-weight: 600;
  background: linear-gradient(90deg, var(--muted) 30%, var(--fg) 50%, var(--muted) 70%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.msg.streaming .bubble.md:not(:empty)::after { content: none; }
.msg.streaming .bubble.md > :last-child::after {
  content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 2px; border-radius: 1px; vertical-align: text-bottom;
  background: var(--c, var(--fg)); animation: caret 0.9s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .member.pondering .av, .member.pondering::after, .msg.streaming .bubble:empty::after { animation: none; }
}

/* ------------------------------------------------------------ memory */
.mem { max-width: 44rem; margin: 0 auto; padding: 8px 16px 32px; display: grid; gap: 18px; }
.mem h1 { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.05; letter-spacing: -0.04em; margin: 8px 0 0; font-weight: 850; }
.mem h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mem .lead { color: var(--muted); font-size: 17px; margin: 0; }
.mem .note { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-head h2 { margin: 0; }
.card-head .tools { display: flex; }
.facts { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.facts li { background: var(--soft); border-radius: 12px; padding: 8px 12px; font-size: 15px; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.steps { margin: 0 0 12px; padding-left: 20px; font-size: 15px; display: grid; gap: 4px; }
.prompt { position: relative; background: var(--soft); border-radius: 14px; margin-bottom: 12px; }
.prompt pre { margin: 0; padding: 12px 48px 12px 14px; font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 9.5rem; overflow: auto; }
.prompt .icon-btn { position: absolute; top: 4px; right: 4px; }
.drop textarea, .card > textarea { width: 100%; resize: vertical; font-size: 14px; }
.drop-bar, .row-end { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.drop-bar .file-name { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { justify-content: flex-end; }
.mem-row { margin-top: 16px; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.mem-row a { font-weight: 600; color: var(--fg); }
/* Your own tools, ticked per room (src/usertools.js). */
.tools-picks { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.tool-pick { border: 1.5px solid var(--line); border-radius: 999px; background: transparent; color: var(--fg); padding: 4px 12px; font-weight: 700; font-size: 13px; }
.tool-pick[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg, #fff); }
.tool-pick[aria-pressed="true"]::before { content: "✓ "; }
.tools-note { flex-basis: 100%; font-size: 12.5px; }
.switch { position: relative; width: 40px; height: 24px; border-radius: 999px; border: 0; background: var(--line); padding: 0; flex: none; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }

/* host tools: mute, remove, block (people only, never the personas) */
.is-host .msg.human:not(.mine) .who { cursor: pointer; }
.is-host .msg.human:not(.mine) .av.who:hover { transform: scale(1.08); }
.msg.is-muted .name b::after { content: var(--muted-label, " · muted"); color: var(--muted); font-weight: 500; }
.msg.is-banned .name b::after { content: var(--blocked-label, " · blocked"); color: var(--muted); font-weight: 500; }
.msg.is-banned .bubble { opacity: 0.5; }
.mod-menu { position: fixed; z-index: 30; display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; background: var(--panel); border: 2px solid var(--fg); border-radius: 999px; box-shadow: var(--shadow); }
.mod-menu b { font-size: 13px; margin-right: 6px; max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod-menu .icon-btn.on { background: var(--fg); color: var(--bg); }
.mod-menu .icon-btn.danger:hover { color: #e8366f; }
.mod-menu [data-tip]:hover::after { bottom: auto; top: calc(100% + 8px); }
.silenced .composer { opacity: 0.55; }
.muted-note { color: var(--muted); margin: 0 0 6px; font-size: 14px; }

/* quote replies */
.msg .body { position: relative; min-width: 0; }
.reply-btn { position: absolute; top: 18px; right: -40px; width: 32px; height: 32px; opacity: 0; transition: opacity 0.15s; }
.msg.mine .reply-btn { right: auto; left: -40px; }
.report-btn { position: absolute; top: 18px; right: -40px; width: 32px; height: 32px; opacity: 0; transition: opacity 0.15s; }
.report-btn svg { width: 15px; height: 15px; }
.msg:hover .reply-btn, .reply-btn:focus-visible, .msg:hover .report-btn, .report-btn:focus-visible { opacity: 1; }
@media (hover: none) { .reply-btn { opacity: 0.55; } .report-btn { opacity: 0.3; } }
.quote { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; max-width: 100%; margin: 0 0 4px; padding: 6px 10px; border: 0; border-left: 3px solid var(--qc, var(--fg)); border-radius: 10px; background: var(--soft); color: var(--fg); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.quote b { font-size: 12px; }
.quote span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.quote { width: fit-content; max-width: min(100%, 28rem); }
.msg.mine .quote { margin-left: auto; }
.reply-bar { display: flex; align-items: center; gap: 8px; margin: 0 4px 6px; padding: 6px 6px 6px 12px; border-left: 3px solid var(--fg); border-radius: 12px; background: var(--soft); font-size: 13px; }
.reply-bar > svg { width: 16px; height: 16px; flex: none; }
.reply-bar > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar #reply-text { color: var(--muted); }
.reply-bar .icon-btn { width: 28px; height: 28px; }
@keyframes flash { 30% { background: color-mix(in srgb, var(--lime, #d4ff3a) 45%, transparent); } }
.msg.flash { animation: flash 1.2s ease; border-radius: 16px; }

/* What a persona looked up before speaking (src/tools.js). */
.looked { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: 12px; }
.looked .q { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border: 1.5px solid var(--line, currentColor); border-radius: 999px; font-weight: 600; max-width: min(18rem, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.looked .q > span { overflow: hidden; text-overflow: ellipsis; }
.looked .q svg { width: 12px; height: 12px; flex: none; }
.looked a { position: relative; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: inherit; text-decoration: none; font-weight: 600; }
.looked a:hover { text-decoration: underline; }

/* The row of languages at the bottom of pages (i18n.js) */
.lang-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; padding: 18px 16px 8px; font-size: 13px; }
.lang-row button { background: none; border: 0; padding: 4px 2px; color: var(--muted); font: inherit; cursor: pointer; }
.lang-row button:hover { color: var(--fg); text-decoration: underline; }
.lang-row button[aria-current] { color: var(--fg); font-weight: 700; }

/* iOS Safari zooms into any field under 16px when it is tapped; phones get 16px. */
@media (hover: none) and (pointer: coarse) {
  input, textarea, select, [contenteditable="true"] { font-size: 16px !important; }
}

/* Signed out: reading along (public/room.js watch()). */
.is-viewer #composer, .is-viewer #reply-bar, .is-viewer #tray, .is-viewer .hand-card .go { display: none !important; }
.is-viewer .hand-card { pointer-events: none; }

/* Links to the terms, privacy and refund pages at the bottom of pages. */
.legal-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; padding: 0 16px 22px; font-size: 13px; }
.legal-row a { color: var(--muted); text-decoration: none; }
.legal-row a:hover { color: var(--fg); text-decoration: underline; }
