/* BrainTart — "bake-shop sticker" UI: plum outlines and offset plum shadows, taken from the logo. */
:root {
  --ivory: #FFF8EE;
  --paper: #FFFDF8;
  --butter: #F6C979;
  --butter-soft: #FDEBC8;
  --rasp: #E2667C;
  --rasp-soft: #F9D3D9;
  --plum: #3B1219;
  --cocoa: #74454C;
  --line: #3B1219;
  --ok: #F6C979;
  --bad: #E2667C;
  --shadow: 4px 4px 0 var(--line);
  --shadow-sm: 3px 3px 0 var(--line);
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --display: "Fredoka", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ivory: #2A0E14;
    --paper: #3A1820;
    --butter: #F2C26E;
    --butter-soft: #5A3A24;
    --rasp: #EE7F92;
    --rasp-soft: #5C2431;
    --plum: #FFF1E2;
    --cocoa: #E3BFC3;
    --line: #12050A;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ivory); color: var(--plum);
  font: 400 18px/1.5 var(--body);
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 0 0;
}
img { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--rasp); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.boot { display: grid; place-items: center; min-height: 80dvh; gap: 8px; color: var(--cocoa); }

/* ---------- layout ---------- */
.shell { max-width: 520px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 18px; }
.topbar .logo { height: 40px; width: auto; }
.topbar .quiet { font-size: 15px; color: var(--cocoa); }

h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0 0 8px; letter-spacing: 0.005em; }
h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 19px; }
p { margin: 0 0 12px; }
.muted { color: var(--cocoa); }
.small { font-size: 15px; }
.stack > * + * { margin-top: 14px; }

/* ---------- the sticker ---------- */
.sticker {
  background: var(--paper); border: 2.5px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 18px;
}
.sticker.butter { background: var(--butter-soft); }
.sticker.rasp { background: var(--rasp-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 20px; border-radius: 999px;
  border: 2.5px solid var(--line); background: var(--paper); box-shadow: var(--shadow-sm);
  font-family: var(--display); font-weight: 600; font-size: 19px; cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease; text-decoration: none; color: var(--plum);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--line); }
.btn.primary { background: var(--rasp); color: #3B1219; }
.btn.butter { background: var(--butter); color: #3B1219; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; text-decoration: underline; font-family: var(--body); font-weight: 700; font-size: 17px; min-height: 44px; }
.btn.ghost:active { transform: none; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 0; }

/* ---------- forms ---------- */
label.field { display: block; font-weight: 700; margin-bottom: 12px; }
label.field span { display: block; margin-bottom: 6px; }
.input {
  width: 100%; min-height: 54px; padding: 10px 16px; font-size: 20px;
  background: var(--paper); border: 2.5px solid var(--line); border-radius: var(--r-md);
  box-shadow: inset 2px 2px 0 rgba(59,18,25,.08);
}
.input:focus { outline: none; border-color: var(--rasp); box-shadow: 0 0 0 3px var(--rasp-soft); }
.error { background: var(--rasp-soft); border: 2px solid var(--line); border-radius: var(--r-sm); padding: 10px 14px; font-weight: 700; }

/* ---------- today ---------- */
.today-hero { display: grid; grid-template-columns: 1fr 112px; gap: 10px; align-items: center; }
.today-hero img { width: 112px; height: auto; }
.today-hero .count { font-family: var(--display); font-weight: 700; font-size: 56px; line-height: 1; }
.list-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--paper); font-size: 15px; font-weight: 700;
}
.chip.butter { background: var(--butter-soft); }
.streak { display: flex; gap: 6px; margin-top: 8px; }
.streak i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: var(--paper); display: block; }
.streak i.on { background: var(--butter); }
.streak i.today { box-shadow: 0 0 0 3px var(--rasp-soft); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 4px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--ivory); border-top: 2.5px solid var(--line);
}
.tabbar button {
  flex: 1; max-width: 120px; display: grid; justify-items: center; gap: 2px;
  background: none; border: 0; padding: 6px 4px; border-radius: 14px; cursor: pointer;
  font-size: 14px; font-weight: 700; color: var(--cocoa);
}
.tabbar button svg { width: 26px; height: 26px; }
.tabbar button[aria-current="page"] { color: var(--plum); background: var(--butter-soft); }

/* ---------- picking lists ---------- */
.cat-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle {
  padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper);
  font-weight: 700; cursor: pointer; font-size: 16px;
}
.toggle[aria-pressed="false"] { opacity: .5; text-decoration: line-through; background: transparent; }
.pick-list { display: grid; gap: 10px; }
.pick {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; text-align: left;
  padding: 14px 16px; border-radius: var(--r-md); border: 2.5px solid var(--line); background: var(--paper);
  cursor: pointer; width: 100%;
}
.pick strong { font-family: var(--display); font-weight: 600; font-size: 19px; }
.pick .muted { grid-column: 1 / 2; font-size: 15px; }
.pick .tick {
  grid-row: 1 / 3; grid-column: 2; width: 34px; height: 34px; border-radius: 50%;
  border: 2.5px solid var(--line); display: grid; place-items: center; background: var(--paper);
}
.pick[aria-pressed="true"] { background: var(--butter-soft); box-shadow: var(--shadow-sm); }
.pick[aria-pressed="true"] .tick { background: var(--rasp); }
.pick[aria-pressed="true"] .tick::after { content: ""; width: 12px; height: 7px; border: solid #3B1219; border-width: 0 0 3px 3px; transform: rotate(-45deg) translate(1px,-1px); }
.sticky-foot { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); margin-top: 18px; }
.cat-head { font-family: var(--display); font-weight: 600; font-size: 17px; color: var(--cocoa); margin: 16px 0 6px; }

