/* Affordly Engine — shared styles (all pages). Themes: Bone & Sea (default), Paper & Forest, Ink Night. */
/* ===== Affordly Engine themes (Bone & Sea is live; switch in Options) ===== */
:root, [data-theme="bone-sea"] {
  --font-sans: "Figtree", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Fraunces", ui-serif, Georgia, serif;
  --bg: #f6f4ef; --ink: #243038; --card: #ffffff;
  --primary: #2b5f56; --primary-ink: #f6f4ef;
  --secondary: #ebe8e1; --accent: #e3e0d8;
  --muted: #5c666c; --subtle: #8a9196;
  --line: rgb(36 48 56 / 0.12);
  --shadow: 0 0 0 1px rgb(36 48 56 / 0.08), 0 1px 2px rgb(36 48 56 / 0.04);
  --shadow-hover: 0 0 0 1px rgb(36 48 56 / 0.14), 0 2px 8px rgb(36 48 56 / 0.06);
  --overlay: rgb(36 48 56 / 0.45);
  --buy: #2b5f56; --wait: #8a6a3a; --skip: #a45a4a;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: light;
}
[data-theme="paper-forest"] {
  --bg: #f4efe4; --ink: #1e1a16; --card: #fffaf1;
  --primary: #1f4a3c; --primary-ink: #f4efe4;
  --secondary: #ece4d4; --accent: #e4dccb;
  --muted: #6b645a; --subtle: #8a8276;
  --line: rgb(30 26 22 / 0.12);
  --shadow: 0 0 0 1px rgb(30 26 22 / 0.08), 0 1px 2px rgb(30 26 22 / 0.04);
  --shadow-hover: 0 0 0 1px rgb(30 26 22 / 0.14), 0 2px 8px rgb(30 26 22 / 0.06);
  --overlay: rgb(30 26 22 / 0.45);
  --buy: #2f6b54; --wait: #8a6a3a; --skip: #a45a4a;
  color-scheme: light;
}
[data-theme="ink-night"] {
  --bg: #161412; --ink: #f3eee6; --card: #1e1c19;
  --primary: #6f8f6a; --primary-ink: #161412;
  --secondary: #25221e; --accent: #2e2a25;
  --muted: #a39b90; --subtle: #8a8278;
  --line: rgb(243 238 230 / 0.12);
  --shadow: 0 0 0 1px rgb(243 238 230 / 0.08);
  --shadow-hover: 0 0 0 1px rgb(243 238 230 / 0.16);
  --overlay: rgb(0 0 0 / 0.6);
  --buy: #7aa37a; --wait: #c4a06a; --skip: #c47a6c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-sans); background: var(--bg); color: var(--ink);
  line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
a { color: inherit; }
::selection { background: color-mix(in srgb, var(--primary) 20%, transparent); }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.display { font-family: var(--font-display); }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.page { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---- Header ---- */
.header {
  position: sticky; top: 0; z-index: 30; height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 24px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; border-radius: 12px; padding-right: 8px; min-width: 0; transition: opacity .15s; }
.brand:hover { opacity: .8; }
.mark {
  width: 32px; height: 32px; border-radius: 999px; flex: none; display: grid; place-items: center;
  background: var(--primary); color: var(--primary-ink); font-family: var(--font-display); font-size: 15px;
}
.word { font-family: var(--font-display); font-size: 20px; letter-spacing: -0.02em; white-space: nowrap; }
.tools { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted);
  position: relative; transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--secondary); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; border-radius: 999px; background: var(--primary); }

