/* ================= Nabd · design system ================= */
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(../fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(../fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(../fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 700; font-display: swap; src: url(../fonts/inter-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 800; font-display: swap; src: url(../fonts/inter-latin-800-normal.woff2) format('woff2'); }
@font-face { font-family: Fraunces; font-weight: 500; font-display: swap; src: url(../fonts/fraunces-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Fraunces; font-weight: 600; font-display: swap; src: url(../fonts/fraunces-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Fraunces; font-weight: 700; font-display: swap; src: url(../fonts/fraunces-latin-700-normal.woff2) format('woff2'); }

:root {
  --bg: #F4F2EC;
  --surface: #FFFFFF;
  --surface-2: #EFECE4;
  --line: #E2DDD2;
  --line-2: #D3CDBF;
  --text: #17191C;
  --muted: #6F6B63;
  --dept: #1D5FA8;
  --dept-soft: #E7EFF9;
  --dept-ink: #FFFFFF;
  --ok: #1F8A5B;
  --warn: #B7791F;
  --bad: #C0392B;
  --skin: #F1E6DA;
  --radius: 14px;
  --serif: Fraunces, Georgia, 'Times New Roman', serif;
  --sans: Inter, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Arabic', system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #0F1113;
  --surface: #171A1D;
  --surface-2: #1F2327;
  --line: #2A2F34;
  --line-2: #363C42;
  --text: #ECE9E2;
  --muted: #99958C;
  --skin: #2A2622;
  --dept-soft: color-mix(in srgb, var(--dept) 22%, #171A1D);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font: 600 30px/1.1 var(--serif); letter-spacing: -.015em; }
h2 { font: 600 21px/1.2 var(--serif); letter-spacing: -.01em; }
h3 { font-size: 15.5px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i-sm svg.i, svg.i.sm { width: 16px; height: 16px; }

/* ================= splash ================= */
#splash { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-content: center; justify-items: center; gap: 14px; transition: opacity .45s, visibility .45s; }
#splash.gone { opacity: 0; visibility: hidden; }
.pulse-mark { width: 180px; }
.splash-logo { width: 96px; height: 96px; display: block; animation: rise .6s ease both; }
@keyframes rise { from { opacity: 0; transform: scale(.92); } }
.pulse-mark path { fill: none; stroke: var(--text); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 420; stroke-dashoffset: 420; animation: draw 1.6s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.wordmark { font: 600 34px var(--serif); letter-spacing: -.02em; }
.wordmark small { font: 500 15px var(--sans); color: var(--muted); margin-inline-start: 8px; letter-spacing: 0; }

/* ================= shell & nav ================= */
main { padding: 20px 18px calc(100px + var(--safe-b)); max-width: 760px; margin: 0 auto; outline: none; }
.rail { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around; align-items: center; padding: 6px 4px calc(6px + var(--safe-b)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.rail .brand, .rail .dept-list, .rail .rail-foot { display: none; }
.nav-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 6px 8px; min-width: 58px; border-radius: 12px; }
.nav-btn.on { color: var(--dept); }
.nav-btn.big { background: var(--dept); color: var(--dept-ink); width: 54px; height: 54px; min-width: 0; border-radius: 16px; justify-content: center; margin-top: -22px; box-shadow: 0 6px 18px color-mix(in srgb, var(--dept) 35%, transparent); }
.nav-btn.big span { display: none; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
  .rail { position: sticky; top: 0; height: 100vh; flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 2px; padding: 22px 14px; border-top: 0; border-right: 1px solid var(--line); background: var(--surface); backdrop-filter: none; }
  .rail .brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 22px; font: 600 24px var(--serif); }
  .rail .brand svg { width: 34px; height: 34px; }
  .rail .dept-list { display: block; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
  .rail .rail-foot { display: block; margin-top: auto; }
  .dept-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); }
  .dept-link .sw { width: 10px; height: 10px; border-radius: 3px; }
  .dept-link.on { background: var(--surface-2); color: var(--text); }
  .nav-btn { flex-direction: row; gap: 12px; font-size: 14.5px; padding: 10px 12px; min-width: 0; }
  .nav-btn.on { background: var(--dept-soft); }
  .nav-btn.big { width: auto; height: auto; margin: 4px 0; border-radius: 10px; justify-content: flex-start; box-shadow: none; }
  .nav-btn.big span { display: inline; }
  .nav-btn.big.on { background: var(--dept); color: var(--dept-ink); }
  main { padding: 40px 48px 60px; max-width: 1040px; margin: 0; }
  .mobile-only { display: none !important; }
}
@media (max-width: 899px) { .desk-only { display: none !important; } }

/* ================= primitives ================= */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-auto { display: grid; gap: 12px; }
@media (min-width: 900px) { .grid-auto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } .grid4 { grid-template-columns: repeat(4, 1fr) !important; } }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 32px 0 12px; }
.section-title a { color: var(--dept); font-size: 13.5px; font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 11px; font-weight: 600; background: var(--surface-2); border: 1px solid transparent; transition: transform .1s, background .15s; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--dept); color: var(--dept-ink); }
.btn.ghost { background: transparent; border-color: var(--line-2); }
.btn.light { background: rgba(255,255,255,.16); color: #fff; }
.btn.white { background: #fff; color: #111; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.danger { color: var(--bad); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); flex: none; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--muted); }
.chip.on { background: var(--dept); border-color: var(--dept); color: var(--dept-ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.tag.dept { background: var(--dept-soft); color: var(--dept); }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--dept); border-radius: 99px; transition: width .6s; }
.ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--dept-soft); color: var(--dept); flex: none; }
.ico.lg { width: 56px; height: 56px; border-radius: 14px; }
.ico.lg svg.i { width: 28px; height: 28px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.topbar h1 { font-size: 26px; flex: 1; }
.empty { text-align: center; padding: 36px 20px; }
.empty .ico { margin: 0 auto 12px; }

/* ================= landing (department picker) ================= */
.landing-head { padding: 12px 0 26px; }
.landing-head h1 { font-size: 38px; margin-top: 18px; }
.landing-head p { color: var(--muted); margin-top: 8px; max-width: 520px; }
.dept-grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .dept-grid { grid-template-columns: 1fr 1fr; } }
.dept-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 14px; padding: 22px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); transition: transform .15s, border-color .15s; min-height: 210px; }
.dept-card:hover { border-color: var(--c); }
.dept-card:active { transform: scale(.99); }
.dept-card .art { position: absolute; right: -18px; bottom: -18px; width: 150px; height: 150px; color: var(--c); opacity: .14; }
.dept-card .art svg.i { width: 150px; height: 150px; stroke-width: 1.1; }
.dept-card .ico { background: var(--cs); color: var(--c); }
.dept-card h2 { font-size: 26px; }
.dept-card .meta { margin-top: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.dept-card .bar { flex: 1; max-width: 140px; }
.dept-card .bar > i { background: var(--c); }
.strip { display: flex; gap: 10px; margin-top: 22px; }
.strip .stat { flex: 1; }

/* ================= department home ================= */
.dept-switch { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.dept-switch .ico { width: 28px; height: 28px; border-radius: 8px; }
.dept-switch .ico svg.i { width: 17px; height: 17px; }
.feature { position: relative; overflow: hidden; border-radius: 18px; padding: 24px; background: var(--dept); color: var(--dept-ink); }
.feature .eyebrow { color: rgba(255,255,255,.75); }
.feature h2 { font-size: 27px; margin: 8px 0 6px; color: #fff; }
.feature .pattern { position: absolute; inset: 0; opacity: .12; pointer-events: none; }
.feature .art { position: absolute; right: 18px; top: 18px; color: rgba(255,255,255,.22); }
.feature .art svg.i { width: 84px; height: 84px; stroke-width: 1.2; }
.stat { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.stat b { font: 600 26px/1.1 var(--serif); display: block; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.action { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-align: left; width: 100%; }
.action .txt { flex: 1; min-width: 0; }
.action b { display: block; font-size: 15px; }
.action .chev { color: var(--muted); }
.topic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 900px) { .topic-grid { grid-template-columns: repeat(3, 1fr); } }
.topic { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.topic .ico { width: 40px; height: 40px; border-radius: 10px; }
.topic b { display: block; font-size: 14px; line-height: 1.25; }
.topic span { font-size: 12px; color: var(--muted); }

/* ================= station list ================= */
.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; margin-bottom: 12px; color: var(--muted); }
.search input { flex: 1; background: none; border: 0; outline: none; color: var(--text); font: inherit; padding: 12px 0; }
.st-row { display: flex; gap: 14px; align-items: center; padding: 14px 16px; width: 100%; text-align: left; }
.st-row .num { font: 600 15px var(--serif); color: var(--muted); width: 26px; flex: none; }
.st-row h3 { font-size: 15px; line-height: 1.3; }
.st-row .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.score-pill { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 7px; background: var(--surface-2); color: var(--muted); flex: none; }
.score-pill.good { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.score-pill.mid { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.list-card { padding: 0; overflow: hidden; }
.list-card > * + * { border-top: 1px solid var(--line); }
.group-h { display: flex; align-items: center; gap: 10px; margin: 26px 2px 10px; }
.group-h .ico { width: 30px; height: 30px; border-radius: 8px; }
.group-h .ico svg.i { width: 17px; height: 17px; }
.group-h h3 { font: 600 17px var(--serif); flex: 1; }

/* ================= station page ================= */
.st-head { border-radius: 18px; padding: 22px; background: var(--dept-soft); position: relative; }
.st-head .crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--dept); }
.st-head h1 { font-size: 30px; margin: 10px 0 12px; max-width: 92%; }
.st-head .facts { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.st-head .facts span { display: inline-flex; align-items: center; gap: 6px; }
.st-head .close { position: absolute; top: 16px; right: 16px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 18px 0; position: sticky; top: 0; z-index: 5; background: var(--bg); }
.tab { flex: 1; padding: 12px 6px; font-size: 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--text); border-color: var(--dept); }

.door { border: 1.5px solid var(--text); border-radius: 6px; padding: 0; background: var(--surface); }
.door-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1.5px solid var(--text); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.door-body { padding: 16px; font: 500 17px/1.55 var(--serif); }
.door-foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px dashed var(--line-2); font-size: 12.5px; color: var(--muted); }

.media-video { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; background: #000; }
.media-video iframe, .media-video video { width: 100%; height: 100%; border: 0; display: block; }
.video-ph { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px dashed var(--line-2); }
.video-ph .play { width: 46px; height: 46px; border-radius: 50%; background: var(--dept); color: var(--dept-ink); display: grid; place-items: center; flex: none; }
.video-ph .play svg.i { width: 18px; height: 18px; fill: currentColor; }

.gallery { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.gallery figure { margin: 0; flex: none; width: 78%; max-width: 360px; scroll-snap-align: start; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 12px; display: block; background: var(--surface-2); }
.gallery figcaption { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.hotspot-wrap { position: relative; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.hotspot-wrap img, .hotspot-wrap svg.dg { display: block; width: 100%; height: auto; }
.hs { position: absolute; transform: translate(-50%, -50%); width: 28px; height: 28px; border-radius: 50%; background: var(--dept); color: var(--dept-ink); font-size: 12px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--surface); box-shadow: 0 0 0 0 color-mix(in srgb, var(--dept) 60%, transparent); animation: ring 2.4s infinite; }
.hs.seen { animation: none; background: var(--surface); color: var(--dept); border-color: var(--dept); }
.hs.on { transform: translate(-50%, -50%) scale(1.15); background: var(--text); color: var(--bg); border-color: var(--surface); }
@keyframes ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--dept) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 12px transparent; } }
.hs-info { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); min-height: 56px; font-size: 14px; }
.hs-info b { color: var(--dept); display: block; margin-bottom: 2px; }

svg.dg .dg-skin { fill: var(--skin); }
svg.dg .dg-skin2 { fill: color-mix(in srgb, var(--skin) 82%, var(--text) 6%); }
svg.dg .dg-ln { fill: none; stroke: var(--text); stroke-opacity: .55; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
svg.dg .dg-soft, svg.dg .dg-soft path { fill: none; stroke: var(--text); stroke-opacity: .22; stroke-width: 1.8; stroke-linecap: round; }
svg.dg .dg-guide { fill: none; stroke: var(--dept); stroke-opacity: .55; stroke-width: 1.6; stroke-dasharray: 5 6; }
svg.dg .dg-acc path, svg.dg .dg-acc { fill: none; stroke: var(--dept); stroke-width: 2.4; stroke-linecap: round; }
svg.dg .dg-acc-fill { fill: var(--dept); fill-opacity: .35; stroke: var(--dept); stroke-width: 1.6; }

.timeline { position: relative; margin: 6px 0 0; padding: 0; list-style: none; }
.timeline li { position: relative; padding: 0 0 16px 40px; }
.timeline li::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .n { position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--dept-soft); color: var(--dept); font-weight: 800; font-size: 13px; }
.timeline b { display: block; font-size: 14.5px; padding-top: 3px; }
.timeline span { font-size: 12.5px; color: var(--muted); }

.mnemo-tiles { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.mnemo-tiles .t { flex: 1 1 64px; min-width: 64px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; text-align: center; background: var(--surface); }
.mnemo-tiles .t b { display: block; font: 700 24px var(--serif); color: var(--dept); }
.mnemo-tiles .t span { font-size: 11.5px; color: var(--muted); line-height: 1.25; display: block; margin-top: 2px; }
.mnemo-word { font: 700 24px var(--serif); color: var(--dept); margin-top: 6px; }

table.signs { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.signs th, table.signs td { padding: 10px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.signs th { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; background: var(--surface-2); }
table.signs td:first-child { font-weight: 700; }
.table-wrap { overflow-x: auto; margin: 10px -18px -18px; }
.table-wrap table { min-width: 100%; }

.listing { margin: 8px 0 0; padding: 0; list-style: none; }
.listing li { position: relative; padding: 8px 0 8px 22px; border-top: 1px solid var(--line); font-size: 14.5px; }
.listing li:first-child { border-top: 0; }
.listing li::before { content: ''; position: absolute; left: 4px; top: 16px; width: 7px; height: 7px; border-radius: 2px; background: var(--dept); }
.listing.bad li::before { background: var(--bad); }
.callout-h { display: flex; align-items: center; gap: 8px; }
.callout-h .ico { width: 30px; height: 30px; border-radius: 8px; }
.callout-h .ico svg.i { width: 17px; height: 17px; }
.ico.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.ico.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }

/* checklist */
.phase { margin-top: 20px; }
.phase-h { display: flex; justify-content: space-between; align-items: center; margin: 0 2px 8px; }
.phase-h b { font: 600 16px var(--serif); }
.phase-h span { font-size: 12px; color: var(--muted); font-weight: 600; }
.phase-img { margin: 0 0 8px; }
.phase-img img { width: 100%; border-radius: 12px; display: block; }
.check { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; transition: background .15s, border-color .15s; }
.check .box { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line-2); flex: none; display: grid; place-items: center; margin-top: 1px; transition: all .15s; }
.check .box svg.i { width: 15px; height: 15px; stroke-width: 2.6; }
.check.done { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: color-mix(in srgb, var(--ok) 6%, var(--surface)); }
.check.done .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.check.done .txt { color: var(--muted); }
.check .crit { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; color: var(--bad); margin-right: 6px; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; vertical-align: 1px; }
.check .tip { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* viva */
.flip { perspective: 1200px; cursor: pointer; }
.flip-in { position: relative; transition: transform .5s cubic-bezier(.2, .8, .2, 1); transform-style: preserve-3d; min-height: 140px; }
.flip.on .flip-in { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); overflow: auto; }
.face.back { transform: rotateY(180deg); background: var(--dept-soft); border-color: transparent; }
.face .lbl { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--muted); }
.face.back .lbl { color: var(--dept); }
.face p { font: 500 17px/1.45 var(--serif); }

.sticky-cta { position: sticky; bottom: calc(84px + var(--safe-b)); margin-top: 22px; z-index: 6; display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
@media (min-width: 900px) { .sticky-cta { bottom: 18px; max-width: 460px; margin-left: auto; } }

/* ================= run station ================= */
.run { min-height: calc(100vh - 60px); display: flex; flex-direction: column; }
.clock { width: 200px; height: 200px; margin: 8px auto; border-radius: 50%; display: grid; place-items: center; text-align: center; background: radial-gradient(closest-side, var(--bg) 90%, transparent 91%), conic-gradient(var(--dept) calc(var(--p) * 1%), var(--surface-2) 0); }
.clock .t { font: 600 50px/1 var(--serif); font-variant-numeric: tabular-nums; }
.clock .lbl { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-top: 6px; }
.mini-timer { position: sticky; top: 8px; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 8px; }
.mini-timer .t { font: 600 24px var(--serif); font-variant-numeric: tabular-nums; }
.mini-timer.warn { border-color: var(--warn); }
.mini-timer.warn .t { color: var(--warn); }
.result-score { width: 170px; height: 170px; border-radius: 50%; margin: 12px auto; display: grid; place-items: center; text-align: center; background: radial-gradient(closest-side, var(--surface) 88%, transparent 89%), conic-gradient(var(--ring, var(--ok)) calc(var(--p) * 1%), var(--surface-2) 0); }
.result-score b { font: 600 44px var(--serif); }
.verdict { text-align: center; font: 600 22px var(--serif); }
.mock-dots { display: flex; gap: 5px; justify-content: center; margin-bottom: 8px; }
.mock-dots i { flex: 0 1 26px; height: 5px; border-radius: 5px; background: var(--surface-2); }
.mock-dots i.done { background: var(--ok); }
.mock-dots i.cur { background: var(--dept); }

/* ================= cards & quiz ================= */
.deck .flip-in { min-height: 300px; }
.deck .face { padding: 28px; text-align: center; align-items: center; }
.deck .face p { font-size: 21px; }
.grade { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.opt { display: flex; gap: 12px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--line); margin-bottom: 8px; font-weight: 500; transition: border-color .15s, background .15s; }
.opt .k { font-weight: 800; color: var(--muted); }
.opt.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 9%, var(--surface)); }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--surface)); }
.explain { margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--surface-2); font-size: 14.5px; }

