/* Tikobu: shared styles. Colors and type come from the prototype. */

@font-face{font-family:"Fredoka";font-style:normal;font-weight:600;font-display:swap;src:url("../fonts/fredoka-latin-600.woff2") format("woff2")}
@font-face{font-family:"Fredoka";font-style:normal;font-weight:700;font-display:swap;src:url("../fonts/fredoka-latin-700.woff2") format("woff2")}
@font-face{font-family:"Atkinson Hyperlegible";font-style:normal;font-weight:400;font-display:swap;src:url("../fonts/atkinson-hyperlegible-latin-400.woff2") format("woff2")}
@font-face{font-family:"Atkinson Hyperlegible";font-style:normal;font-weight:700;font-display:swap;src:url("../fonts/atkinson-hyperlegible-latin-700.woff2") format("woff2")}

:root{
  --bg:#F1EFF8; --surface:#FFFFFF; --ink:#2D2342; --muted:#625B74; --line:#DCD7EA;
  --primary:#2D2342; --on-primary:#FFFFFF; --butter:#FFC94D; --focus:#6B5BD6;
  --display:'Fredoka', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  --body:'Atkinson Hyperlegible', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color-scheme:light dark;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#1B1726; --surface:#262035; --ink:#F2EEFB; --muted:#B9B1CC; --line:#3A3250;
    --primary:#F2EEFB; --on-primary:#2D2342; --focus:#A99BFF;
  }
}
:root[data-theme="dark"]{
  --bg:#1B1726; --surface:#262035; --ink:#F2EEFB; --muted:#B9B1CC; --line:#3A3250;
  --primary:#F2EEFB; --on-primary:#2D2342; --focus:#A99BFF;
}
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--body);font-size:17px;line-height:1.5;-webkit-font-smoothing:antialiased;
  padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}
img{max-width:100%;display:block}
button{font:inherit;color:inherit}
a{color:inherit;text-underline-offset:3px;text-decoration-thickness:1.5px}
:focus-visible{outline:3px solid var(--focus);outline-offset:3px;border-radius:12px}
[hidden]{display:none !important}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

.wrap{max-width:560px;margin:0 auto;padding:20px 18px 40px}
.top{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;min-height:44px}
.logo{font-family:var(--display);font-weight:700;font-size:26px;letter-spacing:-0.01em;margin:0;text-decoration:none}
.ghost{display:inline-flex;align-items:center;min-height:44px;background:none;border:0;color:var(--muted);font-size:15px;padding:0 8px;cursor:pointer;text-decoration:none}
.ghost:hover{color:var(--ink)}

/* buttons */
.cta{display:inline-flex;align-items:center;justify-content:center;min-height:56px;padding:0 30px;border:0;border-radius:999px;background:var(--primary);color:var(--on-primary);font-family:var(--display);font-weight:600;font-size:20px;cursor:pointer;width:100%;text-decoration:none}
.cta:hover{filter:brightness(1.08)}
.cta:disabled{opacity:.7;cursor:progress}
.secondary{display:inline-flex;align-items:center;justify-content:center;min-height:52px;padding:0 22px;border-radius:999px;border:2px solid var(--line);background:var(--surface);cursor:pointer;font-family:var(--display);font-weight:600;font-size:18px;text-decoration:none;width:100%}
.secondary:hover{border-color:var(--focus)}
.fine{font-size:14px;color:var(--muted);margin:14px 0 0;text-align:center}

/* home */
.hero h1{font-family:var(--display);font-weight:700;font-size:clamp(38px,10vw,56px);line-height:1.02;letter-spacing:-0.02em;margin:18px 0 6px}
.slogan{font-family:var(--display);font-weight:600;font-size:21px;margin:0 0 10px;color:var(--ink)}
.hero .lede{color:var(--muted);margin:0 0 18px;max-width:46ch}
.lineup{display:flex;gap:2px;overflow-x:auto;scrollbar-width:none;margin:0 -18px 22px;padding:6px 18px 10px;scroll-snap-type:x proximity}
.lineup::-webkit-scrollbar{display:none}
.lineup a{flex:0 0 auto;width:108px;text-align:center;text-decoration:none;scroll-snap-align:start;border-radius:18px;display:flex;flex-direction:column;align-items:center}
.lineup img{width:108px;height:108px;object-fit:contain;transition:transform .2s ease}
.lineup a:hover img{transform:translateY(-4px) rotate(-2deg)}
.lineup span{font-family:var(--display);font-weight:600;font-size:15px;color:var(--ink);line-height:1.2}
.lineup small{font-size:12.5px;color:var(--muted);line-height:1.2}
.how{margin:44px 0 0;padding:0;list-style:none;counter-reset:how}
.how li{display:grid;grid-template-columns:64px 1fr;gap:4px 14px;align-items:center;padding:14px 0;border-top:2px dashed var(--line)}
.how li:last-child{border-bottom:2px dashed var(--line)}
.how img{width:64px;height:64px;object-fit:contain;grid-row:span 2}
.how h2{font-family:var(--display);font-weight:600;font-size:20px;margin:0;line-height:1.2}
.how h2::before{counter-increment:how;content:counter(how) ". ";color:var(--muted)}
.how p{margin:0;color:var(--muted);font-size:15px}
.age-note{display:inline-block;margin-top:26px;font-size:14px;color:var(--muted);border:2px solid var(--line);border-radius:999px;padding:4px 12px}