/* ---- Home: lead ---- */
main { flex: 1; width: 100%; }
.home { width: min(576px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 80px; }
.eyebrow { margin: 0; color: var(--primary); font-size: 14px; font-weight: 500; }
h1 {
  margin: 12px 0 0; font-family: var(--font-display); font-weight: 560;
  font-size: clamp(36px, 6vw, 48px); line-height: 1.05; letter-spacing: -0.03em; text-wrap: balance;
}
.sub { margin: 16px 0 0; color: var(--muted); font-size: 15px; text-wrap: pretty; }
.stagger > * { animation: rise .4s cubic-bezier(.22,1,.36,1) both; }
.stagger > *:nth-child(2) { animation-delay: 70ms; }
.stagger > *:nth-child(3) { animation-delay: 130ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }

/* ---- Category picker ---- */
.ask { margin-top: 40px; }
.cats { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.cat {
  min-height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border-radius: 16px; background: var(--secondary); padding: 12px 4px;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.cat:hover { background: var(--accent); }
.cat[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); }
.cat .num { display: none; }
.cat .lbl-long { display: none; }
.cat span { font-size: 12px; font-weight: 500; line-height: 1; }
.hint { margin: 24px 0 0; color: var(--subtle); font-size: 12px; text-align: center; }
.fine { margin: 40px 0 0; color: var(--subtle); font-size: 12px; }

/* ---- Fields ---- */
.fields { margin-top: 32px; }
.picked { margin: 0 0 18px; text-align: center; font-family: var(--font-display); font-size: 19px; line-height: 1.3; color: var(--ink); text-wrap: balance; }
.picked-cat { display: block; margin-bottom: 4px; font-family: var(--font-sans); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--primary); }
.stack { display: grid; gap: 16px; }
.label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
label.field, .field { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0.02em; }
.label-row .field { margin: 0; }
.input {
  width: 100%; height: 48px; border: 0; border-radius: 12px; background: var(--secondary);
  padding: 0 12px; font-size: 16px; outline: none; color: var(--ink);
}
.input::placeholder { color: var(--subtle); }
.input:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 40%, transparent); }
.input.bad { box-shadow: 0 0 0 2px color-mix(in srgb, var(--skip) 55%, transparent); }
.tabnum { font-variant-numeric: tabular-nums; }
.with-sym { position: relative; }
.with-sym .sym { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.with-sym .input { padding-left: 30px; }
.conv { margin: 6px 0 0; min-height: 16px; font-size: 12px; color: var(--subtle); }
.err { margin: 8px 0 0; min-height: 18px; font-size: 13px; color: var(--skip); }
.go {
  width: 100%; height: 48px; border-radius: 12px; background: var(--primary); color: var(--primary-ink);
  font-weight: 600; font-size: 16px; transition: opacity .15s;
}
.go:hover { opacity: .92; }
.chips { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 32px; padding: 0 10px; border-radius: 999px; font-size: 12px; color: var(--muted);
  box-shadow: var(--shadow); transition: color .15s, background-color .15s;
}
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--secondary); color: var(--ink); }

/* Currency toggle */
.cur { display: flex; border-radius: 999px; background: var(--secondary); padding: 2px; }
.cur button {
  height: 28px; min-width: 32px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--muted);
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.cur button:hover { color: var(--ink); }
.cur button[aria-checked="true"] { background: var(--primary); color: var(--primary-ink); }

/* Product suggestions */
.combo { position: relative; }
.sugg {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 4px 0;
  list-style: none; max-height: 300px; overflow-y: auto; border-radius: 12px; background: var(--card); box-shadow: var(--shadow-hover);
}
.sugg li[role=option] {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px; font-size: 14px; cursor: pointer;
}
.sugg li[role=option]:hover, .sugg li.active { background: var(--secondary); }
.sugg .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sugg .nm b { font-weight: 600; }
.sugg .tags { display: flex; gap: 8px; align-items: center; flex: none; }
.sugg .tag { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--subtle); }
.sugg .sugg-head { padding: 6px 12px 4px; font-size: 11px; color: var(--subtle); text-transform: uppercase; letter-spacing: .04em; }

