﻿:root {
  /* Defence theme: olive green, khaki and brass. */
  --bg: #f1f2e9;
  --card: #ffffff;
  --text: #1b2414;
  --muted: #5a6450;
  --line: #d9dccb;
  --primary: #3d5a26;
  --primary-soft: #e4ebd6;
  --accent: #a8731a;
  --good: #1f7a37;
  --good-soft: #dcf5df;
  --bad: #b3261e;
  --bad-soft: #fde4e1;
  --review: #1f4b8a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 36, 20, .06), 0 6px 18px rgba(27, 36, 20, .08);

  /* The four sections wear the colours of the three services, plus brass. */
  --g-brand: linear-gradient(135deg, #263d18, #3f5c27 55%, #5f7433);
  --g-quiz: linear-gradient(135deg, #34501f, #5d7d33);   /* Army olive */
  --g-pyq: linear-gradient(135deg, #7c5a14, #b3872b);    /* Brass / khaki */
  --g-tests: linear-gradient(135deg, #0f2444, #1f4b8a);  /* Navy blue */
  --g-mock: linear-gradient(135deg, #1a5f8f, #3997cc);   /* Air Force blue */
  --tricolour: linear-gradient(90deg, #ff9933 0 33.33%, #ffffff 33.33% 66.66%, #138808 66.66% 100%);
  --camo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='220'%3E%3Cpath d='M18 44c18-26 66-34 96-14s34 44 8 62-64 8-84-4-34-24-20-44z' fill='%23000' fill-opacity='.17'/%3E%3Cpath d='M176 22c28-18 82-8 98 18s-8 52-40 58-58-8-72-30-12-34 14-46z' fill='%23fff' fill-opacity='.07'/%3E%3Cpath d='M228 128c24-12 62-2 72 24s-6 50-36 54-52-14-56-40-2-28 20-38z' fill='%23000' fill-opacity='.14'/%3E%3Cpath d='M36 142c34-22 92-12 112 14s6 50-30 58-72-2-92-22-16-36 10-50z' fill='%23fff' fill-opacity='.06'/%3E%3Cpath d='M128 84c16-14 46-10 56 6s2 30-20 34-36-4-42-16-4-16 6-24z' fill='%23000' fill-opacity='.11'/%3E%3Cpath d='M292 62c10-8 24-4 26 8s-6 20-18 20-18-18-8-28z' fill='%23000' fill-opacity='.09'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10140c;
    --card: #1a2014;
    --text: #edf0e4;
    --muted: #a5ae94;
    --line: #2e3725;
    --primary: #a8c67a;
    --primary-soft: #263019;
    --accent: #e0b254;
    --good: #5fd27d;
    --good-soft: #15331d;
    --bad: #f28b82;
    --bad-soft: #3d1b18;
    --review: #8db4f0;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--primary); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- chrome ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--g-brand); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.topbar-in { max-width: 728px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.1rem; display: inline-flex; align-items: center; gap: 8px; letter-spacing: .2px; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #fff; color: #4f46e5; font-weight: 800; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .22); border: 1.5px solid rgba(255, 255, 255, .7); color: #fff; font-weight: 800; text-decoration: none; }

.container { max-width: 760px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { display: grid; justify-items: center; gap: 2px; padding: 8px 4px 9px; font-size: .72rem; font-weight: 700; color: var(--muted); text-decoration: none; border-top: 3px solid transparent; }
.tabs .ico { font-size: 1.3rem; line-height: 1.1; filter: grayscale(.6); opacity: .8; }
.tabs a.on { color: var(--primary); border-top-color: var(--primary); }
.tabs a.on .ico { filter: none; opacity: 1; }

body.playing .tabs, body.playing .topbar,
body.auth .tabs, body.auth .topbar { display: none; }
body.playing { padding-bottom: 24px; }
body.auth { padding-bottom: 0; background: var(--g-brand); min-height: 100vh; min-height: 100dvh; }
body.auth .container { min-height: 100vh; min-height: 100dvh; align-content: center; max-width: 440px; }

@media (min-width: 800px) {
  body { padding-bottom: 24px; }
  .tabs { position: sticky; top: 56px; bottom: auto; max-width: 760px; margin: 0 auto; border: 0; background: transparent; padding: 12px 16px 0; gap: 8px; }
  .tabs a { grid-auto-flow: column; justify-content: center; align-items: center; gap: 6px; font-size: .9rem; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px; }
  .tabs a.on { background: var(--primary-soft); border-color: var(--primary); }
  .tabs .ico { font-size: 1rem; }
}

/* ---------- building blocks ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }

.banner { border: 0; color: #fff; background: var(--g-brand); border-radius: var(--radius); padding: 18px 16px; box-shadow: var(--shadow); display: grid; gap: 4px; }
.banner p { color: rgba(255, 255, 255, .88); }
.banner.quiz { background: var(--g-quiz); }
.banner.pyq { background: var(--g-pyq); }
.banner.tests { background: var(--g-tests); }
.banner.mock { background: var(--g-mock); }
.banner.slim { padding: 10px 14px; box-shadow: none; }
.banner.slim h2 { font-size: 1.05rem; }
.progress-block .tile { background: var(--bg); border-left-width: 4px; padding: 10px; }
.progress-block .tile b { font-size: 1.3rem; }

.sections { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sec { position: relative; overflow: hidden; display: grid; gap: 4px; align-content: end; min-height: 138px; padding: 14px; border-radius: 18px; color: #fff; text-decoration: none; box-shadow: var(--shadow); transition: transform .12s ease; }
.sec:hover { transform: translateY(-2px); }
.sec:active { transform: scale(.98); }
.sec::after { content: ""; position: absolute; right: -28px; top: -28px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.sec .emoji { font-size: 2rem; line-height: 1; position: relative; z-index: 1; }
.sec b { font-size: 1.05rem; line-height: 1.2; }
.sec span { font-size: .8rem; color: rgba(255, 255, 255, .9); }
.sec.quiz { background: var(--g-quiz); }
.sec.pyq { background: var(--g-pyq); }
.sec.tests { background: var(--g-tests); }
.sec.mock { background: var(--g-mock); }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; border-left: 5px solid var(--primary); }
.tile:nth-child(2) { border-left-color: #059669; }
.tile:nth-child(3) { border-left-color: #ea580c; }
.tile:nth-child(4) { border-left-color: #db2777; }
.tile b { display: block; font-size: 1.5rem; line-height: 1.2; }
.tile span { font-size: .8rem; color: var(--muted); }

.grid2 { display: grid; gap: 10px; }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.pick-card { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.pick-card:hover:not([disabled]) { border-color: var(--primary); }
.pick-card[disabled] { opacity: .55; cursor: not-allowed; }
.pick-card .badge { flex: none; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--g-brand); color: #fff; font-weight: 800; }
.quiz-list .badge { background: var(--g-quiz); }
.tests-list .badge { background: var(--g-tests); }
.mock-list .badge { background: var(--g-mock); }
.pyq-list .badge { background: var(--g-pyq); }
.pick-card .t { font-weight: 700; }
.pick-card .s { font-size: .82rem; color: var(--muted); }
.pick-card .go { margin-left: auto; color: var(--muted); font-size: 1.2rem; }

.btn { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 16px; font-weight: 700; min-height: 44px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
.btn.primary { background: var(--g-brand); border-color: transparent; color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.danger { color: #1a0a0a; } }
.btn.ghost { background: transparent; }
.btn.on { border-color: var(--review); color: var(--review); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 6px 12px; min-height: 36px; font-size: .88rem; }
.btn.block { width: 100%; }

.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--g-brand); border-radius: 99px; }
.bar.good > i { background: linear-gradient(90deg, #059669, #22c55e); }

/* ---------- login ---------- */
.login-head { color: #fff; text-align: center; display: grid; gap: 6px; justify-items: center; }
.login-head .logo { width: 64px; height: 64px; font-size: 2.2rem; border-radius: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.login-head p { color: rgba(255, 255, 255, .9); }
.login-card { border: 0; padding: 20px; box-shadow: 0 20px 50px rgba(20, 10, 60, .35); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 9px; font-weight: 700; color: var(--muted); min-height: 40px; }
.seg button.on { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.field { display: grid; gap: 6px; font-size: .85rem; font-weight: 700; color: var(--muted); }
.input, .phone { border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); min-height: 48px; width: 100%; }
.input { padding: 10px 12px; font-weight: 500; color: var(--text); }
.input:focus, .phone:focus-within { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.phone { display: flex; align-items: center; }
.phone span { padding: 0 10px 0 12px; font-weight: 700; color: var(--text); border-right: 1.5px solid var(--line); }
.phone input { border: 0; background: transparent; flex: 1; min-width: 0; padding: 10px 12px; outline: none; font-weight: 500; color: var(--text); }
.otp { text-align: center; font-size: 1.6rem; font-weight: 800; letter-spacing: .5em; padding-left: .5em; font-variant-numeric: tabular-nums; }
.err { color: var(--bad); font-size: .88rem; font-weight: 600; }
.demo { background: #fff7e6; color: #7a4a00; border: 1px dashed #d97706; border-radius: 12px; padding: 10px 12px; font-size: .85rem; }
.demo b { font-size: 1.05rem; letter-spacing: .15em; }
@media (prefers-color-scheme: dark) { .demo { background: #33270c; color: #fcd68a; } }
.linkbtn { border: 0; background: none; color: var(--primary); font-weight: 700; padding: 8px 4px; }

/* ---------- play ---------- */
.playbar { position: sticky; top: 0; z-index: 15; background: var(--bg); padding: calc(8px + env(safe-area-inset-top)) 0 8px; margin-top: -8px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.playbar .title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; padding: 6px 10px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); }
.timer.low { background: var(--bad-soft); color: var(--bad); }

.qtext { font-size: 1.05rem; overflow-x: auto; }
/* Questions and solutions may contain line breaks (statement lists, steps). */
.qtext, .sol, .opt > span:last-child { white-space: pre-line; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; min-height: 54px; }
.opt > span:last-child { overflow-x: auto; min-width: 0; }
.opt .letter { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); font-weight: 800; font-size: .85rem; }
.opt.picked { border-color: var(--primary); background: var(--primary-soft); }
.opt.picked .letter { background: var(--primary); color: #fff; }
.opt.right { border-color: var(--good); background: var(--good-soft); }
.opt.right .letter { background: var(--good); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .letter { background: var(--bad); color: #fff; }
@media (prefers-color-scheme: dark) { .opt.picked .letter, .opt.right .letter, .opt.wrong .letter { color: #0e1020; } }
.opt:disabled { cursor: default; color: inherit; }

.sol { border-left: 4px solid var(--accent); background: var(--card); border-radius: 0 12px 12px 0; padding: 12px 14px; overflow-x: auto; }
.sol b { color: var(--accent); }

.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.palette button { height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: .85rem; }
.palette .done { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.palette .rev { border-color: var(--review); color: var(--review); box-shadow: inset 0 0 0 1px var(--review); }
.palette .cur { outline: 2px solid var(--primary); outline-offset: 1px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; border: 1px solid var(--line); }
.legend .l-done { background: var(--good-soft); border-color: var(--good); }
.legend .l-rev { border-color: var(--review); }

/* ---------- result / lists ---------- */
.score .big { font-size: 2.6rem; font-weight: 800; line-height: 1.1; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: .85rem; font-weight: 700; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.on { color: #0e1020; } }
.tag { display: inline-block; font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.skip { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

.list { display: grid; }
.list > * { padding: 10px 0; border-top: 1px solid var(--line); }
.list > *:first-child { border-top: 0; padding-top: 0; }
.list > *:last-child { padding-bottom: 0; }
.list a { text-decoration: none; color: inherit; }

.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(8, 10, 30, .6); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--card); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 380px; display: grid; gap: 12px; }

.modal.welcome { max-width: 420px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; border-top: 6px solid transparent; border-image: var(--g-brand) 1; border-radius: 0 0 var(--radius) var(--radius); }
.welcome-head { display: flex; align-items: center; gap: 10px; }
.welcome-head .logo { background: var(--g-brand); color: #fff; width: 40px; height: 40px; border-radius: 12px; font-size: 1.3rem; flex: none; }
.welcome-head h3 { font-size: 1.2rem; }
.modal.welcome p { color: var(--text); }
.modal.welcome .sign { color: var(--muted); }
.modal.welcome .sign b { color: var(--primary); font-size: 1.05rem; }

a.pick-card { text-decoration: none; color: inherit; }
.rank-card .badge { background: linear-gradient(135deg, #f59e0b, #ea580c); font-size: 1.3rem; }
.rank-row { display: flex; align-items: center; gap: 12px; }
.rank-row .pos { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); font-weight: 800; font-size: 1rem; }
.rank-row .pts { text-align: right; flex: none; }
.rank-row.me { background: var(--primary-soft); border-radius: 12px; padding-left: 8px; padding-right: 8px; margin: 0 -8px; }
.list > .rank-row.me { border-top-color: transparent; padding-top: 10px; }

/* Photo logo */
img.logo { display: block; flex: none; object-fit: cover; border-radius: 50%; background: #fff; border: 2px solid #fff; padding: 0; }
.brand img.logo { width: 32px; height: 32px; }
.login-head img.logo { width: 96px; height: 96px; border-width: 3px; border-radius: 50%; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.welcome-head img.logo { width: 56px; height: 56px; border: 2px solid var(--primary); background: none; }

.katex { font-size: 1.05em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ================= Defence look ================= */
/* Camouflage texture over the coloured panels. */
.banner { position: relative; } /* .topbar is sticky and .sec is already relative */
.topbar::before, .banner::before, .sec::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: var(--camo); background-size: 320px 220px; border-radius: inherit;
}
.banner, .sec { overflow: hidden; }
.banner > *, .sec > *, .topbar-in { position: relative; z-index: 1; }
body.auth { background: var(--g-brand); }
body.auth::before { content: ""; position: fixed; inset: 0; pointer-events: none; background-image: var(--camo); background-size: 380px 262px; opacity: .7; }
body.auth .container { position: relative; z-index: 1; }

/* Tricolour stripe under the top bar and above the login card. */
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--tricolour); }
.login-card { border-top: 4px solid transparent; border-image: var(--tricolour) 1; border-radius: 0 0 var(--radius) var(--radius); }
.modal.welcome { border-image: var(--tricolour) 1; }

/* Stencil-style headings. */
.brand { text-transform: uppercase; letter-spacing: .06em; font-size: 1rem; }
.banner h1, .login-head h1 { text-transform: uppercase; letter-spacing: .05em; }
.banner > p.small:first-child { text-transform: uppercase; letter-spacing: .18em; font-weight: 700; color: #f3d38a; }
.sec b { text-transform: uppercase; letter-spacing: .04em; font-size: .98rem; }
.quiz-list h2, .tests-list h2, .mock-list h2, #app > h2 {
  text-transform: uppercase; letter-spacing: .1em; font-size: .86rem; color: var(--primary);
  display: flex; align-items: center; gap: 10px; margin-top: 6px;
}
.quiz-list h2::after, .tests-list h2::after, .mock-list h2::after, #app > h2::after { content: ""; flex: 1; height: 2px; background: var(--line); }

/* Brass edges and badges. */
.sec { border: 1px solid rgba(255, 255, 255, .16); box-shadow: var(--shadow), inset 0 -4px 0 rgba(0, 0, 0, .18); }
.sec::after { background: rgba(255, 255, 255, .1); }
.tile { border-left-color: var(--primary); }
.tile:nth-child(2) { border-left-color: #a8731a; }
.tile:nth-child(3) { border-left-color: #1f4b8a; }
.tile:nth-child(4) { border-left-color: #2f86b8; }
.pick-card .badge { border-radius: 10px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .22); }
.rank-card .badge { background: linear-gradient(135deg, #b8892d, #7c5a14); }
.btn { border-radius: 10px; }
.btn.primary { text-transform: uppercase; letter-spacing: .06em; font-size: .92rem; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .22); }
.logo, .login-head .logo { color: #3d5a26; }
.welcome-head img.logo { border-color: var(--accent); }
.bar > i { background: linear-gradient(90deg, #3d5a26, #7d9a45); }
.demo { background: #f6efd9; color: #5c430c; border-color: #a8731a; }
@media (prefers-color-scheme: dark) {
  .demo { background: #2e2710; color: #f0d48f; }
  .btn.primary, .chip.on { color: #fff; }
  .opt.picked .letter, .opt.right .letter, .opt.wrong .letter { color: #10140c; }
}

/* ---------- Section cards with a cadet photo on the right ---------- */
.sections { grid-template-columns: 1fr; }
@media (min-width: 700px) { .sections { grid-template-columns: 1fr 1fr; } }
.sec { min-height: 132px; padding: 14px 44% 14px 16px; align-content: center; }
.sec::after { display: none; }
.sec .sec-photo {
  position: absolute; right: 0; bottom: 0; z-index: 1;
  height: 100%; width: 46%; object-fit: contain; object-position: right bottom;
  filter: drop-shadow(-6px 0 10px rgba(0, 0, 0, .35));
  pointer-events: none;
}
.sec .emoji { font-size: 1.5rem; }
.sec b { font-size: 1.02rem; }

/* ---------- Videos, Updates, Best Books ---------- */
:root { --g-videos: linear-gradient(135deg, #7a1f1f, #b23a2a); --g-updates: linear-gradient(135deg, #5b4a1f, #8a7433); --g-books: linear-gradient(135deg, #1f4a48, #2f7a6f); }
.sec.videos, .banner.videos { background: var(--g-videos); }
.sec.updates, .banner.updates { background: var(--g-updates); }
.sec.books, .banner.books { background: var(--g-books); }
.sec b .new-dot { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: #fff; color: #9a2b1e; font-size: .64rem; font-weight: 800; letter-spacing: .06em; vertical-align: middle; }
.video-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.video-card { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.video-card:hover { border-color: var(--primary); }
.video-card .thumb { position: relative; display: block; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; background: #222; }
.video-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-card .thumb i { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 34px; height: 24px; border-radius: 7px; background: rgba(200, 30, 30, .88); color: #fff; display: grid; place-items: center; font-style: normal; font-size: .7rem; left: auto; right: 6px; top: auto; bottom: 6px; transform: none; }
.video-card .t { font-weight: 700; line-height: 1.3; }
.video-card .s { font-size: .82rem; color: var(--muted); }
.update-body { white-space: pre-line; margin: 0; }
.book { align-items: stretch; }
.book-cover { display: block; width: 100%; max-width: 320px; margin: 0 auto; border-radius: 10px; box-shadow: var(--shadow); }

.book-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); align-items: start; }
.book h2 { font-size: 1rem; }
.book p { margin: 0; font-size: .88rem; }

.video-card.flat { padding: 0; border: 0; box-shadow: none; max-width: 360px; }

/* ---------- Back button in the top bar ---------- */
.topbar-in { justify-content: flex-start; gap: 8px; }
.topbar-in .avatar { margin-left: auto; }
.back-btn { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .7); background: rgba(255, 255, 255, .18); color: #fff; font-size: 1.25rem; line-height: 1; font-weight: 700; display: grid; place-items: center; cursor: pointer; padding: 0 0 2px; }
.back-btn[hidden] { display: none; }
.back-btn:hover { background: rgba(255, 255, 255, .32); }

/* quiz palette: wrong answers */
.palette .bad { background: #fdecea; border-color: #c0392b; color: #c0392b; }
.legend .l-bad { background: #fdecea; border-color: #c0392b; }
.playbar .timer + .btn, .playbar .tag + .btn { margin-left: 6px; }
