/* Koza amber design tokens + components — from ~/workspace/koza-redesign/
   01-home.html and 02-detail.html (amber direction; *-blue.* are NOT the
   direction). Mock pixels are a 1080-wide phone canvas; sizes here are
   CSS px (≈ mock / 2.6). Served as-is from /styles.css (public/) so the
   SPA and the Worker's server-rendered word pages share one stylesheet. */
:root {
  --bg: #12100e;
  --surface: #1d1a17;
  --surface-2: #211d19;
  --nav: #171310;
  --amber: #f2a93b;
  --amber-deep: #d97e27;
  --amber-gradient: linear-gradient(135deg, #f6c453 0%, #ee9b2e 55%, #de7f24 100%);
  --amber-soft: rgba(242, 169, 59, 0.16);
  --text: #f5f1ea;
  --text-2: #e8e2d8;
  --muted: #a49e94;
  --faint: #7a736a;
  --placeholder: #8b8378;
  --ink: #1a1206;
  --hairline: rgba(255, 255, 255, 0.08);
  --chip-line: rgba(255, 255, 255, 0.16);
  --font-ui: "Inter", system-ui, sans-serif;
  --font-head: "Fraunces", Georgia, serif;
  --font-guj: "Noto Sans Gujarati", sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }
html { color-scheme: dark; overflow-x: clip; }
body { background: var(--bg); color: var(--text); font-family: var(--font-ui); min-height: 100vh; overflow-x: clip; }
/* overflow-x: clip (not hidden) is the safety net for the Community-page
   bug: one wide element widened the layout viewport and cut content off
   the left edge in-app. clip keeps position: sticky working. */
a { color: var(--amber); }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
[hidden] { display: none !important; }
main { max-width: 640px; margin: 0 auto; padding: 20px 20px 120px; }
/* Spacing scale is 4 / 8 / 12 / 16 / 24: one page gutter (20px) and one
   card padding (20px), so body text sits at 20px and card text at 40px
   everywhere — no more 16/18/33/35/36px left edges drifting apart. */
.guj { font-family: var(--font-guj); line-height: 1.7; }
.muted { color: var(--muted); line-height: 1.55; }
.faint { color: var(--faint); font-size: 13px; line-height: 1.5; margin-top: 8px; }
.empty { padding: 18px 0; }
.pad { padding: 0; margin-top: 12px; }
code { font-size: 12px; color: var(--muted); word-break: break-all; }
.label { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; color: var(--placeholder); }

/* Offline banner + toast */
.offline-banner { position: sticky; top: 0; z-index: 30; background: var(--amber); color: var(--ink); text-align: center; font-size: 13px; font-weight: 600; padding: 8px 12px; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); background: var(--surface-2); border: 1px solid var(--hairline); color: var(--text); padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; transition: opacity .18s, transform .18s; pointer-events: none; z-index: 40; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Wordmark + search */
.home-head { display: flex; align-items: center; justify-content: space-between; margin-top: 0; }
.wordmark { font-family: var(--font-head); font-weight: 600; font-size: 34px; letter-spacing: -0.01em; }
.wordmark span { color: var(--amber); }
.search-wrap { position: relative; }
.search { margin-top: 16px; height: 50px; background: var(--surface-2); border: 1px solid rgba(255,255,255,0.09); border-radius: 14px; display: flex; align-items: center; padding: 0 16px; gap: 10px; }
.search:focus-within { border-color: rgba(242,169,59,.55); }
.search input { flex: 1; min-width: 0; background: none; border: none; outline: none; color: var(--text); font-size: 16px; font-family: var(--font-ui); }
.search input::placeholder { color: var(--placeholder); }
.search input::-webkit-search-cancel-button { filter: invert(.6); }
.dropdown { margin-top: 8px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 18px; padding: 8px 16px; }

/* Chips */
.chips { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.chips.recent { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg,#000 85%,transparent 100%); mask-image: linear-gradient(90deg,#000 85%,transparent 100%); }
.chips.recent::-webkit-scrollbar { display: none; }
.chip, .fchip { flex: none; border: 1.5px solid var(--chip-line); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 500; color: var(--text-2); text-decoration: none; background: none; }
.chip:hover, .fchip:hover { border-color: rgba(242,169,59,.6); }
.fchip.root, .root-chip { border-color: rgba(242,169,59,.6); color: var(--amber); }
.root-chip { display: inline-block; border: 1.5px solid; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 8px; margin-right: 6px; vertical-align: 2px; letter-spacing: .04em; }

/* WOTD hero */
.hero { display: block; margin-top: 16px; background: var(--amber-gradient); border-radius: 22px; padding: 20px; color: var(--ink); text-decoration: none; }
.hero .label { color: var(--ink); opacity: .72; }
.hero .word { font-family: var(--font-head); font-weight: 600; font-size: 40px; line-height: 1.05; margin-top: 8px; letter-spacing: -0.01em; word-break: break-word; }
.hero .guj { font-size: 16px; line-height: 1.75; margin-top: 8px; opacity: .92; }
.hero .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; min-height: 4px; }
.hero .pos { background: rgba(26,18,6,.16); border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 600; }

/* Challenge card */
.challenge { margin-top: 16px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 22px; padding: 20px; display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); }
.challenge .txt { flex: 1; }
.challenge .label { color: var(--amber); }
.challenge .title { font-size: 17px; font-weight: 600; margin-top: 4px; letter-spacing: -0.01em; }
.challenge .meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.playbtn { flex: none; width: 50px; height: 50px; border-radius: 50%; background: var(--amber); display: flex; align-items: center; justify-content: center; padding-left: 3px; }

/* Lists */
.section { display: flex; justify-content: space-between; align-items: baseline; margin-top: 24px; }
.section h2 { font-family: var(--font-head); font-weight: 600; font-size: 21px; }
.list { margin-top: 4px; }
.row { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.07); text-decoration: none; color: var(--text); gap: 10px; }
.row:last-child { border-bottom: none; }
.row .w { flex: 1; min-width: 0; }
.row .en { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.row .gu { font-size: 14px; color: var(--muted); margin-top: 2px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.static .gu { white-space: normal; }
.row-wrap { display: flex; align-items: center; border-bottom: 1px solid rgba(255,255,255,.07); }
.row-wrap .row { flex: 1; border-bottom: none; }
.row-wrap .x { width: 36px; height: 36px; color: var(--faint); font-size: 22px; }
.pos-pill { font-size: 11px; font-weight: 600; color: var(--amber); border: 1.5px solid rgba(242,169,59,.5); border-radius: 999px; padding: 3px 9px; flex: none; }
.badge { font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--chip-line); border-radius: 999px; padding: 3px 9px; flex: none; }
.chev { color: var(--faint); font-size: 18px; flex: none; }
.root-row { background: rgba(242,169,59,.06); border-radius: 12px; padding-left: 8px; padding-right: 8px; margin-left: -8px; margin-right: -8px; }

/* Community teaser */
.comm { margin-top: 16px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 18px; padding: 16px 20px; display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.comm-ic { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--amber-soft); color: var(--amber); display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700; }
.comm-txt { flex: 1; }
.comm-t { font-size: 15px; font-weight: 600; }
.comm-m { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.comm-go { color: var(--amber); font-size: 14px; font-weight: 600; flex: none; }

/* Cards, buttons */
.card { margin-top: 16px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 18px; padding: 20px; }
.card .label { color: var(--amber); }
.card p { color: var(--muted); margin-top: 8px; line-height: 1.6; }
.card h2 { font-family: var(--font-head); font-weight: 600; font-size: 24px; margin-top: 8px; }
.btn-primary { display: flex; align-items: center; justify-content: center; height: 50px; background: var(--amber); color: var(--ink); border-radius: 999px; font-weight: 700; font-size: 15px; text-decoration: none; }
.btn-primary.small { height: 40px; padding: 0 20px; font-size: 14px; display: inline-flex; margin-top: 10px; }
.btn-ghost { border: 1.5px solid var(--chip-line); border-radius: 999px; padding: 9px 16px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.btn-ghost.small { padding: 6px 12px; font-size: 13px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.site-foot { margin-top: 24px; color: var(--faint); font-size: 13px; line-height: 1.6; }

/* Bottom nav (Home / Favourites / History / Settings) */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--nav); border-top: 1px solid var(--hairline); display: flex; justify-content: space-around; padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--placeholder); font-size: 11px; font-weight: 500; text-decoration: none; width: 76px; }
.nav-item .pill { border-radius: 999px; padding: 4px 16px; display: flex; }
.nav-item.on { color: var(--amber); }
.nav-item.on .pill { background: var(--amber-soft); }

/* Tab pages */
.page-title { font-family: var(--font-head); font-weight: 600; font-size: 30px; margin-top: 8px; }
.title-row { display: flex; align-items: center; justify-content: space-between; }
/* Segmented tabs that wrap: five community tabs (~490px as one pill row)
   overflowed a 390px phone and widened the whole layout viewport, which
   cut content off the left edge in-app. Individual pills wrap to two rows
   instead, so every tab stays visible and nothing overflows. */
.seg { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.seg a { padding: 7px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--hairline); }
.seg a.on { background: var(--amber); border-color: transparent; color: var(--ink); }
.add-word input { display: block; width: 100%; margin-top: 12px; height: 44px; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 12px; padding: 0 12px; color: var(--text); font-size: 15px; }
.setting p { color: var(--text-2); }
.toggle { display: flex; gap: 12px; align-items: flex-start; line-height: 1.5; }
.toggle input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--amber); flex: none; }
.toggle .muted { font-size: 13px; }

