:root {
  --bg: #f7f6f3; --surface: #ffffff; --surface-2: #f0eee9; --text: #16152b; --muted: #6b6a7b; --line: #e4e1da;
  --brand: #4f46e5; --brand-ink: #ffffff; --accent: #ff6b4a; --ok: #12a150; --warn: #d97706; --err: #dc2626;
  --radius: 14px; --shadow: 0 1px 2px rgba(20,20,40,.06), 0 8px 24px rgba(20,20,40,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f0e1a; --surface: #181727; --surface-2: #222136; --text: #f1f0f7; --muted: #a09fb3; --line: #2d2c44;
    --brand: #7c74ff; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3); color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 "Inter", -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.02em; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 440px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }

/* nav */
.nav { display: flex; align-items: center; gap: 16px; padding: 16px 0; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; color: var(--text); letter-spacing: -.03em; }
.logo:hover { text-decoration: none; }
.logo i { width: 28px; height: 28px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--accent)); display: inline-block; position: relative; }
.logo i::after { content: ""; position: absolute; inset: 8px 10px 8px 8px; border: 3px solid #fff; border-left: 0; border-radius: 0 12px 12px 0; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; transition: transform .05s, background .15s; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); }
.btn.big { padding: 14px 24px; font-size: 17px; border-radius: 12px; }
.btn.block { width: 100%; }
input, select, textarea { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field + .field { margin-top: 14px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 600; }
.pill.live { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }
.pill.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--err); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.error { color: var(--err); font-size: 14px; min-height: 20px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 100; max-width: calc(100% - 32px); }

/* chips (language picker) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; user-select: none; }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* modal */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100% - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10,10,25,.5); }
dialog .card { box-shadow: none; border: 0; }

/* landing */
.hero { padding: 56px 0 40px; text-align: center; }
.hero h1 { font-size: clamp(36px, 6vw, 64px); }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 19px; color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.section { padding: 48px 0; }
.section h2 { font-size: 32px; text-align: center; margin-bottom: 28px; }
.step b { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; margin-bottom: 10px; }
.price { font-size: 30px; font-weight: 800; }
.footer { padding: 32px 0; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); margin-top: 32px; }

/* dashboard */
.events { display: grid; gap: 12px; }
.event { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.event h3 { margin: 0; font-size: 18px; }
.stat { font-size: 28px; font-weight: 800; }
.qr { background: #fff; padding: 12px; border-radius: 12px; display: inline-block; }
.qr img, .qr canvas { display: block; }
code.link { background: var(--surface-2); padding: 6px 10px; border-radius: 8px; word-break: break-all; font-size: 14px; }

/* speaker console */
.console { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }
@media (max-width: 860px) { .console { grid-template-columns: 1fr; } }
.meter { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), var(--warn)); transition: width .08s; }
.transcript { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.transcript p { margin: 0; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; }
.mic-btn { width: 120px; height: 120px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-weight: 800; font-size: 18px; cursor: pointer; box-shadow: 0 10px 30px color-mix(in srgb, var(--brand) 40%, transparent); }
.mic-btn.on { background: var(--err); box-shadow: 0 10px 30px color-mix(in srgb, var(--err) 40%, transparent); }

/* listener */
.listen { min-height: 100dvh; display: flex; flex-direction: column; }
.captions { flex: 1; overflow-y: auto; padding: 16px 0; display: flex; flex-direction: column; gap: 14px; }
.captions .c { font-size: 22px; line-height: 1.4; font-weight: 500; }
.captions .c.old { color: var(--muted); font-size: 18px; }
.captions .c small { display: block; font-size: 14px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.bar { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.langgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.langgrid button { padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.langgrid button small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.langgrid button:hover { border-color: var(--brand); }
