/* Big Sea HSSEQ Safety Campaign — Design system
 * โทน: Midnight Navy + Champagne Gold บนพื้นงาช้าง (Ivory) · ฟอนต์ Noto Serif Thai (หัวเรื่อง) + IBM Plex Sans Thai (เนื้อหา)
 * สี/ขนาดทั้งหมดกำหนดเป็นตัวแปรบน :root — ปรับให้ตรง CI บริษัทได้ที่นี่ที่เดียว
 */
@import url("fonts/fonts.css");

:root {
  /* สีหลักจากโลโก้บริษัท: กรมท่า #120A49 และแดง #AF2C18 */
  --ink: #0b0a2e;
  --navy: #14104b;
  --navy-2: #1d1a63;
  --navy-3: #2f2d80;
  --brand-red: #af2c18;
  --gold: #c8a45a;
  --gold-2: #e6cf96;
  --gold-3: #9c7a32;
  --gold-grad: linear-gradient(135deg, #f1dfaa 0%, #d4b06a 45%, #b38a3e 100%);
  --bg: #f6f3ec;
  --card: #fffdf8;
  --card-2: #faf6ec;
  --text: #1c2333;
  --muted: #6b6f7b;
  --line: #e6dcc6;
  --ok: #2e7d5b;
  --ok-bg: #e6f2ec;
  --bad: #b4433a;
  --bad-bg: #fbeceb;
  --warn-bg: #fbf3dc;
  --warn-line: #c8a45a;
  --doc512: #1f4f86;
  --doc512-bg: #e7eef8;
  --doc515: #8a6a24;
  --doc515-bg: #f6eedb;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(10, 22, 40, .05), 0 10px 30px rgba(10, 22, 40, .08);
  --shadow-lg: 0 20px 50px rgba(10, 22, 40, .18);
  --font: "IBM Plex Sans Thai", "Leelawadee UI", "Leelawadee", "Tahoma", system-ui, sans-serif;
  --serif: "Noto Serif Thai", "IBM Plex Sans Thai", "Leelawadee UI", serif;
  --tabbar-h: 0px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a111e; --card: #111b2c; --card-2: #0f1828; --text: #ece7dc; --muted: #a3a9b6; --line: #26324a;
    --ok-bg: #13301f; --bad-bg: #3a1d1b; --warn-bg: #2b2414; --doc512: #9cc0ee; --doc512-bg: #16294a; --doc515: #e6cf96; --doc515-bg: #2e2614;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --bg: #0a111e; --card: #111b2c; --card-2: #0f1828; --text: #ece7dc; --muted: #a3a9b6; --line: #26324a;
  --ok-bg: #13301f; --bad-bg: #3a1d1b; --warn-bg: #2b2414; --doc512: #9cc0ee; --doc512-bg: #16294a; --doc515: #e6cf96; --doc515-bg: #2e2614;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.7;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  padding-bottom: var(--tabbar-h);
}
a { color: var(--navy-3); }
:root[data-theme="dark"] a { color: var(--gold-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a { color: var(--gold-2); } }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Header ---------- */
.topbar { background: linear-gradient(180deg, var(--ink), var(--navy)); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar::after { content: ""; display: block; height: 2px; background: var(--gold-grad); opacity: .9; }
.topbar .inner { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand { flex: 0 1 auto; display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff !important; min-width: 0; }
.logo-slot img { display: block; height: 46px; width: 46px; object-fit: contain; background: #fff; border-radius: 12px; padding: 3px; box-shadow: 0 0 0 1px rgba(230, 207, 150, .55), 0 4px 12px rgba(0, 0, 0, .25); }
body.has-logo .emblem { display: none; }
.emblem { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .06); border: 1px solid rgba(230, 207, 150, .45); }
.emblem svg { width: 26px; height: 26px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand .t1 { font-family: var(--serif); font-weight: 700; font-size: 17px; letter-spacing: 2.5px; color: var(--gold-2); white-space: nowrap; }
.brand .t2 { font-size: 12px; opacity: .78; white-space: nowrap; letter-spacing: .2px; overflow: hidden; text-overflow: ellipsis; }
.nav { margin-left: auto; display: flex; gap: 2px; }
.nav a { color: #e9e3d3 !important; text-decoration: none; padding: 8px 12px; border-radius: 10px; font-size: 14.5px; white-space: nowrap; position: relative; }
.nav a:hover { background: rgba(255, 255, 255, .07); }
.nav a.active { color: var(--gold-2) !important; }
.nav a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--gold-grad); }
.me-link { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--gold-2) !important; border: 1px solid rgba(230, 207, 150, .45); flex: none; }
.me-link svg { width: 20px; height: 20px; }
.me-link.active { background: var(--gold-grad); color: var(--ink) !important; border-color: transparent; }
.net { font-size: 11px; padding: 3px 10px; border-radius: 99px; border: 1px solid rgba(230, 207, 150, .45); color: var(--gold-2); white-space: nowrap; letter-spacing: .5px; }
.net.pending { border-color: #e0a64a; color: #ffd38a; }
.sync { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; white-space: nowrap; vertical-align: middle; }
.sync.ok { background: var(--ok-bg); color: var(--ok); }
.sync.wait { background: var(--bad-bg); color: var(--bad); }

/* ---------- Mobile tab bar ---------- */
.tabbar { display: none; }
@media (max-width: 760px) {
  :root { --tabbar-h: calc(64px + env(safe-area-inset-bottom)); }
  .nav { display: none; }
  .me-link { margin-left: auto; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: linear-gradient(180deg, var(--navy), var(--ink)); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 24px rgba(10, 22, 40, .25); border-top: 1px solid rgba(230, 207, 150, .35);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: #c9c3b3 !important; font-size: 11.5px; padding: 4px 0; border-radius: 12px; min-height: 52px; justify-content: center; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--gold-2) !important; background: rgba(230, 207, 150, .08); }
}

main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }

/* ---------- Typography ---------- */
h1, h2, h3, .serif { font-family: var(--serif); letter-spacing: .2px; }
h1 { font-size: 28px; line-height: 1.35; margin: 0 0 6px; font-weight: 700; }
h2 { font-size: 21px; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 17.5px; margin: 0 0 8px; font-weight: 600; }
h4 { font-size: 15.5px; margin: 16px 0 6px; color: var(--gold-3); font-weight: 600; }
.muted { color: var(--muted); font-size: 14px; }
.eyebrow { font-size: 12px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--gold-3); font-weight: 600; }
.section-title { display: flex; align-items: center; gap: 12px; margin: 28px 0 12px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold), transparent); opacity: .6; }
.section-title h2 { margin: 0; }

/* ---------- Generic ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 16px; position: relative; }
.card.gilt { border-top: 3px solid var(--gold); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 10px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.doc512 { background: var(--doc512-bg); color: var(--doc512); border-color: transparent; font-weight: 600; }
.pill.doc515 { background: var(--doc515-bg); color: var(--doc515); border-color: transparent; font-weight: 600; }
.pill.new { background: var(--warn-bg); border-color: var(--warn-line); color: var(--gold-3); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent;
  background: var(--navy-2); color: #fff !important; padding: 11px 20px; border-radius: 12px; font-size: 15.5px; font-weight: 600;
  cursor: pointer; text-decoration: none; min-height: 46px; transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
  box-shadow: 0 4px 14px rgba(15, 33, 64, .22);
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.gold, .btn.ok { background: var(--gold-grad); color: var(--ink) !important; box-shadow: 0 6px 18px rgba(179, 138, 62, .35); }
.btn.ghost { background: transparent; color: var(--navy-2) !important; border-color: var(--navy-3); box-shadow: none; }
.btn.danger { background: transparent; color: var(--bad) !important; border-color: var(--bad); box-shadow: none; }
:root[data-theme="dark"] .btn.ghost { color: var(--gold-2) !important; border-color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.ghost { color: var(--gold-2) !important; border-color: var(--gold); } }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: grayscale(.3); transform: none; box-shadow: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 34px 28px 30px; margin-bottom: 18px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, var(--navy-3) 0%, var(--navy) 45%, var(--ink) 100%);
  box-shadow: var(--shadow-lg); border: 1px solid rgba(230, 207, 150, .28);
}
.hero .eyebrow { color: var(--gold-2); }
.hero h1 { font-size: 32px; margin-top: 8px; color: #fff; }
.hero p { margin: 4px 0 0; color: #d8d2c3; }
.hero .ornament { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; color: var(--gold); }
.hero .ornament::before, .hero .ornament::after { content: ""; height: 1px; width: 60px; background: var(--gold-grad); }
.hero .wave { position: absolute; right: -40px; bottom: -30px; width: 360px; opacity: .22; pointer-events: none; }
.hero .btn { margin-top: 18px; }
.hero .crest { position: absolute; top: 26px; right: 28px; width: 128px; background: #fff; border-radius: 18px; padding: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .35), 0 0 0 1px rgba(230, 207, 150, .6); }
.hero .crest img { display: block; width: 100%; height: auto; }
.hero.has-crest .hero-body { padding-right: 150px; }
.hero .eyebrow::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--brand-red); margin-right: 8px; vertical-align: 1px; transform: rotate(45deg); }
.hero .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hero .meta span { font-size: 12.5px; padding: 4px 12px; border-radius: 99px; border: 1px solid rgba(230, 207, 150, .4); color: var(--gold-2); background: rgba(255, 255, 255, .04); }

/* ---------- Steps ---------- */
.steps { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); counter-reset: s; }
.step { position: relative; border: 1px solid var(--line); background: var(--card-2); border-radius: 14px; padding: 14px 14px 14px 58px; min-height: 76px; }
.step::before {
  counter-increment: s; content: counter(s); position: absolute; left: 14px; top: 14px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--serif); font-weight: 700; color: var(--gold-3); border: 1.5px solid var(--gold);
}
.step b { display: block; font-size: 15.5px; }
.step.done { border-color: rgba(46, 125, 91, .35); background: var(--ok-bg); }
.step.done::before { content: "✓"; background: var(--ok); color: #fff; border-color: var(--ok); }

/* ---------- Doc cards ---------- */
.doc-card { display: flex; gap: 14px; align-items: flex-start; }
.doc-card .doc-ic { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--doc512-bg); color: var(--doc512); }
.doc-card.d515 .doc-ic { background: var(--doc515-bg); color: var(--doc515); }
.doc-card .doc-ic svg { width: 24px; height: 24px; }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; margin: 8px 0; font-size: 15px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
.tbl tr:last-child td, .tbl tr:last-child th { border-bottom: none; }
.tbl thead th { background: var(--navy); color: var(--gold-2); font-weight: 600; font-size: 14px; letter-spacing: .3px; }
.tbl tbody th { background: var(--card-2); font-weight: 600; width: 32%; }
.tbl-wrap { overflow-x: auto; }
.tbl .nw { white-space: nowrap; font-variant-numeric: tabular-nums; }