/* ---- Layout: Index (two columns, numbered list) ---- */
body[data-layout="index"] .home { width: min(1024px, calc(100% - 32px)); display: grid; gap: 40px; }
body[data-layout="index"] .ask { margin-top: 0; }
body[data-layout="index"] .cats { grid-template-columns: 1fr; gap: 0; }
body[data-layout="index"] .cat {
  min-height: 48px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 0;
  border-radius: 0; background: none; border-bottom: 1px solid var(--line); text-align: left;
}
body[data-layout="index"] .cat:hover, body[data-layout="index"] .cat[aria-pressed="true"] { background: none; color: var(--primary); }
body[data-layout="index"] .cat .num { display: inline; width: 32px; font-family: var(--font-display); font-size: 14px; color: var(--subtle); font-variant-numeric: tabular-nums; }
body[data-layout="index"] .cat svg.i { width: 16px; height: 16px; }
body[data-layout="index"] .cat .lbl-long { display: inline; font-size: 14px; }
body[data-layout="index"] .cat .lbl-short { display: none; }
body[data-layout="index"] .hint, body[data-layout="index"] .picked { text-align: left; }
body[data-layout="index"] .fields { border-top: 1px solid var(--line); padding-top: 24px; }
@media (min-width: 1024px) {
  body[data-layout="index"] .home { grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); gap: 64px; align-items: start; padding-top: 64px; }
  body[data-layout="index"] .lead { position: sticky; top: 96px; }
  body[data-layout="index"] h1 { font-size: 60px; max-width: 32rem; }
}

/* ---- Layout: Stage (centred tiles — the live look) ---- */
body[data-layout="stage"] .lead { text-align: center; }
body[data-layout="stage"] .sub { max-width: 24rem; margin-left: auto; margin-right: auto; font-size: 14px; }
body[data-layout="stage"] .fine { text-align: center; }

/* ---- Layout: Default (tile card) ---- */
body[data-layout="classic"] .home { width: min(672px, calc(100% - 32px)); padding-top: 48px; }
body[data-layout="classic"] .ask { margin-top: 32px; background: var(--card); box-shadow: var(--shadow); border-radius: 16px; padding: 24px; }
body[data-layout="classic"] .cat { align-items: flex-start; min-height: 64px; padding: 10px 12px; border-radius: 12px; }
body[data-layout="classic"] .cat .lbl-long { display: inline; }
body[data-layout="classic"] .cat .lbl-short { display: none; }
body[data-layout="classic"] .picked { text-align: left; }
body[data-layout="classic"] .fields { margin-top: 20px; }

