/* Outsmart me — web. Mirrors the iOS AppTheme (parchment light / obsidian dark). */

:root {
  --bg: #F7F4EE;
  --surface: #FBF9F5;
  --card: #FFFFFF;
  --card-low: #F3F0E9;
  --on: #1B1A17;
  --on-variant: #5C574E;
  --outline: #8A8478;
  --outline-variant: #D6D0C4;
  --primary: #17181D;
  --on-primary: #FBF9F5;
  --secondary-container: #E6E1D7;
  --accent: #9A6208;
  --accent-vivid: #F59E0B;
  --on-accent: #1A1200;
  --success: #0E9F6E;
  --error: #D43F4F;
  --info: #0284C7;
  --hairline: rgba(0, 0, 0, 0.09);
  --ambient: rgba(255, 255, 255, 0.7);
  --shadow: rgba(0, 0, 0, 0.10);
  --glow: rgba(245, 158, 11, 0.15);
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, monospace;
  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px; --radius-xl: 16px; --radius-sheet: 28px;
  --col: 480px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0C10; --surface: #141416; --card: #1C1C1E; --card-low: #16181F;
    --on: #F4F4F5; --on-variant: #A1A1AA; --outline: #71717A; --outline-variant: #3A3A40;
    --primary: #F3F4F6; --on-primary: #0F1015; --secondary-container: #2C2C2E;
    --accent: #E6C387; --accent-vivid: #F59E0B; --on-accent: #1A1200;
    --success: #34D399; --error: #FB7185; --info: #38BDF8;
    --hairline: rgba(255, 255, 255, 0.08); --ambient: rgba(46, 38, 28, 0.6); --shadow: rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme="dark"] {
  --bg: #0B0C10; --surface: #141416; --card: #1C1C1E; --card-low: #16181F;
  --on: #F4F4F5; --on-variant: #A1A1AA; --outline: #71717A; --outline-variant: #3A3A40;
  --primary: #F3F4F6; --on-primary: #0F1015; --secondary-container: #2C2C2E;
  --accent: #E6C387; --accent-vivid: #F59E0B; --on-accent: #1A1200;
  --success: #34D399; --error: #FB7185; --info: #38BDF8;
  --hairline: rgba(255, 255, 255, 0.08); --ambient: rgba(46, 38, 28, 0.6); --shadow: rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--on);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:disabled { cursor: default; }
a { color: var(--accent); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

.app {
  min-height: 100dvh;
  max-width: var(--col);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  background:
    radial-gradient(circle at 50% 22%, var(--ambient) 0, transparent 460px),
    var(--bg);
}
@media (min-width: 640px) {
  :root { --col: 560px; }
  .app { border-left: 1px solid var(--hairline); border-right: 1px solid var(--hairline); }
}

/* Typography helpers */
.serif { font-family: var(--serif); }
.serif-xl { font-family: var(--serif); font-size: 30px; font-weight: 400; line-height: 1.25; letter-spacing: -0.01em; margin: 0; }
.serif-lg { font-family: var(--serif); font-size: 28px; font-weight: 400; margin: 0; letter-spacing: 0.01em; }
.serif-md { font-family: var(--serif); font-size: 22px; font-weight: 500; margin: 0; }
.eyebrow { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; }
.mono-small { font-family: var(--mono); font-size: 12px; letter-spacing: 0.03em; }
.mono-xs { font-family: var(--mono); font-size: 11px; letter-spacing: 0.02em; line-height: 1.5; }
.accent { color: var(--accent); }
.muted { color: var(--on-variant); }
.outline { color: var(--outline); }
.small { font-size: 14px; }
.center { text-align: center; }
p { margin: 0; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 12px 12px;
  background: linear-gradient(var(--bg) 0%, color-mix(in srgb, var(--bg) 94%, transparent) 70%, transparent 100%);
}
.topbar-title { text-align: center; min-width: 0; }
.topbar-title h1 { font-family: var(--serif); font-size: 24px; font-weight: 400; margin: 0; letter-spacing: 0.02em; white-space: nowrap; }
.topbar-right { display: flex; width: 88px; justify-content: flex-end; }
.topbar > .icon-btn:first-child { width: 88px; justify-content: flex-start; padding-left: 12px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--on-variant); border-radius: 50%; transition: transform .15s, background .15s; }
.icon-btn:hover { background: color-mix(in srgb, var(--on) 5%, transparent); }
.icon-btn:active { transform: scale(0.94); }

