:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1d2433; --muted: #5d6677; --line: #d9dde4;
  --accent: #1f5fae; --accent-ink: #fff; --me: #e3eefb; --rec: #c62828; --err-bg: #fdecea; --err: #8a1c1c;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 640px; margin: 0 auto; min-height: 100vh; background: var(--card); }
.screen { padding: 20px 18px 28px; }
h1 { font-size: 1.5rem; margin: 6px 0 14px; }
p { margin: 0 0 12px; }
.prize { font-weight: 600; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; font-size: .9em; }

button, .linkbtn { font: inherit; border: 0; border-radius: 12px; cursor: pointer; }
.primary { background: var(--accent); color: var(--accent-ink); padding: 12px 20px; font-weight: 600; }
.primary:disabled { opacity: .5; cursor: default; }
.secondary { background: #e8ebf0; color: var(--ink); padding: 12px 16px; }
.big { display: block; width: 100%; padding: 16px; font-size: 1.1rem; margin-top: 14px; text-align: center; }
.linkbtn { text-decoration: none; }
.small-link { display: block; text-align: center; margin-top: 14px; color: var(--muted); }
.check, .radio { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; }
.check input, .radio input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.q { font-weight: 600; margin-top: 18px; }
input[type=text] { width: 100%; font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; }

#screen-chat { padding: 0; display: flex; flex-direction: column; min-height: 100vh; }
#messages { flex: 1; padding: 16px 14px 8px; }
.bubble, #thinking { scroll-margin-bottom: calc(var(--composer-h, 240px) + 12px); }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 16px; margin: 8px 0; white-space: pre-wrap; word-wrap: break-word; }
.bubble.interviewer { background: #f0f2f5; border-top-left-radius: 4px; }
.bubble.participant { background: var(--me); margin-left: auto; border-top-right-radius: 4px; }
.bubble.pending { opacity: .6; }
.bubble .tag { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 2px; }
.play { display: inline-block; margin-top: 6px; background: none; color: var(--accent); padding: 2px 0; font-size: .9rem; }
.thinking { margin: 8px 14px; color: var(--muted); }
.dots i { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: var(--muted); animation: b 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes b { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

.mode-btn { display: flex; align-items: center; justify-content: center; gap: 10px; }
#composer .small-link { margin-top: 10px; font-size: .92rem; }

#composer { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
.voice-status { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px;
  font-weight: 600; text-align: center; }
.orb { --lvl: 0; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--line);
  transform: scale(calc(1 + var(--lvl) * .9)); transition: transform .08s linear, background .2s; }
[data-state=speaking] .orb { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
[data-state=listening] .orb, [data-state=sending_soon] .orb { background: var(--rec); }
[data-state=sending] .orb { background: var(--muted); animation: pulse 1s ease-in-out infinite; }
[data-state=error] #voice-label { color: var(--err); font-weight: 400; }
@keyframes pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.timer { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 400; }
.mic-icon { width: 16px; height: 22px; border-radius: 8px; border: 3px solid currentColor; display: inline-block; }
.status { color: var(--muted); font-size: .92rem; margin: 8px 2px 0; }
textarea { width: 100%; margin-top: 10px; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; }
.row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.row.center { justify-content: center; flex-wrap: wrap; }
.row.center button { min-width: 130px; padding: 12px 18px; }
.row .primary { min-width: 120px; }
.error { background: var(--err-bg); color: var(--err); padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; font-size: .95rem; }
