/* Aarya's Portal — design tokens from API_CONTRACT §1 / writing spec v5 §1 / spelling spec v4 §1 */
:root{
  --paper:#f4f1ea; --card:#fffdf7; --track:#ece7da; --ink:#1a2420; --dim:#5d6c64;
  --border:#ddd6c6; --teal:#0b6e5d; --teal-strong:#084c40; --teal-soft:#dcefe9;
  --gold:#c08a1e; --gold-soft:#f6ecd4; --rose:#be3a4b; --rose-soft:#f9e3e6;
  --amber:#b45309; --hero:#0d3b34; --hero-text:#f3efe4; --hero-muted:#a9c6bd;
  --radius:14px;
  --shadow:0 1px 2px rgba(26,36,32,.06),0 10px 28px -14px rgba(26,36,32,.28);
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--paper);color:var(--ink);font-family:Sora,system-ui,-apple-system,sans-serif;font-size:16px;line-height:1.5}
h1,h2,h3,.serif{font-family:Newsreader,Georgia,serif}
h2{font-size:24px;margin:0 0 12px}
h3{font-size:20px;margin:0 0 8px}
a{color:var(--teal)}
button{font-family:inherit;cursor:pointer}
input,select,textarea{font-family:inherit;font-size:16px;color:var(--ink)}
.app{max-width:1100px;margin:0 auto;padding:16px 16px 48px}
.loading{color:var(--dim);padding:40px;text-align:center}
.muted{color:var(--dim)} .dim{color:var(--dim);font-size:12px}
.small{font-size:12px} .tiny{font-size:11px}
.label{font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--dim)}
.empty{color:var(--dim);font-style:italic;padding:12px 0}
.card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:16px;margin-bottom:16px}
.card h2{margin-top:0}
.btn{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:10px 18px;border-radius:999px;border:1px solid transparent;font-weight:700;font-size:15px;text-decoration:none}
.btn-teal{background:var(--teal);color:#fff}
.btn-gold{background:var(--gold);color:#fff}
.btn-outline{background:transparent;border-color:var(--border);color:var(--ink)}
.btn-rose{background:var(--rose);color:#fff}
.btn-block{width:100%}
.btn-sm{min-height:36px;padding:6px 12px;font-size:14px}
.btn:disabled{opacity:.55;cursor:default}
.btn-link{background:none;border:none;color:var(--teal);font-weight:600;padding:4px 0;text-decoration:underline}
/* top nav */
.topnav{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:16px}
.topnav .brand{font-family:Newsreader,Georgia,serif;font-size:22px;font-weight:700;margin-right:8px}
.topnav a.navlink{padding:8px 14px;border-radius:999px;text-decoration:none;color:var(--ink);border:1px solid var(--border);background:var(--card);font-weight:600;font-size:14px}
.topnav a.navlink.active{background:var(--ink);color:#fff;border-color:var(--ink)}
.topnav .spacer{flex:1}
/* hero */
.hero{background:var(--hero);color:var(--hero-text);border-radius:var(--radius);padding:24px;position:relative;overflow:hidden;margin-bottom:16px;box-shadow:var(--shadow)}
.hero::before,.hero::after{content:"";position:absolute;border:1px solid rgba(243,239,228,.18);border-radius:50%}
.hero::before{width:220px;height:220px;top:-90px;right:-40px}
.hero::after{width:150px;height:150px;bottom:-80px;right:120px}
.hero .dateline{font-family:Newsreader,Georgia,serif;font-style:italic;color:var(--hero-muted)}
.hero h1{font-size:36px;line-height:1.1;margin:6px 0 8px}
@media(min-width:640px){.hero h1{font-size:48px}}
.hero .summary{color:var(--hero-text)}
.hero .summary b{color:#e8c97a}
.hero .hero-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px;position:relative;z-index:1}
.hero .ringwrap{position:absolute;top:20px;right:20px;display:none}
@media(min-width:640px){.hero .ringwrap{display:block}}
/* tiles */
.tiles{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:16px}
@media(min-width:900px){.tiles{grid-template-columns:repeat(4,1fr)}}
.tile{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:14px}
.tile .value{font-size:30px;font-weight:800;line-height:1.1}
.tile .value.gold{color:var(--gold)}
.tile .hint{font-size:12px;color:var(--dim);margin-top:4px}
/* layout */
.layout{display:flex;flex-direction:column;gap:0}
@media(min-width:900px){.layout{flex-direction:row;gap:20px}.layout .main{flex:1;min-width:0}.layout .sidebar{width:320px;flex-shrink:0}}
.sidebar .card{padding:16px}
.nudge{border-left:4px solid var(--border)}
.nudge.rose{border-left-color:var(--rose)} .nudge.gold{border-left-color:var(--gold)} .nudge.teal{border-left-color:var(--teal)}
/* pills */
.pill{display:inline-block;padding:2px 10px;border-radius:999px;font-size:12px;font-weight:700;white-space:nowrap}
.pill-fiction{background:var(--teal-soft);color:var(--teal-strong)}
.pill-nonfiction{background:var(--gold-soft);color:var(--amber)}
.pill-teal{background:var(--teal-soft);color:var(--teal-strong)}
.pill-gold{background:var(--gold-soft);color:var(--amber)}
.pill-rose{background:var(--rose-soft);color:var(--rose)}
.pill-dim{background:var(--track);color:var(--dim)}
.pill-ink{background:var(--ink);color:#fff}
.filterrow{display:flex;gap:8px;flex-wrap:wrap;margin:8px 0}
.filterrow .pill{cursor:pointer;border:1px solid var(--border);background:var(--card);color:var(--ink);padding:6px 12px}
.filterrow .pill.on{background:var(--ink);color:#fff;border-color:var(--ink)}
/* rows */
.row{display:flex;gap:12px;align-items:flex-start;padding:12px 0;border-top:1px solid var(--border)}
.row:first-of-type{border-top:none}
.row .grow{flex:1;min-width:0}
.row .title{font-size:16px;font-weight:600}
.row .notes{color:var(--dim);font-size:14px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.check{width:36px;height:36px;flex-shrink:0;border-radius:50%;border:2px solid var(--border);background:#fff;font-size:18px;line-height:1;color:var(--teal)}
.check.done{background:var(--teal);border-color:var(--teal);color:#fff}
.check.gold{border-color:var(--gold);color:var(--gold)}
/* stepper dots */
.stepper{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:8px 0}
.stepper .st{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:600;color:var(--dim)}
.stepper .dot{width:14px;height:14px;border-radius:50%;border:2px solid var(--border);background:#fff;display:inline-block}
.stepper .st.done .dot{background:var(--teal);border-color:var(--teal)}
.stepper .st.done{color:var(--teal)}
.stepper .st.now .dot{border-color:var(--gold);background:var(--gold-soft);box-shadow:0 0 0 3px var(--gold-soft)}
.stepper .st.now{color:var(--amber)}
.stepper .st.bad .dot{border-color:var(--rose);background:var(--rose-soft)}
.stepper .st.bad{color:var(--rose)}
/* progress */
.bar{height:6px;background:var(--track);border-radius:999px;overflow:hidden}
.bar>i{display:block;height:100%;background:var(--teal);border-radius:999px}
.bar.gold>i{background:var(--gold)}
.barwrap{margin:8px 0}
/* week strip */
.weekstrip{display:grid;grid-template-columns:repeat(7,1fr);gap:6px;margin-bottom:12px}
.weekcell{background:var(--card);border:1px solid var(--border);border-radius:10px;padding:8px 4px;text-align:center}
.weekcell.today{border-color:var(--teal);background:var(--teal-soft)}
.weekcell .wd{font-size:10px;text-transform:uppercase;color:var(--dim)}
.weekcell .dn{font-size:18px;font-weight:700;font-family:Sora,sans-serif}
.weekcell .ct{font-size:11px;color:var(--teal);font-weight:600}
/* forms */
.field{margin-bottom:12px}
.field label{display:block;font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--dim);margin-bottom:4px}
.field input,.field select,.field textarea{width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:#fff}
.field textarea{min-height:110px;resize:vertical}
.formrow{display:flex;gap:10px;flex-wrap:wrap}.formrow .field{flex:1;min-width:140px}
.search{width:100%;padding:10px 14px;border:1px solid var(--border);border-radius:12px;background:#fff;box-shadow:var(--shadow);margin:8px 0}
details.finished summary{cursor:pointer;font-family:Newsreader,Georgia,serif;font-size:20px}
/* word cards / visuals */
.wordcard{border:1px solid var(--border);border-radius:12px;padding:14px;margin-bottom:12px;background:#fff}
.wordcard .w{font-family:Newsreader,Georgia,serif;font-size:22px;font-weight:700}
.wordvisual{max-width:220px;width:100%;height:auto;border:1px solid var(--border);border-radius:12px;background:#fff}
.visual-placeholder{border:1px dashed var(--border);border-radius:12px;padding:16px;color:var(--dim);font-style:italic;max-width:220px}
.feedback{border:1px solid var(--border);border-radius:12px;padding:12px;margin:10px 0;background:#fff}
.feedback .fb-label{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--dim)}
.feedback.verified{border-left:4px solid var(--teal)}
.feedback.needs{border-left:4px solid var(--rose)}
.tryagain{border:1px solid var(--rose);background:var(--rose-soft);border-radius:var(--radius);padding:16px;margin-bottom:16px}
.tryagain h2{color:var(--rose)}
/* clock */
.clockwrap{display:flex;flex-direction:column;align-items:center;gap:12px}
.clockface{width:min(320px,86vw);height:auto}
.stepperbtns{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}
.stepperbtns button{min-width:44px;min-height:44px;border-radius:10px;border:1px solid var(--border);background:#fff;font-weight:700}
/* gate */
.gate{max-width:440px;margin:60px auto}
.gate .card{padding:28px;text-align:center}
.passcode{display:flex;gap:10px;justify-content:center;margin:16px 0}
.passcode input{width:52px;height:60px;text-align:center;font-size:28px;font-weight:700;border:1px solid var(--border);border-radius:12px}
.gate input.single{width:100%;text-align:center;font-size:24px;letter-spacing:.4em;padding:12px;border:1px solid var(--border);border-radius:12px}
.error{color:var(--rose);font-weight:600}
.success{color:var(--teal);font-weight:600}
/* misc */
.dots{display:flex;gap:5px;flex-wrap:wrap;margin:8px 0}
.dots i{width:12px;height:12px;border-radius:50%;background:var(--track);display:inline-block}
.dots i.teal{background:var(--teal)} .dots i.gold{background:var(--gold)} .dots i.hollow{background:#fff;border:2px solid var(--border)} .dots i.grey{background:#e3ded0}
.badges{display:flex;gap:8px;flex-wrap:wrap}
.badge{padding:6px 12px;border-radius:999px;background:var(--gold-soft);color:var(--amber);font-weight:700;font-size:13px}
.badge.dim{background:var(--track);color:var(--dim)}
.bignums{display:flex;gap:18px;flex-wrap:wrap;margin:10px 0}
.bignums .bn .v{font-family:Newsreader,Georgia,serif;font-size:30px;font-weight:700}
.bignums .bn .l{font-size:12px;color:var(--dim);text-transform:uppercase;letter-spacing:.06em}
table.log{width:100%;border-collapse:collapse;font-size:14px}
table.log th,table.log td{padding:6px 4px;border-bottom:1px solid var(--border);text-align:left}
.chart{display:flex;align-items:flex-end;gap:8px;height:120px;padding-top:18px;position:relative}
.chart .cb{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%}
.chart .cb i{width:70%;background:var(--teal);border-radius:4px 4px 0 0;display:block}
.chart .cb.best i{background:var(--gold)}
.chart .cb span{font-size:11px;color:var(--dim);margin-top:4px}
.goalline{font-size:12px;color:var(--amber);font-weight:700}
details>summary{cursor:pointer}
.kv{display:flex;justify-content:space-between;gap:10px;padding:6px 0;border-bottom:1px solid var(--border);font-size:14px}
.kv:last-child{border-bottom:none}
@media (prefers-color-scheme: dark){
  :root{--paper:#171a18;--card:#222723;--track:#333a35;--ink:#eef2ee;--dim:#a7b3ab;--border:#3a423d;--teal-soft:#143f37;--gold-soft:#4a3a14;--rose-soft:#4a2027;--hero:#0d3b34}
  .wordcard,.field input,.field select,.field textarea,.search,.check{background:#2a302b}
  .weekcell{background:var(--card)}
}
