/* Live Translate — refined minimalist white theme */
:root {
  --canvas: #fbfaf7;
  --panel: #ffffff;
  --ink: #0c0c0d;
  --ink-soft: #66666d;
  --ink-faint: #9a9a9f;
  --line: #ebe8e1;
  --line-strong: #ddd9cf;
  --accent: #ff4a2b;          /* live coral — used ONLY for live/active */
  --accent-weak: rgba(255, 74, 43, 0.09);
  --ok: #16996a;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(12, 12, 13, 0.04), 0 12px 32px -12px rgba(12, 12, 13, 0.10);
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--canvas);
  background-image: radial-gradient(120% 80% at 50% -10%, #ffffff 0%, var(--canvas) 60%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  letter-spacing: -0.01em;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 56px) 22px 48px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ---- masthead ---- */
.mast { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 30px; }
.mark { font-family: var(--font-display); font-size: 30px; line-height: 1; letter-spacing: -0.02em; }
.mark em { font-style: italic; color: var(--accent); }
.sub { font-size: 12.5px; color: var(--ink-faint); letter-spacing: 0.04em; text-transform: uppercase; }

/* ---- status pill ---- */
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.status .led { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.status[data-state="live"] .led { background: var(--accent); animation: pulse 1.6s ease-out infinite; }
.status[data-state="live"] { color: var(--ink); }
.status[data-state="connecting"] .led, .status[data-state="reconnecting"] .led { background: #f0a500; animation: blink 1s steps(2) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--accent-weak); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes blink { 50% { opacity: 0.25; } }

/* ---- panel ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}
.panel + .panel { margin-top: 18px; }
.step-label { font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 14px; display: block; }

/* ---- form ---- */
.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 7px; }
input[type="password"], input[type="text"], select {
  width: 100%; font-family: var(--font-body); font-size: 15px; color: var(--ink);
  background: var(--canvas); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(12,12,13,0.06); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2366666d' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* ---- language chips (presenter multi-select) ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--font-body); font-size: 13.5px; color: var(--ink-soft);
  background: var(--canvas); border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; user-select: none; transition: all .14s ease; display: inline-flex; align-items: center; gap: 7px;
}
.chip .code { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); transition: color .14s; }
.chip:hover { border-color: var(--ink-faint); color: var(--ink); }
.chip.selected { background: var(--ink); border-color: var(--ink); color: var(--panel); }
.chip.selected .code { color: rgba(255,255,255,0.55); }
.hint { font-size: 12px; color: var(--ink-faint); margin-top: 10px; }

/* ---- buttons ---- */
.btn {
  font-family: var(--font-body); font-size: 15px; font-weight: 500; letter-spacing: -0.01em;
  border: 1px solid var(--ink); border-radius: var(--radius-sm); padding: 13px 20px; cursor: pointer;
  transition: transform .08s ease, background .15s, color .15s, border-color .15s, opacity .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: 100%;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--panel); }
.btn-primary:hover:not(:disabled) { background: #000; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--canvas); }
.btn-live { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-live:hover:not(:disabled) { background: #ec3c1f; border-color: #ec3c1f; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-row { display: flex; gap: 10px; }

/* ---- session info ---- */
.session-info { display: none; }
.session-info.show { display: block; animation: rise .4s ease both; }
.code-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.code { font-family: var(--font-mono); font-size: 26px; letter-spacing: 0.08em; color: var(--ink); }
.qr-frame { display: flex; justify-content: center; padding: 18px; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.qr-frame canvas { display: block; border-radius: 6px; }
.join { display: flex; align-items: center; gap: 8px; margin: 16px 0 22px; }
.join code { flex: 1; font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); background: var(--canvas);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy { font-size: 12px; color: var(--ink-soft); background: none; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 12px; cursor: pointer; flex: none; transition: all .14s; }
.copy:hover { border-color: var(--ink); color: var(--ink); }
.active-langs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag { font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }

/* ---- listener hero ---- */
.listen { flex: 1; display: flex; flex-direction: column; }
.now-lang { font-family: var(--font-display); font-size: 17px; font-style: italic; color: var(--ink-soft); }
.caption-stage { flex: 1; display: flex; align-items: center; padding: 24px 0; min-height: 40dvh; }
.caption { font-size: clamp(24px, 6.4vw, 40px); line-height: 1.32; font-weight: 400; letter-spacing: -0.02em; color: var(--ink); font-family: var(--font-body); word-break: break-word; }
.caption.idle { color: var(--ink-faint); font-family: var(--font-display); font-style: italic; font-size: clamp(22px, 5vw, 32px); }
.listen-controls { position: sticky; bottom: 0; padding: 18px 0 max(18px, env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--canvas) 70%, transparent); }

/* single audio toggle */
.audio-toggle {
  width: 100%; border: 1px solid var(--ink); border-radius: 999px; padding: 16px 22px; cursor: pointer;
  font-family: var(--font-body); font-size: 16px; font-weight: 500; background: var(--ink); color: var(--panel);
  display: flex; align-items: center; justify-content: center; gap: 11px; transition: all .15s; letter-spacing: -0.01em;
}
.audio-toggle:active { transform: translateY(1px); }
.audio-toggle:disabled { opacity: .4; }
.audio-toggle svg { width: 20px; height: 20px; }
.audio-toggle[data-mode="muted"] { background: var(--panel); color: var(--ink); }
.audio-toggle[data-mode="off"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.row-pick { display: flex; gap: 10px; align-items: stretch; }
.row-pick select { flex: 1; }

.foot { margin-top: 26px; font-size: 11.5px; color: var(--ink-faint); text-align: center; letter-spacing: 0.02em; }

/* staggered entrance */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .5s ease both; }
.rise-1 { animation-delay: .04s; } .rise-2 { animation-delay: .12s; } .rise-3 { animation-delay: .2s; }

@media (max-width: 480px) {
  .wrap { padding: 22px 18px 32px; }
  .mark { font-size: 26px; }
  .panel { padding: 20px; }
}
