/* AGA Study - African Guide Academy house colours (maroon / ochre / cream) */
:root {
  --page: #f4f1ec;
  --surface: #ffffff;
  --surface-2: #faf7f2;
  --ink: #1f1612;
  --ink-2: #54463d;
  --muted: #8b7e74;
  --line: #e2d9cf;
  --brand: #6e1e10;
  --brand-dk: #3d0f07;
  --accent: #c06a1a;
  --accent-dk: #a6551a;
  --gold-light: #fbecd2;
  --good: #2f6a43;
  --good-bg: #e3f1e6;
  --bad: #9b2c22;
  --bad-bg: #fbe9e7;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(61,15,7,.06), 0 6px 18px rgba(61,15,7,.07);
  --serif: Georgia, "Times New Roman", serif;
  --bar-h: 58px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #17110e; --surface: #221a16; --surface-2: #2a211c; --ink: #f1e9df; --ink-2: #d4c6b8; --muted: #a39484;
    --line: #3a2e27; --brand: #e6a07a; --accent: #e08a3c; --accent-dk: #e08a3c; --gold-light: #3a2a1a;
    --good: #8cc79b; --good-bg: #1e3326; --bad: #f0907f; --bad-bg: #3e201b; --shadow: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--page); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; min-height: 100dvh;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; }
.ico { width: 22px; height: 22px; flex: none; display: block; }

/* ---------- app bar ---------- */
.appbar { position: sticky; top: 0; z-index: 20; background: var(--brand-dk); color: #fff; padding-top: env(safe-area-inset-top, 0px); }
.appbar-inner { position: relative; height: var(--bar-h); max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 6px; padding: 0 10px 0 12px; }
.logo { position: absolute; left: 50%; top: 0; transform: translateX(-50%); display: flex; align-items: center; height: 100%; }
.logo img { height: 44px; width: auto; display: block; }
.appbar-title { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.appbar-right { margin-left: auto; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; padding-right: 4px; white-space: nowrap; }
.icon-btn { background: none; border: 0; color: inherit; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; margin-left: -6px; flex: none; }
.icon-btn:active { background: rgba(255,255,255,.12); }
.icon-btn[hidden], .net[hidden], .appbar-title:empty { display: none; }
.net { background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; margin-left: auto; }
.net:not([hidden]) + .appbar-right { margin-left: 8px; }
.quiz-progress { height: 4px; background: rgba(255,255,255,.15); }
.quiz-progress span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .35s ease; }
.quiz-progress[hidden] { display: none; }
body.focus .logo { display: none; }
body.titled .logo { display: none; }
main:focus, main:focus-visible { outline: none; }

/* ---------- layout ---------- */
main { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(var(--tab-h) + var(--safe-b) + 24px); outline: none; }
body.focus main { padding-bottom: calc(150px + var(--safe-b)); }
h1 { font-family: var(--serif); font-weight: 700; font-size: 26px; line-height: 1.2; margin: 4px 0 6px; color: var(--brand); }
@media (prefers-color-scheme: dark) { h1 { color: var(--ink); } }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 26px 4px 10px; }
.sub { color: var(--ink-2); margin: 0 0 16px; }
.small { font-size: 13px; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.tabbar a {
  flex: 1; max-width: 200px; height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600;
}
.tabbar a .ico { width: 24px; height: 24px; }
.tabbar a.active { color: var(--brand); }
@media (prefers-color-scheme: dark) { .tabbar a.active { color: var(--accent); } }
body.focus .tabbar { display: none; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius); color: #fff; min-height: 220px;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 20px; background: var(--brand-dk) center/cover no-repeat;
}
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(61,15,7,.05) 0%, rgba(61,15,7,.55) 45%, rgba(61,15,7,.92) 100%); }
.hero > * { position: relative; }
.hero .eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #f2c48d; }
.hero h1 { color: #fff; font-size: 28px; margin: 4px 0 4px; }
.hero p { margin: 0 0 14px; color: rgba(255,255,255,.88); }
.hero .stat { font-size: 13px; color: rgba(255,255,255,.8); margin-top: 10px; }

.hero.compact { min-height: 150px; padding: 18px; }
.hero.compact h1 { font-size: 26px; }
.hero.compact p { margin: 0; }
.home-setting { margin-top: 14px; }

/* home: module with its quiz types listed underneath */
.mod-card { overflow: hidden; }
.mod-top { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: inherit; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.mod-thumb { width: 64px; height: 64px; border-radius: 12px; flex: none; background: var(--line) center/cover no-repeat; }
.mod-info { flex: 1; min-width: 0; }
.mod-info h3 { margin: 0 0 8px; font-family: var(--serif); font-size: 18px; line-height: 1.2; }
.mod-info .bar { height: 6px; }
.mod-info .bar-label { margin-top: 4px; font-size: 12px; }
.mod-more { flex: none; display: flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 600; color: var(--muted); }
.mod-more .ico { width: 16px; height: 16px; }
.mod-card .row-btn { min-height: 64px; padding: 10px 14px; }

/* home: subject tiles */
.subject-list { display: grid; gap: 14px; }
@media (min-width: 600px) { .subject-list { grid-template-columns: 1fr 1fr; } }
.subject { display: flex; flex-direction: column; overflow: hidden; text-decoration: none; color: inherit; }
.subject-img { aspect-ratio: 16/8; background: var(--line) center/cover no-repeat; }
.subject-body { padding: 14px 16px 16px; }
.subject-body h3 { margin: 0 0 2px; font-family: var(--serif); font-size: 22px; color: var(--brand); }
@media (prefers-color-scheme: dark) { .subject-body h3 { color: var(--ink); } }
.subject-body p { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
.subject .go { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; color: var(--brand); }
@media (prefers-color-scheme: dark) { .subject .go { color: var(--accent); } }
.subject .go .ico { width: 16px; height: 16px; }
.coming { padding: 14px 16px; margin-top: 14px; }
/* compact chapter tiles (manual-only subjects) */
.subject-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 600px) { .subject-grid { grid-template-columns: repeat(3, 1fr); } }
.subject-sm { display: flex; flex-direction: column; gap: 6px; padding: 14px; text-decoration: none; color: inherit; min-height: 128px; }
.subject-sm strong { font-family: var(--serif); font-size: 16px; line-height: 1.2; color: var(--brand); flex: 1; }
@media (prefers-color-scheme: dark) { .subject-sm strong { color: var(--ink); } }
.subject-sm .bar { height: 5px; }
.subject-sm:active { transform: scale(.98); }
@media (hover: hover) { .subject-sm:hover { border-color: var(--accent); } }
/* subject page header without a photo */
.mod-head.plain { background: linear-gradient(135deg, var(--brand-dk), var(--brand)); min-height: 170px; }
.mod-head.plain::before { display: none; }
.mod-head .head-ico { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,.12); color: #f2c48d; margin-bottom: 12px; }
.mod-head .head-ico .ico { width: 30px; height: 30px; }
.soon-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.soon { font-size: 13px; padding: 5px 10px; border-radius: 99px; background: var(--surface-2); border: 1px dashed var(--line); color: var(--muted); }

/* subject page: activity tiles in a 2-column grid */
.sec-sub { float: right; text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; }
.act-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 600px) { .act-grid { grid-template-columns: repeat(4, 1fr); } }
.act { display: flex; flex-direction: column; gap: 4px; padding: 14px; min-height: 128px; text-decoration: none; color: inherit; }
.act .tile-ico { margin-bottom: 6px; }
.act strong { font-size: 15px; line-height: 1.25; }
.act span { font-size: 13px; color: var(--muted); line-height: 1.3; }
.act:active { transform: scale(.98); }
@media (hover: hover) { .act:hover { border-color: var(--accent); } }
.act.off { opacity: .55; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--radius-sm); padding: 0 20px; min-height: 50px; font-weight: 700; font-size: 16px;
  background: var(--brand); color: #fff; text-decoration: none;
}
@media (prefers-color-scheme: dark) { .btn { background: var(--accent); color: #1b120d; } }
.btn.accent { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-stack { display: grid; gap: 10px; margin-top: 18px; }
.linkish { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 10px 0; font-size: 14px; }

/* ---------- module cards ---------- */
.module-list { display: grid; gap: 16px; margin-top: 16px; }
@media (min-width: 900px) { .module-list { grid-template-columns: 1fr 1fr; align-items: start; } }
.module { padding: 0; overflow: hidden; text-align: left; width: 100%; display: flex; flex-direction: column; }
.module .banner { position: relative; aspect-ratio: 16/8; background: var(--line) center/cover no-repeat; }
.module .badge { position: absolute; left: 12px; bottom: 12px; background: rgba(31,22,18,.78); color: #fff; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 99px; display: flex; align-items: center; gap: 6px; }
.module .badge .ico { width: 16px; height: 16px; }
.module .body { padding: 14px 16px 16px; }
.module h3 { margin: 0 0 2px; font-size: 18px; font-family: var(--serif); }
.module p { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }

.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--good); border-radius: 99px; transition: width .4s; }
.form label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 12px; }
.form input { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font: inherit; font-weight: 400; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.form input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.done-card { margin-bottom: 14px; background: var(--good-bg); border-color: transparent; }
a.btn { text-decoration: none; }
.bar2 { position: relative; }
.bar2 > span { position: absolute; left: 0; top: 0; bottom: 0; }
.bar2 > .pr { background: #e2b77a; }
.bar2 > .ms { background: var(--good); }
.mod-head .bar2 > .pr { background: rgba(242,196,141,.55); }
.mod-head .bar2 > .ms { background: #f2c48d; }
.legend { display: inline-block; width: 12px; height: 8px; border-radius: 4px; vertical-align: middle; }
.legend.pr { background: #e2b77a; } .legend.ms { background: var(--good); }
.stat-grid.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 420px) { .stat-grid.four { grid-template-columns: repeat(2, 1fr); } }
.bar-label { font-size: 13px; color: var(--muted); margin-top: 6px; display: flex; justify-content: space-between; gap: 8px; }

.nudge { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-top: 14px; text-decoration: none; color: inherit; }
.nudge .tile-ico { background: var(--gold-light); color: var(--accent-dk); }
.nudge strong { display: block; }

/* ---------- module page ---------- */
.mod-head { margin: -16px -16px 0; position: relative; min-height: 190px; padding: 20px 16px 18px; color: #fff; display: flex; flex-direction: column; justify-content: flex-end; background: var(--brand-dk) center/cover no-repeat; }
.mod-head::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(61,15,7,.1), rgba(61,15,7,.9)); }
.mod-head > * { position: relative; }
.mod-head h1 { color: #fff; margin: 0 0 2px; }
.mod-head p { margin: 0 0 12px; color: rgba(255,255,255,.85); font-size: 14px; }
.mod-head .bar { background: rgba(255,255,255,.25); }
.mod-head .bar > span { background: #f2c48d; }
.mod-head .bar-label { color: rgba(255,255,255,.85); }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 3px; }
.seg button { border: 0; background: none; padding: 8px 16px; border-radius: 99px; font-size: 14px; font-weight: 600; color: var(--ink-2); min-width: 54px; }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .seg button[aria-pressed="true"] { background: var(--accent); color: #1b120d; } }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; flex-wrap: wrap; }
.setting-row + .setting-row { border-top: 1px solid var(--line); }
.setting-row label { font-weight: 600; font-size: 15px; }
.select {
  appearance: none; -webkit-appearance: none; font: inherit; font-size: 15px; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 36px 9px 12px; max-width: 100%;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}

.list { overflow: hidden; }
.row-btn { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 14px; background: none; border: 0; text-align: left; min-height: 72px; text-decoration: none; color: inherit; }
.row-btn + .row-btn { border-top: 1px solid var(--line); }
.row-btn:active { background: var(--surface-2); }
.row-btn .txt { flex: 1; min-width: 0; }
.row-btn strong { display: block; font-size: 16px; }
.row-btn span.d { display: block; font-size: 14px; color: var(--muted); }
.row-btn .chev { color: var(--muted); }
.tile-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--gold-light); color: var(--brand); }
@media (prefers-color-scheme: dark) { .tile-ico { color: var(--accent); } }
.tile-ico .ico { width: 24px; height: 24px; }
.empty { color: var(--muted); padding: 22px 16px; text-align: center; }

/* ---------- quiz ---------- */
.prompt { padding: 12px; text-align: center; }
.prompt img.main { width: 100%; max-height: 46vh; max-height: 46dvh; object-fit: contain; border-radius: 10px; background: #120a07; display: block; }
.prompt .q { font-size: 18px; font-weight: 700; margin: 12px 0 2px; }
.prompt .hint { font-size: 14px; color: var(--muted); }
.play {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 99px;
  background: var(--accent); color: #fff; width: 96px; height: 96px; margin: 18px auto 6px; box-shadow: 0 6px 18px rgba(192,106,26,.35);
}
.play .ico { width: 40px; height: 40px; }
.play.playing { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(192,106,26,.45); } 50% { box-shadow: 0 0 0 16px rgba(192,106,26,0); } }
.big-name { font-family: var(--serif); font-size: 26px; font-weight: 700; margin: 16px 0 4px; color: var(--brand); }
@media (prefers-color-scheme: dark) { .big-name { color: var(--ink); } }

.options { display: grid; gap: 10px; margin-top: 14px; }
@media (min-width: 560px) { .options.text { grid-template-columns: 1fr 1fr; } }
.options.pics { grid-template-columns: 1fr 1fr; }
.opt {
  padding: 12px 14px; text-align: left; border: 2px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 12px; min-height: 58px; font-size: 16px; font-weight: 600; transition: border-color .15s, background .15s;
}
.opt .k { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; display: grid; place-items: center; color: var(--muted); }
.options.pics .opt { padding: 5px; flex-direction: column; align-items: stretch; gap: 0; }
.options.pics .opt img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; display: block; }
.options.pics .opt .cap { font-size: 13px; padding: 6px 4px 3px; min-height: 0; font-weight: 600; }
.options.pics .opt .cap:empty { display: none; }
@media (hover: hover) { .opt:hover:not(:disabled) { border-color: var(--accent); } }
.opt:active:not(:disabled) { transform: scale(.985); }
.opt.right { border-color: var(--good); background: var(--good-bg); }
.opt.right .k { background: var(--good); color: #fff; border-color: var(--good); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong .k { background: var(--bad); color: #fff; border-color: var(--bad); }
.opt.dim { opacity: .55; }

/* bottom sheet (answer feedback / flashcard grading) */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(31,22,18,.12); padding: 14px 16px calc(14px + var(--safe-b)); animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.sheet-inner { max-width: 720px; margin: 0 auto; }
.sheet .verdict { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sheet .verdict .mark { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; }
.sheet.good .mark { background: var(--good); }
.sheet.bad .mark { background: var(--bad); }
.sheet .verdict .msg { flex: 1; min-width: 0; }
.sheet .verdict strong { display: block; font-size: 17px; }
.sheet.good strong { color: var(--good); }
.sheet.bad strong { color: var(--bad); }
.sheet .verdict .ans { font-size: 15px; color: var(--ink-2); }
.sheet .verdict img { width: 54px; height: 54px; object-fit: cover; border-radius: 10px; flex: none; }
.sheet .actions { display: flex; gap: 10px; }
.sheet .actions .btn { flex: 1; }
.mini-play {
  display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: var(--surface); border-radius: 99px;
  padding: 0 14px; min-height: 40px; font-size: 14px; font-weight: 600; flex: none;
}
.mini-play .ico { width: 16px; height: 16px; }
.mini-play.playing { border-color: var(--accent); color: var(--accent-dk); }

/* ---------- flashcards ---------- */
.flash { perspective: 1400px; }
.flash-inner { position: relative; height: min(64vh, 540px); height: min(64dvh, 540px); transition: transform .5s cubic-bezier(.3,.7,.2,1); transform-style: preserve-3d; cursor: pointer; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; padding: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; overflow: hidden; }
.face.back { transform: rotateY(180deg); }
.face img { width: 100%; flex: 1; min-height: 0; object-fit: contain; border-radius: 10px; }
.face .hint { color: var(--muted); font-size: 14px; margin-top: 10px; }
.face.back img { max-height: 46%; flex: none; margin-bottom: 6px; }
.grade { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grade .again { background: var(--bad-bg); color: var(--bad); }
.grade .know { background: var(--good-bg); color: var(--good); }

/* ---------- results ---------- */
.result { text-align: center; padding: 24px 16px 20px; }
.ring { width: 150px; height: 150px; margin: 0 auto 8px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 36px; font-weight: 700; }
.result .score-line { font-size: 15px; color: var(--muted); }
.result .msg { font-size: 18px; font-weight: 700; margin: 6px 0 0; }
.review { list-style: none; padding: 0; margin: 0; }
.review li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.review li + li { border-top: 1px solid var(--line); }
.review img, .review .ph { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; flex: none; }
.review .ph { display: grid; place-items: center; background: var(--gold-light); color: var(--accent-dk); }
.review .nm { flex: 1; font-weight: 700; min-width: 0; }
.review .yours { color: var(--bad); font-weight: 400; font-size: 13px; display: block; }

/* ---------- browse ---------- */
.search-wrap { position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px)); z-index: 5; background: var(--page); margin: 0 -16px; padding: 10px 16px; }
.search { width: 100%; padding: 13px 14px 13px 42px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
.search-wrap .ico { position: absolute; left: 30px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 10px; }
.tile { padding: 0; overflow: hidden; text-align: left; display: flex; flex-direction: column; }
.tile img, .tile .ph { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.tile .ph { display: grid; place-items: center; background: var(--gold-light); color: var(--accent-dk); }
.tile .ph .ico { width: 34px; height: 34px; }
.tile .nm { font-size: 14px; font-weight: 700; padding: 8px 10px 2px; line-height: 1.3; }
.tile-link { position: relative; display: block; color: inherit; text-decoration: none; flex: 1; }
.tile-link:active { opacity: .85; }
.info-dot { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: rgba(61,15,7,.78); color: #fff; font: italic 700 13px/22px Georgia, serif; text-align: center; }
/* species page */
.species { padding: 0; overflow: hidden; }
.sp-photo { width: 100%; max-height: 52vh; object-fit: cover; display: block; }
.sp-body { padding: 16px 18px 18px; }
.sp-name { margin: 0 0 2px; font-size: 24px; }
.titbit { margin-top: 16px; background: var(--gold-light); color: var(--ink); border-radius: 12px; padding: 12px 14px; font-size: 15px; line-height: 1.45; }
.titbit .fl, .fact .fl { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-dk); margin-bottom: 3px; }
.small-tb { margin-top: 12px; font-size: 13.5px; text-align: left; }
.facts { margin-top: 14px; display: grid; gap: 12px; }
.fact .fv { font-size: 15px; line-height: 1.45; color: var(--ink); }
.fact + .fact { border-top: 1px solid var(--line); padding-top: 12px; }
.draft-note { margin-top: 16px; }
.draft-note .draft { margin: 0 6px 0 0; }
.credit { margin-top: 14px; color: var(--muted); font-size: 12.5px; }
.credit a, .credits a, .foot-links a { color: inherit; }
.foot-links { margin-top: 6px; font-size: 13px; }
.credits { list-style: none; margin: 0; font-size: 13.5px; line-height: 1.5; }
.credits li + li { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 6px; }
.share-now { display: flex; gap: 12px; align-items: center; padding: 10px; margin-bottom: 12px; }
.share-now img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; }
.share-now div { display: flex; flex-direction: column; }
.share-prev { width: 100%; max-height: 40vh; object-fit: contain; border-radius: 10px; margin: 0 0 12px; background: var(--surface-2); }
.form label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: 14px; }
.form label.check input { width: auto; margin-top: 3px; flex: none; }
/* species photo gallery (swipe) */
.sp-gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.sp-gallery::-webkit-scrollbar { display: none; }
.sp-gallery .sp-photo { flex: 0 0 100%; scroll-snap-align: start; }
.sp-dots { display: flex; justify-content: center; gap: 6px; margin-top: -22px; position: relative; z-index: 1; height: 22px; align-items: center; }
.sp-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.55); box-shadow: 0 0 2px rgba(0,0,0,.5); }
.sp-dots i.on { background: #fff; }
/* exam practice, sightings */
.check-row { display: flex; gap: 10px; align-items: center; padding: 12px 0 2px; font-size: 14.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font-size: 14px; background: var(--surface-2); }
.opt.picked { border-color: var(--brand); background: var(--gold-light); }
.seg.wide { display: flex; width: 100%; }
.seg.wide button { flex: 1; }
.sight-list { padding: 4px 0; }
.sight-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 14px; border: 0; background: none; color: inherit; text-decoration: none; text-align: left; font: inherit; font-size: 15px; }
.sight-row + .sight-row { border-top: 1px solid var(--line); }
.sight-row img { width: 44px; height: 34px; object-fit: cover; border-radius: 6px; flex: none; }
.sight-row > span:first-of-type { flex: 1; }
.sight-row .ico { width: 18px; height: 18px; flex: none; }
.sight-row .linkish .ico { width: 14px; height: 14px; vertical-align: -2px; }
.sight-form { display: grid; gap: 10px; }
.sight-form label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.sight-form input { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.sight-form .actions { display: flex; gap: 10px; }
.sight-form .actions .btn { flex: 1; }
#tabbar a span { font-size: 11px; }
/* manual */
.mrow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; color: inherit; text-decoration: none; }
.mrow .mtxt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mrow .small .ico { width: 13px; height: 13px; vertical-align: -2px; color: var(--good); }
.mtools { display: flex; justify-content: space-between; align-items: center; margin: 0 2px 10px; }
.mtools .icon-btn { font-weight: 700; font-size: 15px; color: var(--ink); border: 1px solid var(--line); background: var(--surface); width: auto; padding: 0 12px; margin-left: 6px; border-radius: 10px; height: 36px; }
.mpages { overflow-x: auto; }
.mpage { margin: 0 0 14px; }
.mpage canvas { display: block; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); border-radius: 4px; }
.mpage figcaption { font-size: 12px; color: var(--muted); text-align: center; margin-top: 4px; }
a.pg { color: inherit; text-decoration: underline; }
.sp-pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }
.sp-nav { flex: 0 1 48%; padding: 10px 12px; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.sp-nav.nx { margin-left: auto; }
.tile .row { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 8px 10px; gap: 6px; }
.dots { display: flex; gap: 3px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--good); }