/* Word page (mock 02-detail) */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.topbar .right { display: flex; gap: 8px; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--hairline); display: flex; align-items: center; justify-content: center; color: var(--text); }
.iconbtn.on { color: var(--amber); }
.iconbtn.on svg path { fill: var(--amber); }
.headword { font-family: var(--font-head); font-weight: 600; font-size: 50px; line-height: 1.02; letter-spacing: -0.02em; margin-top: 24px; word-break: break-word; }
.headword.small { font-size: 36px; }
.sub { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.sub .pos { background: var(--amber); color: var(--ink); border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 700; }
.translit { font-size: 19px; color: var(--amber); line-height: 1.4; }
.root-note { margin-top: 16px; color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.actions { display: flex; gap: 7px; margin-top: 16px; }
.act { flex: 1; height: 42px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 999px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); min-width: 0; }
.act.on { color: var(--amber); border-color: rgba(242,169,59,.5); }
.status-line { min-height: 18px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.hairline { height: 1px; background: var(--hairline); margin: 16px 0; }
.sense { display: flex; gap: 13px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.sense:last-of-type { border-bottom: none; }
.num { font-family: var(--font-head); font-weight: 600; font-size: 18px; color: var(--amber); line-height: 1.5; min-width: 14px; }
.sense .gu { font-family: var(--font-guj); font-size: 18px; line-height: 1.7; }
.sense .tap { color: inherit; text-decoration: none; border-bottom: 1.5px dotted rgba(242,169,59,.75); }
.example { margin-top: 24px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 18px; padding: 20px; }
.example .label { color: var(--amber); }
.example .sent { font-family: var(--font-head); font-style: italic; font-weight: 500; font-size: 19px; line-height: 1.45; margin-top: 8px; }
.example[data-state="pending"] .sent, .example[data-state="cached_only"] .sent, .example[data-state="error"] .sent { font-size: 15px; color: var(--muted); }
.example .note { color: var(--muted); font-size: 14px; margin-top: 8px; line-height: 1.55; }
.example .note:empty { display: none; }
.chiplabel { margin-top: 24px; }
.app-links { margin-top: 24px; }
.app-links .get { display: block; text-align: center; margin-top: 12px; font-weight: 600; font-size: 14px; }
.notfound .list { margin-top: 6px; }
.request { margin-top: 24px; }

@media (min-width: 720px) {
  main { padding-top: 32px; }
  .wordmark { font-size: 40px; }
  .hero .word { font-size: 52px; }
  .headword { font-size: 64px; }
}

/* Home columns wrapper: display:contents below desktop, so the mobile
   order (hero, challenge, trending, community, footer) is untouched. */
.home-cols, .home-main, .home-side { display: contents; }

/* Desktop: a real layout, not a stretched phone column. Text pages get a
   720px reading column; home gets a two-column grid (main + sticky
   sidebar); type scales up; the bottom nav clusters instead of spanning
   the whole screen. */
@media (min-width: 1024px) {
  main { max-width: 720px; }
  main.home { max-width: 1060px; }
  .wordmark { font-size: 44px; }
  .hero { padding: 28px 32px; }
  .hero .word { font-size: 60px; }
  .hero .guj { font-size: 18px; }
  .headword { font-size: 72px; }
  .headword.small { font-size: 44px; }
  .page-title { font-size: 36px; }
  .section h2 { font-size: 24px; }
  .card h2 { font-size: 28px; }
  .q-prompt { font-size: 36px; }
  .a-prompt { font-size: 30px; }
  .result-score { font-size: 56px; }
  .room-code { font-size: 56px; }
  .example .sent { font-size: 21px; }
  .bottom-nav { justify-content: center; gap: 64px; }
  .home-cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 0 32px; align-items: start; }
  .home-main { display: block; min-width: 0; }
  .home-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 24px; min-width: 0; }
  .home-side .comm { margin-top: 0; }
  .home-side .site-foot { margin-top: 0; background: var(--surface); border: 1px solid var(--hairline); border-radius: 18px; padding: 16px 20px; }
}

/* Hover feedback, pointer devices only (no sticky hover on touch). */
@media (hover: hover) {
  .row:hover .en { color: var(--amber); }
  .row:hover .chev { color: var(--amber); }
  .comm:hover, .challenge:hover { border-color: rgba(242,169,59,.45); }
  .hero:hover { filter: brightness(1.04); }
  .btn-primary:hover { filter: brightness(1.08); }
  .btn-ghost:hover { border-color: rgba(242,169,59,.6); color: var(--text); }
  .seg a:hover:not(.on) { color: var(--text); border-color: rgba(255,255,255,.3); }
  .iconbtn:hover { border-color: rgba(242,169,59,.6); color: var(--amber); }
  .nav-item:hover { color: var(--text-2); }
  .act:hover { border-color: rgba(242,169,59,.5); color: var(--text); }
}

/* Job 3 — challenge, quiz, practice (amber, mock 03-challenge) */
.q-prompt { font-family: var(--font-head); font-weight: 600; font-size: 30px; line-height: 1.2; margin-top: 12px; word-break: break-word; }
.a-prompt { font-family: var(--font-head); font-weight: 600; font-size: 26px; line-height: 1.3; margin-top: 12px; word-break: break-word; }
.opts { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.opt { min-height: 48px; background: var(--surface-2); border: 1.5px solid var(--hairline); border-radius: 14px; padding: 12px 16px; font-size: 15px; font-weight: 500; color: var(--text-2); text-align: left; }
.opt:hover:not(:disabled) { border-color: rgba(242,169,59,.6); }
.opt.picked { border-color: var(--amber); background: var(--amber-soft); color: var(--text); }
.opt.right { border-color: var(--amber); background: var(--amber-soft); color: var(--text); }
.opt.wrong { border-color: #c05a4e; color: #e8a49c; }
.opt:disabled { opacity: .75; cursor: default; }
.result-score { font-family: var(--font-head); font-weight: 600; font-size: 46px; margin-top: 8px; }
.marks { font-size: 14px; color: var(--muted); margin-top: 8px; }
.name-form input { display: block; width: 100%; margin-top: 12px; height: 44px; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 12px; padding: 0 12px; color: var(--text); font-size: 15px; }
.name-form input:focus { outline: none; border-color: rgba(242,169,59,.55); }
.name-error { color: #e8a49c; font-size: 13px; margin-top: 8px; }
.brow { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.06); gap: 10px; }
.brow:last-child { border-bottom: none; }
.brow .rank { flex: none; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: rgba(255,255,255,.09); color: var(--text-2); }
.brow .rank.gold { background: rgba(242,169,59,.2); color: var(--amber); }
.brow .rank.silver { background: rgba(255,255,255,.09); color: #d8d2c8; }
.brow .rank.bronze { background: rgba(217,126,39,.18); color: #e0913f; }
.brow .name { flex: 1; font-size: 15px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .score { font-size: 13px; color: var(--muted); font-weight: 600; flex: none; }
.brow.you { background: rgba(242,169,59,.08); border: 1.5px solid rgba(242,169,59,.45); border-radius: 14px; padding: 12px 10px; margin: 4px -10px 8px; }
.brow.you .name { color: var(--amber); }
.brow.you .score { color: var(--amber); }
.flashcard { text-align: left; }
.flashcard .q-prompt { margin-top: 14px; }
#pr-typed { display: flex; gap: 8px; margin-top: 16px; }
#pr-typed input { flex: 1; min-width: 0; height: 44px; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 12px; padding: 0 12px; color: var(--text); font-size: 15px; }
#pr-typed input:focus { outline: none; border-color: rgba(242,169,59,.55); }
details.card summary { list-style: none; }
details.card summary::-webkit-details-marker { display: none; }

/* Job 5 — live rooms: the six-letter code, large and letter-spaced. */
.room-code{font-family:Fraunces,Georgia,serif;font-size:44px;letter-spacing:8px;text-align:center;color:var(--amber);margin:12px 0 4px}
