/* SignMog app styles. Tokens only (src/tokens.css); no colors here. */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font-ui); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; opacity: 0.5; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0 0 6px; font-weight: 600; }
h4 { margin-top: 18px; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
p { margin: 0 0 10px; }
.serif { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.link { color: var(--accent); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: inherit; }
.link.danger { color: var(--danger); }
.card { background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-m); box-shadow: var(--shadow-1); }

/* boot */
.boot { height: 100vh; display: grid; place-content: center; gap: 14px; text-align: center; }
.boot-mark { width: 54px; height: 54px; margin: 0 auto; border-radius: 16px; background: var(--accent-grad); box-shadow: var(--shadow-glow); animation: pulse 1.2s ease-in-out infinite; }
.boot-text { font-family: var(--font-display); font-size: 28px; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* shell */
.app, .shell { height: 100%; }
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.top { display: flex; align-items: center; gap: 14px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); border-bottom: 1px solid var(--border); background: var(--bg); z-index: 5; }
.wordmark { font-size: 26px; line-height: 1; display: inline-flex; align-items: baseline; cursor: pointer; font-style: italic; }
.wordmark i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 3px; transform: translateY(-1px); }
.top-actions { margin-left: auto; display: flex; gap: 6px; }
.main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tabs { display: flex; gap: 2px; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 44px; padding: 6px 10px; border-radius: var(--radius-s); color: var(--text-2); font-size: 11px; font-weight: 600; letter-spacing: 0.01em; }
.tab.on { color: var(--text); background: var(--surface-2); }
.tab.on svg { color: var(--accent); }
.tabs-top { display: none; }
.tabs-bottom { padding: 6px 10px; padding-bottom: max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--bg); }
.tabs-bottom .tab { flex: 1; }
@media (min-width: 820px) {
  .tabs-top { display: flex; }
  .tabs-top .tab { flex-direction: row; gap: 8px; font-size: 14px; padding: 8px 14px; }
  .tabs-bottom { display: none; }
}
.embed .main { height: 100vh; }

/* screens */
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px 24px; }

