/* Tarka: indigo ink on a pale khadi page. Calm, readable, phone first. */
:root {
  --page: #EEF1EC;        /* pale khadi */
  --sheet: #F8F9F6;       /* raised surfaces */
  --ink: #1B2140;         /* indigo-black text */
  --muted: #4A5070;
  --indigo: #2E3A86;      /* actions, links */
  --indigo-soft: #DCE0F0; /* vote fills */
  --turmeric: #7F5A0C;    /* "your choice" only (4.7:1 or better on every surface) */
  --leaf: #2F6B4F;        /* reasoning holds */
  --line: #C9CEC6;
  --focus: #2E3A86;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --tab-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #141A2E; --sheet: #1C2340; --ink: #ECEEF4; --muted: #B4B9CF;
    --indigo: #A9B4F2; --indigo-soft: #2E3768; --turmeric: #E2AE45; --leaf: #8FD0AE;
    --line: #353D61; --focus: #A9B4F2; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 400 1.0625rem/1.55 var(--sans);
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
a { color: var(--indigo); text-underline-offset: 0.18em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; }
.skip:focus { left: 16px; z-index: 20; background: var(--sheet); padding: 8px 12px; }

.top { padding: 14px 20px 0; max-width: 36rem; margin: 0 auto; }
.brand {
  font: 600 1.35rem/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: 0.01em;
}
main, main:focus, main:focus-visible { outline: none; }
.page { max-width: 36rem; margin: 0 auto; padding: 18px 20px 40px; }

h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.6rem; margin: 0.6em 0 0.4em; }
h2 { font-size: 1.15rem; margin: 1.4em 0 0.4em; }
.small-h { font-family: var(--sans); font-size: 1rem; font-weight: 600; margin: 1.6em 0 0.6em; }
p { margin: 0 0 0.9em; }
.lede { font-size: 1.1rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.92rem; }
.date { color: var(--muted); margin: 0.4em 0 0.2em; }
.streak { margin: 0 0 1.2em; font-size: 0.95rem; }

/* The story reads like a page of a book. */
.story {
  font: 400 1.18rem/1.7 var(--serif); margin: 1.1em 0 0.5em; max-width: 34em;
}
.source { font-size: 0.88rem; color: var(--muted); margin: 0 0 1.2em; }
.tag {
  display: inline-block; font-size: 0.78rem; border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 8px; margin-left: 6px; color: var(--muted); white-space: nowrap;
}
.ask { font-size: 1.28rem; margin: 1.1em 0 0.8em; }
.hint { color: var(--muted); font-size: 0.92rem; margin-bottom: 0.6em; }
.notice {
  background: var(--sheet); border-left: 3px solid var(--indigo); padding: 10px 14px;
  font-size: 0.95rem; border-radius: 0 6px 6px 0;
}

