/* =========================================================
   Upper Sixth revision section
   Builds on style.css (DM Serif Display / DM Sans / DM Mono)
   ========================================================= */

.u6 {
  --navy: #0f2147;
  --navy-2: #1a3263;
  --accent: #1e73ff;
  --accent-soft: #e8f0ff;
  --accent-ink: #0b4fc4;
  --ok: #047857;
  --ok-soft: #e7f6ef;
  --bad: #be123c;
  --bad-soft: #fdecef;
  --warn-soft: #fff6e0;
  --paper: #ffffff;
  --line: #e2e0da;
  --ink: #1c1c1a;
  --muted: #6b6b65;
  --radius: 16px;
  font-family: 'DM Sans', Arial, sans-serif;
  color: var(--ink);
}
.u6-geo {
  --accent: #0f8a5f;
  --accent-soft: #e5f5ee;
  --accent-ink: #0b6b49;
}
.u6-eng {
  --accent: #7a1a2e;
  --accent-soft: #f7ecef;
  --accent-ink: #4a0f1c;
}

.u6 [hidden] { display: none !important; }
.u6-wrap { max-width: 1120px; margin: 0 auto; padding: 0 2rem; }
.u6-main { padding-top: 2rem; padding-bottom: 6rem; }
.u6 code { font-family: 'DM Mono', monospace; font-size: 0.9em; background: rgba(15,33,71,0.07); padding: 1px 5px; border-radius: 4px; }