/* Main */
.main { flex: 1; display: flex; flex-direction: column; }
.view { flex: 1; display: flex; flex-direction: column; padding: 0 24px; }
.view-center { align-items: center; justify-content: center; text-align: center; gap: 20px; padding: 40px 24px; }
#view-play { justify-content: space-between; animation: rise .45s cubic-bezier(.2,.8,.3,1); }
@keyframes rise { from { opacity: 0; transform: translateY(16px);} to { opacity: 1; transform: none; } }
.play-top { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 40px; gap: 28px; flex: 1; justify-content: center; }
.play-bottom { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 24px 0 16px; }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px; border-radius: 999px;
  background: var(--card-low); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: 0 0 12px var(--glow);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--on-variant);
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .85; animation: pulse 2.4s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.riddle {
  font-family: var(--serif);
  font-size: 27px; line-height: 1.4; letter-spacing: -0.01em; font-weight: 400;
  max-width: 500px; white-space: pre-line;
}
.riddle.compact { font-size: 22px; line-height: 1.38; }

/* Card */
.card {
  width: 100%;
  background: linear-gradient(180deg, var(--card), var(--card-low));
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 18px -4px var(--shadow);
  padding: 18px;
  transition: border-color .2s;
}
.answer-card:focus-within { border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.answer-card #answer-format { margin-bottom: 8px; text-transform: uppercase; }
.answer-card #answer-format b { color: var(--on); font-weight: 500; text-transform: lowercase; }
#answer-form { margin-bottom: 8px; }
#answer-input {
  width: 100%; text-align: center; background: transparent; border: 0; outline: 0;
  font-family: var(--mono); font-size: 18px; color: var(--on); padding: 12px 8px;
}
#answer-input::placeholder { color: var(--outline); }
.rule { height: 1px; background: var(--outline-variant); transition: background .2s; }
.answer-card:focus-within .rule, .answer-card.has-text .rule { background: color-mix(in srgb, var(--accent) 80%, transparent); }
.answer-card.correct .rule { background: var(--success); }
.answer-card.incorrect .rule { background: var(--error); }
.answer-card.shake #answer-form { animation: shake .4s linear; }
@keyframes shake { 0%,100% { transform: translateX(0);} 25% { transform: translateX(7px);} 50% { transform: translateX(-7px);} 75% { transform: translateX(7px);} }
.feedback { font-family: var(--mono); font-size: 13px; text-align: center; margin-bottom: 10px; }
.feedback.error { color: var(--error); }
.actions { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.flex { flex: 1; }

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 16px; border-radius: 999px;
  background: var(--primary); color: var(--on-primary);
  font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  box-shadow: 0 6px 10px -2px color-mix(in srgb, var(--shadow) 60%, transparent);
  transition: transform .15s, opacity .15s; white-space: nowrap;
}
.btn-primary:active { transform: scale(0.97); opacity: .85; }
.btn-primary:disabled { background: var(--outline); opacity: .6; }
.btn-primary.tall { min-height: 56px; font-weight: 700; }
.btn-primary svg { stroke-width: 2.4; width: 16px; height: 16px; }
.wide { width: 100%; }
.badge { font-family: var(--mono); font-size: 11px; letter-spacing: 0; text-transform: none; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--on-primary) 12%, transparent); }
.btn-accent {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 16px; border-radius: 999px;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  transition: transform .15s;
}
.btn-accent:active { transform: scale(0.97); }
.btn-accent svg { width: 16px; height: 16px; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 24px; border-radius: 999px;
  background: var(--card-low); border: 1px solid var(--hairline); color: var(--on);
  font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  transition: transform .15s;
}
.btn-ghost:active { transform: scale(0.98); }
.btn-ghost svg { width: 16px; height: 16px; color: var(--on-variant); }
.btn-small {
  min-height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--secondary-container); border: 1px solid var(--hairline);
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.btn-small.danger { color: var(--error); }
.link-btn {
  min-height: 44px; padding: 0 16px;
  font-family: var(--mono); font-size: 12px; color: var(--on-variant);
  text-decoration: underline; text-decoration-color: var(--outline-variant); text-underline-offset: 4px;
}
.circle-btn {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--secondary-container) 60%, transparent);
  border: 1px solid var(--hairline); color: var(--on-variant);
  transition: transform .15s, background .15s, color .15s, border-color .15s;
}
.circle-btn:active { transform: scale(0.94); }
.circle-btn.primary { background: var(--primary); color: var(--on-primary); border: 0; box-shadow: 0 6px 10px -2px color-mix(in srgb, var(--shadow) 60%, transparent); }
.circle-btn.primary:disabled { background: var(--secondary-container); color: var(--outline); box-shadow: none; }
.circle-btn.selected-up { color: var(--success); border-color: var(--success); background: color-mix(in srgb, var(--success) 16%, transparent); transform: scale(1.08); }
.circle-btn.selected-down { color: var(--error); border-color: var(--error); background: color-mix(in srgb, var(--error) 16%, transparent); transform: scale(1.08); }
.circle-btn.selected-fav { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); transform: scale(1.08); }
.circle-btn.selected-fav svg { fill: currentColor; }