/* Options: big, full-width, one-thumb targets. */
.option {
  display: block; width: 100%; text-align: left; font: inherit; color: var(--ink);
  background: var(--sheet); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin: 0 0 10px; min-height: 52px; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.option:hover:not(:disabled) { border-color: var(--indigo); }
.option:disabled { cursor: default; }
.option.picked { border-color: var(--turmeric); box-shadow: inset 4px 0 0 var(--turmeric); }
.option.best { border-color: var(--leaf); box-shadow: inset 4px 0 0 var(--leaf); }
/* Options not chosen stay readable (muted text keeps 7:1 contrast). */
.option:disabled:not(.picked):not(.best) { color: var(--muted); background: transparent; }

/* The reveal: ink fills each option by how readers chose. */
.result {
  position: relative; overflow: hidden; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--sheet); margin: 0 0 10px; padding: 12px 16px;
}
.result .fill {
  position: absolute; inset: 0 auto 0 0; width: var(--pct); background: var(--indigo-soft);
  transform-origin: left; animation: ink 0.9s cubic-bezier(.2,.7,.2,1) both;
}
.result.mine { border-color: var(--turmeric); }
.result .row, .result .marks { position: relative; }
.result .row { display: flex; gap: 12px; justify-content: space-between; align-items: baseline; }
.result .pct { font-weight: 600; font-variant-numeric: tabular-nums; }
.result .marks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mark { font-size: 0.8rem; padding: 1px 8px; border-radius: 999px; background: var(--page); }
.mark.you { color: var(--turmeric); border: 1px solid var(--turmeric); }
.mark.char { color: var(--indigo); border: 1px solid var(--indigo); }
@keyframes ink { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.explain, .life { margin-top: 1.4em; }
.explain h2, .life h2 { font-family: var(--sans); font-size: 1rem; margin: 0 0 0.4em; }
.explain.holds h2 { color: var(--leaf); }
.best-line { padding-left: 12px; border-left: 3px solid var(--leaf); }
.life { background: var(--sheet); border-radius: 12px; padding: 14px 16px; }
.life p { font: 400 1.08rem/1.65 var(--serif); margin: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 1.6em 0 1em; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
  padding: 10px 20px; border-radius: 999px; border: 1.5px solid var(--indigo);
  background: var(--indigo); color: var(--page); font: 600 1rem var(--sans);
  text-decoration: none; cursor: pointer;
}
.btn.quiet { background: transparent; color: var(--indigo); }
.btn.wide { width: 100%; }
.link {
  background: none; border: 0; padding: 6px 0; font: inherit; color: var(--indigo);
  text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer;
}
.report { font-size: 0.88rem; color: var(--muted); }

/* Practice */
.skills, .growth, .plain-list { list-style: none; padding: 0; margin: 0; }
.skill { padding: 18px 0; border-top: 1px solid var(--line); }
.skill h2, .growth h2 { margin: 0 0 0.2em; font-size: 1.12rem; }
.plain { font: 400 0.92rem var(--sans); color: var(--muted); margin-left: 4px; }
.skill p { margin: 0 0 0.7em; color: var(--muted); }
.levels { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 18px;
  border: 1.5px solid var(--line); border-radius: 999px; text-decoration: none;
  color: var(--ink); background: var(--sheet); font-weight: 600; font-size: 0.95rem;
}
.chip:hover { border-color: var(--indigo); }
.plain-list li::first-letter { text-transform: uppercase; }
.plain-list li { padding: 6px 0 6px 14px; border-left: 3px solid var(--line); margin-bottom: 6px; }

.progress { font-size: 0.88rem; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; margin-top: 8px; }
.bar { flex-basis: 100%; height: 4px; background: var(--line); border-radius: 4px; margin-top: 8px; }
.bar div { height: 100%; background: var(--indigo); border-radius: 4px; }

/* Growth */
.growth li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.spark { flex: none; }
.spark path { fill: none; stroke: var(--indigo); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark circle { fill: var(--indigo); }

/* Panels, forms */
.panel, .invite { background: var(--sheet); border-radius: 14px; padding: 16px 18px; margin: 1.2em 0; }
.panel h2, .invite h2 { margin-top: 0; }
.stack { display: grid; gap: 8px; margin: 1.2em 0; }
.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0.6em 0; }
label { font-weight: 600; font-size: 0.95rem; }
input, textarea {
  font: inherit; color: var(--ink); background: var(--page); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 10px 12px; min-height: 46px; width: 100%;
}
.inline input { width: auto; flex: 1 1 8rem; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.switch input { width: 22px; height: 22px; min-height: 0; accent-color: var(--indigo); }
.links { display: grid; margin-top: 1.4em; }
.links a { padding: 14px 0; border-top: 1px solid var(--line); text-decoration: none; }

.prose h2 { margin-top: 1.6em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 0.5em; }
.defs dt { font-family: var(--serif); font-weight: 600; margin-top: 0.8em; }
.defs dd { margin: 0; color: var(--muted); }

/* Bottom tab bar, within thumb reach */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 10; display: flex; justify-content: center;
  background: var(--sheet); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; max-width: 9rem; height: var(--tab-h); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; font-size: 0.8rem;
  color: var(--muted); text-decoration: none;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--indigo); font-weight: 600; }

dialog {
  border: 0; border-radius: 16px; padding: 4px 20px; width: min(32rem, calc(100% - 32px));
  background: var(--sheet); color: var(--ink);
}
dialog::backdrop { background: rgba(20, 26, 46, 0.45); }
#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); z-index: 30;
  background: var(--ink); color: var(--page); padding: 10px 18px; border-radius: 999px; font-size: 0.95rem;
  max-width: calc(100% - 32px);
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (min-width: 720px) {
  .story { font-size: 1.24rem; }
  h1 { font-size: 1.85rem; }
}