.hl { background: var(--warn-bg); border: 1px solid rgba(200, 164, 90, .45); border-left: 4px solid var(--gold); padding: 12px 14px; border-radius: 12px; margin: 12px 0; }
.hl-inline { background: var(--warn-bg); box-shadow: inset 0 -2px 0 rgba(200, 164, 90, .5); }

/* ---------- Form ---------- */
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 15px; }
input, select { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; background: var(--card); color: var(--text); font-family: inherit; min-height: 48px; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200, 164, 90, .25); }
.form-grid { display: grid; gap: 0 18px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.err { color: var(--bad); font-size: 14px; min-height: 1em; }

/* ---------- Lessons ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: var(--card); padding: 9px 16px; border-radius: 99px; cursor: pointer; font-size: 14.5px; color: var(--text); min-height: 42px; }
.tab.active { background: var(--navy); color: var(--gold-2); border-color: var(--navy); box-shadow: 0 4px 14px rgba(15, 33, 64, .25); }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--gold-grad); width: 0; transition: width .35s ease; }
.lesson { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; background: var(--card); overflow: hidden; box-shadow: 0 1px 2px rgba(10, 22, 40, .04); }
.lesson[open] { box-shadow: var(--shadow); border-color: rgba(200, 164, 90, .55); }
.lesson > summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.lesson > summary::-webkit-details-marker { display: none; }
.lesson > summary .chk { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--gold); flex: none; display: grid; place-items: center; font-size: 14px; color: #fff; }
.lesson.read > summary .chk { background: var(--ok); border-color: var(--ok); }
.lesson > summary .ttl { flex: 1; min-width: 180px; font-weight: 600; font-family: var(--serif); }
.lesson > .body { padding: 2px 18px 16px; border-top: 1px solid var(--line); background: linear-gradient(180deg, var(--card-2), var(--card) 80px); }
.lesson > .body ul, .lesson > .body ol { padding-left: 22px; }

/* ---------- Quiz ---------- */
.qhead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.qhead b { font-family: var(--serif); font-size: 17px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; padding: 5px 12px; border-radius: 10px; background: var(--navy); color: var(--gold-2); letter-spacing: .5px; }
.timer.low { background: var(--bad); color: #fff; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .75; } }
.qtext { font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.55; margin: 14px 0 16px; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; text-align: left; border: 1.5px solid var(--line); background: var(--card); color: var(--text); padding: 13px 14px; border-radius: 14px; cursor: pointer; font-size: 16px; line-height: 1.55; min-height: 52px; transition: border-color .15s, background .15s, transform .1s; }
.opt .k { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--card-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--gold-3); }
.opt:hover { border-color: var(--gold); }
.opt:active { transform: scale(.995); }
.opt.sel { border-color: var(--gold); background: var(--warn-bg); box-shadow: 0 0 0 3px rgba(200, 164, 90, .18); }
.opt.sel .k { background: var(--gold-grad); color: var(--ink); border-color: transparent; }
.qdots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.qdot { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.qdot.ans { background: var(--navy); color: var(--gold-2); border-color: var(--navy); }
.qdot.cur { outline: 2px solid var(--gold); outline-offset: 1px; }

/* ---------- Result ---------- */
.score { font-family: var(--serif); font-size: 60px; font-weight: 700; line-height: 1; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.badge { display: inline-block; padding: 4px 14px; border-radius: 99px; font-weight: 700; }
.review { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.review.wrong { border-left: 5px solid var(--bad); }
.review .a-ok { color: var(--ok); }
.review .a-bad { color: var(--bad); text-decoration: line-through; }
.review .exp { background: var(--card-2); border-radius: 8px; padding: 8px 10px; font-size: 14px; margin-top: 6px; }

/* ---------- Rank / Leaderboard ---------- */
.rank-banner {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap; color: #fff; border-radius: 22px; padding: 18px 20px; margin-bottom: 16px;
  background: radial-gradient(140% 140% at 0% 0%, var(--navy-3), var(--navy) 50%, var(--ink)); box-shadow: var(--shadow-lg); border: 1px solid rgba(230, 207, 150, .45);
}
.rank-banner .rk-medal { font-size: 46px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35)); }
.rank-banner > div:nth-child(2) { flex: 1; min-width: 210px; }
.rank-banner .rk-title { font-family: var(--serif); font-size: 20px; }
.rank-banner .rk-title b { font-size: 34px; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rank-banner .rk-sub { font-size: 14px; margin-top: 2px; color: #e4dece; }
.rank-banner .rk-note { font-size: 12px; color: #b9b3a4; margin-top: 6px; }
.rank-banner .btn.ghost { color: var(--gold-2) !important; border-color: var(--gold); }
.rank-banner.pop { animation: pop .55s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { 0% { transform: scale(.92); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .rank-banner.pop, .timer.low { animation: none; } }

.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 10px; align-items: end; margin: 8px 0 18px; }
.podium .pd { text-align: center; border-radius: 16px 16px 10px 10px; padding: 14px 8px 12px; border: 1px solid var(--line); background: var(--card-2); min-width: 0; }
.podium .pd .md { font-size: 30px; line-height: 1.1; }
.podium .pd .nm { font-weight: 700; font-family: var(--serif); line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.podium .pd .vs { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium .pd .sc { font-variant-numeric: tabular-nums; font-weight: 700; margin-top: 4px; }
.podium .p1 { padding-top: 22px; background: radial-gradient(120% 120% at 50% 0%, #fff6d8, var(--card-2)); border-color: var(--gold); box-shadow: 0 10px 26px rgba(179, 138, 62, .25); }
:root[data-theme="dark"] .podium .p1 { background: radial-gradient(120% 120% at 50% 0%, #3a2f15, var(--card-2)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .podium .p1 { background: radial-gradient(120% 120% at 50% 0%, #3a2f15, var(--card-2)); } }
.podium .p2 { border-color: #c0c6cf; }
.podium .p3 { border-color: #cf9a6a; }
.tbl.lb td.rk { font-size: 18px; text-align: center; white-space: nowrap; font-family: var(--serif); font-weight: 700; color: var(--gold-3); }
.tbl.lb tr.me td { background: var(--warn-bg); font-weight: 600; }
@media (max-width: 640px) { .podium .pd .nm { font-size: 14px; } .podium .pd .sc { font-size: 13.5px; } .tbl .hide-m { display: none; } .tbl.lb { font-size: 14px; } .tbl.lb th, .tbl.lb td { padding: 8px 6px; } }

/* ---------- Single attempt / review ---------- */
.warn-box { background: var(--bad-bg); border: 1px solid rgba(180, 67, 58, .45); border-left: 5px solid var(--bad); border-radius: 14px; padding: 13px 15px; margin: 14px 0; }
.warn-box ul { margin: 6px 0 0; padding-left: 20px; }
.chkline { display: flex; gap: 12px; align-items: flex-start; font-weight: 600; margin: 16px 0; cursor: pointer; padding: 12px 14px; border: 1px dashed var(--gold); border-radius: 12px; background: var(--card-2); }
.chkline input { width: 24px; height: 24px; min-height: 0; flex: none; margin-top: 2px; accent-color: var(--gold-3); }
.rv-list { padding-left: 28px; margin: 12px 0; }
.rv-list li { margin-bottom: 8px; }
.rv-list li::marker { font-family: var(--serif); font-weight: 700; color: var(--gold-3); }
.rv { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 12px; padding: 11px 13px; cursor: pointer; font-size: 15px; line-height: 1.55; }
.rv:hover { border-color: var(--gold); }
.rv .rv-q { display: block; }
.rv .rv-a { display: block; color: var(--navy-3); font-weight: 600; margin-top: 4px; }
:root[data-theme="dark"] .rv .rv-a { color: var(--gold-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rv .rv-a { color: var(--gold-2); } }
.rv-list li.miss .rv { border: 2px solid var(--bad); background: var(--bad-bg); }
.rv-list li.miss .rv-a { color: var(--bad); }
.flag { color: var(--bad); }

/* ---------- Exam (anti-capture) ---------- */
body.in-exam .exam { -webkit-user-select: none; user-select: none; position: relative; }
.exam::after { content: ""; position: absolute; inset: 0; background-image: var(--wm, none); background-repeat: repeat; pointer-events: none; border-radius: inherit; z-index: 2; }
body.in-exam .nav, body.in-exam .tabbar { pointer-events: none; opacity: .45; }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--tabbar-h)); transform: translateX(-50%); background: var(--ink); color: var(--gold-2); border: 1px solid rgba(230, 207, 150, .45); padding: 11px 18px; border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 50; font-size: 14.5px; max-width: calc(100vw - 32px); text-align: center; }

footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 20px 16px 36px; }
footer .fl { display: inline-block; width: 40px; height: 1px; background: var(--gold); vertical-align: middle; margin: 0 8px; opacity: .7; }

@media (max-width: 640px) {
  .hide-sm { display: none; }
  .logo-slot img { height: 42px; width: 42px; }
  .qnav .btn { flex: 1; }
  .qnav .spacer { display: none; }
  .qnav #submit { flex-basis: 100%; order: 3; }
  main { padding-top: 16px; }
  .brand .t2 { font-size: 11px; }
  h1 { font-size: 24px; }
  .hero { padding: 26px 20px 24px; border-radius: 20px; }
  .hero h1 { font-size: 25px; }
  .hero .crest { position: static; width: 96px; padding: 7px; border-radius: 14px; margin-bottom: 14px; }
  .hero.has-crest .hero-body { padding-right: 0; }
  .score { font-size: 50px; }
  .card { padding: 18px; }
  .qtext { font-size: 18px; }
}

@media print {
  body { background: #fff; padding: 0; }
  .topbar, footer, .no-print, .toast, .tabbar { display: none !important; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: none; padding: 0; }
  body.in-exam main { display: none !important; }
}