/* ---- Thread (answer view) ---- */
.thread { width: min(672px, calc(100% - 32px)); margin: 0 auto; padding: 16px 0 48px; display: flex; flex-direction: column; gap: 24px; }
.card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); }
.consult { padding: 12px 16px; }
.consult .k { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: .02em; color: var(--primary); }
.consult .p { margin: 4px 0 0; font-size: 16px; font-weight: 500; }
.consult .m { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.consult .m .sep { margin: 0 8px; color: var(--subtle); }
.think { margin: 0; font-size: 14px; background-image: linear-gradient(90deg, var(--muted) 0%, var(--ink) 45%, var(--muted) 100%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.8s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.advice { overflow: hidden; }
.advice .bar { height: 6px; background: var(--primary); }
.advice.buy .bar { background: var(--buy); } .advice.wait .bar { background: var(--wait); } .advice.skip .bar { background: var(--skip); }
.advice .body { padding: 24px; display: grid; gap: 20px; }
.advice .top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.verdict { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.verdict.buy { color: var(--buy); } .verdict.wait { color: var(--wait); } .verdict.skip { color: var(--skip); }
.ratio { margin: 0; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.advice h2 { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 22px; line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
.score { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.score b { font-family: var(--font-display); font-weight: 500; font-size: 22px; font-variant-numeric: tabular-nums; }
.score span { font-size: 13px; color: var(--muted); }
.note { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--secondary); font-size: 13px; color: var(--muted); }

/* Scorecard: verdict + ring, five meters, "In short" */
.advice { --vc: var(--primary); }
.advice.buy { --vc: var(--buy); } .advice.wait { --vc: var(--wait); } .advice.skip { --vc: var(--skip); }
.advice .head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.advice .head h2 { margin-top: 4px; }
.advice .head .ratio { margin-top: 6px; }
.ring { --p: 0; flex: none; width: 76px; height: 76px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--card) 80%, transparent 81%), conic-gradient(var(--vc) calc(var(--p) * 1%), var(--secondary) 0); }
.ring b { font-family: var(--font-display); font-weight: 500; font-size: 24px; line-height: 1; color: var(--vc); font-variant-numeric: tabular-nums; }
.ring small { font-size: 11px; color: var(--muted); }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 12px 16px; }
.meters .m { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; font-size: 13px; color: var(--muted); }
.meters .m b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.meters .m .meter { grid-column: 1 / -1; }
.meter { display: block; height: 6px; border-radius: 999px; background: var(--secondary); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--vc); }
.inshort { margin: 0; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5; color: var(--ink);
  background: color-mix(in srgb, var(--vc) 12%, transparent); }
.inshort strong { color: var(--vc); font-weight: 600; }
@media (max-width: 560px) { .ring { width: 64px; height: 64px; } .ring b { font-size: 20px; } }

/* Model report */
.report { font-size: 14px; line-height: 1.65; }
.report h3 { margin: 18px 0 6px; font-size: 15px; font-weight: 600; color: var(--primary); }
.report h3:first-child { margin-top: 0; }
.report p { margin: 0 0 8px; color: var(--muted); text-wrap: pretty; }
.report .sline { display: grid; grid-template-columns: auto auto minmax(0, 140px); align-items: center; gap: 10px; justify-content: start; margin: 12px 0 4px; color: var(--ink); font-weight: 500; }
.report .sline .meter { max-width: 160px; }
.report .sline b { font-weight: 600; font-variant-numeric: tabular-nums; }
.report .pill { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--vc); background: color-mix(in srgb, var(--vc) 12%, transparent); vertical-align: 1px; }
.report .pc { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 24px; }
.report .pc ul { gap: 10px; }
.report .pc li::before { content: none; }
.report .pc li svg.i { width: 16px; height: 16px; margin-top: 3px; stroke-width: 2.25; }
.report .pros li svg.i { color: var(--buy); } .report .cons li svg.i { color: var(--skip); }
.report ul { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.report li { display: flex; gap: 12px; color: var(--ink); }
.report li::before { content: ""; width: 6px; height: 6px; margin-top: 9px; border-radius: 999px; background: var(--primary); flex: none; }
.report strong { font-weight: 600; color: var(--ink); }
.tbl-wrap { overflow-x: auto; margin: 4px 0 8px; }
.report table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.report th, .report td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.report th { color: var(--muted); font-weight: 500; }
/* Smart Buyer Advice: Read more */
.report details.more { margin: 2px 0 8px; }
.report details.more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 8px;
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--primary); user-select: none; }
.report details.more > summary::-webkit-details-marker { display: none; }
.report details.more > summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .2s; order: 1; }
.report details.more[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.report details.more > summary:hover { border-color: var(--primary); }
.report details.more > summary small { color: var(--muted); font-weight: 400; font-size: 12px; }
.report details.more .less, .report details.more[open] .more-l, .report details.more[open] > summary small { display: none; }
.report details.more[open] .less { display: inline; }
.report details.more > div { margin-top: 14px; }
@media (prefers-reduced-motion: reduce) { .report details.more > summary::after { transition: none; } }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border-radius: 8px;
  font-size: 13px; color: var(--muted); transition: background-color .15s, color .15s;
}
.btn-ghost:hover { background: var(--secondary); color: var(--ink); }
.btn-ghost svg.i { width: 14px; height: 14px; }
.btn-outline {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 10px;
  font-size: 13px; box-shadow: var(--shadow); transition: box-shadow .15s;
}
.btn-outline:hover { box-shadow: var(--shadow-hover); }
.msg { padding: 16px 20px; display: grid; gap: 12px; }
.msg h3 { margin: 0; font-size: 16px; font-weight: 600; }
.msg p { margin: 0; font-size: 14px; color: var(--muted); }
.opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.opt {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left;
  padding: 10px 12px; border-radius: 12px; background: var(--secondary); font-size: 14px; transition: background-color .15s;
}
.opt:hover { background: var(--accent); }
.opt small { color: var(--subtle); font-size: 12px; }

