/* Brain Teasers: The Logbook's calm navy, cream and brass, with a little more play. */

:root {
  --navy: #1c2c4c;
  --navy-deep: #142038;
  --ink: #24304a;
  --ink-soft: #4d5568;
  --ink-shape: #24304a;
  --cream: #faf6ee;
  --card: #ffffff;
  --brass: #b8892d;
  --brass-soft: #e9d9b4;
  --teal: #35766b;
  --teal-soft: #d9eae6;
  --rose: #a24a3f;      /* sparingly, never as "WRONG red" */
  --rose-soft: #f3e0dc;
  --line: #e6dfd2;
  --muted: #6b7386;
  --wash: rgba(28, 44, 76, 0.05);
  --radius: 14px;
  --shadow: 0 2px 10px rgba(28, 44, 76, 0.07), 0 10px 30px rgba(28, 44, 76, 0.06);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--font-body); font-size: 17px; line-height: 1.5; }
[hidden] { display: none !important; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 18px; }
main.wrap { padding-top: 22px; padding-bottom: 60px; }
h1, h2, h3 { font-family: var(--font-display); color: var(--navy); line-height: 1.2; margin: 0 0 .4em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.block { display: block; }

/* header */
.site-header { background: var(--navy); color: var(--cream); padding-top: env(safe-area-inset-top); }
.header-row { display: flex; align-items: center; justify-content: space-between; min-height: 58px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--cream); text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; position: relative; }
.brand-mark { width: 26px; height: 26px; color: var(--brass-soft); }
.header-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.link-btn { background: none; border: 0; color: inherit; font: inherit; font-size: .95rem; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-decoration: none; }
.site-header .link-btn { color: var(--cream); opacity: .9; }
.link-btn:hover { background: var(--wash); }
.site-header .link-btn:hover { background: rgba(255, 255, 255, .1); opacity: 1; }

/* cards and buttons */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.btn { font: inherit; font-weight: 600; border-radius: 12px; padding: 12px 20px; border: 1.5px solid transparent; cursor: pointer; min-height: 48px; }
.btn-primary { background: var(--navy); color: var(--cream); }
.btn-primary:hover { background: var(--navy-deep); }
.btn-ghost { background: var(--card); color: var(--navy); border-color: var(--navy); }
.btn-quiet { background: var(--wash); color: var(--navy); }
.btn:disabled { opacity: .5; cursor: default; }