/* ---------- manual questions ---------- */
.qprompt { text-align: left; padding: 18px 16px; }
.qmeta { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-dk); margin-bottom: 6px; }
.qtext { font-family: var(--serif); font-size: 21px; line-height: 1.35; font-weight: 700; }
.options.one { grid-template-columns: 1fr !important; }
.options.text .opt span:last-child { line-height: 1.35; }
.draft { display: inline-block; background: var(--gold-light); color: var(--accent-dk); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; letter-spacing: 0; text-transform: none; vertical-align: middle; margin-left: 6px; }
.explain { font-size: 14px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: -2px 0 12px; max-height: 30vh; overflow: auto; }
.pg { display: inline-block; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.qface { justify-content: flex-start; padding: 22px 18px; text-align: left; align-items: stretch; }
.qface .qtext { font-size: 22px; margin-top: 8px; }
.qface .hint { margin-top: auto; text-align: center; }
.qface.back .big-name { margin-top: 4px; font-size: 24px; }
.qface .explain { margin: 12px 0 0; max-height: none; }
.qreview .nm { font-weight: 700; }
.qreview .qq { display: block; font-weight: 400; color: var(--ink-2); font-size: 14px; margin-bottom: 2px; }
.qa + .qa { border-top: 1px solid var(--line); }
.qa summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; gap: 10px; align-items: flex-start; font-weight: 600; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::before { content: "+"; flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--gold-light); color: var(--accent-dk); display: grid; place-items: center; font-weight: 800; line-height: 1; }
.qa[open] summary::before { content: "\2212"; }
.qa summary span:first-child { flex: 1; }
.qa-body { padding: 0 16px 14px 48px; font-size: 15px; }
.qa-body strong { color: var(--good); display: block; }
.qa-body p { margin: 4px 0 6px; color: var(--ink-2); font-size: 14px; }

/* ---------- progress & offline pages ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 14px 10px; text-align: center; }
.stat b { display: block; font-family: var(--serif); font-size: 26px; color: var(--brand); line-height: 1.1; }
@media (prefers-color-scheme: dark) { .stat b { color: var(--accent); } }
.stat span { font-size: 12px; color: var(--muted); }
.pad { padding: 16px; }
.pad + .pad { border-top: 1px solid var(--line); }
.pad h3 { margin: 0 0 4px; font-size: 16px; }
.pad p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.done { color: var(--good); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.done .ico { width: 18px; height: 18px; }
.steps { margin: 6px 0 0; padding-left: 22px; }
.steps li { margin: 6px 0; }
.alert { background: var(--bad-bg); color: var(--bad); padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 14px; }
.foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 28px; }
.foot img { height: 34px; width: auto; display: block; margin: 0 auto 6px; opacity: .9; }

.mpractise { display: flex; gap: 10px; margin: 0 0 12px; }
.mpractise .btn { flex: 1; text-decoration: none; }

