/* SHADOW — dark camera-app aesthetic, one accent, mobile first. */
:root {
  --bg: #0b0b0f;
  --bg-2: #111118;
  --surface: #16161e;
  --surface-2: #1f1f2a;
  --surface-3: #2a2a37;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f6f6f8;
  --text-2: #c9c9d3;
  --muted: #8d8d9c;
  --accent: #ffd23f;
  --accent-2: #ffe27a;
  --accent-ink: #1b1500;
  --accent-soft: rgba(255, 210, 63, 0.14);
  --ok: #3ddc97;
  --bad: #ff5d5d;
  --warn: #ffb547;
  --glass: rgba(12, 12, 16, 0.6);
  --glass-strong: rgba(12, 12, 16, 0.82);
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --gutter: 16px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body[data-screen="teach"], body[data-screen="guide"] { overflow: hidden; background: #000; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
button:disabled { cursor: default; opacity: 0.4; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); }
.hidden { display: none !important; }
.ic { display: inline-flex; flex: none; line-height: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- boot ---------- */
.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; }
.boot-logo, .brand-mark {
  width: 56px; height: 56px; border-radius: 18px;
  background:
    radial-gradient(circle at 62% 38%, var(--accent) 0 26%, transparent 27%),
    radial-gradient(circle at 42% 58%, rgba(255, 210, 63, 0.35) 0 30%, transparent 31%),
    var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.boot-logo { animation: breathe 1.6s var(--ease) infinite; }
.boot-name { font-weight: 800; letter-spacing: 0.32em; color: var(--text-2); font-size: 14px; }

/* ---------- screens ---------- */
#app { min-height: 100dvh; }
.screen { min-height: 100dvh; opacity: 0; transform: translateY(8px); transition: opacity 0.28s var(--ease), transform 0.32s var(--ease); }
.screen.screen-in { opacity: 1; transform: none; }
.screen-teach, .screen-guide { position: fixed; inset: 0; overflow: hidden; background: #000; transform: none; }
.fatal { padding: calc(var(--sat) + 48px) 24px; display: grid; gap: 16px; justify-items: start; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px; border: 0;
  font-weight: 700; font-size: 16px; letter-spacing: -0.005em; text-decoration: none;
  transition: transform 0.12s var(--ease), background 0.2s, opacity 0.2s;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:active:not(:disabled) { background: var(--accent-2); }
.btn-ghost { background: rgba(255, 255, 255, 0.08); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn-lg { min-height: 56px; padding: 0 24px; font-size: 17px; }
.btn-xl { min-height: 62px; padding: 0 30px; font-size: 18px; width: 100%; }
.btn.block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--accent-ink); border-right-color: transparent; animation: spin 0.7s linear infinite;
}
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 0; flex: none;
  display: inline-grid; place-items: center; background: transparent; color: var(--text);
  transition: transform 0.12s var(--ease), background 0.2s;
}
.icon-btn:active:not(:disabled) { transform: scale(0.92); background: rgba(255, 255, 255, 0.1); }
.icon-btn.sm { width: 40px; height: 40px; }
.icon-btn.glass { background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: inset 0 0 0 1px var(--line); }
.icon-btn.danger { color: var(--bad); }
.icon-btn.off { color: var(--muted); position: relative; }
.icon-btn.off::after { content: ""; position: absolute; width: 26px; height: 2px; background: currentColor; transform: rotate(-45deg); border-radius: 2px; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.grow { flex: 1; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 999px; background: var(--glass); color: var(--text-2);
  font-size: 13px; font-weight: 600; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap;
}

/* ---------- toasts ---------- */
#toasts {
  position: fixed; z-index: 100; left: 0; right: 0; top: calc(var(--sat) + 10px);
  display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 var(--gutter);
}
.toast {
  pointer-events: auto; max-width: min(520px, 100%); padding: 12px 16px; border-radius: 16px;
  background: var(--glass-strong); color: var(--text); font-size: 15px; font-weight: 500;
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: var(--shadow), inset 0 0 0 1px var(--line-strong);
  transform: translateY(-12px) scale(0.98); opacity: 0; transition: transform 0.25s var(--ease), opacity 0.25s;
}
.toast.in { transform: none; opacity: 1; }
.toast-error { box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 93, 93, 0.5); }
.toast-error::before { content: "● "; color: var(--bad); }
.toast-ok::before { content: "✓ "; color: var(--ok); font-weight: 800; }

/* ---------- sheets ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 80; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); opacity: 0; transition: opacity 0.25s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88dvh; overflow-y: auto;
  background: var(--surface); border-radius: 26px 26px 0 0;
  padding: 8px calc(var(--gutter) + var(--sar)) calc(var(--sab) + 18px) calc(var(--gutter) + var(--sal));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 var(--line-strong);
  transform: translateY(100%); transition: transform 0.3s var(--ease);
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 4px auto 12px; }
.sheet-title { font-weight: 700; font-size: 17px; padding: 0 4px 12px; color: var(--text); }
.action-list { display: grid; gap: 6px; }
.action-item {
  display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 0 16px; border: 0;
  border-radius: 16px; background: var(--surface-2); font-size: 16px; font-weight: 600; text-align: left;
}
.action-item:active { background: var(--surface-3); }
.action-item.danger { color: var(--bad); }
.action-item.cancel { justify-content: center; margin-top: 6px; background: transparent; color: var(--muted); }
.confirm { display: grid; gap: 20px; padding: 6px 2px 4px; }
.confirm-msg { font-size: 17px; font-weight: 600; line-height: 1.4; }
.sheet-image .image-view img { width: 100%; border-radius: 18px; max-height: 66dvh; object-fit: contain; background: #000; }
.image-caption { margin-top: 12px; color: var(--text-2); font-size: 15px; }

/* ---------- home ---------- */
.screen-home { padding: 0 calc(var(--gutter) + var(--sar)) 0 calc(var(--gutter) + var(--sal)); max-width: 640px; margin: 0 auto; }
.home-header {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(var(--sat) + 14px) 0 12px; background: linear-gradient(var(--bg) 70%, rgba(11, 11, 15, 0));
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 40px; height: 40px; border-radius: 13px; }
.brand-name { font-weight: 800; letter-spacing: 0.22em; font-size: 16px; }
.brand-sub { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.badge {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px;
  font-size: 13px; font-weight: 700; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
  max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.badge-demo .dot { background: var(--warn); }
.badge-ai .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.18); }
.badge-off { color: var(--bad); }
.badge-off .dot { background: var(--bad); }
.badge-loading .dot { animation: blink 1s infinite; }
.home-scroll { padding-bottom: calc(var(--sab) + 28px); }
.hero { padding: 18px 0 8px; }
.hero-title { font-size: clamp(28px, 8.4vw, 40px); line-height: 1.12; font-weight: 800; letter-spacing: -0.025em; }
.accent { color: var(--accent); }
.hero-sub { margin-top: 12px; color: var(--text-2); font-size: 15.5px; max-width: 34em; }
.cta {
  margin-top: 22px; width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  min-height: 84px; padding: 14px 18px 14px 14px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 14px 34px rgba(255, 210, 63, 0.2);
  transition: transform 0.14s var(--ease);
}
.cta:active { transform: scale(0.98); }
.cta-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: rgba(27, 21, 0, 0.1); flex: none; }
.cta-text { display: grid; flex: 1; min-width: 0; }
.cta-title { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.cta-sub { font-size: 14px; font-weight: 500; opacity: 0.75; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin: 30px 2px 12px; }
.section-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.section-count { color: var(--muted); font-weight: 700; font-size: 15px; }
.skill-list { display: grid; gap: 12px; }
.skill-card {
  display: flex; align-items: stretch; gap: 14px; padding: 12px; border-radius: var(--radius);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); min-height: 104px;
  transition: transform 0.14s var(--ease), background 0.2s; cursor: pointer; -webkit-user-select: none; user-select: none;
}
.skill-card:active { transform: scale(0.985); background: var(--surface-2); }
.skill-cover {
  position: relative; width: 80px; flex: none; border-radius: 16px; overflow: hidden;
  background: linear-gradient(140deg, #2b2a1d, #1b1b24 60%); display: grid; place-items: center;
}
.skill-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.skill-initial { font-size: 30px; font-weight: 800; color: var(--accent); }
.skill-cover img + .skill-initial { display: none; }
.skill-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.skill-name { font-size: 17px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.skill-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.skill-meta span { display: inline-flex; align-items: center; gap: 5px; }
.skill-summary { color: var(--text-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.skill-actions { display: flex; flex-direction: column; justify-content: space-between; align-items: center; margin: -4px -4px -4px 0; }
.play-chip { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.skeleton { pointer-events: none; }
.skeleton .skill-cover, .sk-line { background: var(--surface-2); animation: shimmer 1.3s ease-in-out infinite; }
.sk-line { height: 14px; border-radius: 7px; }
.w70 { width: 70%; } .w40 { width: 40%; }
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 36px 20px; border-radius: var(--radius); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2); }
.empty-icon { width: 60px; height: 60px; border-radius: 20px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty-title { font-weight: 700; color: var(--text); font-size: 17px; }
.home-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 30px; letter-spacing: 0.02em; }

/* ---------- camera screens (shared) ---------- */
.cam-wrap { position: absolute; inset: 0; background: #000; }
.cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.hand-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cam-shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0) 58%, rgba(0, 0, 0, 0.7));
}
.cam-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(var(--sat) + 10px) calc(var(--gutter) + var(--sar)) 10px calc(var(--gutter) + var(--sal));
}
.cam-top-center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.mode-label { font-weight: 700; font-size: 15px; padding: 6px 14px; border-radius: 999px; background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.rec-pill { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 999px; background: rgba(255, 59, 48, 0.92); font-weight: 700; font-variant-numeric: tabular-nums; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; animation: blink 1s infinite; }
.counters { display: flex; gap: 6px; }
.cam-error {
  position: absolute; z-index: 6; left: var(--gutter); right: var(--gutter); top: 50%; transform: translateY(-50%);
  margin: 0 auto; max-width: 420px; padding: 24px 20px; border-radius: var(--radius); text-align: center;
  background: var(--glass-strong); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: inset 0 0 0 1px var(--line-strong);
  display: grid; gap: 14px; justify-items: center; color: var(--text-2);
}
.cam-error-icon { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 93, 93, 0.15); color: var(--bad); }
.cam-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px;
  padding: 0 calc(var(--gutter) + var(--sar)) calc(var(--sab) + 18px) calc(var(--gutter) + var(--sal));
}