/* the stage */
.stage { position: relative; flex: 1; min-height: 0; background: var(--stage-bg); overflow: hidden; }
.stage-compact { flex: 0 0 auto; height: 38vh; min-height: 240px; }
@media (min-width: 820px) { .stage-compact { height: 44vh; min-height: 300px; } }
.stage-host { position: absolute; inset: 0; }
.stage-host canvas, .signer-canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; }
.stage::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; background: linear-gradient(to top, var(--stage-floor), transparent); pointer-events: none; }
.stage-hud { position: absolute; top: 10px; left: 12px; display: flex; gap: 8px; align-items: center; z-index: 2; }
.stage-tools { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.embed-note { position: absolute; bottom: 12px; left: 12px; padding: 6px 10px; border-radius: var(--radius-pill); background: var(--surface-2); backdrop-filter: blur(var(--glass-blur)); font-size: 12px; color: var(--text-2); }
.tool { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); backdrop-filter: blur(var(--glass-blur)); transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast); }
.tool:hover { transform: translateY(-1px); }
.tool.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.tool-text { font-weight: 700; font-size: 13px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 8px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--border); backdrop-filter: blur(var(--glass-blur)); font-size: 13px; font-weight: 600; color: var(--text); min-height: 36px; }
.chip-twin { padding-left: 5px; }
.chip-live { color: var(--live); }
.chip-label { background: var(--live-word); color: var(--live-word-ink); border-color: transparent; text-transform: uppercase; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 var(--live); animation: live 1.6s ease-out infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 60%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
.twin-mark { border-radius: 50%; }

/* dock */
.dock { padding: 10px 16px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.embed .dock { padding-bottom: 12px; }
.tp { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; min-height: 42px; align-items: center; -webkit-overflow-scrolling: touch; }
.tp::-webkit-scrollbar { display: none; }
.tp-empty, .tp-empty-inline { color: var(--text-3); font-size: 14px; }
.tp-chip { flex: 0 0 auto; padding: 7px 12px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--border); font-size: 15px; font-weight: 500; transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast), opacity var(--dur-fast); white-space: nowrap; }
.tp-chip.done { opacity: 0.5; }
.tp-chip.active { background: var(--live-word); color: var(--live-word-ink); border-color: transparent; transform: scale(1.06); font-weight: 700; box-shadow: 0 6px 18px color-mix(in srgb, var(--live-word) 35%, transparent); }
.tp-chip.omit { opacity: 0.35; font-style: italic; font-weight: 400; }
.tp-chip.fs { font-family: var(--font-mono); letter-spacing: 0.05em; }
.tp-chip.fs b { font-weight: 500; opacity: 0.55; }
.tp-chip.fs b.lit { opacity: 1; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.tp-chip.interim { opacity: 0.6; border-style: dashed; }
.tp-chip.fixable { cursor: pointer; position: relative; }
.tp-chip .fix-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: middle; }
.fix-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 10px 0; }
.fix-grid label { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); font-weight: 600; }
.fix-grid select { max-width: none; width: 100%; }
.fix-cam { display: grid; gap: 10px; }
.fix-cam-box { position: relative; height: 260px; border-radius: 16px; overflow: hidden; background: var(--stage-bg); }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 96px; color: #fff; background: rgba(0, 0, 0, 0.35); z-index: 3; }
.countdown.rec { font-size: 26px; gap: 10px; display: flex; align-items: center; justify-content: center; background: transparent; align-content: flex-start; padding-top: 12px; height: 50px; inset: auto 0 0 0; top: auto; }
.tp-sep { color: var(--text-3); padding: 0 2px; }
.gloss-line { font-size: 12px; letter-spacing: 0.06em; color: var(--text-2); padding: 0 4px; }
.say-row { display: flex; gap: 8px; align-items: center; }
.say-input { flex: 1; min-width: 0; min-height: 48px; padding: 10px 14px; border-radius: 16px; border: 1px solid var(--border-strong); background: var(--surface-solid); color: var(--text); }
.say-input::placeholder { color: var(--text-3); }
.say-input.area { min-height: 110px; width: 100%; resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: 16px; font-weight: 700; border: 1px solid var(--border-strong); background: var(--surface-solid); color: var(--text); transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast); }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn-ghost { background: var(--surface-2); }
.btn-right { background: var(--live); color: var(--accent-ink); border-color: transparent; }
.btn-wrong { background: var(--danger-soft); border-color: var(--danger); }
.say-btn span { display: none; }
@media (min-width: 520px) { .say-btn span { display: inline; } }
.mic { position: relative; width: 52px; height: 52px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--surface-solid); border: 1px solid var(--border-strong); color: var(--text); transition: background var(--dur-med), color var(--dur-med); }
.mic.listening { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.mic.denied { color: var(--danger); }
.mic-ring { position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
.mic.listening .mic-ring { animation: ring 1.4s ease-out infinite; }
@keyframes ring { 0% { transform: scale(0.9); opacity: 0.8; } 100% { transform: scale(1.5); opacity: 0; } }
.say-status { font-size: 13px; color: var(--text-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-height: 20px; }
.say-status .link { color: var(--text-2); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.seg button { padding: 8px 14px; border-radius: 11px; font-weight: 600; color: var(--text-2); min-height: 38px; }
.seg button.on { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-1); }
.seg-wide { width: 100%; }
.seg-wide button { flex: 1; }
.toggle-inline { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; margin-left: auto; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
select { min-height: 40px; padding: 6px 10px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-solid); max-width: 60%; }

/* camera */
.listen-stage { position: relative; flex: 1; min-height: 0; background: var(--stage-bg); }
.cam { position: absolute; inset: 0; overflow: hidden; }
.cam-video, .cam-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam.mirror .cam-video, .cam.mirror .cam-canvas { transform: scaleX(-1); }
.cam-off { display: grid; place-items: center; padding: 24px; }
.cam-off-inner { max-width: 360px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.cam-off-icon { width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.cam-off-icon svg { width: 34px; height: 34px; }
.cam-hud { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; gap: 8px; align-items: center; z-index: 2; }
.cam-hud .tool { margin-left: auto; }
.tp-read { min-height: 46px; }
.read-line { font-family: var(--font-display); font-size: 24px; line-height: 1.2; }

/* learn */
.learn-home { display: grid; gap: 18px; max-width: 760px; margin: 0 auto; }
.learn-head { padding: 16px; display: grid; gap: 12px; }
.learn-head-row { display: flex; gap: 18px; justify-content: space-between; }
.big { font-size: 30px; line-height: 1; }
.big .small { font-size: 13px; color: var(--text-3); font-family: var(--font-ui); }
.meter { height: 8px; border-radius: 99px; background: var(--meter-track); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent-grad); border-radius: 99px; transition: width var(--dur-slow) var(--ease-out); }
.unit h3 { font-size: 22px; }
.lessons { display: grid; gap: 8px; }
.lesson { display: flex; gap: 12px; align-items: center; padding: 12px 14px; text-align: left; width: 100%; }
.lesson.locked { opacity: 0.55; }
.lesson.done .lesson-icon { background: var(--live); color: var(--accent-ink); }
.lesson-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: 0 0 auto; }
.lesson-title { font-weight: 700; }
.done-all { color: var(--text-2); }
.lesson-player { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lp-head { display: flex; gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.lp-title { flex: 1; }
.lp-title .serif { font-size: 20px; line-height: 1.1; }
.lp-meter { width: 90px; }
.lp-split { flex: 1; min-height: 0; display: grid; grid-template-rows: 1fr 1fr; }
.lp-split .stage { height: auto; min-height: 0; }
.lp-cam { position: relative; background: var(--stage-bg); overflow: hidden; }
@media (min-width: 820px) { .lp-split { grid-template-rows: none; grid-template-columns: 1fr 1fr; } }
.hold-ring { position: absolute; right: 14px; bottom: 14px; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--text); background: conic-gradient(var(--accent) calc(var(--p, 0) * 360deg), var(--meter-track) 0); }
.hold-ring span { width: 50px; height: 50px; border-radius: 50%; background: var(--surface-solid); display: grid; place-items: center; }
.lp-dock { gap: 8px; }
.lp-card { display: grid; gap: 6px; }
.lp-word { font-size: 28px; line-height: 1.1; }
.quiz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* dictionary */
.dict-letters { display: flex; flex-wrap: wrap; gap: 6px; }
.dict-letters .tp-chip { font-family: var(--font-mono); padding: 7px 0; width: 38px; text-align: center; }
.dict-results { display: grid; gap: 4px; max-height: 32vh; overflow: auto; }
.dict-row { display: grid; gap: 2px; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; }
.dict-row:hover, .dict-row.on { background: var(--surface-2); border-color: var(--border); }
.dict-detail { padding: 12px 14px; display: grid; gap: 6px; }
.dict-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dict-detail-head .serif { font-size: 24px; }
.dict-recipe { font-size: 12px; color: var(--text-2); }

/* sheets */
.sheet-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(6px); display: flex; align-items: flex-end; justify-content: center; z-index: 20; animation: fade var(--dur-fast) both; }
.sheet { width: 100%; max-height: 90vh; background: var(--bg-elev); border-radius: var(--radius-l) var(--radius-l) 0 0; box-shadow: var(--shadow-2); display: flex; flex-direction: column; animation: rise var(--dur-med) var(--ease-out) both; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 8px; }
.sheet-title { font-size: 24px; }
.sheet-body { overflow: auto; padding: 4px 18px 24px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
@media (min-width: 720px) { .sheet-back { align-items: center; padding: 20px; } .sheet { max-width: 460px; border-radius: var(--radius-l); max-height: 86vh; } .sheet-wide { max-width: 640px; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; box-shadow: var(--shadow-1); }
.swatch.on { border-color: var(--accent); }
.twin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.twin-card { display: grid; justify-items: center; gap: 4px; padding: 14px 10px; text-align: center; border: 2px solid var(--border); }
.twin-card.on { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.twin-name { font-size: 24px; }
.plans { display: grid; gap: 10px; }
.plan { padding: 14px 16px; }
.plan.on { border-color: var(--accent); }
.plan-name { font-size: 24px; }
.plan ul { margin: 8px 0; padding-left: 18px; color: var(--text-2); }
.plan-price { font-size: 28px; }
.plan-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }

/* onboarding */
.onboard { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: grid; place-items: center; padding: 20px; }
.onboard-card { max-width: 480px; width: 100%; display: grid; gap: 10px; }
.onboard h1 { font-size: 40px; line-height: 1.05; }
.onboard h2 { font-size: 30px; }
.onboard .wordmark { font-size: 34px; }
ul.plain { padding-left: 18px; color: var(--text-2); }
ul.plain b { color: var(--text); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); padding: 10px 16px; border-radius: var(--radius-pill); background: var(--surface-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow-2); z-index: 40; animation: rise var(--dur-med) var(--ease-out) both; max-width: calc(100vw - 32px); }
@media (min-width: 820px) { .toast { bottom: 28px; } }

@media (prefers-reduced-motion: reduce) { .dot, .mic-ring, .boot-mark { animation: none; } }