/* ---- Footer ---- */
.footer { border-top: 1px solid var(--line); padding: 16px 24px; font-size: 12px; color: var(--subtle); }
.footer .in { max-width: 672px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.footer p { margin: 0; }
.footer nav { display: flex; gap: 12px; }
.footer nav a { text-decoration: none; }
.footer nav a:hover, .footer nav button:hover { color: var(--ink); }

/* ---- Dialogs & sheets ---- */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--card); }
dialog::backdrop { background: var(--overlay); }
.dlg { width: min(440px, calc(100% - 32px)); max-height: min(90dvh, 40rem); border-radius: 20px; box-shadow: var(--shadow-hover); }
.dlg .in { padding: 24px; }
.dlg h2, .sheet h2 { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 24px; letter-spacing: -0.02em; }
.dlg .desc, .sheet .desc { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.dlg-x { position: absolute; top: 14px; right: 14px; }
.dlg form { margin-top: 20px; display: grid; gap: 16px; }
.legal { display: grid; gap: 12px; margin-top: 16px; font-size: 14px; color: var(--muted); }
.legal p { margin: 0; }
.sheet {
  position: fixed; top: 0; bottom: 0; margin: 0; height: 100dvh; max-height: 100dvh; width: min(380px, 88vw);
  flex-direction: column; box-shadow: var(--shadow-hover);
}
.sheet[open] { display: flex; }
.sheet[open] { animation: slide-l .25s var(--ease); }
.sheet.left { left: 0; right: auto; } .sheet.right { right: 0; left: auto; }
.sheet.right[open] { animation-name: slide-r; }
@keyframes slide-l { from { transform: translateX(-100%); } }
@keyframes slide-r { from { transform: translateX(100%); } }
.sheet .head { padding: 20px 20px 12px; position: relative; }
.sheet .scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 12px 16px; }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { position: relative; }
.hist .row {
  width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 12px 40px 12px 12px; border-radius: 12px; transition: background-color .15s;
}
.hist .row:hover { background: color-mix(in srgb, var(--secondary) 70%, transparent); }
.hist .row.on { background: var(--secondary); }
.hist .t { width: 100%; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist .s { display: flex; gap: 8px; font-size: 12px; color: var(--muted); }
.hist .del { position: absolute; top: 8px; right: 4px; opacity: 0; }
.hist li:hover .del, .hist li:focus-within .del { opacity: 1; }
@media (hover: none) { .hist .del { opacity: 1; } }
.v-buy { color: var(--buy); } .v-wait { color: var(--wait); } .v-skip { color: var(--skip); }
.sheet .foot { display: flex; justify-content: space-between; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.sheet .foot button { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.sheet .foot button:hover { color: var(--ink); }
.empty { padding: 24px 8px; font-size: 14px; color: var(--muted); }
.opt-sec { padding: 8px 8px 0; }
.opt-sec + .opt-sec { margin-top: 16px; }
.opt-sec > p { margin: 0 0 8px; font-size: 12px; font-weight: 500; letter-spacing: .02em; color: var(--muted); }
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg3 button { border-radius: 12px; padding: 12px 10px; text-align: left; background: var(--secondary); font-size: 14px; transition: background-color .15s; }
.seg3 button:hover { background: var(--accent); }
.seg3 button[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); }
.seg3 b { display: block; font-weight: 500; }
.seg3 small { display: block; margin-top: 4px; font-size: 12px; opacity: .75; }
.links { display: grid; gap: 4px; margin-top: 16px; padding: 0 0 8px; }
.links a, .links button { text-decoration: none; text-align: left; padding: 8px 12px; border-radius: 12px; font-size: 14px; color: var(--muted); }
.links a:hover, .links button:hover { background: var(--secondary); color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 60; opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 10px 14px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 13px;
  transition: opacity .2s, transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .header { padding: 0 16px; }
  .home { padding-top: 40px; }
  .cats { gap: 8px; }
  .advice .body { padding: 20px; }
  .advice h2 { font-size: 20px; }
  .sugg .tag.kind { display: none; }
  body[data-layout="classic"] .cats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  body[data-layout="classic"] .ask { padding: 20px; }
  .footer { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .stagger > *, .sheet[open] { animation: none; }
  .think { animation: none; background: none; color: var(--muted); }
}

/* ===== Accounts: header button + menu ===== */
.signin-btn { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; margin-left: 4px; border-radius: 10px;
  font-size: 13px; font-weight: 600; text-decoration: none; background: var(--primary); color: var(--primary-ink); }
.signin-btn:hover { opacity: .92; }
.acct { position: relative; margin-left: 4px; }
.avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--secondary); color: var(--ink); font-weight: 600; font-size: 14px; }
.avatar:hover { background: var(--accent); }
.acct-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 200px; padding: 6px; border-radius: 12px;
  background: var(--card); box-shadow: var(--shadow-hover); display: grid; }