/* ---------- Buttons ---------- */
.u6 .btn {
  font-family: inherit; font-size: 14px; font-weight: 600; border-radius: 10px;
  padding: 10px 18px; border: 1.5px solid transparent; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, border-color .15s, transform .1s; white-space: nowrap;
}
.u6 .btn:active { transform: translateY(1px); }
.u6 .btn-primary { background: var(--accent); color: #fff; }
.u6 .btn-primary:hover { background: var(--accent-ink); }
.u6 .btn-ghost { background: var(--paper); color: var(--ink); border-color: var(--line); }
.u6 .btn-ghost:hover { border-color: var(--ink); }
.u6 .btn-yes { background: var(--ok); color: #fff; min-width: 120px; justify-content: center; }
.u6 .btn-no { background: var(--paper); color: var(--bad); border-color: #f3b8c4; min-width: 120px; justify-content: center; }
.u6 .link-btn { background: none; border: none; color: var(--accent-ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Home hero ---------- */
.u6-home-hero {
  background: radial-gradient(1200px 400px at 85% -10%, rgba(30,115,255,.35), transparent 60%), var(--navy);
  color: #fff; padding: 64px 0 56px; position: relative; overflow: hidden;
}
.u6-home-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: linear-gradient(to bottom, #000, transparent);
}
.u6-home-badge { font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.7); margin-bottom: 14px; }
.u6-home-title { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: clamp(38px, 6vw, 60px); line-height: 1.05; margin: 0 0 14px; }
.u6-home-sub { font-size: 17px; max-width: 620px; color: rgba(255,255,255,.82); margin: 0 0 28px; }
.u6-subject-switch { display: flex; gap: 12px; flex-wrap: wrap; position: relative; z-index: 1; }
.u6-switch {
  color: #fff; text-decoration: none; border: 1.5px solid rgba(255,255,255,.3); border-radius: 12px;
  padding: 12px 18px; font-weight: 600; font-size: 15px; background: rgba(255,255,255,.06);
  display: flex; flex-direction: column; gap: 2px; min-width: 200px; transition: background .15s, border-color .15s;
}
.u6-switch span { font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 500; opacity: .7; }
.u6-switch:hover, .u6-switch.is-active { background: #fff; color: var(--navy); border-color: #fff; }

/* ---------- How-to strip ---------- */
.u6-howto { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 2.5rem; }
.u6-howto-title { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.u6-howto-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.u6-howto-steps li { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.u6-howto-steps strong { color: var(--ink); font-size: 14px; }
.hs-n { width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; font-family: 'DM Mono', monospace; font-size: 12px; display: grid; place-items: center; margin-bottom: 6px; }

/* ---------- Subject sections ---------- */
.u6-subject { margin-bottom: 3.5rem; scroll-margin-top: 80px; }
.u6-subject-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.u6-subject-mark { font-family: 'DM Serif Display', serif; font-size: 15px; color: var(--muted); }
.u6-subject-mark span { color: var(--accent); }
.u6-subject-name { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 36px; margin: 0; line-height: 1.1; }
.u6-subject-name small { font-family: 'DM Mono', monospace; font-size: 13px; color: var(--muted); margin-left: 6px; }
.u6-overall { min-width: 240px; }
.u6-overall-bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.u6-overall-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .6s; }
.u6-overall-label { font-size: 12px; color: var(--muted); margin-top: 6px; display: block; text-align: right; }

.u6-papers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.u6-paperbox { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 14px 18px; }
.u6-paperbox-name { font-weight: 600; font-size: 15px; }
.u6-paperbox-detail { font-size: 13px; color: var(--muted); }

.u6-group-title { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 28px 0 12px; }
.u6-topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.u6-tcard {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 16px;
  text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 6px;
  transition: box-shadow .15s, transform .15s, border-color .15s; position: relative;
}
.u6-tcard:hover { box-shadow: 0 8px 28px rgba(15,33,71,.1); transform: translateY(-2px); border-color: var(--accent); }
.u6-tcard-code { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--accent-ink); }
.u6-tcard-code em { font-style: normal; font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 600; background: var(--accent-soft); padding: 1px 7px; border-radius: 99px; margin-left: 4px; }
.u6-tcard-title { font-family: 'DM Serif Display', serif; font-size: 21px; line-height: 1.15; }
.u6-tcard-sum { font-size: 13px; color: var(--muted); line-height: 1.45; flex: 1; }
.u6-tcard-bar { height: 5px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.u6-tcard-fill { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 99px; }

.u6-res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.u6-res { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.u6-res span { font-size: 12.5px; color: var(--muted); }
.u6-res:hover { border-color: var(--accent); }

.u6-ai { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 28px; }
.u6-ai h2 { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 28px; margin: 0 0 16px; }
.u6-ai-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.u6-ai-grid p { font-size: 13.5px; color: rgba(255,255,255,.78); margin: 4px 0 0; line-height: 1.5; }

/* ---------- Topic hero ---------- */
.u6-topic-hero { background: var(--navy); color: #fff; padding: 28px 0 30px; }
.u6-geo .u6-topic-hero { background: linear-gradient(135deg, #0c3b2e 0%, #0f2147 100%); }
.u6-crumb { color: rgba(255,255,255,.72); text-decoration: none; font-size: 13px; font-weight: 500; }
.u6-crumb:hover { color: #fff; }
.u6-topic-badges { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 10px; }
.u6-code, .u6-paper, .u6-scope { font-family: 'DM Mono', monospace; font-size: 12px; padding: 4px 10px; border-radius: 99px; }
.u6-code { background: var(--accent); color: #fff; }
.u6-paper { background: rgba(255,255,255,.12); color: #fff; }
.u6-scope { background: #ffd66b; color: #3b2a00; }
.u6-topic-title { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: clamp(32px, 5vw, 48px); line-height: 1.08; margin: 0 0 10px; }
.u6-topic-summary { font-size: 16.5px; color: rgba(255,255,255,.82); max-width: 760px; margin: 0 0 16px; }
.u6-topic-summary code { background: rgba(255,255,255,.14); }
.u6-spec { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.15); border-radius: 12px; padding: 10px 16px; max-width: 820px; }
.u6-spec summary { cursor: pointer; font-size: 13px; font-weight: 600; color: rgba(255,255,255,.9); }
.u6-spec ul { margin: 10px 0 4px; padding-left: 18px; font-size: 13.5px; color: rgba(255,255,255,.85); }
.u6-spec li { margin-bottom: 4px; }
.u6-spec-note { font-size: 13px; color: #ffd66b; margin: 8px 0 2px; }

/* ---------- Tabs ---------- */
.u6-tabs { position: sticky; top: 56px; z-index: 50; background: rgba(247,246,242,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.u6-tabs-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.u6-tabs-inner::-webkit-scrollbar { display: none; }
.u6-tab {
  background: none; border: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted);
  padding: 14px 14px 12px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.u6-tab:hover { color: var(--ink); }
.u6-tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.u6-tab-n { width: 20px; height: 20px; border-radius: 50%; background: var(--line); color: var(--ink); font-family: 'DM Mono', monospace; font-size: 11px; display: grid; place-items: center; }
.u6-tab.is-active .u6-tab-n { background: var(--accent); color: #fff; }

.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.panel-head h2 { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 30px; margin: 0 0 4px; }
.panel-head p { color: var(--muted); margin: 0; max-width: 700px; font-size: 14.5px; }

/* ---------- Info sheet ---------- */
.sheet { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 30px; box-shadow: 0 2px 0 rgba(0,0,0,.02); }
.sheet-top { border-bottom: 2px solid var(--navy); padding-bottom: 10px; margin-bottom: 18px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sheet-kicker { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--accent-ink); order: 2; }
.sheet-title { font-family: 'DM Serif Display', serif; font-size: 26px; }
.sheet-cols { columns: 2; column-gap: 34px; }
.sheet-sec { break-inside: avoid; margin-bottom: 20px; }
.sheet-sec.sheet-wide { column-span: all; }
.sheet h3 { font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent-ink); margin: 0 0 8px; }
.sheet p { font-size: 14px; margin: 0 0 8px; line-height: 1.55; }
.sheet-list, .sheet-steps { margin: 0 0 10px; padding-left: 18px; font-size: 14px; }
.sheet-list li, .sheet-steps li { margin-bottom: 4px; line-height: 1.5; }
.sheet-terms { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 6px; }
.sheet-terms dl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 28px; margin: 0; }
.sheet-terms dl > div { font-size: 13.5px; line-height: 1.45; }
.sheet-terms dt { font-weight: 700; display: inline; }
.sheet-terms dt::after { content: ": "; }
.sheet-terms dd { display: inline; margin: 0; color: #3d3d39; }
.sheet-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.sheet-tips, .sheet-mistakes { border-radius: 12px; padding: 14px 16px; }
.sheet-tips { background: var(--accent-soft); }
.sheet-mistakes { background: var(--bad-soft); }
.sheet-mistakes h3 { color: var(--bad); }
.sheet-tips ul, .sheet-mistakes ul { margin: 0; padding-left: 18px; font-size: 13.5px; }
.sheet-tips li, .sheet-mistakes li { margin-bottom: 4px; }

.callout { border-radius: 10px; padding: 11px 14px; font-size: 13.5px; line-height: 1.5; margin: 8px 0 12px; }
.callout-info { background: var(--accent-soft); border-left: 4px solid var(--accent); }
.callout-tip { background: var(--warn-soft); border-left: 4px solid #e0a100; }
.callout-warn { background: var(--bad-soft); border-left: 4px solid var(--bad); }
.callout strong { margin-right: 4px; }

.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 6px 0 12px; }
.compare-col { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.compare-head { background: var(--navy); color: #fff; font-weight: 600; font-size: 13px; padding: 6px 10px; }
.compare-col ul { margin: 0; padding: 8px 10px 8px 26px; font-size: 13px; }
.compare-col li { margin-bottom: 3px; }

/* ---------- Visuals ---------- */
.v { margin: 10px 0 14px; }
.v-caption { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.v-scroll { overflow-x: auto; }
.data-table { border-collapse: collapse; font-size: 13.5px; width: 100%; background: var(--paper); }
.data-table th, .data-table td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.data-table thead th { background: var(--navy); color: #fff; font-weight: 600; border-color: var(--navy); }
.data-table .cell-hl { background: #fff3c4; font-weight: 700; }
.data-table .row-hl td { background: var(--accent-soft); }

.bits { display: flex; flex-direction: column; gap: 4px; overflow-x: auto; padding: 2px; }
.bits-row { display: flex; align-items: center; gap: 3px; font-family: 'DM Mono', monospace; }
.bits-label { font-family: 'DM Sans', sans-serif; font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: right; padding-right: 8px; min-width: 76px; flex-shrink: 0; }
.bits-head .bit-h { width: 32px; flex-shrink: 0; font-size: 10.5px; color: var(--muted); text-align: center; }
.bit { width: 32px; height: 34px; flex-shrink: 0; display: grid; place-items: center; border-radius: 6px; background: #f1f0eb; font-size: 15px; font-weight: 500; }
.bit-one { background: #dde8ff; color: var(--navy); }
.u6-geo .bit-one { background: #d7f0e4; }
.bit-point { width: 10px; flex-shrink: 0; text-align: center; font-weight: 700; font-size: 20px; color: var(--bad); line-height: 1; }
.bits-head .bit-point { font-size: 10px; }
.bit-hl { outline: 2.5px solid #e0a100; background: #fff3c4; }
.bits-result .bit { background: var(--navy); color: #fff; }
.bits-result .bit.bit-hl { background: #e0a100; color: #fff; outline: none; }
.bits-note { font-family: 'DM Sans', sans-serif; font-size: 12.5px; color: var(--muted); padding-left: 10px; }

.flow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.flow-node { background: var(--paper); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 500; max-width: 260px; }
.flow-active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(30,115,255,.12); font-weight: 700; }
.flow-arrow { color: var(--muted); font-size: 18px; }
.flow-return { font-size: 12px; color: var(--muted); font-style: italic; margin-left: 6px; }

.arr { display: flex; flex-wrap: wrap; gap: 4px; padding-bottom: 20px; }
.arr-cell { position: relative; min-width: 44px; text-align: center; }
.arr-val { border: 1.5px solid var(--line); background: var(--paper); border-radius: 8px; padding: 8px 6px; font-family: 'DM Mono', monospace; font-size: 14px; }
.arr-idx { font-size: 10.5px; color: var(--muted); font-family: 'DM Mono', monospace; margin-top: 2px; }
.arr-ptr { position: absolute; left: 50%; transform: translateX(-50%); top: 100%; margin-top: 12px; font-size: 11px; font-weight: 700; color: var(--accent-ink); white-space: nowrap; }
.arr-ptr ~ .arr-ptr { margin-top: 26px; }
.arr-hl .arr-val { border-color: #e0a100; background: #fff3c4; font-weight: 700; }
.arr-dim .arr-val { opacity: .35; }
.arr-done .arr-val { background: var(--ok-soft); border-color: #9fd9bf; }

.stack { display: inline-flex; flex-direction: column; border: 2px solid var(--navy); border-top: none; border-radius: 0 0 10px 10px; padding: 4px; gap: 4px; min-width: 120px; }
.stack-cell { background: var(--paper); border: 1.5px solid var(--line); border-radius: 6px; padding: 6px 10px; font-family: 'DM Mono', monospace; font-size: 14px; text-align: center; position: relative; }
.stack-top { border-color: var(--accent); background: var(--accent-soft); }
.stack-label { position: absolute; left: 100%; margin-left: 12px; font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 600; color: var(--accent-ink); white-space: nowrap; }
.stack-empty { color: var(--muted); font-style: italic; }

.code { background: #0f1a33; color: #e6ecff; border-radius: 10px; padding: 12px 0; font-family: 'DM Mono', monospace; font-size: 13px; line-height: 1.55; overflow-x: auto; margin: 0; }
.code-line { display: block; padding: 0 14px 0 0; white-space: pre; }
.code-ln { display: inline-block; width: 34px; text-align: right; margin-right: 14px; color: #6f7ea6; user-select: none; }
.code-hl { background: rgba(255,214,107,.18); box-shadow: inset 3px 0 0 #ffd66b; }

.calc { background: #fbfaf7; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-family: 'DM Mono', monospace; font-size: 14px; }
.calc-line { padding: 3px 0; }
.calc-final { border-top: 1.5px solid var(--ink); margin-top: 4px; padding-top: 6px; font-weight: 700; color: var(--accent-ink); }
.calc code { background: none; padding: 0; }

.vcards { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 8px; }
.vcard { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--paper); }
.vcard-hl { border-color: var(--accent); background: var(--accent-soft); }
.vcard-title { font-weight: 700; font-size: 13.5px; margin-bottom: 2px; }
.vcard-text { font-size: 12.5px; color: #3d3d39; line-height: 1.45; }

.svg-wrap svg { max-width: 100%; height: auto; display: block; }

/* ---------- Flashcards ---------- */
.fc { max-width: 720px; margin: 0 auto; }
.fc-bar { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.fc-progress { flex: 1; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.fc-progress-fill { height: 100%; width: 0; background: var(--ok); transition: width .3s; }
.fc-count, .fc-known { font-family: 'DM Mono', monospace; font-size: 12.5px; }
.fc-stage { perspective: 1400px; }
.fc-card {
  width: 100%; min-height: 300px; position: relative; border: none; padding: 0; cursor: pointer; background: none;
  transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.7,.2,1); font: inherit; color: inherit; text-align: center;
}
.fc-card.is-flipped { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 36px 40px;
  border: 1px solid var(--line); background: var(--paper); box-shadow: 0 10px 40px rgba(15,33,71,.08);
}
.fc-back { transform: rotateY(180deg); background: var(--navy); color: #fff; border-color: var(--navy); }
.fc-label { position: absolute; top: 18px; left: 22px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.fc-back .fc-label { color: #9cc0ff; }
.u6-geo .fc-back .fc-label { color: #8fe0bd; }
.fc-text { font-size: 21px; line-height: 1.45; max-width: 560px; }
.fc-back .fc-text { font-size: 17px; line-height: 1.55; }
.fc-hint { position: absolute; bottom: 16px; font-size: 12px; color: var(--muted); }
.fc-actions { display: flex; justify-content: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.fc-tools { display: flex; justify-content: center; gap: 18px; margin-top: 12px; flex-wrap: wrap; }
.fc-card.is-known .fc-front { box-shadow: 0 0 0 3px var(--ok) inset, 0 10px 40px rgba(15,33,71,.08); }
.fc-done { text-align: center; padding: 60px 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; }

/* ---------- Walk-through worksheet ---------- */
.ws-score { font-family: 'DM Mono', monospace; font-size: 13px; background: var(--paper); border: 1px solid var(--line); padding: 8px 14px; border-radius: 99px; }
.ws-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.ws { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; transition: border-color .2s; }
.ws.is-correct { border-color: #9fd9bf; }
.ws.is-wrong { border-color: #f3b8c4; }
.ws-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ws-n { font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 500; background: var(--navy); color: #fff; padding: 3px 9px; border-radius: 99px; }
.ws-skill { font-size: 12px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); padding: 3px 10px; border-radius: 99px; }
.ws-q { font-size: 16px; font-weight: 500; margin-bottom: 10px; line-height: 1.5; }
.ws-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.ws-opt { display: flex; align-items: flex-start; gap: 10px; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-size: 14px; transition: border-color .15s, background .15s; }
.ws-opt:hover { border-color: var(--accent); }
.ws-opt input { margin-top: 3px; accent-color: var(--accent); }
.ws-opt.is-picked-right { border-color: var(--ok); background: var(--ok-soft); }
.ws-opt.is-picked-wrong { border-color: var(--bad); background: var(--bad-soft); }
.ws-input { margin-bottom: 12px; }
.ws-text { font-family: 'DM Mono', monospace; font-size: 15px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 10px; width: 100%; max-width: 360px; }
.ws-text:focus { outline: none; border-color: var(--accent); }
.ws-buttons { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.ws-feedback { font-size: 14px; font-weight: 600; margin-top: 10px; }
.ws-feedback.ok { color: var(--ok); }
.ws-feedback.bad { color: var(--bad); }
.ws-walk { margin-top: 14px; background: #fbfaf7; border: 1px dashed #c9c6bd; border-radius: 12px; padding: 16px 18px; }
.ws-walk-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 10px; }
.ws-step { border-left: 3px solid var(--accent); padding: 2px 0 4px 14px; margin-bottom: 14px; animation: stepIn .35s ease; }
.ws-step-n { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ws-step-text { font-size: 14.5px; line-height: 1.55; margin-top: 2px; }
.ws-walk-nav { display: flex; gap: 10px; flex-wrap: wrap; }
@keyframes stepIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Exam questions ---------- */
.exq { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.exq-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.exq-n { font-family: 'DM Mono', monospace; font-size: 12px; background: var(--navy); color: #fff; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.exq-cmd { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-ink); }
.exq-marks { margin-left: auto; font-family: 'DM Mono', monospace; font-size: 12.5px; background: var(--accent-soft); color: var(--accent-ink); padding: 3px 10px; border-radius: 99px; }
.exq-q { font-size: 15.5px; line-height: 1.55; margin-bottom: 10px; white-space: pre-line; }
.exq-answer { width: 100%; font: inherit; font-size: 14.5px; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; resize: vertical; line-height: 1.55; background: #fdfdfb; }
.exq-answer:focus { outline: none; border-color: var(--accent); }
.exq-buttons { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.exq-ms { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.exq-ms-title { font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.exq-tally { font-family: 'DM Mono', monospace; font-size: 13px; background: var(--ok-soft); color: var(--ok); padding: 3px 10px; border-radius: 99px; }
.exq-ms-note { font-size: 13px; color: var(--muted); margin: 4px 0 8px; }
.exq-ms-sub { font-weight: 700; font-size: 13px; margin: 12px 0 4px; }
.exq-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.exq-points label { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }
.exq-points input { margin-top: 3px; accent-color: var(--ok); }
.exq-points label:has(input:checked) { background: var(--ok-soft); border-color: #9fd9bf; }
.exq-ind { font-size: 14px; padding-left: 18px; }
.exq-ind li { margin-bottom: 4px; }
.exq-levels th { width: 150px; background: #f6f5f0; font-size: 13px; }
.exq-level-pick { font-size: 14px; font-weight: 600; display: inline-flex; gap: 8px; align-items: center; margin: 8px 0; }
.exq-level-pick select { font: inherit; padding: 4px 8px; border-radius: 8px; border: 1.5px solid var(--line); }

/* ---------- Further reading ---------- */
.reading-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.reading { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; transition: border-color .15s, box-shadow .15s; }
.reading:hover { border-color: var(--accent); box-shadow: 0 6px 20px rgba(15,33,71,.08); }
.reading-type { align-self: flex-start; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); }
.reading-video { background: #fdecef; color: #9f1239; }
.reading-practice { background: #e7f6ef; color: #065f46; }
.reading-podcast { background: #f3e8ff; color: #6b21a8; }
.reading-spec { background: #fff3c4; color: #7a5600; }
.reading-title { font-weight: 700; font-size: 15px; line-height: 1.35; margin-top: 4px; }
.reading-source { font-size: 12.5px; color: var(--accent-ink); font-weight: 600; }
.reading-note { font-size: 13px; color: var(--muted); line-height: 1.45; }

/* ---------- Copilot prompts ---------- */
.prompt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-bottom: 16px; }
.prompt { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.prompt-head { display: flex; flex-direction: column; gap: 2px; }
.prompt-title { font-weight: 700; font-size: 15px; }
.prompt-purpose { font-size: 12.5px; color: var(--muted); }
.prompt-text { font-family: 'DM Sans', sans-serif; white-space: pre-wrap; font-size: 13.5px; line-height: 1.5; background: #f6f5f0; border-radius: 10px; padding: 12px 14px; margin: 0; flex: 1; color: #2d2d2a; }
.prompt .btn { align-self: flex-start; }
.btn.is-copied { background: var(--ok) !important; color: #fff !important; border-color: var(--ok) !important; }

/* ---------- Pager ---------- */
.u6-pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; border-top: 1px solid var(--line); padding-top: 20px; }
.u6-pager-link { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 2px; max-width: 48%; }
.u6-pager-link span { font-size: 12px; color: var(--muted); font-weight: 600; }
.u6-pager-link strong { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 18px; }
.u6-pager-next { text-align: right; margin-left: auto; }
.u6-pager-link:hover strong { color: var(--accent-ink); }

/* Embed mode: when a topic is loaded in a study-session iframe with ?embed=1
   we hide the site nav, gate, topic hero and pager so only the tabs and
   content show. The tabs stay so students can switch tool without leaving. */
body.is-embed .nav,
body.is-embed .password-gate,
body.is-embed .u6-topic-hero,
body.is-embed .u6-pager { display: none !important; }
body.is-embed .u6-main { padding-top: 12px; }
body.is-embed .u6-tabs { top: 0; }

/* Hub hero video background: poster shows on every device; JS conditionally
   attaches a <video> element on top when the viewport is wide and the
   network isn't save-data (see study-session.js mountHubHeroes). */
.u6-hero-video { position: relative; overflow: hidden; }
.u6-hero-video .u6-hero-media {
  position: absolute; inset: 0; z-index: 0;
  background-position: center; background-size: cover; background-repeat: no-repeat;
}
.u6-hero-video .u6-hero-media video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.u6-hero-video .u6-hero-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(15,33,71,.55) 0%, rgba(15,33,71,.85) 100%);
}
.u6-hero-video .u6-wrap { position: relative; z-index: 2; }
.u6-hero-video::after { display: none; } /* hide the grid pattern from the base .u6-home-hero */

/* Hub CTA to open a study session */
.u6-hero-cta {
  display: inline-flex; align-items: center; gap: 14px;
  margin-top: 22px; padding: 14px 20px;
  background: rgba(255,255,255,.92); color: var(--navy);
  border-radius: 14px; text-decoration: none;
  transition: transform .12s, box-shadow .2s;
}
.u6-hero-cta:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(15,33,71,.28); }
.u6-hero-cta-icon {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 16px;
}
.u6-hero-cta-body { display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.u6-hero-cta-body strong { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 18px; }
.u6-hero-cta-body em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.u6-hero-cta-arrow { font-size: 18px; color: var(--accent-ink); }

/* Per-topic "Study this in a focus session" button in the topic hero */
.u6-study-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 16px; padding: 8px 14px;
  background: rgba(255,255,255,.14); color: #fff;
  border: 1px solid rgba(255,255,255,.28); border-radius: 999px;
  font-size: 13px; font-weight: 600; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.u6-study-btn:hover { background: rgba(255,255,255,.24); border-color: rgba(255,255,255,.5); }
.u6-study-btn-icon { color: rgba(255,255,255,.9); }

/* Credits page */
.credits-section { margin-bottom: 36px; }
.credits-h2 { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 24px; margin: 0 0 6px; }
.credits-note { font-size: 14px; color: var(--muted); margin: 0 0 16px; }
.credits-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.credits-item {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 6px;
}
.credits-item-name { font-family: 'DM Serif Display', serif; font-size: 17px; }
.credits-item-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.credits-tag {
  font-family: 'DM Mono', monospace; font-size: 11px;
  background: var(--accent-soft); color: var(--accent-ink);
  padding: 2px 8px; border-radius: 99px;
}
.credits-item-source { font-size: 12.5px; color: var(--muted); }
.credits-item-source code { font-size: 11px; }
.credits-notes p { max-width: 720px; font-size: 14px; color: var(--muted); line-height: 1.55; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .u6-howto-steps { grid-template-columns: repeat(3, 1fr); }
  .u6-ai-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .u6-wrap { padding: 0 16px; }
  .u6-howto-steps { grid-template-columns: 1fr 1fr; }
  .u6-papers, .ws-options, .sheet-bottom, .sheet-terms dl, .u6-ai-grid { grid-template-columns: 1fr; }
  .sheet { padding: 20px 18px; }
  .sheet-cols { columns: 1; }
  .fc-card { min-height: 340px; }
  .fc-face { padding: 36px 22px; }
  .fc-text { font-size: 18px; }
  .vcards { grid-template-columns: 1fr 1fr; }
  .u6-topic-hero { padding: 22px 0 24px; }
  .stack-label { position: static; margin-left: 8px; }
}

/* ---------- Print: info sheet only, fitted to A4 ---------- */
@media print {
  @page { size: A4; margin: 9mm; }
  body { background: #fff !important; }
  .nav, .password-gate, .u6-tabs, .u6-topic-hero, .panel-head, .u6-pager, .pdf-overlay, .u6-panel:not([data-panel="info"]) { display: none !important; }
  .u6-panel[data-panel="info"] { display: block !important; }
  .u6-main { padding: 0; }
  .u6-wrap { padding: 0; max-width: none; }
  .sheet { border: none; padding: 0; box-shadow: none; zoom: 0.74; }
  .sheet-top { margin-bottom: 10px; }
  .sheet-cols { columns: 3; column-gap: 6mm; column-fill: balance; }
  .sheet-sec { break-inside: auto; margin-bottom: 10px; }
  .sheet-sec h3 { break-after: avoid; }
  .v, .compare, .callout, table, .vcards { break-inside: avoid; }
  .sheet-terms dl { grid-template-columns: 1fr 1fr 1fr; }
  .sheet-bottom { break-inside: avoid; }
  .vcards { grid-template-columns: 1fr 1fr !important; }
  .code { background: #f3f3f3 !important; color: #111 !important; }
  .code-ln { color: #999 !important; }
  .bits-result .bit { background: #333 !important; color: #fff !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Keep diagrams on the info sheet a readable size rather than full width */
.sheet .svg-wrap svg { max-width: 600px; margin: 0 auto; }
.sheet .sheet-sec:not(.sheet-wide) .svg-wrap svg { max-width: 100%; }
@media print { .sheet .svg-wrap svg { max-width: 100%; } .sheet .sheet-wide .svg-wrap svg { max-width: 150mm; } }

/* ---------- Subject chooser (/upper-sixth/) ---------- */
.u6-chooser {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 24px 0 12px;
}
.u6-chooser-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 28px 28px 24px;
  border-radius: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 33, 71, 0.04);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}
.u6-chooser-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
}
.u6-chooser-cs::before { background: linear-gradient(180deg, #0f2147 0%, #1e73ff 100%); }
.u6-chooser-geo::before { background: linear-gradient(180deg, #065f46 0%, #0f8a5f 100%); }
.u6-chooser-eng::before { background: linear-gradient(180deg, #4a0f1c 0%, #7a1a2e 100%); }
.u6-chooser-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 33, 71, 0.10);
  border-color: rgba(30, 115, 255, 0.25);
}
.u6-chooser-geo:hover { border-color: rgba(15, 138, 95, 0.25); }
.u6-chooser-eng:hover { border-color: rgba(122, 26, 46, 0.25); }
.u6-chooser-mark {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: var(--muted);
  line-height: 1;
}
.u6-chooser-cs .u6-chooser-mark span { color: #1e73ff; }
.u6-chooser-geo .u6-chooser-mark span { color: #0f8a5f; }
.u6-chooser-eng .u6-chooser-mark span { color: #7a1a2e; }
.u6-chooser-name {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  margin-top: 6px;
  line-height: 1.1;
}
.u6-chooser-board {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.u6-chooser-cta {
  margin-top: 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-ink);
}
.u6-chooser-geo .u6-chooser-cta { color: #0b6b49; }
.u6-chooser-eng .u6-chooser-cta { color: #7a1a2e; }
.u6-chooser-note {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 0;
}

@media (max-width: 960px) {
  .u6-chooser { grid-template-columns: 1fr; }
}

/* Structured study session: the partner to "Start a study session" (same shape, secondary colour) */
.u6-cta-pair { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.u6-cta-pair .u6-hero-cta { margin-top: 0; }
.u6-hero-cta-alt { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.4); }
.u6-hero-cta-alt .u6-hero-cta-body em { color: rgba(255,255,255,.82); }
.u6-hero-cta-alt .u6-hero-cta-arrow { color: #fff; }
.u6-hero-cta-alt .u6-hero-cta-icon { background: rgba(255,255,255,.22); }
.u6-study-btn + .u6-study-btn { margin-left: 8px; }
@media (max-width: 520px) { .u6-cta-pair { flex-direction: column; } .u6-cta-pair .u6-hero-cta { width: 100%; } .u6-study-btn + .u6-study-btn { margin-left: 0; } }

/* Case-study badges (Upper Sixth Geography): Mock (blue) and Summer exam (amber) */
.cs-badge { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1.5; white-space: nowrap; border: 1px solid transparent; }
.cs-badge-mock { background: #1e73ff; color: #fff; }
.cs-badge-summer { background: #fff3c4; color: #6b4d00; border-color: #e0a100; }
.cs-badge-key { margin: 0 0 16px; padding: 8px 12px; border-radius: 10px; background: #f5f7fb; font-size: 13px; line-height: 1.7; }
.cs-badge-key .cs-badge { margin: 0 2px 0 0; }
@media print {
  .cs-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cs-badge-key { background: #fff; border: 1px solid #ccc; margin-bottom: 8px; }
}

/* Geography hubs: topic cards fill the row (no empty slot beside three cards);
   Lower Sixth's two one-topic paper groups sit side by side. */
.u6-subject.u6-geo .u6-topic-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.u6-paper-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); column-gap: 12px; }
.u6-paper-pair > div { display: flex; flex-direction: column; }
.u6-paper-pair .u6-topic-grid { flex: 1; }