/* Bottom bar */
.bottombar {
  position: sticky; bottom: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--hairline);
  padding-bottom: env(safe-area-inset-bottom);
}
.timer-bar { height: 2px; background: color-mix(in srgb, var(--outline-variant) 30%, transparent); margin-top: -1px; }
.timer-fill { height: 100%; width: 0; background: var(--accent); transition: width 1s linear; }
.reveal-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 8px auto 6px; min-width: 96px; min-height: 64px; color: var(--outline); transition: transform .15s; }
.reveal-btn:active { transform: scale(0.95); }
.key-wrap { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; position: relative; }
.key-wrap svg { width: 24px; height: 24px; stroke-width: 1.7; position: relative; z-index: 1; }
.reveal-btn.active { color: var(--accent); }
.reveal-btn.active .key-wrap::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 16%, transparent); filter: blur(6px); }
.reveal-label { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase; color: var(--outline); }
.reveal-btn.active .reveal-label { color: color-mix(in srgb, var(--on) 85%, transparent); }
.reveal-timer { color: var(--outline); min-height: 14px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%);
  max-width: min(92vw, 420px); padding: 10px 24px; z-index: 50;
  background: color-mix(in srgb, var(--card) 97%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 22px; box-shadow: 0 6px 16px var(--shadow);
  font-family: var(--mono); font-size: 13px; text-align: center;
  animation: rise .25s;
}

/* Spinner / error */
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--outline-variant); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-icon { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); color: var(--accent); }
.error-icon svg { width: 30px; height: 30px; }

/* Completion */
.score-card { max-width: 320px; text-align: center; padding: 24px; }
.score { font-family: var(--serif); font-size: 56px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; margin-top: 6px; }