/* ---------- teach ---------- */
.teach-hint {
  position: absolute; z-index: 2; left: var(--gutter); right: var(--gutter); top: 50%; transform: translateY(-62%);
  margin: 0 auto; max-width: 380px; padding: 22px 20px; border-radius: var(--radius); text-align: center;
  background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: inset 0 0 0 1px var(--line);
  display: grid; gap: 8px; justify-items: center;
}
.teach-hint-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.teach-hint-title { font-weight: 800; font-size: 19px; }
.teach-hint-sub { color: var(--text-2); font-size: 15px; font-style: italic; }
.teach-hint-warn { display: flex; gap: 8px; align-items: flex-start; text-align: left; color: var(--warn); font-size: 13.5px; margin-top: 6px; }
.transcript {
  max-height: 34dvh; overflow: hidden; padding: 12px 14px; border-radius: 18px;
  background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: inset 0 0 0 1px var(--line);
  display: grid; gap: 6px;
}
.transcript-lines { display: grid; gap: 6px; }
.transcript-line { font-size: 15.5px; line-height: 1.35; animation: rise 0.3s var(--ease); }
.transcript-line .t, .form-transcript .t { color: var(--accent); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 8px; }
.transcript-interim { color: var(--muted); font-size: 15px; font-style: italic; min-height: 1.3em; }
.record-row { display: grid; justify-items: center; gap: 8px; }
.record-btn {
  width: 84px; height: 84px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center;
  background: transparent; box-shadow: inset 0 0 0 5px #fff; transition: transform 0.12s var(--ease);
}
.record-btn:active { transform: scale(0.94); }
.record-inner { width: 64px; height: 64px; border-radius: 50%; background: #ff3b30; transition: all 0.25s var(--ease); }
.is-recording .record-inner { width: 32px; height: 32px; border-radius: 9px; }
.record-caption { font-size: 13px; font-weight: 600; color: var(--text-2); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.shutter-flash { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 0 rgba(255, 210, 63, 0); }
.shutter-flash.go { animation: shutter 0.45s ease-out; }
.has-form .cam-bottom, .has-form .teach-hint { visibility: hidden; }
.form-backdrop { position: absolute; inset: 0; z-index: 7; background: rgba(0, 0, 0, 0.45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade 0.25s; }
.teach-form {
  position: absolute; z-index: 8; left: 0; right: 0; bottom: 0; max-height: calc(100dvh - var(--sat) - 70px); overflow-y: auto;
  background: var(--surface); border-radius: 26px 26px 0 0; display: grid; gap: 14px;
  padding: 20px calc(var(--gutter) + var(--sar)) calc(var(--sab) + 18px) calc(var(--gutter) + var(--sal));
  animation: sheetUp 0.35s var(--ease); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}
.form-head { display: grid; gap: 10px; }
.form-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.015em; }
.form-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.form-stats .chip { background: var(--surface-2); }
.field { display: grid; gap: 6px; }
.field-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--radius-sm); border: 0;
  background: var(--surface-2); color: var(--text); font-size: 16px; box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.15s; -webkit-appearance: none; appearance: none;
}
.input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.input::placeholder { color: #6d6d7c; }
.textarea { resize: none; line-height: 1.4; min-height: 50px; overflow: hidden; }
.teach-form .textarea { overflow: auto; }
.form-transcript { background: var(--surface-2); border-radius: var(--radius-sm); padding: 4px 14px; }
.form-transcript summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--text-2); cursor: pointer; }
.form-transcript ol { margin: 0 0 10px; padding-left: 0; list-style: none; display: grid; gap: 8px; font-size: 15px; }
.form-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 4px; }
.form-actions .btn { white-space: nowrap; padding: 0 18px; }
.loading-overlay {
  position: absolute; inset: 0; z-index: 20; display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center;
  padding: 0 28px; background: rgba(8, 8, 12, 0.9); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  opacity: 0; transition: opacity 0.3s;
}
.loading-overlay.in { opacity: 1; }
.orb { position: relative; width: 120px; height: 120px; margin-bottom: 14px; }
.orb i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: ripple 2.4s var(--ease) infinite; }
.orb i:nth-child(2) { animation-delay: 0.8s; }
.orb i:nth-child(3) { animation-delay: 1.6s; }
.orb::after { content: ""; position: absolute; inset: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--accent-2), var(--accent) 55%, #c79a00); box-shadow: 0 0 40px rgba(255, 210, 63, 0.55); animation: breathe 1.8s ease-in-out infinite; }
.loading-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.loading-line { color: var(--text-2); font-size: 16px; min-height: 1.5em; }
.loading-line.swap { animation: rise 0.4s var(--ease); }
.loading-stats { color: var(--muted); font-size: 13px; }
.loading-elapsed { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; min-height: 1.4em; }
.progress-bar { width: 200px; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin: 6px 0 12px; }
.progress-bar i { display: block; width: 40%; height: 100%; border-radius: 2px; background: var(--accent); animation: indeterminate 1.4s ease-in-out infinite; }

