/* ==========================================================================
   RedFlag: The Scam Detective Game - styles
   Mobile-first. The app is a phone-width column; on desktop it floats over
   a decorative backdrop. Themes: dark (default), light, high-contrast,
   large text and reduced motion are driven by <html data-*> attributes.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 64px;
  --ease-out: cubic-bezier(.2, .9, .3, 1);
  --spring: cubic-bezier(.2, 1.4, .4, 1);

  /* dark theme (default) */
  --bg: #130f24;
  --bg2: #191433;
  --surface: #1f1a3a;
  --surface2: #2a2350;
  --card: #241e45;
  --card-head: #2d2654;
  --bubble: #352d63;
  --text: #f5f2ff;
  --muted: #a8a1cc;
  --border: rgba(255, 255, 255, .09);
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --red: #ff4d6d;
  --red-2: #ff7a59;
  --green: #22c58b;
  --amber: #ffb020;
  --violet: #7c5cff;
  --blue: #59a8ff;
  --link: #6cb6ff;
  --mark: rgba(255, 196, 0, .38);
  --qr-bg: #ffffff;
  --qr-fg: #111;
  --focus: #ffd166;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f1fb;
  --bg2: #ebe6f7;
  --surface: #ffffff;
  --surface2: #f1edfb;
  --card: #ffffff;
  --card-head: #f3f1f8;
  --bubble: #ecebf3;
  --text: #1c1533;
  --muted: #6b6488;
  --border: rgba(30, 20, 70, .1);
  --shadow: 0 16px 40px rgba(40, 20, 90, .14);
  --red: #e8304f;
  --green: #0f9d6b;
  --amber: #d98a00;
  --violet: #6a48f5;
  --link: #1f6fd6;
  --mark: rgba(255, 190, 0, .45);
  --focus: #6a48f5;
  color-scheme: light;
}
:root[data-contrast] {
  --bg: #000;
  --bg2: #000;
  --surface: #0c0c0c;
  --surface2: #161616;
  --card: #000;
  --card-head: #111;
  --bubble: #1a1a1a;
  --text: #fff;
  --muted: #e2e2e2;
  --border: #ffffff;
  --red: #ff6b85;
  --green: #3dffa8;
  --amber: #ffd000;
  --violet: #b9a6ff;
  --link: #8fd0ff;
  --mark: #ffd000;
  --focus: #ffd000;
}
:root[data-contrast][data-theme="light"] {
  --bg: #fff; --bg2: #fff; --surface: #fff; --surface2: #f2f2f2; --card: #fff; --card-head: #eee; --bubble: #e9e9e9;
  --text: #000; --muted: #222; --border: #000; --red: #b0001e; --green: #006b3c; --amber: #8a5a00; --violet: #3d1fb8; --link: #0040b0;
  --mark: #ffe066; --focus: #0040b0;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; height: 100%; }
:root[data-large] { font-size: 19.5px; }
body {
  margin: 0; min-height: 100%; height: 100%;
  font-family: var(--font); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { line-height: 1.5; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.block { display: block; width: 100%; }
.mt { margin-top: 10px; }
code { font-family: var(--mono); }

/* ---------- Desktop backdrop & app shell ---------- */
.backdrop { position: fixed; inset: 0; overflow: hidden; background: radial-gradient(1200px 800px at 20% 10%, #2a1752 0%, transparent 60%), radial-gradient(900px 700px at 90% 90%, #4a1030 0%, transparent 60%), #0d0a1a; }
:root[data-theme="light"] .backdrop { background: radial-gradient(1200px 800px at 20% 10%, #e3dafc 0%, transparent 60%), radial-gradient(900px 700px at 90% 90%, #ffd9e2 0%, transparent 60%), #efeaf8; }
.bd-blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; }
.bd-blob.b1 { width: 420px; height: 420px; background: #ff4d6d; left: -120px; top: 40%; }
.bd-blob.b2 { width: 380px; height: 380px; background: #7c5cff; right: -100px; top: -80px; }
.bd-blob.b3 { width: 300px; height: 300px; background: #ffb020; right: 10%; bottom: -120px; opacity: .25; }
.bd-tagline { position: absolute; left: 48px; bottom: 44px; display: none; flex-direction: column; gap: 6px; color: rgba(255,255,255,.8); }
.bd-tagline strong { font-size: 2rem; }
:root[data-theme="light"] .bd-tagline { color: #2a1f4d; }

.app {
  position: relative; margin: 0 auto; width: 100%; max-width: 480px; height: 100vh; height: 100dvh;
  background: var(--bg); overflow: hidden; overflow: clip; isolation: isolate;
}
@media (min-width: 760px) {
  .app { height: calc(100dvh - 48px); max-height: 940px; margin-top: max(24px, calc((100dvh - 940px) / 2)); border-radius: 36px;
    box-shadow: 0 40px 120px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.08), inset 0 0 0 1px rgba(255,255,255,.04); }
  .bd-tagline { display: flex; }
}
@media (min-width: 760px) and (max-width: 1100px) { .bd-tagline { display: none; } }

.view {
  position: absolute; inset: 0 0 calc(var(--tabbar-h) + env(safe-area-inset-bottom)) 0;
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; outline: none;
  scrollbar-width: thin;
}
:root[data-fullscreen] .view { bottom: 0; }
:root[data-fullscreen] .tabbar { transform: translateY(110%); }

/* ---------- Tab bar ---------- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border); transition: transform .3s var(--ease-out);
}
.tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); position: relative; }
.tabbar button span { font-size: 1.35rem; transition: transform .2s var(--spring); filter: grayscale(.6); opacity: .8; }
.tabbar button small { font-size: .72rem; font-weight: 600; letter-spacing: .02em; }
.tabbar button.active { color: var(--text); }
.tabbar button.active span { transform: translateY(-2px) scale(1.12); filter: none; opacity: 1; }
.tabbar button.active::after { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--red); }

/* ---------- Screens & common pieces ---------- */
.screen { min-height: 100%; animation: screenIn .35s var(--ease-out); }
.screen.pad { padding: calc(14px + env(safe-area-inset-top)) 18px 28px; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } }
.screen-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-height: 44px; }
.screen-head h1 { font-size: 1.45rem; font-weight: 800; flex: 1; }
.head-spacer { width: 44px; }
.lead { color: var(--muted); margin: 0 0 16px; }
.section-title { font-size: 1.02rem; margin: 26px 0 10px; font-weight: 800; }
.foot-note { color: var(--muted); font-size: .8rem; text-align: center; margin: 22px 8px 6px; line-height: 1.5; }

.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; font-size: 1.25rem; flex: none; transition: transform .15s; }
.icon-btn:active { transform: scale(.92); }
.icon-btn span { line-height: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface2); font-weight: 700; transition: transform .15s, filter .15s; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn-primary { background: linear-gradient(135deg, var(--red), #ff7a59); border-color: transparent; color: #fff; box-shadow: 0 8px 22px rgba(255, 77, 109, .35); }
.btn-danger { background: var(--red); border-color: transparent; color: #fff; }
.btn-lg { min-height: 54px; font-size: 1.05rem; border-radius: 16px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 8px 12px; font-size: .86rem; font-weight: 600; }
.chev { margin-left: auto; font-size: 1.6rem; color: var(--muted); line-height: 1; }

/* ---------- Home ---------- */
.home { padding: calc(16px + env(safe-area-inset-top)) 16px 20px; }
.home-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo h1 { font-size: 1.7rem; font-weight: 900; letter-spacing: -.02em; background: linear-gradient(90deg, var(--text), var(--red)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo small { color: var(--muted); font-size: .8rem; }
.logo-flag { font-size: 2.1rem; display: inline-block; animation: wave 3s ease-in-out infinite; transform-origin: 20% 90%; }
@keyframes wave { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(8deg); } }

.player-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius); background: linear-gradient(135deg, color-mix(in srgb, var(--violet) 30%, var(--surface)), var(--surface)); border: 1px solid var(--border); }
.rank-badge { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 1.8rem; background: rgba(255,255,255,.08); border: 1px solid var(--border); flex: none; }
.rank-badge.lg { width: 70px; height: 70px; font-size: 2.4rem; border-radius: 20px; }
.player-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.player-info small { font-size: .72rem; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.player-info strong { font-size: 1.1rem; }
.player-info small.muted { font-weight: 500; letter-spacing: 0; }
.xpbar { height: 8px; border-radius: 99px; background: rgba(127,127,127,.22); overflow: hidden; margin: 3px 0; }
.xpbar-fill { height: 100%; width: 100%; transform-origin: left; background: linear-gradient(90deg, var(--violet), var(--red)); border-radius: 99px; transition: transform .6s var(--ease-out); }
.iq-pill { border: 0; border-radius: 16px; padding: 8px 12px; background: linear-gradient(135deg, var(--red), #ff7a59); color: #fff; display: flex; flex-direction: column; align-items: center; min-width: 74px; box-shadow: 0 8px 20px rgba(255,77,109,.3); }
.iq-pill small { font-size: .62rem; font-weight: 800; letter-spacing: .08em; opacity: .9; }
.iq-pill strong { font-size: 1.55rem; line-height: 1.1; }

.challenge-banner { margin-top: 12px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--amber) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--amber) 55%, transparent); animation: pulseGlow 2s infinite; }
.challenge-banner > div:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.challenge-banner small { color: var(--muted); }
.cb-emoji { font-size: 1.8rem; }
@keyframes pulseGlow { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--amber) 18%, transparent); } }

.hero-play {
  margin-top: 14px; width: 100%; border: 0; border-radius: 22px; padding: 20px 18px; display: flex; align-items: center; gap: 16px; text-align: left; color: #fff;
  background: linear-gradient(135deg, #ff4d6d 0%, #ff7a59 45%, #7c5cff 130%); box-shadow: 0 16px 40px rgba(255, 77, 109, .35); position: relative; overflow: hidden;
  transition: transform .15s;
}
.hero-play::before { content: ""; position: absolute; inset: 0; background: radial-gradient(300px 120px at 80% 0%, rgba(255,255,255,.35), transparent 70%); }
.hero-play:active { transform: scale(.98); }
.hero-play > div:last-child { display: flex; flex-direction: column; gap: 4px; position: relative; }
.hero-play strong { font-size: 1.5rem; font-weight: 900; }
.hero-play small { opacity: .92; font-weight: 600; }
.hero-cards { position: relative; width: 74px; height: 64px; flex: none; }
.hero-cards span { position: absolute; width: 44px; height: 54px; border-radius: 10px; background: rgba(255,255,255,.95); display: grid; place-items: center; font-size: 1.3rem; box-shadow: 0 6px 14px rgba(0,0,0,.2); animation: bob 3s ease-in-out infinite; }
.hc1 { left: 0; top: 6px; transform: rotate(-14deg); }
.hc2 { left: 16px; top: 2px; transform: rotate(-2deg); animation-delay: .4s !important; }
.hc3 { left: 32px; top: 8px; transform: rotate(12deg); animation-delay: .8s !important; }
@keyframes bob { 50% { translate: 0 -5px; } }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.mode-tile { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 14px 12px; text-align: left; display: flex; flex-direction: column; gap: 4px; min-height: 108px; transition: transform .15s, border-color .2s; }
.mode-tile:active { transform: scale(.97); }
.mode-tile:hover { border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.mode-ico { font-size: 1.7rem; margin-bottom: 2px; }
.mode-tile strong { font-size: .98rem; }
.mode-tile small { color: var(--muted); font-size: .78rem; line-height: 1.3; }
.mode-tile.glow { border-color: color-mix(in srgb, var(--amber) 60%, transparent); background: linear-gradient(160deg, color-mix(in srgb, var(--amber) 16%, var(--surface)), var(--surface)); }
.mode-tile.done { opacity: .85; }
.mode-tile.tool { background: linear-gradient(160deg, color-mix(in srgb, var(--green) 16%, var(--surface)), var(--surface)); border-color: color-mix(in srgb, var(--green) 40%, transparent); }

.train-tip { width: 100%; margin-top: 12px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px dashed color-mix(in srgb, var(--violet) 60%, transparent); background: color-mix(in srgb, var(--violet) 12%, var(--surface)); text-align: left; }
.train-tip > span:first-child { font-size: 1.6rem; }
.train-tip > span:nth-child(2) { display: flex; flex-direction: column; }
.train-tip small { color: var(--muted); }

/* ---------- Run (Inbox Rush etc.) ---------- */
.run, .lookalike { height: 100%; display: flex; flex-direction: column; padding: calc(10px + env(safe-area-inset-top)) 14px calc(12px + env(safe-area-inset-bottom)); gap: 8px; }
.run-top { display: flex; align-items: center; gap: 10px; }
.run-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.run-title strong { font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-progress { font-size: .78rem; color: var(--muted); }
.lives { display: flex; gap: 1px; font-size: 1rem; }
.lives .lost { filter: grayscale(1); opacity: .3; transform: scale(.85); transition: all .3s; }
.lives.inf { font-size: 1.2rem; color: var(--muted); }
.score { min-width: 64px; text-align: right; font-weight: 900; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.timer { height: 7px; border-radius: 99px; background: rgba(127,127,127,.2); overflow: hidden; flex: none; }
.timer.off { opacity: 0; }
.timer-fill { height: 100%; background: linear-gradient(90deg, var(--green), var(--amber)); transform-origin: left; border-radius: 99px; }
.timer.low .timer-fill { background: var(--red); animation: blink .5s infinite; }
@keyframes blink { 50% { opacity: .55; } }
.to-beat { text-align: center; font-size: .82rem; font-weight: 700; color: var(--amber); }
.combo-chip { align-self: center; font-weight: 800; font-size: .85rem; padding: 4px 12px; border-radius: 99px; background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber); opacity: 0; transform: scale(.8); transition: all .25s var(--spring); height: 26px; }
.combo-chip.show { opacity: 1; transform: scale(1); }
.combo-chip.hot { background: linear-gradient(90deg, var(--red), var(--amber)); color: #fff; animation: hot 1s infinite; }
@keyframes hot { 50% { transform: scale(1.06); } }

.stage { position: relative; flex: 1; min-height: 240px; perspective: 900px; }
.ghost { position: absolute; inset: 0; border-radius: 26px; background: var(--card); border: 1px solid var(--border); }
.ghost.g1 { transform: translateY(10px) scale(.95); opacity: .55; }
.ghost.g2 { transform: translateY(20px) scale(.9); opacity: .28; }
.swipe-card { position: absolute; inset: 0; z-index: 2; --drag: 0; will-change: transform; cursor: grab; transition: transform .45s var(--spring), opacity .3s; user-select: none; -webkit-user-select: none; }
.swipe-card.enter { transform: translateY(40px) scale(.94); opacity: 0; }
.swipe-card.dragging { cursor: grabbing; }
.swipe-card .msg-card { height: 100%; box-shadow: var(--shadow); }
.swipe-card::before, .swipe-card::after { content: ""; position: absolute; inset: 0; border-radius: 26px; pointer-events: none; z-index: 4; }
.swipe-card::before { box-shadow: inset 0 0 0 4px var(--red), inset 0 0 60px color-mix(in srgb, var(--red) 25%, transparent); opacity: calc(var(--drag) * -1.5); }
.swipe-card::after { box-shadow: inset 0 0 0 4px var(--green), inset 0 0 60px color-mix(in srgb, var(--green) 25%, transparent); opacity: calc(var(--drag) * 1.5); }
.swipe-label { position: absolute; top: 18px; z-index: 5; font-weight: 900; font-size: 1.3rem; padding: 6px 14px; border-radius: 12px; border: 3px solid; pointer-events: none; letter-spacing: .04em; background: var(--card); }
.swipe-label.l { right: 16px; color: var(--red); transform: rotate(10deg); opacity: calc(var(--drag) * -1.6); }
.swipe-label.r { left: 16px; color: var(--green); transform: rotate(-10deg); opacity: calc(var(--drag) * 1.6); }
.run-hint { text-align: center; font-size: .8rem; color: var(--muted); transition: opacity .4s; }
.run-hint.dim { opacity: .55; }
.controls { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.big-choice { border: 0; border-radius: 20px; min-height: 60px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 1.12rem; font-weight: 900; color: #fff; transition: transform .12s; }
.big-choice span { font-size: 1.3rem; }
.big-choice.scam { background: linear-gradient(135deg, #ff4d6d, #e8304f); box-shadow: 0 10px 24px rgba(255, 77, 109, .35); }
.big-choice.legit { background: linear-gradient(135deg, #22c58b, #0f9d6b); box-shadow: 0 10px 24px rgba(34, 197, 139, .3); }
.big-choice:active { transform: scale(.95); }
.round-btn { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); font-size: 1.2rem; }
.round-btn:disabled { opacity: .35; }
.kbd-hint { text-align: center; font-size: .72rem; color: var(--muted); opacity: .7; }
@media (pointer: coarse) { .kbd-hint { display: none; } }

/* ---------- Message card (phone app look) ---------- */
.msg-card { display: flex; flex-direction: column; border-radius: 26px; background: var(--card); border: 1px solid var(--border); overflow: hidden; color: var(--text); }
.mc-app { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--card-head); font-size: .8rem; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--border); flex: none; }
.mc-app-icon { font-size: 1rem; }
.mc-time { margin-left: auto; font-weight: 500; }
.mc-scroll { flex: 1; overflow-y: auto; padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.mc-ctx { font-size: .85rem; line-height: 1.4; padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--blue) 14%, transparent); border: 1px solid color-mix(in srgb, var(--blue) 30%, transparent); color: var(--text); }
.mc-sender { display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 1rem; color: #fff; background: linear-gradient(135deg, hsl(var(--h, 260) 70% 58%), hsl(calc(var(--h, 260) + 40) 70% 45%)); }
.mc-sender-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mc-from { font-weight: 800; font-size: 1.02rem; word-break: break-word; }
.mc-addr { font-size: .84rem; color: var(--muted); word-break: break-all; font-family: var(--mono); }
.mc-subject { font-weight: 800; font-size: 1.05rem; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.mc-body { display: flex; flex-direction: column; gap: 8px; font-size: 1rem; line-height: 1.5; }
.bubble { align-self: flex-start; max-width: 88%; padding: 10px 14px; border-radius: 20px 20px 20px 6px; background: var(--bubble); word-break: break-word; }
.bubble.me { align-self: flex-end; border-radius: 20px 20px 6px 20px; background: var(--violet); color: #fff; }
.em-line { margin: 0; word-break: break-word; }
.linkish { color: var(--link); text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.listing { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: var(--surface2); }
.listing-img { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: rgba(127,127,127,.18); font-size: 1.3rem; }
.listing span:last-child { display: flex; flex-direction: column; }
.listing small { color: var(--muted); }

/* voicemail */
.vm-player { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--surface2); }
.vm-play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--green); color: #fff; font-size: 1rem; flex: none; }
.vm-wave { flex: 1; height: 34px; display: flex; align-items: center; gap: 2px; }
.vm-wave i { flex: 1; background: color-mix(in srgb, var(--muted) 70%, transparent); border-radius: 2px; min-height: 3px; }
.vm-label { font-size: .72rem; font-weight: 800; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.vm-line { margin: 0; font-style: italic; }

/* QR poster */
.qr-poster { align-self: center; width: min(100%, 300px); padding: 16px; border-radius: 6px; background: #fff7d6; color: #2a2100; text-align: center; box-shadow: 0 10px 24px rgba(0,0,0,.25); transform: rotate(-1.2deg); position: relative; }
.qr-poster::before { content: ""; position: absolute; top: -8px; left: 50%; width: 70px; height: 18px; margin-left: -35px; background: rgba(200,200,200,.6); transform: rotate(2deg); }
.qr-title { font-weight: 900; font-size: 1.12rem; margin-bottom: 4px; }
.qr-line { margin: 4px 0; font-size: .92rem; }
.qr-code { width: 140px; height: 140px; margin: 10px auto 4px; color: var(--qr-fg); }
.qr-svg { width: 100%; height: 100%; display: block; }
.qr-preview { padding: 10px 12px; border-radius: 14px; background: var(--surface2); display: flex; flex-direction: column; gap: 4px; }
.qr-preview small { color: var(--muted); }
.qr-url { font-family: var(--mono); font-size: .9rem; word-break: break-all; }

/* Flag Hunt words */
.w { border-radius: 4px; cursor: pointer; transition: background .15s, box-shadow .15s; }
.swipe-card .w:hover { background: rgba(127,127,127,.14); }
.w.marked { background: var(--mark); box-shadow: 0 0 0 2px var(--mark); color: inherit; }
.bubble.me .w.marked { color: #1c1533; }

/* Reveal highlights */
.hl { color: inherit; border-radius: 4px; padding: 0 1px; }
.hl-red { background: color-mix(in srgb, var(--red) 24%, transparent); box-shadow: inset 0 -2px 0 var(--red); }
.hl-green { background: color-mix(in srgb, var(--green) 22%, transparent); box-shadow: inset 0 -2px 0 var(--green); }
.bubble.me .hl-red, .bubble.me .hl-green { color: #fff; }

/* Stamp + flashes */
.stamp { position: absolute; left: 50%; top: 42%; z-index: 30; pointer-events: none; font-weight: 900; font-size: 2.6rem; letter-spacing: .06em; padding: 6px 20px; border: 6px solid; border-radius: 14px; transform: translate(-50%, -50%) rotate(-14deg); animation: stamp .45s var(--spring) both; background: color-mix(in srgb, var(--card) 70%, transparent); text-shadow: 0 2px 0 rgba(0,0,0,.08); }
.stamp-scam { color: var(--red); }
.stamp-legit { color: var(--green); }
.stamp-timeout { color: var(--amber); }
@keyframes stamp { from { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(2.4); } 60% { opacity: 1; } to { transform: translate(-50%, -50%) rotate(-14deg) scale(1); } }
.flash { position: absolute; inset: 0; z-index: 25; pointer-events: none; animation: flash .5s ease-out forwards; }
.flash-good { background: radial-gradient(circle at 50% 40%, rgba(34,197,139,.28), transparent 70%); }
.flash-bad { background: radial-gradient(circle at 50% 40%, rgba(255,77,109,.35), transparent 70%); }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.shake { animation: shake .45s; }
@keyframes shake { 15% { transform: translateX(-9px); } 30% { transform: translateX(8px); } 45% { transform: translateX(-6px); } 60% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.float-text { position: absolute; z-index: 60; pointer-events: none; font-weight: 900; font-size: 1.4rem; transform: translate(-50%, 0); animation: floatUp 1.1s ease-out forwards; text-shadow: 0 2px 10px rgba(0,0,0,.35); }
.float-text.good { color: var(--green); }
.float-text.bad { color: var(--red); }
@keyframes floatUp { to { opacity: 0; transform: translate(-50%, -60px) scale(1.2); } }
.fx-canvas { position: absolute; inset: 0; z-index: 70; pointer-events: none; }

/* ---------- Overlays: modal, sheet, toasts, badge pop ---------- */
.overlay { position: absolute; inset: 0; z-index: 50; pointer-events: none; }
.modal-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(8, 5, 20, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity .25s; pointer-events: auto; }
.modal-wrap.in { opacity: 1; }
.modal { width: 100%; max-width: 420px; max-height: 88%; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 20px; box-shadow: var(--shadow); transform: scale(.94) translateY(10px); transition: transform .3s var(--spring); }
.modal-wrap.in .modal { transform: none; }
.modal-title { font-size: 1.25rem; margin-bottom: 10px; }
.modal-body { margin: 0 0 6px; color: var(--muted); line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
.modal-wrap.as-sheet { align-items: flex-end; padding: 0; }
.modal-wrap.as-sheet .modal { max-width: none; border-radius: 26px 26px 0 0; max-height: 90%; transform: translateY(100%); transition: transform .38s var(--ease-out); padding-bottom: calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.modal-wrap.as-sheet.in .modal { transform: none; }
.modal.feedback { padding: 16px 16px 14px; }
.modal.feedback .modal-actions { position: sticky; bottom: -14px; margin: 12px -16px -14px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--surface) 30%); }
.modal.feedback .modal-actions .btn-primary { flex: 2; }

.fb-verdict { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; }
.fb-verdict.good { background: color-mix(in srgb, var(--green) 18%, transparent); }
.fb-verdict.bad { background: color-mix(in srgb, var(--red) 18%, transparent); }
.fb-verdict > div { display: flex; flex-direction: column; gap: 2px; }
.fb-verdict strong { font-size: 1.1rem; }
.fb-verdict small { color: var(--muted); font-weight: 600; }
.fb-icon { font-size: 1.9rem; }
.fb-card { margin: 12px 0; }
.fb-card .msg-card { border-radius: 18px; max-height: none; }
.fb-card .mc-scroll { overflow: visible; }
.fb-sub { font-size: 1rem; margin: 14px 0 8px; }
.flag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.flag-item { display: flex; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface2); border-left: 4px solid var(--red); }
.flag-item.green { border-left-color: var(--green); }
.flag-ico { font-size: 1.3rem; }
.flag-item strong { display: block; font-size: .95rem; }
.flag-item q { display: block; font-size: .85rem; color: var(--muted); font-style: italic; margin: 2px 0; word-break: break-word; }
.flag-item p { margin: 2px 0 0; font-size: .88rem; color: var(--text); opacity: .9; }
.lesson { display: flex; gap: 10px; margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--amber) 15%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); }
.lesson p { margin: 0; font-weight: 600; }

.toasts { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { max-width: 90%; display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--border); box-shadow: var(--shadow); font-weight: 600; font-size: .92rem; opacity: 0; transform: translateY(-14px); transition: all .3s var(--spring); }
.toast.in { opacity: 1; transform: none; }

.badge-pop { position: absolute; z-index: 95; top: calc(12px + env(safe-area-inset-top)); left: 50%; width: min(92%, 380px); display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 20px; background: linear-gradient(135deg, #2b1f5c, #4b1740); color: #fff; box-shadow: 0 20px 50px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.12); transform: translate(-50%, -140%); transition: transform .5s var(--spring); }
.badge-pop.in { transform: translate(-50%, 0); }
.badge-pop-medal { width: 58px; height: 58px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 1.9rem; background: radial-gradient(circle at 35% 30%, #fff3b0, #ffb020 60%, #c77800); box-shadow: 0 0 0 4px rgba(255,255,255,.15), 0 0 24px rgba(255,176,32,.6); animation: medal 1s var(--spring); }
.level-pop .badge-pop-medal { background: radial-gradient(circle at 35% 30%, #d9ccff, #7c5cff 60%, #4a2fc0); }
@keyframes medal { from { transform: scale(0) rotate(-120deg); } }
.badge-pop-text { display: flex; flex-direction: column; gap: 2px; }
.badge-pop-text small { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #ffd166; }
.badge-pop-text strong { font-size: 1.1rem; }
.badge-pop-text span { font-size: .85rem; opacity: .85; }

/* ---------- Results ---------- */
.results { padding: calc(20px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.results-hero { text-align: center; padding: 18px 12px; border-radius: 26px; background: radial-gradient(400px 200px at 50% 0%, color-mix(in srgb, var(--red) 35%, transparent), transparent), var(--surface); border: 1px solid var(--border); }
.results-emoji { font-size: 3.2rem; animation: pop .6s var(--spring); }
@keyframes pop { from { transform: scale(0); } }
.results-hero h1 { font-size: 1.5rem; margin: 6px 0; }
.big-score { display: flex; flex-direction: column; align-items: center; margin: 6px 0; }
.big-score span { font-size: 3.2rem; font-weight: 900; line-height: 1; background: linear-gradient(180deg, var(--text), var(--red)); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.big-score small { color: var(--muted); font-weight: 700; }
.vs { font-weight: 700; color: var(--amber); margin: 6px 0 0; }
.acc { color: var(--muted); margin: 6px 0 0; font-weight: 600; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); text-align: center; }
.tile-ico { font-size: 1.3rem; }
.tile strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.tile small { color: var(--muted); font-size: .75rem; font-weight: 600; }
.review { border-radius: 16px; background: var(--surface); border: 1px solid var(--border); padding: 12px 14px; }
.review summary { font-weight: 700; cursor: pointer; }
.review ul { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 10px; }
.review li p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.result-actions { display: flex; flex-direction: column; gap: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-preview { width: 100%; border-radius: 16px; display: block; box-shadow: var(--shadow); }
.link-input { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface2); font-family: var(--mono); font-size: .82rem; }

/* ---------- Story ---------- */
.star-total { font-weight: 800; color: var(--amber); margin-bottom: 12px; }
.case-list { display: flex; flex-direction: column; gap: 10px; }
.case-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); text-align: left; transition: transform .15s; }
.case-card:active { transform: scale(.98); }
.case-card.done { background: linear-gradient(135deg, color-mix(in srgb, var(--green) 12%, var(--surface)), var(--surface)); }
.case-card.locked { opacity: .55; cursor: not-allowed; }
.case-num { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 1.7rem; background: var(--surface2); flex: none; }
.case-info { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.case-info small:first-child { font-size: .7rem; font-weight: 800; letter-spacing: .08em; color: var(--red); }
.case-info strong { font-size: 1.05rem; }
.stars { display: flex; gap: 2px; color: rgba(127,127,127,.4); font-size: 1rem; }
.stars .on { color: var(--amber); text-shadow: 0 0 8px rgba(255,176,32,.5); }
.stars.big { justify-content: center; font-size: 2rem; margin: 6px 0; }
.chapter-hero { text-align: center; margin: 4px 0 14px; }
.chapter-icon { font-size: 3.4rem; animation: pop .6s var(--spring); }
.chapter-hero h2 { font-size: 1.5rem; margin-top: 6px; }
.chapter-steps { padding-left: 20px; line-height: 1.6; margin: 0 0 14px; }
.star-rules { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 16px; }
.star-rules span { font-size: .78rem; font-weight: 700; padding: 5px 10px; border-radius: 99px; background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }

/* Boss */
.boss { height: 100%; display: flex; flex-direction: column; padding: calc(10px + env(safe-area-inset-top)) 0 0; }
.boss-top { display: flex; align-items: center; gap: 10px; padding: 0 14px 10px; }
.boss-title { flex: 1; display: flex; flex-direction: column; }
.boss-title small { font-size: .7rem; font-weight: 800; letter-spacing: .08em; color: var(--red); }
.loss-chip { font-weight: 800; font-size: .82rem; padding: 6px 10px; border-radius: 99px; background: var(--surface2); white-space: nowrap; }
.loss-chip.hit { background: color-mix(in srgb, var(--red) 25%, transparent); color: var(--red); animation: pop .4s var(--spring); }
.chat-head, .call-head { margin: 0 14px; padding: 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.chat-head { display: flex; align-items: center; gap: 12px; }
.chat-head > div:last-child { display: flex; flex-direction: column; }
.chat-head small, .caller small { color: var(--muted); font-size: .8rem; }
.call-head { background: linear-gradient(160deg, #1d3b2f, #1a1733); color: #fff; border: 0; }
:root[data-contrast] .call-head { background: #000; border: 2px solid #fff; }
.caller { display: flex; align-items: center; gap: 14px; }
.caller > div:last-child { display: flex; flex-direction: column; }
.caller small { color: rgba(255,255,255,.75); }
.caller-avatar { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; background: rgba(255,255,255,.12); position: relative; }
.caller-avatar::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(34,197,139,.7); animation: ring 1.6s infinite; }
@keyframes ring { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
.pressure { margin-top: 10px; }
.pressure-label { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 700; margin-bottom: 4px; }
.meter { height: 10px; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.meter-fill { height: 100%; transform-origin: left; transform: scaleX(0); transition: transform .8s var(--ease-out), background .5s; border-radius: 99px; }
.boss-feed { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.bb { max-width: 86%; padding: 10px 14px; border-radius: 18px; line-height: 1.45; animation: bubbleIn .3s var(--spring); word-break: break-word; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.bb.them { align-self: flex-start; background: var(--bubble); border-bottom-left-radius: 6px; }
.bb.me { align-self: flex-end; background: var(--violet); color: #fff; border-bottom-right-radius: 6px; }
.bb.sys { align-self: center; max-width: 94%; background: transparent; border: 1px dashed var(--border); color: var(--muted); font-size: .86rem; text-align: center; }
.bb.coach { align-self: stretch; max-width: none; font-size: .88rem; border-radius: 14px; }
.bb.coach.good { background: color-mix(in srgb, var(--green) 16%, transparent); }
.bb.coach.bad { background: color-mix(in srgb, var(--red) 16%, transparent); }
.bb.coach.meh { background: color-mix(in srgb, var(--amber) 14%, transparent); }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: dot 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { transform: translateY(-4px); opacity: .5; } }
.day-sep { align-self: center; font-size: .75rem; font-weight: 800; letter-spacing: .08em; color: var(--muted); padding: 4px 12px; border-radius: 99px; background: var(--surface2); margin: 6px 0; text-transform: uppercase; }
.boss-choices { padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; background: var(--bg2); border-top: 1px solid var(--border); max-height: 62%; overflow-y: auto; }
.boss-choices:empty { display: none; }
.choose-label { font-size: .75rem; font-weight: 800; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.choice { display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); line-height: 1.35; animation: bubbleIn .3s var(--spring) both; transition: transform .12s, border-color .2s; }
.choice:nth-child(3) { animation-delay: .06s; } .choice:nth-child(4) { animation-delay: .12s; }
.choice:hover { border-color: var(--violet); }
.choice:active { transform: scale(.98); }
.choice-k { width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center; font-size: .8rem; font-weight: 800; background: var(--surface2); color: var(--muted); }
.ending { text-align: center; padding: 18px 14px; border-radius: 22px; background: var(--surface); border: 2px solid var(--border); animation: pop .5s var(--spring); }
.ending.safe { border-color: var(--green); }
.ending.partial { border-color: var(--amber); }
.ending.lost { border-color: var(--red); }
.ending-icon { font-size: 3rem; }
.ending h2 { font-size: 1.35rem; margin: 4px 0; }
.ending-loss { font-weight: 800; color: var(--amber); }
.ending.safe .ending-loss { color: var(--green); }
.ending.lost .ending-loss { color: var(--red); }
.ending p { color: var(--muted); }
.unlock-note { color: var(--green) !important; font-weight: 800; }
.ending-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

/* ---------- Lookalike Lightning ---------- */
.ll-time { font-weight: 900; font-size: 1.2rem; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.ll-time.low { color: var(--red); animation: blink .5s infinite; }
.ll-prompt { margin-top: 12px; padding: 18px; border-radius: 22px; background: linear-gradient(135deg, color-mix(in srgb, var(--violet) 30%, var(--surface)), var(--surface)); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; text-align: center; font-weight: 700; font-size: 1.05rem; }
.ll-brand { font-size: 1.6rem; font-weight: 900; }
.ll-opts { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.ll-opts.pop .ll-opt { animation: bubbleIn .3s var(--spring) both; }
.ll-opts.pop .ll-opt:nth-child(2) { animation-delay: .04s; } .ll-opts.pop .ll-opt:nth-child(3) { animation-delay: .08s; } .ll-opts.pop .ll-opt:nth-child(4) { animation-delay: .12s; }
.ll-opt { display: flex; align-items: center; gap: 12px; text-align: left; padding: 16px 14px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); transition: transform .12s, border-color .2s, background .2s; }
.ll-opt code { font-size: 1rem; word-break: break-all; }
.ll-opt:active { transform: scale(.98); }
.ll-opt.right { border-color: var(--green); background: color-mix(in srgb, var(--green) 16%, var(--surface)); }
.ll-opt.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 16%, var(--surface)); }
.ll-why { min-height: 48px; margin-top: 10px; font-weight: 600; text-align: center; font-size: .92rem; }
.ll-why.good { color: var(--green); }
.ll-why.bad { color: var(--red); }

/* ---------- Check a Message ---------- */
.check-input { width: 100%; resize: vertical; min-height: 130px; padding: 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); line-height: 1.5; }
.check-actions { display: flex; gap: 10px; margin-top: 10px; }
.check-actions .btn-primary { flex: 1; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.examples small { color: var(--muted); width: 100%; font-weight: 700; }
.check-out { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.check-out:empty { display: none; }
.check-out h3 { font-size: 1rem; margin-top: 6px; }
.risk-head { display: flex; align-items: center; gap: 16px; padding: 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); }
.risk-head > div:last-child { display: flex; flex-direction: column; gap: 2px; }
.risk-head small { font-size: .7rem; font-weight: 800; letter-spacing: .08em; color: var(--muted); }
.risk-head p { margin: 2px 0 0; font-size: .86rem; }
.risk-label { font-size: 1.3rem; }
.risk-label.low { color: var(--green); } .risk-label.medium { color: var(--amber); } .risk-label.high, .risk-label.very-high { color: var(--red); }
.gauge { position: relative; width: 96px; height: 96px; flex: none; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.g-bg { fill: none; stroke: rgba(127,127,127,.2); stroke-width: 12; }
.g-fg { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease-out); }
.gauge.low .g-fg { stroke: var(--green); } .gauge.medium .g-fg { stroke: var(--amber); } .gauge.high .g-fg, .gauge.very-high .g-fg { stroke: var(--red); }
.gauge-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-num strong { font-size: 1.7rem; line-height: 1; }
.gauge-num small { font-size: .7rem; color: var(--muted); }
.check-hl { padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); line-height: 1.6; word-break: break-word; }
.af { color: inherit; border-radius: 4px; padding: 0 2px; background: color-mix(in srgb, var(--red) 24%, transparent); box-shadow: inset 0 -2px 0 var(--red); }
.af-urgency, .af-tone { background: color-mix(in srgb, var(--amber) 26%, transparent); box-shadow: inset 0 -2px 0 var(--amber); }
.link-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.link-list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface2); }
.link-list span { font-size: .84rem; color: var(--muted); }
.plain { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.5; }
.todo { padding: 14px 16px; border-radius: 18px; background: color-mix(in srgb, var(--green) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--green) 35%, transparent); }
.todo ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.55; }
.todo li { margin-bottom: 4px; }
.disclaimer { font-size: .84rem; color: var(--muted); padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--border); margin: 0; line-height: 1.5; }

/* ---------- Field guide ---------- */
.guide-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.guide-progress .xpbar { flex: 1; }
.guide-progress small { color: var(--muted); font-weight: 700; white-space: nowrap; }
.search { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 12px; }
.guide-list { display: flex; flex-direction: column; gap: 8px; }
.guide-entry { border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.guide-entry.locked { display: flex; align-items: center; gap: 12px; padding: 12px 14px; opacity: .55; }
.guide-entry.locked > div { display: flex; flex-direction: column; }
.guide-entry.locked small { color: var(--muted); }
.guide-entry summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.guide-entry summary::-webkit-details-marker { display: none; }
.guide-entry summary > div { display: flex; flex-direction: column; }
.guide-entry summary small { color: var(--muted); font-size: .8rem; }
.guide-entry[open] summary .chev { transform: rotate(90deg); }
.guide-entry .chev { transition: transform .2s; }
.g-ico { font-size: 1.6rem; width: 36px; text-align: center; }
.g-body { padding: 0 16px 14px; }
.g-body h4 { margin: 10px 0 4px; font-size: .92rem; }
.g-body p { margin: 0; color: var(--muted); }
.g-body ul { margin: 0; padding-left: 20px; line-height: 1.55; }
.g-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- Profile ---------- */
.profile-hero { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 22px; background: linear-gradient(135deg, color-mix(in srgb, var(--violet) 28%, var(--surface)), var(--surface)); border: 1px solid var(--border); margin-bottom: 12px; }
.profile-hero > div:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile-hero small { font-size: .72rem; font-weight: 700; letter-spacing: .05em; }
.iq-big { display: flex; flex-direction: column; align-items: center; padding: 8px 10px; border-radius: 16px; background: rgba(0,0,0,.18); }
.iq-big strong { font-size: 2rem; line-height: 1.1; color: var(--red); }
.profile .stat-tiles { margin-bottom: 12px; grid-template-columns: repeat(3, 1fr); }
.cat-bars { display: flex; flex-direction: column; gap: 10px; }
.cat-bar.unseen { opacity: .45; }
.cb-label { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; font-weight: 600; margin-bottom: 4px; }
.cb-label small { color: var(--muted); white-space: nowrap; }
.cb-track { height: 8px; border-radius: 99px; background: rgba(127,127,127,.2); overflow: hidden; }
.cb-fill { height: 100%; transform-origin: left; border-radius: 99px; transition: transform .6s var(--ease-out); }
.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); text-align: center; min-height: 86px; }
.badge small { font-size: .66rem; line-height: 1.2; color: var(--muted); font-weight: 600; }
.badge-ico { font-size: 1.6rem; filter: grayscale(1); opacity: .45; }
.badge.has { background: linear-gradient(160deg, color-mix(in srgb, var(--amber) 18%, var(--surface)), var(--surface)); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.badge.has .badge-ico { filter: none; opacity: 1; }
.badge.has small { color: var(--text); }

/* ---------- Settings ---------- */
.set-group { border-radius: 18px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: 0; }
.set-row.col { flex-direction: column; align-items: stretch; }
.set-label { display: flex; flex-direction: column; gap: 2px; font-weight: 600; flex: 1; }
.set-label small { color: var(--muted); font-weight: 500; font-size: .8rem; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 2; }
.switch-ui { position: absolute; inset: 0; border-radius: 99px; background: rgba(127,127,127,.35); transition: background .2s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: transform .25s var(--spring); }
.switch input:checked + .switch-ui { background: var(--green); }
.switch input:checked + .switch-ui::after { transform: translateX(22px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--focus); outline-offset: 2px; }
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface2); }
.segmented button { flex: 1; border: 0; background: none; padding: 9px 6px; border-radius: 10px; font-weight: 700; color: var(--muted); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.slider-row input[type="range"] { width: 46%; accent-color: var(--red); }
.set-link { display: block; width: 100%; text-align: left; padding: 14px; border: 0; border-bottom: 1px solid var(--border); background: none; font-weight: 600; text-decoration: none; color: var(--text); }
.set-link:last-child { border-bottom: 0; }
.set-link.danger { color: var(--red); }

/* ---------- Onboarding ---------- */
.onboarding { position: absolute; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 30px 26px calc(30px + env(safe-area-inset-bottom)); text-align: center; background: radial-gradient(500px 400px at 50% 20%, color-mix(in srgb, var(--violet) 40%, transparent), transparent), radial-gradient(500px 400px at 50% 100%, color-mix(in srgb, var(--red) 30%, transparent), transparent), var(--bg); opacity: 0; transition: opacity .3s; }
.onboarding.show { opacity: 1; }
.ob-skip { position: absolute; top: calc(16px + env(safe-area-inset-top)); right: 16px; border: 0; background: rgba(127,127,127,.18); padding: 8px 14px; border-radius: 99px; font-weight: 700; color: var(--muted); }
.ob-body { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 360px; }
.ob-body.in { animation: screenIn .4s var(--ease-out); }
.ob-body h2 { font-size: 1.6rem; font-weight: 900; }
.ob-body p { margin: 0; color: var(--muted); font-size: 1.02rem; }
.ob-art { height: 200px; width: 100%; display: flex; align-items: center; justify-content: center; position: relative; }
.ob-card { width: 220px; padding: 16px; border-radius: 22px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; text-align: left; font-size: .92rem; position: relative; }
.ob-art.swipe .ob-card { animation: obSwipe 3s ease-in-out infinite; }
@keyframes obSwipe { 0%, 100% { transform: none; } 25% { transform: translateX(-46px) rotate(-8deg); } 50% { transform: none; } 75% { transform: translateX(46px) rotate(8deg); } }
.ob-l, .ob-r { position: absolute; font-weight: 900; font-size: .9rem; padding: 4px 8px; border-radius: 8px; border: 2px solid; }
.ob-l { left: 0; color: var(--red); } .ob-r { right: 0; color: var(--green); }
.ob-art.hunt mark { background: var(--mark); color: inherit; border-radius: 4px; padding: 0 2px; animation: markIn 2.4s infinite; }
@keyframes markIn { 0%, 20% { background: transparent; } 40%, 100% { background: var(--mark); } }
.ob-finger { position: absolute; right: 10px; bottom: -14px; font-style: normal; font-size: 2rem; animation: tap 1.2s infinite; }
@keyframes tap { 50% { transform: translateY(-8px) scale(.9); } }
.ob-art.learn span { font-size: 3.2rem; margin: 0 8px; animation: bob 2.4s ease-in-out infinite; }
.ob-art.learn span:nth-child(2) { animation-delay: .3s; } .ob-art.learn span:nth-child(3) { animation-delay: .6s; }
.ob-dots { display: flex; gap: 8px; }
.ob-dots span { width: 8px; height: 8px; border-radius: 99px; background: rgba(127,127,127,.4); transition: all .3s; }
.ob-dots span.on { width: 26px; background: var(--red); }
.onboarding .btn-lg { width: min(100%, 320px); }

/* ---------- Large text tweaks ---------- */
:root[data-large] .mode-grid { grid-template-columns: 1fr; }
:root[data-large] .mode-tile { min-height: 0; }
:root[data-large] .badge-grid { grid-template-columns: repeat(3, 1fr); }
:root[data-large] .stat-tiles { grid-template-columns: repeat(2, 1fr); }
:root[data-large] .profile .stat-tiles { grid-template-columns: repeat(2, 1fr); }

/* ---------- High contrast tweaks ---------- */
:root[data-contrast] .msg-card, :root[data-contrast] .mode-tile, :root[data-contrast] .btn, :root[data-contrast] .tile { border-width: 2px; }
:root[data-contrast] .hl-red { background: transparent; box-shadow: none; outline: 2px solid var(--red); text-decoration: underline 3px var(--red); }
:root[data-contrast] .hl-green { background: transparent; box-shadow: none; outline: 2px solid var(--green); }
:root[data-contrast] .w.marked { background: var(--mark); color: #000; }
:root[data-contrast] .hero-play, :root[data-contrast] .btn-primary, :root[data-contrast] .iq-pill { background: var(--red); box-shadow: none; color: #000; }
:root[data-contrast] .big-choice.scam { background: var(--red); color: #000; box-shadow: none; }
:root[data-contrast] .big-choice.legit { background: var(--green); color: #000; box-shadow: none; }
:root[data-contrast] .logo h1 { color: var(--text); background: none; }
:root[data-contrast] .big-score span { color: var(--text); background: none; }

/* ---------- Reduced motion ---------- */
:root[data-reduced-motion] *, :root[data-reduced-motion] *::before, :root[data-reduced-motion] *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .05s !important; scroll-behavior: auto !important;
}

/* ---------- Small phones ---------- */
@media (max-height: 640px) {
  .run-hint, .kbd-hint { display: none; }
  .big-choice { min-height: 52px; }
  .stage { min-height: 200px; }
}
@media (max-width: 360px) {
  .mode-grid { gap: 8px; }
  .mode-tile { padding: 12px 10px; }
  .badge-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Polish pass ---------- */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }
.results .stat-tiles { grid-template-columns: repeat(4, 1fr); }
:root[data-large] .results .stat-tiles { grid-template-columns: repeat(2, 1fr); }
.profile .train-tip { margin: 0 0 14px; }

/* decorative app footers on message cards */
.mc-foot { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px calc(10px); border-top: 1px solid var(--border); background: var(--card-head); color: var(--muted); font-size: .85rem; }
.mc-foot.mail { justify-content: space-around; font-weight: 600; }
.cf-plus { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface2); font-size: 1.2rem; font-weight: 700; flex: none; }
.cf-input { flex: 1; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--border); background: var(--card); }
.cf-mic { flex: none; opacity: .7; }

/* onboarding art spacing */
.ob-art.swipe { align-items: flex-end; padding-bottom: 6px; }
.ob-art.swipe .ob-card { width: 210px; }
.ob-l, .ob-r { top: 6px; }

/* Lookalike: "how to read a link" helper */
.lookalike { gap: 6px; }
.ll-tip { margin-top: auto; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px dashed var(--border); text-align: center; }
.ll-tip small { font-size: .7rem; font-weight: 800; letter-spacing: .08em; color: var(--muted); }
.ll-url { font-family: var(--mono); font-size: 1.05rem; margin: 8px 0 6px; word-break: break-all; }
.ll-legend { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; font-size: .75rem; font-weight: 700; }
.ll-legend span { padding: 2px 8px; border-radius: 99px; background: var(--surface2); }
.u-dim { color: var(--muted); }
.u-sub { color: var(--blue); }
.u-own { color: var(--green); font-weight: 800; }
.mc-meta { align-self: center; font-size: .74rem; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