/* sign in */
.auth-hero { text-align: center; padding: 34px 0 20px; position: relative; }
.hero-mark { width: 66px; height: 66px; color: var(--brass); }
.hero-title { font-size: 2.6rem; margin: 6px 0 4px; }
.hero-sub { color: var(--muted); margin: 0; }
.auth-card { max-width: 420px; margin: 0 auto; }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
input { font: inherit; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: #fffdf9; color: var(--ink); min-height: 48px; }
input:focus { outline: 2px solid var(--brass); outline-offset: 1px; border-color: var(--brass); }
.form-error { color: var(--rose); margin: 0; font-size: .95rem; }

/* home */
.greeting { font-size: 2rem; margin-bottom: 18px; }
.daily-card { display: flex; align-items: center; gap: 18px; background: linear-gradient(135deg, #fff 0%, #fbf3e2 100%); border-color: var(--brass-soft); position: relative; }
.daily-icon { font-size: 2.6rem; width: 70px; height: 70px; display: grid; place-items: center; background: var(--cream); border-radius: 50%; border: 1.5px solid var(--brass-soft); flex: none; }
.daily-body { flex: 1; min-width: 0; }
.daily-body h2 { font-size: 1.45rem; margin: 0 0 2px; }
.daily-body p { margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--brass); margin: 0 0 2px; }
.daily-card.is-done .daily-icon { background: var(--teal-soft); border-color: var(--teal-soft); }
.keep-card { display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 14px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.keep-card:hover, .kind-card:hover { border-color: var(--brass); }
.keep-icon { font-size: 1.8rem; }
.keep-card strong { font-size: 1.1rem; color: var(--navy); }
.chev { margin-left: auto; font-size: 1.8rem; color: var(--muted); }
.section-title { margin: 30px 0 12px; font-size: 1.25rem; }
.kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px; }
.kind-card { display: grid; gap: 2px; text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 16px; border-top: 4px solid var(--kind, var(--brass)); position: relative; }
.kind-icon { font-size: 1.7rem; }
.kind-name { font-weight: 700; color: var(--navy); }
.kind-blurb { font-size: .88rem; }
.kind-count { font-size: .78rem; color: var(--kind); font-weight: 600; margin-top: 4px; }
.cabinet p { margin: 0 0 10px; }
.stamp-row { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.stamp { width: 18px; height: 18px; border-radius: 50%; border: 2px dashed var(--brass-soft); }
.stamp.got { background: var(--brass); border: 2px solid var(--brass); }
.curio-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; padding: 12px; background: linear-gradient(transparent 76%, #d8c49a 76%, #c9b282 80%, transparent 80%); background-size: 100% 104px; border-radius: 10px; }
.curio { margin: 0; text-align: center; height: 94px; display: grid; align-content: end; justify-items: center; }
.curio span { font-size: 2.2rem; line-height: 1; }
.curio figcaption { font-size: .72rem; color: var(--muted); margin-top: 8px; }
.empty-shelf { grid-column: 1 / -1; text-align: center; padding: 26px 0; margin: 0; }

/* puzzle */
.puzzle-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.back { color: var(--navy); font-weight: 600; padding-left: 0; }
.kind-chip { font-size: .85rem; font-weight: 600; color: var(--kind, var(--navy)); background: var(--card); border: 1.5px solid var(--kind, var(--line)); padding: 5px 12px; border-radius: 999px; }
.q-card { padding: 24px; position: relative; }
.q-title { font-size: 1.6rem; margin-bottom: 14px; }
.q-visual { display: flex; justify-content: center; margin: 6px 0 14px; overflow-x: auto; }
.q-prompt { font-size: 1.12rem; margin: 0 0 16px; }
.q-helper { margin: 0 0 16px; }
.answer { margin-top: 6px; }
.options { display: grid; gap: 10px; }
.options.words { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.options.pics { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); justify-items: stretch; }
.option { font: inherit; font-size: 1.08rem; font-weight: 600; color: var(--navy); background: #fffdf9; border: 2px solid var(--line); border-radius: 12px; padding: 14px 12px; cursor: pointer; min-height: 56px; display: grid; place-items: center; transition: transform .12s, border-color .12s; }
.option:hover:not(:disabled) { border-color: var(--brass); transform: translateY(-1px); }
.option.right { border-color: var(--teal); background: var(--teal-soft); }
.option.nope { opacity: .45; text-decoration: line-through; text-decoration-color: var(--muted); }
.option.nope svg { opacity: .6; }
.typed { display: flex; gap: 10px; max-width: 420px; }
.typed input { flex: 1; min-width: 0; width: 100%; font-size: 1.3rem; font-weight: 600; letter-spacing: .04em; text-align: center; }
.q-aids { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 10px; }
.q-aids .link-btn { color: var(--navy); font-weight: 500; }
.clue { background: #fbf3e2; border-radius: 10px; padding: 12px 14px; margin: 12px 0 0; }

.feedback { margin-top: 14px; }
.fb-head { font-family: var(--font-display); font-size: 1.35rem; color: var(--navy); margin: 0 0 6px; }
.fb-note { margin: 0 0 8px; color: var(--ink-soft); }
.fb-answer { margin: 4px 0 10px; font-size: 1.1rem; }
.fb-why { margin: 8px 0 0; font-weight: 600; color: var(--navy); }
.fb-curio { background: #fbf3e2; padding: 10px 12px; border-radius: 10px; margin: 6px 0 0; }
.fb-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.feedback.is-right { border-color: var(--teal); background: linear-gradient(135deg, #fff, var(--teal-soft)); }
.feedback.is-nearly { border-color: var(--brass-soft); }
.feedback.is-how { border-color: var(--navy); }
.steps { margin: 6px 0 0; padding-left: 1.3em; display: grid; gap: 8px; }
.step { opacity: 0; animation: stepIn .45s ease forwards; animation-delay: calc(var(--i) * .5s); }
@keyframes stepIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .step { animation: none; opacity: 1; } }

.stamp-pop { position: fixed; left: 50%; top: 40%; font-size: 4.4rem; transform: translate(-50%, -50%) scale(.3); pointer-events: none; z-index: 50; opacity: 0; }
.stamp-pop.go { animation: pop 1.3s ease forwards; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 60% { opacity: 1; transform: translate(-50%, -60%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -120%) scale(.8); } }
@media (prefers-reduced-motion: reduce) { .stamp-pop.go { animation: none; opacity: 0; } }

/* pictures */
.plink { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 18px; }
.plink-pair { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--wash); border-radius: 14px; }
.plink-arrow { font-size: 1.6rem; color: var(--brass); font-weight: 700; }
.plink-as { color: var(--muted); font-weight: 600; }
.seq { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; }
.seq-chip { font-family: var(--font-display); font-weight: 600; font-size: 1.6rem; color: var(--navy); background: #fffdf9; border: 2px solid var(--line); border-radius: 12px; padding: 8px 14px; min-width: 56px; text-align: center; }
.seq-chip.q, td.q, .word.q { color: var(--brass); border-color: var(--brass); border-style: dashed; }
.seq-gap { color: var(--muted); font-size: 1.4rem; }

.matrix { display: grid; grid-template-columns: repeat(3, auto); gap: 8px; padding: 10px; background: var(--wash); border-radius: 14px; }
.cell-bg { fill: #fffdf9; stroke: var(--line); stroke-width: 2; }
.cell-bg.gap { fill: #fbf3e2; stroke: var(--brass); stroke-dasharray: 6 5; }
.gap-q { font-family: var(--font-display); font-size: 40px; fill: var(--brass); font-weight: 700; }
.option .cell-svg { width: 84px; height: 84px; }
@media (max-width: 420px) { .matrix .cell-svg { width: 84px; height: 84px; } }

.shape-wrap { display: grid; place-items: center; }
.shape-wrap.big { padding: 10px 26px; background: var(--wash); border-radius: 14px; }
.poly { fill: var(--teal-soft); stroke: var(--teal); stroke-width: 2; }
.shape-wrap.big .poly { fill: #d8e3ef; stroke: var(--navy); }
.poly-dot { fill: var(--brass); }

.scales { display: grid; gap: 18px; justify-items: center; width: 100%; }
.scales-q { margin: 2px 0 0; font-weight: 600; color: var(--muted); }
.balance { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 6px; width: min(100%, 460px); padding-bottom: 4px; border-bottom: 1px dashed var(--line); }
.balance.is-q { border-bottom: 0; }
.pan { display: grid; justify-items: center; }
.pan-items { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 3px; max-width: 170px; min-height: 30px; padding: 0 4px 4px; }
.dish { width: 100%; height: 10px; border-radius: 0 0 60px 60px; background: var(--brass-soft); border: 2px solid var(--brass); border-top-width: 3px; }
.beam svg { display: block; }
.fulcrum { fill: #8a7a5c; }
.balance.is-q .dish { border-style: dashed; }
.pan-q { font-family: var(--font-display); font-weight: 700; color: var(--brass); font-size: 1.4rem; margin-right: 4px; }
.pan-many { font-weight: 700; color: var(--navy); margin-right: 3px; }
.mini { display: block; }
.mini g { stroke-width: 2; }
.mini-square { fill: #d8e3ef; stroke: var(--navy); }
.mini-circle { fill: var(--teal-soft); stroke: var(--teal); }
.mini-triangle { fill: var(--brass-soft); stroke: var(--brass); }
.mini-star { fill: var(--rose-soft); stroke: var(--rose); }

.code-table { border-collapse: separate; border-spacing: 8px 8px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1.4rem; font-weight: 700; color: var(--navy); }
.code-table td { background: #fffdf9; border: 2px solid var(--line); border-radius: 10px; padding: 8px 14px; text-align: center; letter-spacing: .14em; }
.code-table td.arrow { background: none; border: 0; color: var(--muted); letter-spacing: 0; }

.analogy { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; font-size: 1.2rem; }
.analogy .word { font-family: var(--font-display); font-weight: 600; color: var(--navy); background: #fffdf9; border: 2px solid var(--line); border-radius: 10px; padding: 6px 14px; }
.analogy .link { color: var(--muted); }
.analogy .as { color: var(--brass); font-weight: 700; margin: 0 6px; }

.clues, .island { width: 100%; }
.clues p { margin: 0 0 8px; }
.clues ol { margin: 0 0 10px; padding-left: 1.4em; display: grid; gap: 4px; }
.clues-q { font-weight: 700; color: var(--navy); font-size: 1.1rem; margin: 6px 0 0 !important; }
.speech { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0; }
.speech .who { font-weight: 700; color: var(--navy); min-width: 52px; padding-top: 8px; }
.speech .bubble { background: #fffdf9; border: 2px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 8px 14px; font-style: italic; }

.grid-scroll { overflow-x: auto; }
.tick-grid { border-collapse: collapse; font-size: .9rem; }
.tick-grid th { font-weight: 600; color: var(--navy); padding: 4px 6px; }
.tick-grid thead th span { display: inline-block; max-width: 70px; }
.tick-grid td { padding: 2px; }
.tick-grid .split { width: 10px; }
.tick { width: 40px; height: 40px; border: 1.5px solid var(--line); background: #fffdf9; border-radius: 8px; font-size: 1.1rem; font-weight: 700; cursor: pointer; color: var(--muted); }
.tick.yes { color: var(--teal); background: var(--teal-soft); border-color: var(--teal); }
.tick.no { color: var(--muted); background: var(--wash); }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .daily-card { flex-wrap: wrap; }
  .daily-card .btn { width: 100%; }
  .greeting { font-size: 1.6rem; }
  .q-card { padding: 18px; }
  .seq-chip { font-size: 1.3rem; padding: 6px 10px; min-width: 46px; }
  .code-table { font-size: 1.1rem; }
}

/* ---------- grown-ups page ---------- */
.gu h1 { font-size: 1.9rem; }
.gu-note { background: #fbf3e2; border: 1px solid var(--brass-soft); border-radius: 12px; padding: 12px 16px; font-size: .92rem; color: var(--ink-soft); margin: 0 0 18px; }
.gu-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { padding: 16px; }
.tile .big { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.tile .label { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.tile .sub { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.gu-section { margin: 26px 0 10px; }
.gu table.data { width: 100%; border-collapse: collapse; font-size: .9rem; background: var(--card); }
.gu table.data th, .gu table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.gu table.data th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.gu table.data td.num, .gu table.data th.num { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--wash); color: var(--ink-soft); }
.pill.good { background: var(--teal-soft); color: var(--teal); }
.pill.help { background: #fbf3e2; color: var(--brass); }
.pill.miss { background: var(--rose-soft); color: var(--rose); }
.days { display: flex; gap: 5px; flex-wrap: wrap; }
.day { width: 22px; height: 22px; border-radius: 6px; background: var(--wash); }
.day.done { background: var(--brass-soft); }
.day.solved { background: var(--teal); }
.chart { width: 100%; height: auto; }
.chart .grid { stroke: var(--line); }
.chart .line { fill: none; stroke: var(--navy); stroke-width: 2.5; }
.chart .dot { fill: var(--navy); }
.chart .bar { fill: var(--brass-soft); }
.chart text { font-size: 11px; fill: var(--muted); font-family: var(--font-body); }
.gu-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.gu-pick button[aria-pressed="true"] { background: var(--navy); color: var(--cream); }
.gu-age { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .92rem; }
.gu-age input { min-height: 40px; padding: 6px 10px; }
.gu-age .btn { min-height: 40px; padding: 6px 14px; }
.prompt-cell { max-width: 340px; }