/* ---------- review ---------- */
.screen-review { max-width: 680px; margin: 0 auto; }
.app-bar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 6px;
  padding: calc(var(--sat) + 8px) calc(var(--gutter) + var(--sar)) 8px calc(6px + var(--sal));
  background: rgba(11, 11, 15, 0.86); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border-bottom: 1px solid var(--line);
}
.app-bar-title { flex: 1; font-weight: 800; font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-scroll { padding: 14px calc(var(--gutter) + var(--sar)) calc(var(--sab) + 28px) calc(var(--gutter) + var(--sal)); }
.review-notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(255, 181, 71, 0.1); box-shadow: inset 0 0 0 1px rgba(255, 181, 71, 0.35); color: var(--text-2); font-size: 13.5px; line-height: 1.45; margin-bottom: 14px; }
.review-notice svg { color: var(--warn); flex: none; margin-top: 1px; }
.review-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-2); font-size: 14.5px; margin-bottom: 14px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); padding: 16px; display: grid; gap: 14px; }
.field-title .input { font-size: 19px; font-weight: 700; }
.step-list { display: grid; gap: 14px; }
.step-card { transition: box-shadow 0.4s; }
.step-card.flash { box-shadow: inset 0 0 0 2px var(--accent); }
.step-head { display: flex; align-items: center; gap: 12px; }
.step-num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.step-thumb { position: relative; width: 92px; height: 68px; border-radius: 12px; overflow: hidden; border: 0; padding: 0; background: var(--surface-2); flex: none; display: grid; place-items: center; color: var(--muted); }
.step-thumb img { width: 100%; height: 100%; object-fit: cover; }
.step-thumb.broken img { display: none; }
.step-tools { margin-left: auto; display: flex; gap: 2px; }
.field-instruction .input { font-size: 17px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 520px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.field-tip .field-label { color: var(--accent); }
.field-warn .field-label { color: var(--warn); }
.step-more { border-top: 1px solid var(--line); padding-top: 4px; }
.step-more summary { min-height: 44px; display: flex; align-items: center; color: var(--muted); font-weight: 600; font-size: 14.5px; cursor: pointer; }
.step-more[open] { display: grid; gap: 12px; }
.review-bottom { margin-top: 22px; }

/* ---------- guide ---------- */
.guide-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 3; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px;
  padding: calc(var(--sat) + 10px) calc(var(--gutter) + var(--sar)) 0 calc(var(--gutter) + var(--sal));
}
.guide-row { display: flex; align-items: center; gap: 10px; }
.guide-titles { flex: 1; min-width: 0; }
.step-label { font-weight: 800; font-size: 17px; letter-spacing: -0.01em; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); }
.skill-label { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: 999px; flex: none; max-width: 48vw;
  background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13.5px; font-weight: 700; white-space: nowrap; transition: background 0.25s, box-shadow 0.25s;
}
.pill-text { overflow: hidden; text-overflow: ellipsis; }
.pill-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.pill-latency { font-size: 11px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.pill-latency:empty { display: none; }
.status-pill.is-looking .pill-dot { background: var(--accent); animation: pulse 1.1s infinite; }
.status-pill.is-seen .pill-dot { background: var(--text-2); }
.status-pill.is-ok { background: rgba(61, 220, 151, 0.22); box-shadow: inset 0 0 0 1px rgba(61, 220, 151, 0.55); }
.status-pill.is-ok .pill-dot { background: var(--ok); }
.status-pill.is-bad { background: rgba(255, 93, 93, 0.22); box-shadow: inset 0 0 0 1px rgba(255, 93, 93, 0.55); }
.status-pill.is-bad .pill-dot { background: var(--bad); }
.status-pill.is-warn { background: rgba(255, 181, 71, 0.2); box-shadow: inset 0 0 0 1px rgba(255, 181, 71, 0.55); }
.status-pill.is-warn .pill-dot { background: var(--warn); animation: pulse 1.6s infinite; }
.status-pill.is-ok .pill-dot, .status-pill.is-bad .pill-dot { display: none; }
.status-pill.is-ok .pill-latency, .status-pill.is-bad .pill-latency { color: var(--text-2); }
.hud {
  border-radius: var(--radius); padding: 16px 16px 14px; display: grid; gap: 10px;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
.glass { background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); box-shadow: inset 0 0 0 1px var(--line-strong), 0 8px 30px rgba(0, 0, 0, 0.25); }
.hud.pop { animation: hudPop 0.45s var(--ease); }
.hud-instruction { font-size: clamp(21px, 6.2vw, 28px); line-height: 1.22; font-weight: 800; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.hud-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hud-chips:empty { display: none; }
.hud-chip { display: inline-flex; align-items: flex-start; gap: 6px; padding: 6px 10px; border-radius: 12px; font-size: 13.5px; font-weight: 600; line-height: 1.3; max-width: 100%; }
.hud-chip .ic { margin-top: 1px; }
.hud-chip.tip { background: var(--accent-soft); color: var(--accent-2); }
.hud-chip.warn { background: rgba(255, 181, 71, 0.16); color: var(--warn); }
.progress-dots { display: flex; gap: 6px; }
.progress-dots:empty { display: none; }
.pdot { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); transition: background 0.3s; max-width: 64px; }
.pdot.done { background: var(--accent); }
.pdot.active { background: rgba(255, 210, 63, 0.45); animation: blink 1.4s ease-in-out infinite; }
.guide-side { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-direction: row-reverse; }
.ref-thumb {
  position: relative; width: 96px; height: 96px; border-radius: 18px; overflow: hidden; border: 0; padding: 0; flex: none;
  background: var(--surface-2); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), inset 0 0 0 2px rgba(255, 255, 255, 0.85);
  transition: transform 0.15s var(--ease);
}
.ref-thumb:active { transform: scale(0.95); }
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ref-tag { position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 8px; font-size: 11px; font-weight: 700; background: rgba(0, 0, 0, 0.65); }
.debug-bar { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.guide-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px;
  padding: 0 calc(var(--gutter) + var(--sar)) calc(var(--sab) + 14px) calc(var(--gutter) + var(--sal));
}
.speech-bubble {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 22px 22px 22px 8px;
  background: rgba(255, 255, 255, 0.94); color: #111; box-shadow: var(--shadow); max-width: 560px;
}
.speech-bubble.pop { animation: bubbleIn 0.35s var(--ease); }
.bubble-avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; background: radial-gradient(circle at 62% 38%, var(--accent) 0 30%, #222 31%); }
.bubble-body { min-width: 0; }
.bubble-who { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: #6a6a6a; }
.bubble-text { font-size: 17px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.speech-bubble.kind-mismatch, .speech-bubble.kind-hint { box-shadow: var(--shadow), inset 0 0 0 3px var(--bad); }
.speech-bubble.kind-success, .speech-bubble.kind-complete { box-shadow: var(--shadow), inset 0 0 0 3px var(--ok); }
.speech-bubble.kind-user { background: var(--glass-strong); color: var(--text); border-radius: 22px 22px 8px 22px; margin-left: auto; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.speech-bubble.kind-user .bubble-avatar { display: none; }
.speech-bubble.kind-user .bubble-who { color: var(--muted); }
.guide-controls { display: flex; align-items: flex-end; justify-content: space-between; }
.guide-controls > .icon-btn { width: 52px; height: 52px; margin-bottom: 26px; }
.mic-wrap { display: grid; justify-items: center; gap: 8px; }
.mic-btn {
  position: relative; width: 80px; height: 80px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 30px rgba(255, 210, 63, 0.3);
  transition: transform 0.15s var(--ease); touch-action: none; -webkit-touch-callout: none;
}
.mic-btn::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
.mic-btn.listening { transform: scale(1.1); background: #fff; }
.mic-btn.listening::before { animation: ripple 1.2s var(--ease) infinite; }
.mic-btn.thinking { opacity: 0.85; }
.mic-btn.thinking::before { opacity: 1; border-color: var(--accent) transparent; animation: spin 0.9s linear infinite; }
.mic-label { font-size: 13px; font-weight: 700; color: var(--text); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); }
.start-overlay {
  position: absolute; inset: 0; z-index: 10; display: flex; align-items: flex-end;
  padding: calc(var(--sat) + 16px) calc(var(--gutter) + var(--sar)) calc(var(--sab) + 16px) calc(var(--gutter) + var(--sal));
  background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.8)); transition: opacity 0.35s;
}
.start-overlay.leaving { opacity: 0; pointer-events: none; }
.start-card {
  width: 100%; max-width: 520px; margin: 0 auto; padding: 22px 20px 18px; border-radius: 28px; display: grid; gap: 14px;
  background: var(--glass-strong); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); box-shadow: inset 0 0 0 1px var(--line-strong);
  animation: sheetUp 0.45s var(--ease);
}
.start-kicker { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 13px; font-weight: 700; }
.start-title { font-size: 26px; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
.start-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.start-meta:empty { display: none; }
.start-tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; color: var(--text-2); font-size: 14.5px; }
.start-tips li { display: flex; gap: 10px; align-items: flex-start; }
.start-tips .ic { color: var(--accent); margin-top: 1px; }
.start-conn { text-align: center; font-size: 12.5px; color: var(--muted); }
.start-conn.ok { color: var(--ok); }
.start-conn.ok::before { content: "● "; }
.pre-start .guide-bottom, .pre-start .guide-side { visibility: hidden; }
.completed .hud { box-shadow: inset 0 0 0 2px var(--ok), 0 8px 30px rgba(0, 0, 0, 0.25); }

/* ---------- guide: eval capture ---------- */
.eval-on .speech-bubble { display: none; }
.eval-bar { border-radius: var(--radius); padding: 10px 12px 12px; display: grid; gap: 10px; }
.eval-bar.flash-ok { animation: evalFlashOk 0.6s var(--ease); }
.eval-bar.flash-bad { animation: evalFlashBad 0.6s var(--ease); }
.eval-bar.flash-undo { animation: evalFlashUndo 0.6s var(--ease); }
.eval-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.eval-titles { flex: 1; min-width: 0; }
.eval-step { font-weight: 800; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eval-sub { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.4em; }
.eval-sub.busy { color: var(--accent); }
.flash-ok .eval-sub { color: var(--ok); }
.flash-bad .eval-sub { color: var(--bad); }
.flash-undo .eval-sub { color: var(--accent); }
.eval-counts {
  display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 10px; border-radius: 999px; flex: none;
  background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; font-variant-numeric: tabular-nums;
}
.eval-counts.pop { animation: hudPop 0.35s var(--ease); }
.eval-counts b { font-weight: 800; }
.eval-mark { font-weight: 800; }
.eval-mark.ok { color: var(--ok); }
.eval-mark.bad { color: var(--bad); }
.eval-dot { color: var(--muted); margin: 0 2px; }
.eval-undo {
  display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 11px; border-radius: 999px; border: 0; flex: none;
  background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; font-weight: 700; white-space: nowrap;
  transition: transform 0.12s var(--ease), background 0.2s;
}
.eval-undo span { font-size: 16px; line-height: 1; }
.eval-undo:active:not(:disabled) { transform: scale(0.95); background: rgba(255, 255, 255, 0.16); }
.eval-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.eval-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 58px; padding: 0 10px; border: 0; border-radius: 18px;
  font-size: 17px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; color: #fff;
  transition: transform 0.1s var(--ease), filter 0.15s; -webkit-touch-callout: none;
}
.eval-btn-mark { font-size: 20px; line-height: 1; }
.eval-btn:active:not(:disabled) { transform: scale(0.96); filter: brightness(1.15); }
.eval-done { background: rgba(61, 220, 151, 0.28); box-shadow: inset 0 0 0 1.5px rgba(61, 220, 151, 0.75); }
.eval-done .eval-btn-mark { color: var(--ok); }
.eval-not { background: rgba(255, 93, 93, 0.26); box-shadow: inset 0 0 0 1.5px rgba(255, 93, 93, 0.75); }
.eval-not .eval-btn-mark { color: var(--bad); }
@keyframes evalFlashOk { 0% { box-shadow: inset 0 0 0 3px var(--ok), 0 8px 30px rgba(0, 0, 0, 0.25); } 100% { box-shadow: inset 0 0 0 1px var(--line-strong), 0 8px 30px rgba(0, 0, 0, 0.25); } }
@keyframes evalFlashBad { 0% { box-shadow: inset 0 0 0 3px var(--bad), 0 8px 30px rgba(0, 0, 0, 0.25); } 100% { box-shadow: inset 0 0 0 1px var(--line-strong), 0 8px 30px rgba(0, 0, 0, 0.25); } }
@keyframes evalFlashUndo { 0% { box-shadow: inset 0 0 0 3px var(--accent), 0 8px 30px rgba(0, 0, 0, 0.25); } 100% { box-shadow: inset 0 0 0 1px var(--line-strong), 0 8px 30px rgba(0, 0, 0, 0.25); } }
@media (max-width: 359px) { .eval-undo { padding: 0 9px; } .eval-btn { font-size: 16px; } }

/* ---------- settings ---------- */
.settings { display: grid; gap: 4px; }
.toggle-row { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.toggle-text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.toggle-label { font-weight: 600; }
.toggle-sub { font-size: 13px; color: var(--muted); }
.switch-input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 52px; height: 32px; border-radius: 16px; background: var(--surface-3); position: relative; flex: none; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); }
.switch-input:checked + .switch { background: var(--accent); }
.switch-input:checked + .switch::after { transform: translateX(20px); }
.switch-input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.settings-stats { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; padding: 14px 4px 0; }
.ask-form { display: flex; gap: 10px; }
.ask-form .input { flex: 1; }