/* ================= progress ================= */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; overflow-x: auto; }
.heat i { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-2); }
.heat i.l1 { background: color-mix(in srgb, var(--dept) 30%, var(--surface-2)); }
.heat i.l2 { background: color-mix(in srgb, var(--dept) 60%, var(--surface-2)); }
.heat i.l3 { background: var(--dept); }

/* ================= settings ================= */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.switch { width: 46px; height: 28px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { background: var(--dept); }
.switch.on::after { transform: translateX(18px); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.seg button { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
input.text, textarea.text, select.text { background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; color: var(--text); font: inherit; width: 100%; }
input.text:focus, textarea.text:focus, select.text:focus { outline: 2px solid color-mix(in srgb, var(--dept) 40%, transparent); border-color: var(--dept); }

/* ================= toast, sheet, viewer ================= */
#toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 16px); opacity: 0; z-index: 90; background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; transition: all .25s; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.sheet:not(.pg) { position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 14, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet:not(.pg)[hidden] { display: none; }
.sheet .panel { background: var(--surface); width: 100%; max-width: 520px; border-radius: 20px 20px 0 0; padding: 20px 18px calc(24px + var(--safe-b)); animation: up .25s ease; max-height: 88vh; overflow: auto; }
@media (min-width: 900px) { .sheet:not(.pg) { align-items: center; } .sheet .panel { border-radius: 18px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.viewer { position: fixed; inset: 0; z-index: 80; background: rgba(8, 9, 11, .95); display: flex; flex-direction: column; color: #fff; }
.viewer-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; }
.viewer-img { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 0 10px; }
.viewer-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.viewer-img.zoomed { display: block; }
.viewer-img.zoomed img { max-width: none; max-height: none; width: 200%; }

.fade-in { animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.burst { position: fixed; top: -10px; width: 8px; height: 12px; z-index: 70; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(600deg); } }

/* ---------- Blueprint and study planner ---------- */

/* ---------- settings: grouped, with picture choices for the pens ---------- */
.settings-page { max-width: 760px; }
.set-group { margin-top: 26px; }
.set-group > h2 { font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--muted); margin: 0 0 8px 4px; }
.set-group > p { margin: -4px 0 10px 4px; }
.set-block { padding: 8px 0 16px; border-bottom: 1px solid var(--line); }
.set-block:last-child { border-bottom: 0; padding-bottom: 6px; }
.set-block > b { display: block; margin-bottom: 10px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { display: grid; gap: 3px; justify-items: start; text-align: left; padding: 10px 12px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); transition: border-color .2s, background .2s; }
.choice .art { width: 100%; height: 64px; margin-bottom: 6px; border-radius: 9px; background: var(--surface-2); }
.choice b { font-size: 14.5px; }
.choice span { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.choice.on { border-color: var(--dept); background: color-mix(in srgb, var(--dept) 5%, var(--surface)); }
.choice .tx rect { fill: color-mix(in srgb, var(--text) 22%, transparent); }
.choice .hl { fill: #FFD84D; opacity: .55; mix-blend-mode: multiply; }
.choice .hlf { fill: none; stroke: #FFD84D; stroke-width: 12; opacity: .55; stroke-linecap: round; mix-blend-mode: multiply; }
.choice .ink { fill: none; stroke: #1F3A93; stroke-width: 2.4; stroke-linecap: round; }
.choice .ink.gone { stroke-dasharray: 3 4; opacity: .35; }
.choice .er { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.set-group > h2 { font-family: var(--sans); text-transform: none; }
.choice .pp { fill: var(--surface); stroke: color-mix(in srgb, var(--text) 30%, transparent); stroke-width: 1.4; }
.choice .pp.dim { opacity: .5; }
.choice .ar { fill: none; stroke: var(--dept); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html, body { touch-action: pan-x pan-y; }