/* test */
.progress{display:flex;align-items:center;gap:12px;margin:8px 0 26px}
.bar{flex:1;height:10px;background:var(--line);border-radius:999px;overflow:hidden}
.bar span{display:block;height:100%;width:0;background:var(--primary);border-radius:999px;transition:width .25s ease}
.count{font-size:14px;color:var(--muted);min-width:52px;text-align:right}
.q{min-height:150px;display:flex;align-items:center}
.q p{font-family:var(--display);font-weight:600;font-size:clamp(25px,6.6vw,32px);line-height:1.18;letter-spacing:-0.01em;margin:0}
.opts{display:grid;gap:10px;margin-top:26px}
.opt{display:flex;align-items:center;gap:14px;width:100%;min-height:56px;padding:0 18px;border:2px solid var(--line);border-radius:18px;background:var(--surface);cursor:pointer;text-align:left;font-size:18px;touch-action:manipulation}
.opt:hover{border-color:var(--focus)}
.opt .dot{width:22px;height:22px;border-radius:50%;border:2px solid var(--line);flex:0 0 auto}
.opt[aria-pressed="true"]{border-color:var(--primary)}
.opt[aria-pressed="true"] .dot{background:var(--butter);border-color:var(--ink)}
.navrow{display:flex;justify-content:space-between;align-items:center;margin-top:18px}
#qbody{transition:opacity .16s ease, transform .16s ease}
#qbody.out{opacity:0;transform:translateY(8px)}
.resume{background:var(--surface);border-radius:24px;padding:22px 20px;margin-top:18px;display:grid;gap:10px}
.screen-title{font-family:var(--display);font-weight:700;font-size:clamp(24px,6.4vw,30px);margin:0 0 6px;line-height:1.15}
.resume p{margin:0 0 6px;color:var(--muted)}

/* text pages */
.prose h1{font-family:var(--display);font-weight:700;font-size:clamp(34px,8vw,44px);line-height:1.05;letter-spacing:-0.02em;margin:18px 0 10px}
.prose h2{font-family:var(--display);font-weight:600;font-size:22px;margin:30px 0 8px}
.prose p,.prose li{max-width:62ch}
.prose ul{padding-left:20px}
.prose li{margin-bottom:6px}
.prose .updated{color:var(--muted);font-size:14px}
.prose .callout{background:var(--surface);border-radius:18px;padding:14px 16px;margin:18px 0}
.scales-list{list-style:none;padding:0;display:grid;gap:10px}
.scales-list li{background:var(--surface);border-radius:16px;padding:12px 14px;margin:0}
.scales-list b{font-family:var(--display);font-weight:600;font-size:18px;display:block}

