:root {
  /* Itanile brand: forest green and the logo's gold, Cardo serif (as on itanile.org) */
  --paper: #F5F6F1;
  --surface: #FFFFFF;
  --ink: #1C2520;
  --brand: #29513A;
  --brand-2: #2F6447;
  --muted: #5D6A62;
  --line: #DCE3DA;
  --gold: #DE9907;
  --gold-ink: #2B1D00;
  --money: #1E7A4C;
  --danger: #B3261E;
  --tint: #E8EFE7;
  --shelf: #C9D3C8;
  --bar: #FFFFFF;

  --serif: 'Cardo', Georgia, 'Times New Roman', serif;
  --ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;

  --r-cover: 3px;
  --r-control: 10px;
  --r-panel: 14px;
  --gutter: 16px;
  --tabbar: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121915;
    --surface: #1A231E;
    --ink: #E8EEE9;
    --muted: #A3B0A7;
    --line: #2C3A31;
    --brand-2: #8CC7A1;
    --tint: #203028;
    --money: #6FD3A0;
    --danger: #FF8A80;
    --shelf: #0C110E;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --paper: #121915;
    --surface: #1A231E;
    --ink: #E8EEE9;
    --muted: #A3B0A7;
    --line: #2C3A31;
    --brand-2: #8CC7A1;
    --tint: #203028;
    --money: #6FD3A0;
    --danger: #FF8A80;
    --shelf: #0C110E;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--ui);
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-2); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--gold-ink); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ header */
/* The bar stays white in both themes so the gold logo always reads correctly. */
.top {
  background: var(--bar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--gutter);
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 3px solid var(--gold);
  box-shadow: inset 0 -3px 0 var(--brand);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { height: 38px; width: auto; }
.brand-sub { font: italic 400 1.15rem/1 var(--serif); color: #29513A; padding-left: 10px; border-left: 1px solid #C9D3C8; }
.nav { display: none; gap: 2px; }
.nav a { color: #29513A; text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: .95rem; }
.nav a:hover { background: #E8EFE7; }
.nav a[aria-current="page"] { background: #29513A; color: #fff; }

/* ------------------------------------------------------------- tab bar */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tabbar); text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600; white-space: nowrap;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tabbar a[aria-current="page"] { color: var(--brand-2); }
.tabbar a[aria-current="page"] svg { stroke-width: 2.4; }

@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .nav { display: flex; }
  :root { --gutter: 32px; }
}

/* -------------------------------------------------------------- layout */
main { max-width: 1180px; margin: 0 auto; padding: 24px var(--gutter) 48px; outline: none; }
main:focus, main:focus-visible { outline: none; }
.narrow { max-width: 640px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; letter-spacing: -0.005em; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(1.85rem, 1.3rem + 2.4vw, 2.85rem); }
h2 { font-size: 1.45rem; margin-top: 1.8em; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; max-width: 68ch; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }

/* --------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: var(--r-control);
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--brand-2); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--brand-2); padding-inline: 8px; }
.btn.danger { color: var(--danger); }
.linklike { border: 0; background: none; padding: 0; color: var(--brand-2); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.block { width: 100%; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.input, select.input {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-control); background: var(--surface);
}
.input:focus { border-color: var(--brand-2); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 25%, transparent); }
.hint { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.error { color: var(--danger); font-weight: 600; margin: 0 0 12px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 20px; }
.panel + .panel { margin-top: 16px; }

/* ----------------------------------------------------------------- library */
.hero { margin: 4px 0 20px; }
.hero h1 { max-width: 18ch; }
.search { position: relative; max-width: 560px; }
.search .input { padding-left: 44px; border-radius: 999px; }
.search svg { position: absolute; left: 15px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding-inline: var(--gutter); }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: .9rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 24px 16px; margin-top: 16px; }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 32px 24px; } }
.book { text-decoration: none; color: inherit; display: block; }
.cover {
  aspect-ratio: 2 / 3; border-radius: var(--r-cover); overflow: hidden; background: var(--tint);
  box-shadow: 0 1px 0 var(--line), 3px 4px 0 -1px color-mix(in srgb, var(--brand) 18%, transparent);
  position: relative;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .blank {
  position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 12px;
  background: var(--brand); color: #fff; font: 600 1rem/1.2 var(--serif);
  background-image: repeating-linear-gradient(135deg, transparent 0 10px, rgba(222,153,7,.28) 10px 12px);
}
.book .title { font: 700 1.02rem/1.25 var(--serif); margin-top: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book .by { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.book .bar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.book .bar span { display: block; height: 100%; background: var(--gold); }
.book:hover .title { text-decoration: underline; text-underline-offset: 3px; }

.shelf-row { display: grid; grid-auto-flow: column; grid-auto-columns: 120px; gap: 14px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }

/* A shelf: covers stand on a ledge, titles sit beneath it */
.shelf { margin-top: 30px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.shelf-head h2 { margin: 0 0 14px; }
.shelf-head a { font-weight: 600; font-size: .92rem; white-space: nowrap; }
.ledge {
  --cw: 108px;
  --ch: calc(var(--cw) * 1.5);
  display: grid; grid-auto-flow: column; grid-auto-columns: var(--cw); gap: 18px;
  overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter) 8px;
  background:
    linear-gradient(var(--shelf), var(--shelf)) 0 var(--ch) / 100% 9px no-repeat,
    linear-gradient(rgba(0,0,0,.10), transparent) 0 calc(var(--ch) + 9px) / 100% 8px no-repeat;
}
.ledge::-webkit-scrollbar { display: none; }
.ledge .book .title { margin-top: 22px; font-size: .95rem; }
.ledge .cover { box-shadow: 4px 0 0 -1px rgba(0,0,0,.08), 0 6px 10px -6px rgba(0,0,0,.45); }
@media (min-width: 760px) { .ledge { --cw: 132px; gap: 26px; margin: 0; padding-inline: 0; } }

/* Reading room */
.hello { font: italic 400 1.15rem/1.3 var(--serif); color: var(--muted); margin: 0 0 6px; }
.now {
  display: grid; grid-template-columns: 104px 1fr; gap: 18px; align-items: center;
  background: var(--brand); color: #fff; border-radius: var(--r-panel); padding: 18px;
  text-decoration: none; position: relative; overflow: hidden;
}
.now::after {
  content: ''; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%;
  background: repeating-linear-gradient(135deg, transparent 0 9px, rgba(222,153,7,.22) 9px 11px);
  pointer-events: none;
}
.now .cover { box-shadow: 0 8px 18px -6px rgba(0,0,0,.6); }
.now-label { font: italic 400 1rem/1.2 var(--serif); color: #F3D58E; margin: 0 0 4px; }
.now h2 { color: #fff; margin: 0 0 4px; font-size: clamp(1.35rem, 1.1rem + 1.2vw, 1.9rem); }
.now .by { color: #D7E3DA; margin: 0 0 14px; }
.meter { height: 6px; border-radius: 3px; background: rgba(255,255,255,.18); overflow: hidden; margin-bottom: 8px; max-width: 360px; }
.meter span { display: block; height: 100%; background: var(--gold); }
.now .small { color: #D7E3DA; margin: 0 0 14px; }
.now .btn.primary { position: relative; z-index: 1; }
@media (min-width: 760px) { .now { grid-template-columns: 150px 1fr; padding: 26px 30px; gap: 30px; } }
.also { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.also a { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-control); padding: 8px 12px 8px 8px; min-width: 0; max-width: 100%; }
.also .cover { width: 34px; flex: none; }
.also b { font: 700 .95rem/1.2 var(--serif); display: block; }
.also span { font-size: .82rem; color: var(--muted); }

.week { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.week-days { display: flex; gap: 8px; }
.week-day { display: grid; justify-items: center; gap: 4px; font-size: .74rem; color: var(--muted); }
.week-day i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: block; }
.week-day.read i { background: var(--gold); border-color: var(--gold); }
.week-day.today { color: var(--ink); font-weight: 700; }
.week p { margin: 0; font-size: .92rem; }

.welcome { display: grid; gap: 22px; align-items: center; padding: 8px 0 4px; }
.welcome h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.4rem); margin-bottom: .3em; }
.welcome p { font-size: 1.08rem; }
.open-book { display: none; }
@media (min-width: 760px) {
  .welcome { grid-template-columns: 1.1fr 1fr; gap: 48px; }
  .open-book { display: flex; justify-content: center; align-items: flex-end; gap: 0; perspective: 900px; }
  .open-book .cover { width: 150px; }
  .open-book .cover:nth-child(1) { transform: rotate(-6deg) translateY(10px); z-index: 1; }
  .open-book .cover:nth-child(2) { transform: translateY(-8px); z-index: 2; margin: 0 -18px; width: 170px; }
  .open-book .cover:nth-child(3) { transform: rotate(6deg) translateY(10px); z-index: 1; }
}
.empty { padding: 32px 20px; border: 1.5px dashed var(--line); border-radius: var(--r-panel); text-align: center; color: var(--muted); }
.empty p { margin-inline: auto; }

/* --------------------------------------------------------------- book page */
.detail { display: grid; gap: 24px; }
.detail .cover { max-width: 160px; }
@media (min-width: 760px) { .detail { grid-template-columns: 260px 1fr; gap: 48px; align-items: start; } .detail .cover { max-width: none; } }
.detail .desc { font-family: var(--serif); line-height: 1.7; white-space: pre-line; }
.byline { font: italic 400 1.3rem/1.3 var(--serif); color: var(--brand-2); margin: -4px 0 10px; }
.progress-line { display: grid; gap: 6px; margin: 0 0 18px; max-width: 360px; }
.progress-line .meter { background: var(--line); margin: 0; }
.facts { display: flex; gap: 20px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; margin: 4px 0 20px; }

/* ----------------------------------------------------------- earn + tables */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 16px; }
.stat { min-width: 0; }
.stat b { display: block; font: 700 clamp(1.3rem, 1rem + 1.6vw, 1.6rem)/1.1 var(--serif); overflow-wrap: anywhere; }
.stat span { color: var(--muted); font-size: .88rem; }
.stat.money b { color: var(--money); }
.linkbox { display: flex; gap: 8px; flex-wrap: wrap; }
.linkbox .input { flex: 1 1 220px; }
.linkbox .input { font-size: .9rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--tint); color: var(--brand-2); }
.pill.paid { background: color-mix(in srgb, var(--money) 15%, transparent); color: var(--money); }
.pill.failed { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.switch { width: 46px; height: 28px; border-radius: 999px; border: 0; background: var(--line); position: relative; cursor: pointer; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: translate .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch[aria-checked="true"] { background: var(--money); }
.switch[aria-checked="true"]::after { translate: 18px 0; }

.plan { display: flex; align-items: baseline; gap: 6px; margin: 4px 0 12px; }
.plan b { font: 700 2.1rem/1 var(--serif); }

@media (max-width: 640px) {
  .payouts table, .payouts tbody, .payouts tr, .payouts td { display: block; }
  .payouts thead { display: none; }
  .payouts tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .payouts td { border: 0; padding: 3px 0; text-align: left; }
  .payouts td .row { justify-content: flex-start !important; margin-top: 6px; }
}

/* ----------------------------------------------------------------- reader */
body.reading { padding-bottom: 0; overflow: hidden; }
body.reading .top, body.reading .tabbar { display: none; }
body.reading main { max-width: none; padding: 0; }
.reader { position: fixed; inset: 0; background: #1E2722; display: flex; flex-direction: column; color: #fff; touch-action: pan-y pinch-zoom; }
.reader.dim { background: #000; }
.reader-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: rgba(24,46,33,.95); transition: translate .2s, opacity .2s; z-index: 2;
}
.reader-bar .t { flex: 1; min-width: 0; font: 600 .95rem/1.2 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn:hover { background: rgba(255,255,255,.1); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.reader-stage { flex: 1; overflow: auto; display: flex; align-items: flex-start; justify-content: center; position: relative; -webkit-overflow-scrolling: touch; }
.reader-stage canvas { background: #fff; box-shadow: 0 4px 24px rgba(0,0,0,.35); margin: 12px auto; display: block; }
.reader.dim canvas { filter: invert(.92) hue-rotate(180deg); }
.reader-foot {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: rgba(24,46,33,.95); font-size: .85rem; transition: translate .2s, opacity .2s;
}
.reader-foot input[type=range] { flex: 1; accent-color: var(--gold); }
.reader-foot .icon-btn { width: 40px; height: 40px; }
.reader-foot .pos { min-width: 64px; text-align: center; }
.reader-foot .icon-btn[data-act=prev], .reader-foot .icon-btn[data-act=next] { background: rgba(255,255,255,.08); }
.reader [hidden] { display: none !important; }
.speak-bar { display: flex; gap: 10px; align-items: center; padding: 8px 14px; background: rgba(24,46,33,.95); font-size: .8rem; border-top: 1px solid rgba(255,255,255,.1); }
.speak-bar select { background: #1E2722; color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 6px; min-width: 0; font: inherit; }
.speak-bar .voice { flex: 1; }
.icon-btn[aria-pressed=true] { background: rgba(224,164,0,.35); }
.reader .counted { position: absolute; left: 0; right: 0; bottom: 120px; text-align: center; pointer-events: none; }
.reader-toast { position: absolute; left: 50%; bottom: 140px; translate: -50% 0; background: rgba(0,0,0,.85); padding: 10px 16px; border-radius: 10px; z-index: 5; font-size: .85rem; max-width: 90%; }
.reader.immersive .speak-bar { display: none; }
.reader.immersive .reader-bar { translate: 0 -100%; opacity: 0; pointer-events: none; }
.reader.immersive .reader-foot { translate: 0 100%; opacity: 0; pointer-events: none; }
.reader .loading { margin: auto; text-align: center; color: #CFE0D4; padding: 40px 20px; }
.reader .counted { color: #CFE0D4; font-size: .78rem; }
.zone { position: absolute; top: 0; bottom: 0; width: 28%; z-index: 1; }
.zone.prev { left: 0; }
.zone.next { right: 0; }

/* --------------------------------------------------------- confirm box */
.ask { position: fixed; inset: 0; z-index: 70; background: color-mix(in srgb, var(--brand) 55%, transparent); display: grid; place-items: center; padding: 16px; }
.ask-box { background: var(--surface); color: var(--ink); border-radius: var(--r-panel); padding: 22px; max-width: 420px; width: 100%; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.ask-box p { font-weight: 600; margin-bottom: 18px; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); translate: -50% 20px;
  background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 12px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, translate .2s; z-index: 60; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; translate: -50% 0; }
@media (min-width: 760px) { .toast { bottom: 24px; } }

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

/* ------------------------------------------------- events and rewards */
.tabbar a, .nav a { position: relative; }
.dot { position: absolute; top: 6px; left: calc(50% + 8px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--gold); color: var(--gold-ink); font: 700 .65rem/16px system-ui, sans-serif; text-align: center; font-style: normal; }
.nav a .dot { position: static; display: inline-block; margin-left: 6px; vertical-align: middle; }
.events { display: grid; gap: 12px; margin-top: 16px; }
.event { display: flex; gap: 14px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); text-decoration: none; color: inherit; }
.event:hover { border-color: var(--brand-2); }
.event .when { flex: none; width: 54px; text-align: center; border-radius: 12px; background: var(--brand); color: #fff; padding: 8px 0; display: grid; }
.event .when b { font: 700 1.4rem/1 var(--serif); }
.event .when span { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.event h3 { margin: 0 0 2px; font-size: 1.02rem; }
.event p { margin: 0; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px !important; }
.tags span { font-size: .72rem; padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--brand-2) 12%, transparent); color: var(--brand-2); font-weight: 600; }
.event-page .lead { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.promo { margin-top: 16px; }
textarea.input { resize: vertical; font: inherit; }
.reminder { display: block; margin-bottom: 14px; padding: 10px 14px; border-radius: var(--r-panel); background: color-mix(in srgb, var(--gold) 22%, var(--surface)); color: var(--ink); text-decoration: none; }
.rewards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); color: inherit; text-decoration: none; }
.rewards:hover { border-color: var(--brand-2); }
.rewards .stat { display: grid; gap: 2px; align-content: start; }
.rewards .stat b { font: 700 1.15rem/1.2 var(--serif); }
.rewards .stat i { font-style: normal; font-size: .74rem; color: var(--muted); }
.meter.light { background: color-mix(in srgb, var(--brand) 14%, transparent); margin: 4px 0 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.big { font: 700 2rem/1.1 var(--serif); margin: 0; }
.lvl { margin-bottom: 16px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-top: 12px; }
.badge { display: grid; gap: 2px; justify-items: center; text-align: center; padding: 14px 8px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); opacity: .5; filter: grayscale(1); }
.badge.on { opacity: 1; filter: none; border-color: var(--gold); }
.badge .ico { font-size: 1.8rem; }
@media (max-width: 380px) { .tabbar a { font-size: .66rem; } }

.lead-in { font: italic 400 1.15rem/1.4 var(--serif); color: var(--muted); }
.how { margin-bottom: 16px; background: color-mix(in srgb, var(--gold) 10%, var(--surface)); }
.how h3 { margin: 0 0 6px; }
.how ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: .92rem; }
.how .kinds { list-style: none; padding: 0; }
.tags .kind { background: var(--brand); color: #fff; }

/* ---- Wallet, passes, samples, legal ---- */
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.opt { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 16px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.opt .price { font: 700 1.25rem/1.2 var(--serif); color: var(--brand-2); }
.opt p { margin: 2px 0 8px; flex: 1; }
.opt .btn, .opt .pill { margin-top: auto; }
.narrow.wide { max-width: 760px; }
.panel.access { border-color: var(--brand-2); }
.access-top { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; }
.access-t { margin: 2px 0 0; font-size: 1.4rem; }
.coinchip { flex: none; display: grid; place-items: center; width: 74px; height: 74px; border-radius: 50%; background: var(--gold); color: var(--gold-ink); text-decoration: none; line-height: 1; text-align: center; }
.coinchip b { font: 700 1.5rem/1 var(--serif); display: block; }
.coinchip span { font-size: .72rem; font-weight: 700; }
.adminrow { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.warn { background: color-mix(in srgb, var(--gold) 20%, transparent); border-radius: 8px; padding: 8px 12px; margin: 12px 0 0; font-size: .92rem; }
.bignum { font: 700 2.4rem/1 var(--serif); }
.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.pack { font: inherit; color: inherit; background: var(--tint); border: 1px solid var(--line); border-radius: var(--r-control); padding: 12px 8px; cursor: pointer; display: grid; gap: 2px; justify-items: center; min-height: 44px; }
.pack:hover { border-color: var(--brand-2); }
.pack b { font: 700 1.3rem/1 var(--serif); }
.pack span { font-size: .78rem; color: var(--muted); }
.pack small { font-weight: 600; }
ul.plain { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.history .plus { color: var(--money); }
details.fold { padding: 0; }
details.fold > summary { cursor: pointer; font-weight: 700; padding: 14px 16px; list-style-position: inside; min-height: 44px; }
details.fold[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 14px; }
details.fold > :not(summary) { margin-inline: 16px; }
details.fold > :last-child { margin-bottom: 16px; }
.pill.sample { background: var(--gold); color: var(--gold-ink); }
.pill.ok { background: color-mix(in srgb, var(--money) 15%, transparent); color: var(--money); }
.unlock-box { margin-top: 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 16px; font-size: .92rem; }
.check input { margin-top: 3px; width: 20px; height: 20px; flex: none; }
.input.mini { width: 74px; display: inline-block; padding: 6px 8px; }
form.sample { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sample-end { position: absolute; left: 12px; right: 12px; bottom: 76px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 14px; display: grid; gap: 6px; justify-items: start; box-shadow: 0 8px 24px rgba(0,0,0,.18); z-index: 5; }
.sample-end[hidden] { display: none; }
.foot { display: flex; flex-wrap: wrap; gap: 4px 18px; justify-content: center; padding: 28px var(--gutter) 24px; font-size: .85rem; }
.foot a { color: var(--muted); padding: 6px 2px; }
body.reading .foot { display: none; }
article.legal h2 { margin-top: 22px; }
article.legal li { margin-bottom: 6px; }
#consent-bar { position: fixed; z-index: 30; left: 0; right: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); background: var(--ink); color: var(--paper); padding: 10px var(--gutter); display: flex; gap: 12px; align-items: center; justify-content: space-between; font-size: .88rem; }
#consent-bar a { color: inherit; text-decoration: underline; }
@media (min-width: 760px) { #consent-bar { bottom: 0; } }
body.reading #consent-bar { display: none; }
.stat small { display: block; margin-top: 4px; font-size: .78rem; }

main { min-height: 60vh; }
main[aria-busy="true"] + .foot { visibility: hidden; }

.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--tint); color: var(--brand-2); white-space: nowrap; }
.tag.coin { background: var(--gold); color: var(--gold-ink); }
.tag.free { background: color-mix(in srgb, var(--money) 15%, transparent); color: var(--money); }
.tag.own { background: var(--brand-2); color: #fff; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 18px 0 8px; }
.action { display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 12px 14px; text-decoration: none; color: inherit; min-height: 44px; }
.action:hover { border-color: var(--brand-2); }
.action b { font-size: 1rem; }
.action span { color: var(--muted); font-size: .85rem; }
@media (max-width: 640px) {
  .actions { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .action { padding: 10px 6px; text-align: center; align-content: center; }
  .action b { font-size: .8rem; }
  .action span:not(.walletn) { display: none; }
}

.top-right { display: flex; align-items: center; gap: 6px; }
.top-out { font: inherit; font-weight: 600; font-size: .9rem; color: var(--brand-2); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; min-height: 40px; }
.top-out:hover { background: var(--tint); }
body.reading .top-out { display: none; }