/* ---------- done ---------- */
.screen-done { position: relative; overflow: hidden; display: grid; place-items: center; }
.done-wrap {
  position: relative; z-index: 1; width: 100%; max-width: 480px; display: grid; justify-items: center; text-align: center; gap: 10px;
  padding: calc(var(--sat) + 40px) calc(var(--gutter) + var(--sar)) calc(var(--sab) + 28px) calc(var(--gutter) + var(--sal));
}
.done-badge { position: relative; width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); animation: popIn 0.6s var(--ease); margin-bottom: 10px; }
.done-badge .ic { position: relative; z-index: 1; }
.done-ring { position: absolute; inset: -10px; border-radius: 50%; border: 2px solid var(--accent); animation: ripple 2s var(--ease) infinite; }
.done-kicker { color: var(--accent); font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; font-size: 13px; }
.done-title { font-size: clamp(26px, 7.6vw, 34px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.done-sub { color: var(--text-2); }
.stats-grid { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 6px; }
.stat { background: var(--surface); border-radius: 20px; padding: 16px 12px; box-shadow: inset 0 0 0 1px var(--line); display: grid; justify-items: center; gap: 4px; animation: rise 0.5s var(--ease) both; }
.stat:nth-child(2) { animation-delay: 0.06s; } .stat:nth-child(3) { animation-delay: 0.12s; } .stat:nth-child(4) { animation-delay: 0.18s; }
.stat-icon { color: var(--accent); }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.done-praise { color: var(--text-2); font-size: 15px; margin-bottom: 12px; }
.done-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.done-actions .btn:only-child { grid-column: 1 / -1; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute; top: -20px; left: var(--x); width: 8px; height: 14px; border-radius: 2px;
  background: var(--accent); opacity: 0.9; animation: fall 2.8s cubic-bezier(0.3, 0.6, 0.4, 1) forwards;
  animation-delay: calc(var(--i) * 0.07s);
}
.confetti i:nth-child(3n) { background: #fff; }
.confetti i:nth-child(4n) { background: var(--ok); width: 10px; height: 10px; border-radius: 50%; }

/* ---------- animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0.35; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 210, 63, 0.6); } 100% { box-shadow: 0 0 0 9px rgba(255, 210, 63, 0); } }
@keyframes breathe { 50% { transform: scale(0.92); } }
@keyframes shimmer { 50% { opacity: 0.5; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ripple { 0% { transform: scale(0.7); opacity: 0.9; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@keyframes shutter { 0% { box-shadow: inset 0 0 0 6px rgba(255, 210, 63, 0.9); } 100% { box-shadow: inset 0 0 0 0 rgba(255, 210, 63, 0); } }
@keyframes hudPop { 0% { transform: scale(0.97); box-shadow: inset 0 0 0 2px var(--accent); } 100% { transform: none; } }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes popIn { 0% { transform: scale(0.3); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(105dvh) rotate(540deg); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