/* character page */
.chero{border-radius:28px;padding:18px 18px 22px;margin-top:8px;background:var(--tint,#F5EADB);color:var(--deep,#3B2A22)}
.chero img{width:min(280px,72vw);height:auto;aspect-ratio:1;margin:0 auto;object-fit:contain}
.chero h1{font-family:var(--display);font-weight:700;font-size:clamp(40px,11vw,56px);line-height:1;letter-spacing:-0.02em;margin:8px 0 2px}
.chero .ctitle{font-family:var(--display);font-weight:600;font-size:21px;margin:0 0 8px;color:var(--accent,#8A5A3B)}
.chero .ctag{margin:0;font-weight:700}
.cbody{margin-top:24px}
.cbody > p{margin:0 0 18px}
.others{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin:12px 0 0;padding:0;list-style:none}
.others a{display:block;text-align:center;text-decoration:none;font-family:var(--display);font-weight:600;font-size:13px;color:var(--muted);border-radius:14px;padding:4px 0}
.others img{width:100%;max-width:76px;height:auto;aspect-ratio:1;margin:0 auto;object-fit:contain}
.section-title{font-family:var(--display);font-weight:600;font-size:21px;margin:30px 0 10px}

/* 404 */
.lost{text-align:center;padding-top:20px}
.lost img{width:220px;height:220px;margin:0 auto}
.lost h1{font-family:var(--display);font-weight:700;font-size:40px;margin:8px 0 6px;line-height:1.05}
.lost p{color:var(--muted);margin:0 auto 22px;max-width:36ch}
.lost .actions{display:grid;gap:10px;max-width:360px;margin:0 auto}

/* footer */
.foot{max-width:560px;margin:0 auto;padding:22px 18px 34px;border-top:2px solid var(--line);font-size:14px;color:var(--muted)}
.foot nav{display:flex;flex-wrap:wrap;gap:0 18px;margin-bottom:6px}
.foot nav a{display:inline-flex;align-items:center;min-height:44px;color:var(--ink);font-weight:700;text-decoration:none}
.foot nav a:hover{text-decoration:underline}
.foot p{margin:0 0 6px}
.foot .crisis a{color:var(--ink);font-weight:700}

/* toast */
.toast{position:fixed;left:50%;bottom:calc(24px + env(safe-area-inset-bottom,0px));transform:translate(-50%,20px);background:var(--primary);color:var(--on-primary);padding:10px 18px;border-radius:999px;font-weight:700;font-size:15px;opacity:0;pointer-events:none;transition:opacity .2s ease, transform .2s ease;z-index:10;max-width:calc(100% - 32px);text-align:center}
.toast.on{opacity:1;transform:translate(-50%,0)}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{transition:none !important;animation:none !important}
}
@media (min-width:720px){
  .lineup{flex-wrap:wrap;justify-content:center;overflow:visible;margin:0 -60px 26px;padding:6px 0 10px;max-width:none}
}

/* character colors (same as CH in data-characters.js) */
.c-merribun{--tint:#F6E3CF;--accent:#8B5229;--deep:#3A2618}
.c-bounzy{--tint:#E2F1E3;--accent:#2A6E44;--deep:#183A26}
.c-harkly{--tint:#F5EADB;--accent:#8A5A3B;--deep:#3B2A22}
.c-tallo{--tint:#FCEFCB;--accent:#985E0D;--deep:#3D2A08}
.c-quillo{--tint:#F7E0D8;--accent:#A8442C;--deep:#3E1D14}
.c-wayfin{--tint:#FBE5D3;--accent:#A64B17;--deep:#3F1F0A}
.c-calmo{--tint:#E7E9F1;--accent:#4E5A7E;--deep:#1F2638}
.c-wispen{--tint:#EEE5F6;--accent:#7A4FA0;--deep:#2E1A40}

/* test: hints, halfway note */
.hint{font-size:14px;color:var(--muted);margin:12px 0 0}
.keytip{display:none}
@media (hover:hover) and (pointer:fine){ .keytip{display:block;margin-top:2px} }
.halfway{position:absolute;left:0;right:0;top:-4px;z-index:2;display:flex;align-items:center;gap:10px;background:var(--surface);border:2px dashed var(--line);border-radius:16px;padding:6px 12px;margin:0;font-family:var(--display);font-weight:600;font-size:16px}
.halfway img{width:44px;height:44px;object-fit:contain;flex:0 0 auto}
@media (prefers-reduced-motion: no-preference){ .halfway:not([hidden]){animation:pop .4s ease both} }

/* home: sample card */
.sample{margin:40px 0 0;text-align:center}
.sample .gcard{margin-top:0;text-align:left}
.sample-cap{font-family:var(--display);font-weight:600;font-size:18px;margin:14px 0 0}

#quiz{position:relative}
.screen-pic{width:96px;height:96px;object-fit:contain;margin:0 auto 4px}
.helpline{font-size:14px;color:var(--muted);margin:8px 0 0}
.helpline a{color:var(--ink);font-weight:700}
.link-btn{justify-self:center;text-decoration:underline;text-underline-offset:3px}
/* short screens (small phones, in-app browsers): keep all five answers on screen */
@media (max-height:700px){
  .q{min-height:110px}
  .opts{gap:8px;margin-top:16px}
  .opt{min-height:50px}
  .progress{margin-bottom:16px}
}