.estimate { display: grid; gap: 8px; }
.estimate output { font-family: var(--display); font-weight: 700; font-size: 28px; }
input[type=range] { width: 100%; accent-color: var(--rasp); height: 36px; }

/* ---------- the session card ---------- */
.session-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.session-top .close { width: 44px; height: 44px; border-radius: 50%; border: 2.5px solid var(--line); background: var(--paper); cursor: pointer; display: grid; place-items: center; flex: none; }
.progress { flex: 1; height: 16px; border-radius: 999px; border: 2.5px solid var(--line); background: var(--paper); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--butter); border-right: 2.5px solid var(--line); transition: width .25s ease; }
.progress i[style*="width: 0%"] { border-right: 0; }
.card { padding: 20px 18px 22px; }
.card .kicker { font-size: 15px; font-weight: 700; color: var(--cocoa); margin-bottom: 10px; display: flex; justify-content: space-between; gap: 8px; }
.card .prompt { font-family: var(--display); font-weight: 600; font-size: 34px; line-height: 1.12; margin: 6px 0 4px; overflow-wrap: anywhere; }
.card .prompt.long { font-size: 24px; line-height: 1.25; }
.card .hint { color: var(--cocoa); margin-bottom: 4px; }
.visual { margin: 6px 0 12px; border: 2.5px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: #FFFFFF; display: grid; place-items: center; min-height: 160px; }
.visual img { display: block; max-height: 320px; width: auto; max-width: 100%; object-fit: contain; }
.visual.flag { background: var(--butter-soft); padding: 18px; }
.visual.flag img { max-height: 170px; border: 2px solid var(--line); border-radius: 6px; }
.visual svg { display: block; width: 100%; height: auto; }
.credit { font-size: 13px; color: var(--cocoa); text-align: right; margin-top: -6px; margin-bottom: 8px; }
.answer-area { margin-top: 16px; }
.choices { display: grid; gap: 10px; }
.choice {
  text-align: left; padding: 14px 16px; min-height: 56px; border-radius: var(--r-md);
  border: 2.5px solid var(--line); background: var(--paper); box-shadow: var(--shadow-sm);
  font-size: 19px; font-weight: 700; cursor: pointer;
}
.choice:active { transform: translate(3px,3px); box-shadow: none; }
.choice.right { background: var(--butter); }
.choice.wrong { background: var(--rasp-soft); text-decoration: line-through; }
.choice[disabled] { cursor: default; }
.typed-row { display: grid; gap: 10px; }

.feedback { margin-top: 16px; padding: 14px 16px; border-radius: var(--r-md); border: 2.5px solid var(--line); }
.feedback.good { background: var(--butter); color: #3B1219; }
.feedback.miss { background: var(--rasp-soft); }
.feedback .big { font-family: var(--display); font-weight: 600; font-size: 24px; line-height: 1.2; }
.feedback .detail { margin-top: 4px; }

.learn-tag { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--butter); border: 2px solid var(--line); font-weight: 700; font-size: 15px; color: #3B1219; }

/* ---------- check-in ---------- */
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale button { min-height: 52px; border-radius: var(--r-sm); border: 2.5px solid var(--line); background: var(--paper); font-family: var(--display); font-weight: 600; font-size: 20px; cursor: pointer; }
.scale button[aria-pressed="true"] { background: var(--butter); box-shadow: var(--shadow-sm); color: #3B1219; }
.scale-ends { display: flex; justify-content: space-between; font-size: 14px; color: var(--cocoa); margin-top: 4px; }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 700; margin-bottom: 8px; padding: 0; }

/* ---------- progress / charts ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 12px; border: 2.5px solid var(--line); border-radius: var(--r-md); background: var(--paper); }
.stat b { display: block; font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1.1; }
.stat span { font-size: 14px; color: var(--cocoa); }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { font: 13px var(--body); fill: var(--cocoa); }
.chart .grid line { stroke: var(--cocoa); stroke-opacity: .18; }
.chart .tip {
  position: absolute; pointer-events: none; background: var(--paper); border: 2px solid var(--line);
  border-radius: 10px; padding: 6px 10px; font-size: 14px; box-shadow: var(--shadow-sm); white-space: nowrap; transform: translate(-50%, -110%);
}
.list-progress { display: grid; gap: 12px; }
.lp-row { display: grid; gap: 4px; }
.lp-row .bar { height: 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); overflow: hidden; display: flex; }
.lp-row .bar i { display: block; height: 100%; }
.lp-row .bar i.m { background: var(--rasp); }
.lp-row .bar i.l { background: var(--butter); }
.key { display: flex; gap: 14px; font-size: 14px; color: var(--cocoa); flex-wrap: wrap; }
.key i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 2px solid var(--line); vertical-align: -2px; margin-right: 5px; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th, table.data td { text-align: left; padding: 6px 4px; border-bottom: 1.5px solid rgba(116,69,76,.25); }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; }
details summary { cursor: pointer; font-weight: 700; }

/* ---------- settings ---------- */
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1.5px solid rgba(116,69,76,.25); }
.setting:last-child { border-bottom: 0; }
select.input { min-height: 46px; width: auto; font-size: 17px; padding: 6px 12px; }

.banner { padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--butter-soft); font-size: 15px; margin-bottom: 14px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