.acct-menu .acct-email { margin: 0; padding: 8px 10px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acct-menu a, .acct-menu button { padding: 8px 10px; border-radius: 8px; font-size: 14px; text-align: left; text-decoration: none; color: var(--ink); }
.acct-menu a:hover, .acct-menu button:hover { background: var(--secondary); }

/* ===== Simple pages (login, signup, account, legal) ===== */
.simple { width: min(440px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 72px; }
.simple.wide { width: min(640px, calc(100% - 32px)); }
.simple h1 { font-size: clamp(30px, 5vw, 38px); }
.simple .lede { margin: 10px 0 0; color: var(--muted); font-size: 15px; }
.panel { margin-top: 28px; padding: 24px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.panel .hint-text { margin: 0 0 16px; font-size: 13px; color: var(--muted); }
.form { display: grid; gap: 16px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.check input { margin-top: 3px; accent-color: var(--primary); }
.check a, .alt a, .legal-page a { color: var(--primary); }
.alt { margin: 18px 0 0; font-size: 14px; color: var(--muted); text-align: center; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--subtle); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.social { display: grid; gap: 10px; }
.btn-social { width: 100%; height: 48px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-social:hover { box-shadow: var(--shadow-hover); }
.btn-social svg { flex: none; }
.btn-secondary { height: 44px; padding: 0 16px; border-radius: 12px; background: var(--secondary); font-weight: 600; }
.btn-secondary:hover { background: var(--accent); }
.btn-danger { height: 44px; padding: 0 16px; border-radius: 12px; background: color-mix(in srgb, var(--skip) 14%, transparent); color: var(--skip); font-weight: 600; }
.btn-danger:hover { background: color-mix(in srgb, var(--skip) 22%, transparent); }
.msg-ok { margin: 0; padding: 10px 12px; border-radius: 12px; font-size: 14px; background: color-mix(in srgb, var(--buy) 14%, transparent); color: var(--ink); }
.msg-err { margin: 0; padding: 10px 12px; border-radius: 12px; font-size: 14px; background: color-mix(in srgb, var(--skip) 14%, transparent); color: var(--ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.go:disabled { opacity: .6; cursor: wait; }
.legal-page h2 { margin: 28px 0 8px; font-size: 17px; font-weight: 600; }
.legal-page p, .legal-page li { color: var(--muted); font-size: 15px; line-height: 1.65; }
.legal-page ul { padding-left: 20px; }
.legal-page .updated { font-size: 13px; color: var(--subtle); }

/* ===== Feedback under each answer ===== */
.fb { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 10px; }
.fb-q { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.fb-btn { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; box-shadow: var(--shadow); color: var(--muted); transition: background-color .15s, color .15s; }
.fb-btn:hover { color: var(--ink); box-shadow: var(--shadow-hover); }
.fb-btn[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); box-shadow: none; }
.fb-btn svg.i { width: 16px; height: 16px; }
.fb-more { display: grid; gap: 10px; }
.fb-reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.fb textarea { width: 100%; min-height: 70px; resize: vertical; border: 0; border-radius: 12px; background: var(--secondary); padding: 10px 12px; font: inherit; font-size: 14px; color: var(--ink); outline: none; }
.fb textarea:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 40%, transparent); }
.fb-send { justify-self: start; height: 36px; padding: 0 14px; border-radius: 10px; background: var(--primary); color: var(--primary-ink); font-weight: 600; font-size: 13px; scroll-margin-bottom: 24px; }
.fb-thanks { margin: 0; font-size: 13px; color: var(--muted); }
@media (max-width: 560px) { .row-2 { grid-template-columns: 1fr; } .simple { padding-top: 32px; } .panel { padding: 20px; } }
a.brand { text-decoration: none; color: inherit; }

/* Occupation picker: compact pills (five common jobs + Other) */
.occ-grid { display: flex; flex-wrap: wrap; gap: 6px; border-radius: 12px; }
.occ-grid.bad { box-shadow: 0 0 0 2px color-mix(in srgb, var(--skip) 55%, transparent); }
.chip.occ { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; font-size: 13px; color: var(--ink);
  transition: color .15s, background-color .15s, transform .1s; }
.chip.occ:hover { background: var(--secondary); }
.chip.occ:active { transform: scale(0.97); }
.chip.occ svg.i { width: 15px; height: 15px; color: var(--muted); }
.chip.occ[aria-checked="true"] { background: var(--primary); color: var(--primary-ink); box-shadow: none; }
.chip.occ[aria-checked="true"] svg.i { color: currentColor; }
#occOtherBox .input { margin-top: 8px; }


/* Header: Log in + Sign up on every page */
#authSlot { display: flex; align-items: center; gap: 4px; }
.login-link { display: inline-flex; align-items: center; height: 34px; padding: 0 10px; border-radius: 10px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--ink); }
.login-link:hover { background: var(--secondary); }
@media (max-width: 400px) { .word { display: none; } .login-link { padding: 0 6px; } }

/* ===== Pricing ===== */
.simple.wider { width: min(820px, calc(100% - 32px)); }
.price-cur { display: flex; justify-content: center; margin-top: 24px; }
.price-cur .cur button { min-width: 84px; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; padding: 24px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); }
.plan.plus { box-shadow: 0 0 0 2px var(--primary), var(--shadow-hover); }
.plan h2 { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 26px; }
.plan-tag { position: absolute; top: -11px; right: 20px; margin: 0; padding: 3px 10px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.plan-price { margin: 10px 0 0; display: flex; align-items: baseline; gap: 8px; }
.plan-price b { font-family: var(--font-display); font-weight: 500; font-size: 38px; font-variant-numeric: tabular-nums; }
.plan-price span { color: var(--muted); font-size: 14px; }
.plan ul { list-style: none; margin: 18px 0 22px; padding: 0; display: grid; gap: 10px; flex: 1; }
.plan li { display: flex; gap: 10px; font-size: 14px; color: var(--muted); }
.plan li::before { content: "✓"; color: var(--primary); font-weight: 700; }
.plan li b { color: var(--ink); }
.plan-btn { display: flex; align-items: center; justify-content: center; text-decoration: none; color: inherit; }
.plan .go.plan-btn { color: var(--primary-ink); }
.plan-current { cursor: default; opacity: .8; }
a.btn-outline { text-decoration: none; color: var(--ink); }
.msg.limit h3 { font-family: var(--font-display); font-weight: 500; font-size: 20px; }
.plan-badge { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-size: 11px; font-weight: 600; vertical-align: middle; }
@media (max-width: 640px) { .plans { grid-template-columns: 1fr; } }

/* Plans on the home page */
.home-plans { width: min(820px, calc(100% - 32px)); margin: 0 auto; padding: 8px 0 72px; border-top: 1px solid var(--line); }
.home-plans .eyebrow { margin-top: 48px; text-align: center; }
.home-plans h2 { margin: 10px auto 0; max-width: 34rem; text-align: center; font-family: var(--font-display); font-weight: 500; font-size: clamp(24px, 4vw, 32px); letter-spacing: -0.02em; text-wrap: balance; }
.home-plans .plans { margin-top: 28px; }
.plans-link { margin: 10px 0 0; text-align: center; font-size: 14px; }
.plans-link a { color: var(--primary); }
.plans-fallback { margin: 28px 0 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; text-align: center; color: var(--muted); font-size: 14px; }

/* Header "Plans" button (opens the pricing page) */
.plans-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 10px;
  font-size: 13px; font-weight: 600; text-decoration: none; color: var(--primary); transition: background-color .15s; }
.plans-btn:hover { background: var(--secondary); }
.plans-btn svg.i { width: 16px; height: 16px; }
@media (max-width: 480px) { .plans-btn span { display: none; } .plans-btn { width: 36px; padding: 0; justify-content: center; } }

/* Waiting card: swaying scale, ticking steps, long-wait note, mini-game, Cancel */
.waiting { display: grid; justify-items: center; gap: 14px; padding: 24px; }
.scale { width: 200px; height: 100px; overflow: visible; }
.scale line, .scale path { stroke: var(--muted); stroke-width: 2.5; stroke-linecap: round; fill: none; }
.scale .post { stroke: var(--ink); stroke-width: 3; }
.scale path { fill: color-mix(in srgb, var(--primary) 14%, transparent); stroke: var(--primary); stroke-width: 1.5; }
.scale circle { fill: var(--primary); }
.scale text { font: 12px var(--font-sans); fill: var(--muted); text-anchor: middle; }
.scale .beam { transform-origin: 120px 34px; animation: sway 2.4s ease-in-out infinite; }
.scale .pan.l { animation: panL 2.4s ease-in-out infinite; } .scale .pan.r { animation: panR 2.4s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes panL { 0%, 100% { transform: translateY(-5px); } 50% { transform: translateY(5px); } }
@keyframes panR { 0%, 100% { transform: translateY(5px); } 50% { transform: translateY(-5px); } }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; justify-self: stretch; max-width: 360px; width: 100%; margin-inline: auto; }
.steps li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--subtle); transition: color .3s; }
.steps .dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line); flex: none; display: grid; place-items: center; }
.steps li.now { color: var(--ink); } .steps li.now .dot { border-color: var(--primary); border-top-color: transparent; animation: spin .8s linear infinite; }
.steps li.done { color: var(--muted); } .steps li.done .dot { background: var(--primary); border-color: var(--primary); }
.steps li.done .dot::after { content: ""; width: 5px; height: 9px; border: solid var(--primary-ink); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
@keyframes spin { to { transform: rotate(360deg); } }
.waiting .think { max-width: 420px; text-align: center; }
.game-slot { justify-self: stretch; display: grid; justify-items: center; }
.game { width: 100%; display: grid; gap: 8px; }
.game-bar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.game-bar b { color: var(--ink); font-variant-numeric: tabular-nums; }
.g-stage { display: grid; place-items: center; min-height: 0; }
.game canvas { display: block; width: 100%; height: auto; border-radius: 12px; background: var(--secondary); touch-action: none; cursor: crosshair; }
/* While waiting for an answer the whole page fits one screen: no footer, no scrolling,
   and the game takes whatever height is left. */
body.is-waiting { overflow: hidden; }
body.is-waiting .page { height: 100dvh; min-height: 0; overflow: hidden; }
body.is-waiting .footer { display: none; }
body.is-waiting main { display: flex; flex-direction: column; min-height: 0; }
body.is-waiting .thread { flex: 1; min-height: 0; padding: 12px 0; gap: 12px; }
body.is-waiting .thread .waiting { flex: 1; min-height: 0; align-content: center; padding: 16px; gap: 10px; }
body.is-waiting .thread .waiting.gaming { display: flex; flex-direction: column; align-items: stretch; padding: 12px; }
body.is-waiting .waiting.gaming .game-slot { flex: 1; min-height: 0; display: flex; }
body.is-waiting .waiting.gaming .game { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
body.is-waiting .waiting.gaming .g-stage { flex: 1; }
body.is-waiting .waiting.gaming .cancel-btn { align-self: center; }
.waiting.gaming .scale, .waiting.gaming .steps, .waiting.gaming .think { display: none; }
.waiting.gaming { padding: 16px; }
.g-status { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.game .g-hint { margin: 0; font-size: 12px; color: var(--subtle); text-align: center; }
.cancel-btn { flex: none; }
@media (prefers-reduced-motion: reduce) { .scale .beam, .scale .pan, .steps li.now .dot { animation: none; } }