/* Sheets (dialogs) */
.sheet {
  width: 100%; max-width: var(--col); margin: auto auto 0;
  padding: 0; border: 0; color: var(--on);
  background: var(--surface);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  box-shadow: 0 -10px 40px var(--shadow);
  max-height: 92dvh; overflow: auto;
  animation: sheet-up .3s cubic-bezier(.2,.8,.3,1);
}
.sheet::backdrop { background: rgba(0,0,0,.45); backdrop-filter: blur(4px); }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) {
  .sheet { margin: auto; border-radius: var(--radius-sheet); max-width: 480px; max-height: 88vh; border: 1px solid var(--hairline); }
  .sheet.small { max-width: 400px; }
}
.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--on) 20%, transparent); margin: 10px auto 0; }
@media (min-width: 640px) { .sheet-handle { display: none; } }
.sheet-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 20px 14px; border-bottom: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent); position: sticky; top: 0; background: color-mix(in srgb, var(--surface) 96%, transparent); z-index: 2; }
.sheet-header > div:first-child { flex: 1; text-align: center; padding-left: 36px; }
.close-btn { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--secondary-container); border: 1px solid var(--hairline); color: var(--on-variant); }
.close-btn svg { width: 14px; height: 14px; stroke-width: 2.5; }
.sheet-body { padding: 24px 24px calc(32px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.sheet-body.center { align-items: center; text-align: center; }
.sheet-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--accent-vivid); background: color-mix(in srgb, var(--accent-vivid) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent-vivid) 20%, transparent); box-shadow: 0 0 12px color-mix(in srgb, var(--accent-vivid) 25%, transparent); margin-bottom: -4px; }
.sheet-icon svg { width: 16px; height: 16px; }
.stack { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.logo { border-radius: 18px; }
.rules { text-align: left; margin: 0; padding-left: 20px; color: var(--on-variant); font-size: 15px; display: flex; flex-direction: column; gap: 6px; }
.rules b { color: var(--on); font-weight: 600; }

/* Hint sheet */
.hint-quote { font-family: var(--serif); font-size: 20px; line-height: 1.4; padding: 24px; width: 100%; }
.timer-display { font-family: var(--mono); font-size: 40px; font-weight: 500; font-variant-numeric: tabular-nums; }
.hint-progress { width: 60%; height: 2px; background: color-mix(in srgb, var(--outline-variant) 30%, transparent); border-radius: 2px; overflow: hidden; }
.hint-progress div { height: 100%; background: var(--accent); }

/* Solution sheet */
.answer-display { font-family: var(--serif); font-size: 44px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; word-break: break-word; text-shadow: 0 4px 16px color-mix(in srgb, var(--on) 16%, transparent); padding: 0 8px; }
.answer-display.long { font-size: 26px; font-weight: 400; letter-spacing: 0; line-height: 1.3; }
.divider { width: 64px; height: 1px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--outline) 60%, transparent), transparent); }
.rating-row { display: flex; gap: 16px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pill-badge { font-family: var(--mono); font-size: 13px; color: var(--accent); padding: 7px 14px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.confetti { position: absolute; top: 0; left: 0; right: 0; height: 280px; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; left: 50%; top: 120px; width: 5px; height: 10px; border-radius: 2px; opacity: 0; animation: burst 1.3s ease-out forwards; }
@keyframes burst { 0% { opacity: .95; transform: translate(0,0) rotate(0); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); } }

/* Store */
.product {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px; border-radius: var(--radius-xl); position: relative;
  background: linear-gradient(180deg, var(--card), var(--card-low));
  border: 1px solid var(--hairline); box-shadow: 0 10px 18px -4px var(--shadow);
  text-align: left; width: 100%; transition: transform .15s;
}
.product:active { transform: scale(0.985); }
.product.featured { border-color: color-mix(in srgb, var(--accent-vivid) 40%, transparent); box-shadow: 0 0 14px color-mix(in srgb, var(--accent-vivid) 22%, transparent); background: linear-gradient(90deg, color-mix(in srgb, var(--accent-vivid) 12%, var(--card)), var(--card), color-mix(in srgb, var(--accent-vivid) 6%, var(--card-low))); margin-top: 4px; }
.product-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.product-icon { width: 44px; height: 44px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--on) 4%, transparent); border: 1px solid var(--hairline); color: color-mix(in srgb, var(--on) 80%, transparent); flex: none; }
.product.featured .product-icon { color: var(--accent); background: color-mix(in srgb, var(--accent-vivid) 15%, transparent); border-color: color-mix(in srgb, var(--accent-vivid) 30%, transparent); }
.product-name { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.product.featured .product-name { font-weight: 700; }
.product-sub { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--on-variant); margin-top: 3px; }
.product.featured .product-sub { color: color-mix(in srgb, var(--accent) 85%, transparent); }
.price { font-family: var(--mono); font-size: 14px; font-weight: 700; padding: 9px 14px; border-radius: var(--radius-lg); background: var(--primary); color: var(--on-primary); white-space: nowrap; }
.product.featured .price { background: var(--accent-vivid); color: var(--on-accent); }
.product.soon .price { background: var(--secondary-container); color: var(--on-variant); }
.best-value { position: absolute; top: -9px; right: 24px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; background: var(--accent-vivid); color: var(--on-accent); }
.banner { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: var(--radius-xl); background: color-mix(in srgb, var(--info) 10%, transparent); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); box-shadow: 0 0 14px color-mix(in srgb, var(--info) 18%, transparent); }
.banner-check { width: 24px; height: 24px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--info); background: color-mix(in srgb, var(--info) 20%, transparent); border: 1px solid color-mix(in srgb, var(--info) 40%, transparent); flex: none; }
.banner-check svg { width: 12px; height: 12px; stroke-width: 3; }
.banner-title { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--info); }
.banner-text { font-size: 14px; margin-top: 4px; color: color-mix(in srgb, var(--on) 90%, transparent); }
.store-note { max-width: 320px; margin: 0 auto; line-height: 1.6; }

/* History */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: linear-gradient(180deg, var(--card), var(--card-low)); border: 1px solid var(--hairline); border-radius: var(--radius-lg); padding: 12px 10px; text-align: center; }
.stat-value { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.1; }
.stat-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--on-variant); margin-top: 4px; }
.section-label { margin-top: 8px; }
.list { display: flex; flex-direction: column; border-radius: var(--radius-xl); border: 1px solid var(--hairline); background: var(--card); overflow: hidden; }
.list:empty::after { content: "No history yet. Solve your first riddle to build a record."; display: block; padding: 24px; text-align: center; font-family: var(--serif); color: var(--on-variant); }
.hist { display: flex; flex-direction: column; border-bottom: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent); }
.hist:last-child { border-bottom: 0; }
.hist-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; width: 100%; text-align: left; }
.hist-no { font-family: var(--serif); font-size: 18px; width: 64px; flex: none; }
.hist-text { flex: 1; min-width: 0; font-size: 14px; color: var(--on-variant); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--hairline); color: var(--on-variant); flex: none; }
.tag.solved { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.tag.revealed { color: var(--on-variant); }
.tag.latest { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.hist-star { color: var(--accent); flex: none; }
.hist-star svg { width: 14px; height: 14px; fill: currentColor; }
.hist-detail { padding: 0 16px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.hist-detail .q { font-family: var(--serif); font-size: 17px; line-height: 1.4; white-space: pre-line; }
.hist-detail .a { font-family: var(--mono); font-size: 13px; }
.hist-detail .a b { color: var(--accent); font-weight: 600; }
.hist-detail .explain { font-size: 13px; color: var(--on-variant); }

/* Settings */
.segmented { display: flex; background: var(--secondary-container); border-radius: 10px; padding: 3px; border: 1px solid var(--hairline); }
.segmented button { flex: 1; min-height: 34px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--on-variant); }
.segmented button.on { background: var(--card); color: var(--on); box-shadow: 0 1px 4px var(--shadow); }
.group { border-radius: var(--radius-xl); border: 1px solid var(--hairline); background: var(--card); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent); color: inherit; text-decoration: none; }
.row:last-child { border-bottom: 0; }
.row-text { flex: 1; min-width: 0; }
.row-title { font-size: 15px; font-weight: 600; }
.row-sub { font-size: 13px; color: var(--on-variant); margin-top: 2px; }
.chev { color: var(--outline); font-size: 22px; line-height: 1; }
.or { display: flex; align-items: center; gap: 12px; color: var(--outline); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
input[type="email"] { width: 100%; min-height: 48px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--outline-variant); background: var(--card); color: var(--on); font-family: var(--mono); font-size: 14px; outline: 0; }
input[type="email"]:focus { border-color: var(--accent); }

/* Focus: accent ring for keyboard users only. */
:focus { outline: none; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
#answer-input:focus-visible, input[type="email"]:focus-visible { outline: none; }
.text-input { width: 100%; min-height: 48px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--outline-variant); background: var(--card); color: var(--on); font-family: var(--mono); font-size: 14px; outline: 0; letter-spacing: .2em; }
.text-input:focus { border-color: var(--accent); }
