/* ============ Gaming Education Network styles ============ */
:root {
  --band-bg: hsl(205 85% 95%); /* full-width home page bands (Trending Labs) - light blue */
  --dot: #c9cdd2; --dot-active: #6a6f73; /* carousel pagination: grey dots, darker grey for the current page */
  --bg: #f7f9fa;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --ink: #1c1d1f;
  --ink-2: #6a6f73;
  --line: #d1d7dc;
  --accent-h: 273;
  --accent: hsl(var(--accent-h) 80% 42%);
  --accent-ink: hsl(var(--accent-h) 75% 34%);
  --accent-soft: hsl(var(--accent-h) 85% 96%);
  --on-accent: #fff;
  --good: #11804a;
  --good-soft: #def5e7;
  --bad: #c22f2f;
  --bad-soft: #fde4e2;
  --warn-soft: #fff3cf;
  --warn-ink: #7a5600;
  --footer-bg: #1c1d1f;
  /* Brand purple (the logo's colour) - used by every call-to-action button, whatever the page's hue */
  --brand: hsl(273 80% 42%);
  --brand-ink: hsl(273 80% 42%);
  --brand-soft: hsl(273 85% 96%);
  --on-brand: #fff;
  --avatar-bg: #e0e0e0;
  --avatar-ink: #616161;
  --shadow: 0 1px 2px rgba(20,21,23,.04), 0 2px 10px rgba(20,21,23,.05);
  --radius: 10px;
  --font: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --base: 19px;
  color-scheme: light;
}
/* Light is the default for everyone; dark mode is opt-in only via the
   theme button (which sets data-theme="dark"), never the OS preference. */
:root[data-theme="dark"] {
  --band-bg: hsl(208 38% 15%);
  --dot: #45434f; --dot-active: #a9a6b4;
  --bg: #121117; --surface: #1c1b23; --surface-2: #26252f; --ink: #f3f1ea; --ink-2: #b9b6c4; --line: #33313d;
  --accent: hsl(var(--accent-h) 85% 68%); --accent-ink: hsl(var(--accent-h) 90% 78%); --accent-soft: hsl(var(--accent-h) 35% 20%); --on-accent: #111;
  --good: #4cd38a; --good-soft: #143826; --bad: #ff7b72; --bad-soft: #3d1a1a; --warn-soft: #3a3013; --warn-ink: #f3cf6b;
  --footer-bg: var(--surface);
  --brand: hsl(273 70% 50%); --brand-ink: hsl(273 90% 78%); --brand-soft: hsl(273 35% 20%);
  --avatar-bg: #8a8794; --avatar-ink: #34323b;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: var(--base); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); line-height: 1.65; font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); }
strong, b { font-weight: 700; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
code, pre { font-family: var(--mono); font-size: .82em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 6px; }
pre { background: var(--surface-2); padding: 1em 1.1em; border-radius: 12px; overflow-x: auto; line-height: 1.5; border: 1px solid var(--line); white-space: pre; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: .5em 1em; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 68px;
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-size: 1.15rem; }
.brand-mark { color: var(--accent); display: flex; --accent-h: 273; }
.brand-text b { font-weight: 700; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn {
  min-width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 700 .85rem var(--font); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 10px;
}
.icon-btn:hover { border-color: var(--ink-2); }
.menu-btn { display: none; }
.progress-pill { font-weight: 700; font-size: .78rem; padding: .45em .9em; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
.progress-pill:empty { display: none; } /* logged out, or not inside a module - nothing to count */
.auth-buttons { display: flex; gap: 8px; align-items: center; }
.auth-buttons .btn { padding: .5em 1em; font-size: .85rem; white-space: nowrap; }

/* ---------- Site search (top bar) ---------- */
.site-search { position: relative; display: flex; align-items: center; }
.search-field { width: 0; overflow: hidden; transition: width .28s ease, margin .28s ease; }
.site-search.open .search-field { width: min(320px, 34vw); margin-right: 6px; }
.search-field input {
  width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: 400 .92rem var(--font);
}
.search-field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-btn {
  width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: transparent; color: var(--ink); display: inline-flex; align-items: center; justify-content: center;
}
.search-btn .material-symbols-outlined { font-size: 26px; }
.search-btn:hover, .site-search.open .search-btn { background: var(--surface-2); }
.search-results {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 50; width: min(460px, calc(100vw - 24px));
  max-height: min(70vh, 560px); overflow-y: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.sr-group { padding: 10px 10px 4px; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.sr-item { display: flex; gap: 12px; align-items: flex-start; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.sr-item:hover, .sr-item[aria-selected="true"] { background: var(--surface-2); }
.sr-item > .material-symbols-outlined { font-size: 20px; color: var(--brand-ink); margin-top: 1px; flex: none; }
.sr-text { min-width: 0; flex: 1; }
.sr-title { display: block; font-weight: 700; font-size: .9rem; line-height: 1.35; }
.sr-meta { display: block; font-size: .76rem; color: var(--ink-2); margin-top: 2px; }
.sr-snippet { display: block; font-size: .8rem; color: var(--ink-2); margin-top: 3px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-item mark { background: var(--brand-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.sr-lock { font-size: 16px !important; color: var(--ink-2) !important; flex: none; margin-top: 2px; }
.sr-empty { padding: 14px 12px; font-size: .88rem; color: var(--ink-2); }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.sidebar {
  position: sticky; top: 68px; height: calc(100vh - 68px); overflow-y: auto;
  padding: 18px 14px 40px; border-right: 1px solid var(--line); background: var(--bg);
}
.side-section { display: grid; gap: 4px; margin-bottom: 18px; }
.side-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--ink-2); margin: 6px 10px 8px; }
.side-link .material-symbols-outlined { font-size: 22px; color: var(--ink-2); }
.side-link.active .material-symbols-outlined { color: var(--ink); }
.side-link, .side-parts a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  text-decoration: none; color: var(--ink); font-weight: 400; font-size: .86rem; line-height: 1.3;
}
.side-link:hover, .side-parts a:hover { background: var(--surface-2); }
.side-link.active, .side-parts a.active { background: var(--surface); box-shadow: var(--shadow); font-weight: 700; }
.side-parts { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side-num {
  flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  font-weight: 700; font-size: .78rem; background: var(--accent-soft); color: var(--accent-ink);
}
.side-parts .done .side-num { background: var(--good); color: #fff; }
.side-score { margin-left: auto; font-size: .7rem; font-weight: 700; color: var(--ink-2); }

.main { --main-pad-top: 36px; padding: var(--main-pad-top) clamp(16px, 4vw, 56px) 80px; max-width: 1040px; width: 100%; min-width: 0; outline: none; }
.scrim { display: none; }

/* Course picker screen: no course is active yet, so there's no sidebar or
   per-course progress to show - and its content is centred, unlike every
   course-internal screen (part, quiz, glossary), which stays left-aligned. */
body.no-course .layout { grid-template-columns: minmax(0, 1fr); }
body.no-course .sidebar { display: none; }
body.no-course .progress-pill { display: none; }
body.no-course .main { margin: 0 auto; text-align: center; }
body.no-course .hero { grid-template-columns: 1fr; justify-content: center; }
body.no-course .hero > div { margin: 0 auto; }

/* ---------- Generic ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em; padding: .8em 1.3em; border-radius: 8px;
  font: 700 .95rem var(--font); border: 1px solid transparent; cursor: pointer; text-decoration: none;
  background: var(--brand); color: var(--on-brand); border-color: var(--brand); transition: transform .08s ease, filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--brand-ink); border: 2px solid var(--brand-ink); font-weight: 700; }
.btn.ghost:hover { background: var(--brand-soft); filter: none; }
.btn.big { font-size: 1.05rem; padding: 1em 1.6em; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--ink-2); }
.eyebrow { font-size: .74rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; padding: .25em .7em; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.tag.good { background: var(--good-soft); color: var(--good); }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center; padding: 34px; margin-bottom: 30px; }
.hero h1 { font-size: clamp(1.8rem, 4.2vw, 2.7rem); }

/* Homepage hero: full-bleed photo banner with a curved bottom edge. It breaks out of
   .main's centred column to the full window width, and up over .main's top padding
   (--main-pad-top) so it sits flush under the top bar. */
.home-hero {
  width: 100vw; margin: calc(-1 * var(--main-pad-top)) calc(50% - 50vw) 34px;
  padding: clamp(56px, 9vw, 112px) 24px clamp(76px, 11vw, 136px);
  background: linear-gradient(rgba(18, 8, 38, .55), rgba(18, 8, 38, .55)), url("../img/hero-img/hero-image.webp") center / cover no-repeat;
  border-radius: 0 0 50% 50% / 0 0 64px 64px;
  color: #fff; text-align: center;
}
.home-hero > div { max-width: 760px; margin: 0 auto; }
.home-hero .eyebrow { color: #fff; opacity: .85; }
.home-hero h1 { color: #fff; font-size: clamp(1.9rem, 4.6vw, 3rem); margin-bottom: .35em; }
.home-hero p { color: rgba(255, 255, 255, .92); font-size: 1.1rem; margin: 0; }
body.no-course .layout { overflow-x: clip; } /* 100vw includes the scrollbar - don't let it cause sideways scroll */
.hero p { font-size: 1.05rem; color: var(--ink-2); max-width: 36em; margin: 0 0 1.2em; }
.ring { width: 150px; height: 150px; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 700; font-size: 1.6rem; line-height: 1.1; }
.ring-label small { display: block; font-size: .62rem; font-weight: 700; color: var(--ink-2); letter-spacing: .05em; }
.section-h { font-size: 1.35rem; margin: 34px 0 14px; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.how .card { padding: 20px; }
.how .material-symbols-outlined { font-size: 34px; color: var(--brand-ink); }
.how h3 { font-size: 1rem; margin: .4em 0 .2em; }
.how p { margin: 0; font-size: .88rem; color: var(--ink-2); }
/* Home page module carousel: --per-view cards per page (1 mobile, 2 tablet, 4 desktop). */
body.is-home .main { max-width: 1280px; padding-bottom: 0; } /* the last full-width band meets the footer */
.carousel { text-align: left; }
.carousel-track {
  --per-view: 4; --gap: 16px;
  display: grid; grid-auto-flow: column; gap: var(--gap);
  grid-auto-columns: calc((100% - (var(--per-view) - 1) * var(--gap)) / var(--per-view));
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  padding: 8px 2px 12px; margin: -8px -2px 0; /* room for the hover lift and shadow */
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track:focus-visible { outline: 3px solid var(--brand); outline-offset: 4px; border-radius: var(--radius); }
.carousel-track > * { scroll-snap-align: start; min-width: 0; }
@media (max-width: 1023px) { .carousel-track { --per-view: 2; } }
@media (max-width: 639px) { .carousel-track { --per-view: 1; } }
.carousel-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin-top: 14px; min-height: 24px; }
.carousel-dot {
  width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
}
.carousel-dot::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--dot); transition: background .2s, transform .2s;
}
.carousel-dot:hover::before { background: var(--dot-active); }
.carousel-dot.active::before { background: var(--dot-active); transform: scale(1.15); }
.carousel-dot:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; }
@media (prefers-reduced-motion: reduce) { .carousel-track { scroll-behavior: auto; } }

/* Free tools panel (home page): boxed, in tones of one deep navy-violet, white text. */
.tools-panel {
  --t-bg: oklch(25.65% .0265 278.04);
  --t-surface: oklch(31% .032 278.04);
  --t-raised: oklch(36% .04 278.04);
  --t-line: oklch(44% .045 278.04);
  --t-hl: oklch(42% .07 278.04);
  --t-muted: oklch(84% .02 278.04);
  margin: 64px 0 0; padding: clamp(22px, 4vw, 40px); border-radius: 20px;
  background: var(--t-bg); color: #fff; text-align: left;
  box-shadow: 0 18px 40px -20px oklch(25.65% .0265 278.04 / .7);
}
.tools-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.tools-head h2 { color: #fff; font-size: clamp(1.5rem, 3vw, 2rem); margin: 0 0 4px; }
.tools-head p { margin: 0; color: var(--t-muted); }
.tools-badge, .tools-info-icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 16px; background: var(--t-raised); color: #fff;
}
.tools-badge .material-symbols-outlined { font-size: 30px; }
.tools-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
/* Each calculator choice is a clear, separate button: raised tone, outline and shadow; the selected one turns white. */
.tools-tab {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 10px 14px;
  border: 1px solid var(--t-line); border-radius: 12px; background: var(--t-raised); color: #fff;
  font: 700 .95rem var(--font); cursor: pointer;
  box-shadow: 0 2px 0 oklch(18% .025 278.04), 0 6px 14px -8px oklch(10% .02 278.04 / .8);
  transition: background .15s, color .15s, transform .12s, box-shadow .12s, border-color .15s;
}
.tools-tab .material-symbols-outlined { font-size: 22px; }
.tools-tab:hover { background: var(--t-hl); border-color: oklch(62% .08 278.04); transform: translateY(-1px); }
.tools-tab:active { transform: translateY(1px); box-shadow: 0 1px 0 oklch(18% .025 278.04); }
.tools-tab[aria-selected="true"] { background: #fff; color: var(--t-bg); border-color: #fff; box-shadow: 0 0 0 3px oklch(60% .09 278.04 / .55); transform: none; }
.tools-tab:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.tools-pane { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 28px; align-items: start; }
.tools-pane[hidden] { display: none; }
.tools-info h3 { color: #fff; font-size: 1.3rem; margin: 14px 0 8px; }
.tools-info p { color: var(--t-muted); font-weight: 300; margin: 0 0 16px; }
.tools-info-icon { width: 48px; height: 48px; border-radius: 14px; }
.tools-learn { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--t-line); padding-bottom: 2px; }
.tools-learn:hover { border-color: #fff; }
.tools-learn .material-symbols-outlined { font-size: 18px; }
/* The calculators themselves (js/widgets.js), re-toned for the dark panel. */
.tools-panel .tools-calc { margin: 0; padding: 20px; border: 0; border-radius: 14px; background: var(--t-surface); }
.tools-panel .tools-calc h4, .tools-panel .tools-calc .w-sub { display: none; } /* the panel's own title and text replace them */
/* Inputs line up: every field fills its grid row, the label takes the spare height, the box sits at the bottom. */
.tools-panel .fields { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); align-items: stretch; }
.tools-panel .field { display: flex; flex-direction: column; }
.tools-panel .field label { color: var(--t-muted); flex: 1; text-wrap: balance; line-height: 1.35; }
/* Results as a stacked list: label on the left, value on the right, one per row. */
.tools-panel .stats { grid-template-columns: 1fr; gap: 6px; }
.tools-panel .stat { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 16px; }
.tools-panel .stat .s-l { letter-spacing: .06em; }
.tools-panel .stat .s-v { font-size: 1.2rem; text-align: right; white-space: nowrap; }
.tools-panel .field input { background: var(--t-bg); border-color: var(--t-line); color: #fff; }
.tools-panel .field input:focus { border-color: #fff; box-shadow: 0 0 0 3px var(--t-raised); }
.tools-panel .stat { background: var(--t-raised); }
.tools-panel .stat .s-l { color: var(--t-muted); }
.tools-panel .stat .s-v { color: #fff; }
.tools-panel .stat.hl { background: var(--t-hl); box-shadow: inset 0 0 0 1px oklch(60% .09 278.04); }
.tools-panel .stat.hl .s-v { color: #fff; }
.tools-panel .verdict { background: var(--t-raised); color: #fff; border-left: 3px solid var(--t-muted); }
.tools-panel .verdict.warn { background: var(--t-raised); color: #fff; border-left-color: oklch(80% .14 75); }
.tools-panel .verdict.ok { background: var(--t-raised); color: #fff; border-left-color: oklch(80% .13 160); }
@media (max-width: 1023px) {
  /* Tablet and below: explanation above the calculator, so the calculator gets the full width. */
  .tools-pane { grid-template-columns: 1fr; gap: 18px; }
  .tools-info-icon { display: none; } /* the selected tab already shows it */
  .tools-info h3 { margin-top: 0; }
}
@media (max-width: 760px) {
  .tools-tab { flex-direction: column; gap: 2px; font-size: .8rem; min-height: 64px; }
  .tools-head { align-items: flex-start; }
  .tools-badge { width: 46px; height: 46px; border-radius: 13px; }
}
:root[data-theme="dark"] .tools-panel { box-shadow: 0 0 0 1px oklch(40% .04 278.04); }

/* Full-width tinted band on the home page; its content lines up with .main's width and padding. */
.home-band { width: 100vw; margin: 56px calc(50% - 50vw) 0; padding: 56px 0 44px; background: var(--band-bg); }
.home-band + .home-band { margin-top: 0; }
.home-band-inner { max-width: 1280px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 56px); }
.band-h { font-size: clamp(1.8rem, 3.6vw, 2.5rem); margin: 0 0 8px; text-align: center; }
.band-sub { color: var(--ink-2); text-align: center; margin: 0 auto 26px; max-width: 640px; }
.lab-card { text-align: left; min-height: 260px; }
.lab-card .lab-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.lab-card .lab-course { font-size: .72rem; font-weight: 700; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: .25em .7em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lab-card .lab-hot { display: inline-flex; align-items: center; gap: 2px; font-size: .72rem; font-weight: 700; color: var(--brand-ink); white-space: nowrap; }
.lab-card .lab-hot .material-symbols-outlined { font-size: 16px; }
.lab-card .lab-intro { margin: 0; font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lab-card .pc-cta { padding: .6em 1.1em; font-size: .85rem; margin-left: auto; }
.lab-skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: lab-shimmer 1.4s infinite linear; }
@keyframes lab-shimmer { to { background-position: -200% 0; } }

.parts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.part-card { padding: 20px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden; transition: transform .12s, box-shadow .12s; }
.part-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--accent); }
.part-card:hover { transform: translateY(-3px); }
.part-card .pc-num { font-size: .75rem; font-weight: 700; color: var(--accent-ink); letter-spacing: .1em; text-transform: uppercase; }
.part-card h3 { font-size: 1.05rem; margin: 0; }
.part-card .pc-meta { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: .78rem; color: var(--ink-2); padding-top: 8px; }
.course-card { text-align: left; }
.course-card::before { display: none; }
.course-card .course-image-wrap { position: relative; margin: -20px -20px 0; aspect-ratio: 16 / 9; overflow: hidden; background: var(--accent-soft); }
.course-card .course-image-wrap img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transform: scale(1); transition: transform .6s ease-out; will-change: transform;
}
/* Hover: zoom the image 20% inside its frame; leaving the card eases it back. */
.course-card:hover .course-image-wrap img { transform: scale(1.2); transition: transform .35s ease-out; }
.course-card .course-image-icon { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; font-size: 2.6rem; }
.course-card .course-image-wrap.img-fallback .course-image-icon { display: flex; }
.course-card .pc-meta { flex-wrap: wrap; gap: 10px; }
.course-card .pc-meta-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.course-card .pc-count { font-weight: 700; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: .3em .8em; }
.course-card .pc-cta { padding: .6em 1.1em; font-size: .85rem; }
.blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.block { padding: 18px 20px; }
.block h3 { font-size: .98rem; margin-bottom: .4em; }
.block .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { text-decoration: none; font-weight: 700; font-size: .76rem; padding: .35em .75em; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- Part / lesson ---------- */
.part-head { padding: 34px; margin-bottom: 22px; position: relative; overflow: hidden; }
.part-head::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: var(--accent-soft); z-index: 0; }
.part-head > * { position: relative; z-index: 1; }
.part-head h1 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); margin-top: .2em; }
.part-head p { font-size: 1.04rem; color: var(--ink-2); max-width: 40em; }
.bar { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
.toc { display: grid; gap: 6px; margin: 0 0 26px; padding: 18px; }
.toc a { display: flex; gap: 12px; align-items: baseline; color: var(--ink); text-decoration: none; padding: 6px 8px; border-radius: 8px; font-size: .9rem; font-weight: 400; }
.toc a:hover { background: var(--surface-2); }
.toc .t-n { font-weight: 700; color: var(--accent-ink); min-width: 1.6em; }
.toc .t-done { margin-left: auto; color: var(--good); font-weight: 700; }

.topic { padding: 30px clamp(18px, 3.5vw, 38px); margin-bottom: 22px; scroll-margin-top: 90px; }
.topic-q { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.topic-q .n { flex: none; width: 46px; height: 46px; border-radius: 14px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; }
.topic-q h2 { font-size: clamp(1.15rem, 2.4vw, 1.45rem); margin: .2em 0 0; }
.label { display: inline-flex; align-items: center; gap: .45em; font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin: 1.4em 0 .5em; color: var(--ink-2); }
.plain p, .plain li { font-size: 1rem; }
.plain ul, .plain ol { padding-left: 1.3em; }
.plain li { margin: .35em 0; }
.plain li::marker { color: var(--accent); font-weight: 700; }
.box { border-radius: 10px; padding: 18px 22px; margin: 18px 0; }
.box > :first-child { margin-top: 0; } .box > :last-child { margin-bottom: 0; }
.box-example { background: var(--warn-soft); border-left: 4px solid #e0a800; }
.box-example .label { color: var(--warn-ink); margin-top: 0; }
.box-maths { background: var(--accent-soft); border-left: 4px solid var(--accent); }
.box-maths .label { color: var(--accent-ink); margin-top: 0; }
.calc { font-family: var(--mono); font-size: .95rem; background: var(--surface); padding: .55em .9em; border-radius: 8px; margin: .5em 0; border: 1px solid var(--line); overflow-x: auto; }
.key { display: flex; gap: 14px; align-items: flex-start; background: var(--ink); color: var(--bg); border-radius: 10px; padding: 18px 22px; margin-top: 22px; font-weight: 300; font-size: 1rem; }
.key .k-ico { font-size: 1.4rem; line-height: 1; }
.key small { display: block; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; opacity: .7; font-weight: 700; margin-bottom: 2px; }
.table-wrap { overflow-x: auto; margin: 14px 0; border-radius: 10px; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; min-width: 520px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.flow { list-style: none; padding: 0; margin: 16px 0; counter-reset: f; }
.flow li { position: relative; padding: 0 0 18px 58px; }
.flow li::before { counter-increment: f; content: counter(f); position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: .9rem; z-index: 1; }
.flow li::after { content: ""; position: absolute; left: 19px; top: 40px; bottom: 0; width: 3px; background: var(--line); }
.flow li:last-child::after { display: none; }
.flow b { display: block; font-size: 1rem; padding-top: 6px; }
.flow span { color: var(--ink-2); font-size: .92rem; }
.got { margin-top: 20px; display: flex; justify-content: flex-end; }
.got button { font: 700 .85rem var(--font); padding: .7em 1.1em; border-radius: 8px; cursor: pointer; border: 2px solid var(--brand-ink); background: transparent; color: var(--brand-ink); }
.got button:hover { background: var(--brand-soft); }
.got button.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.cta { padding: 30px; text-align: center; margin: 30px 0; }
.cta h2 { font-size: 1.4rem; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

/* ---------- Widgets ---------- */
.widget { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 20px 22px; margin: 22px 0 6px; background: var(--surface); }
.widget h4 { font-size: 1rem; margin-bottom: .2em; }
.widget .w-sub { font-size: .82rem; color: var(--ink-2); margin: 0 0 14px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.field label { display: block; font-size: .74rem; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.field input, .field select {
  width: 100%; font: 400 1rem var(--font); padding: .6em .75em; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 12px 14px; }
.stat .s-l { font-size: .7rem; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; }
.stat .s-v { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.hl { background: var(--accent-soft); }
.stat.hl .s-v { color: var(--accent-ink); }
.verdict { margin-top: 12px; padding: 12px 14px; border-radius: 8px; font-weight: 300; font-size: .92rem; }
.verdict.ok { background: var(--good-soft); color: var(--good); }
.verdict.warn { background: var(--bad-soft); color: var(--bad); }
.sim-canvas { width: 100%; height: 220px; display: block; background: var(--bg); border-radius: 8px; border: 1px solid var(--line); margin: 12px 0; }
.ev-table input { width: 100%; font: 400 .95rem var(--font); padding: .45em .6em; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.ev-table table { min-width: 0; }
.ev-table td { padding: 6px 8px; }
.x-btn { border: 0; background: none; color: var(--bad); font-size: 1.2rem; cursor: pointer; font-weight: 700; }

/* ---------- Quiz ---------- */
.quiz { padding: clamp(20px, 4vw, 40px); }
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.quiz-q { font-size: clamp(1.2rem, 2.6vw, 1.55rem); margin: 18px 0 22px; }
.opts { display: grid; gap: 12px; }
.opt {
  text-align: left; font: 400 1rem var(--font); padding: 16px 18px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); display: flex; gap: 14px; align-items: center;
  transition: border-color .12s, transform .08s;
}
.opt:hover:not([disabled]) { border-color: var(--accent); transform: translateX(3px); }
.opt .letter { flex: none; width: 34px; height: 34px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; }
.opt.correct { border-color: var(--good); background: var(--good-soft); }
.opt.correct .letter { background: var(--good); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .letter { background: var(--bad); color: #fff; }
.opt[disabled] { cursor: default; }
.feedback { margin-top: 18px; padding: 16px 20px; border-radius: 10px; font-size: .96rem; }
.feedback.ok { background: var(--good-soft); }
.feedback.no { background: var(--bad-soft); }
.feedback b { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.feedback.ok b { color: var(--good); } .feedback.no b { color: var(--bad); }
.quiz-foot { display: flex; justify-content: flex-end; margin-top: 20px; }
.result { text-align: center; padding: clamp(24px, 5vw, 48px); }
.result .big-score { font-size: clamp(3rem, 9vw, 5rem); font-weight: 700; line-height: 1; margin: .2em 0; }
.result .big-score.pass { color: var(--good); } .result .big-score.fail { color: var(--bad); }
.review { text-align: left; margin-top: 26px; display: grid; gap: 12px; }
.review .rv { padding: 16px 18px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: .9rem; }
.review .rv b { display: block; margin-bottom: 4px; font-size: .96rem; }
.review .rv .ya { color: var(--bad); font-weight: 400; } .review .rv .ca { color: var(--good); font-weight: 700; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* ---------- Glossary ---------- */
.search { width: 100%; font: 400 1.05rem var(--font); padding: .85em 1.1em; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); margin: 10px 0 20px; }
.search:focus { border-color: var(--accent); outline: none; }
.gloss { display: grid; gap: 10px; }
.gloss .g { padding: 16px 20px; }
.gloss .g b { font-size: 1.02rem; display: block; }
.gloss .g span { color: var(--ink-2); font-size: .93rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer-bg); padding: 40px clamp(16px, 4vw, 56px); }
.footer-inner { max-width: 1040px; margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px; }
.footer-left { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.footer-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-size: 1.1rem; }
.footer-brand .brand-mark { color: #fff; }
.footer-brand .brand-text b { font-weight: 700; }
.footer-controls { display: flex; gap: 8px; align-items: center; }
.footer-controls .icon-btn { background: transparent; border-color: rgba(255,255,255,.3); color: #fff; }
.footer-controls .icon-btn:hover { border-color: rgba(255,255,255,.6); }
.footer-legal { margin-top: 18px; max-width: 420px; color: #9a9b9d; font-size: .78rem; line-height: 1.5; }
.footer-legal p { margin: 0 0 4px; }
.footer-legal-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 10px !important; }
.footer-legal-links a, .footer-legal-links button { color: #c9cacc; font: 700 .78rem var(--font); text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; padding: 0; cursor: pointer; }
.footer-legal-links a:hover, .footer-legal-links button:hover { color: #fff; }
.footer-courses .footer-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: #fff; opacity: .65; margin-bottom: 10px; }
.footer-links { display: grid; grid-template-columns: repeat(2, max-content); column-gap: 32px; row-gap: 8px; }
.footer-links a { color: #fff; opacity: .85; text-decoration: none; font-size: .9rem; }
.footer-links a:hover { opacity: 1; text-decoration: underline; }

/* ---------- Auth (login / register / forgot / reset password) ---------- */
.auth-card { max-width: 420px; margin: 40px auto; padding: 34px; text-align: left; }
.auth-card h1 { font-size: 1.6rem; margin-top: .2em; }
.auth-card .field { margin-bottom: 14px; }
.field.has-error input { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: .78rem; margin-top: 4px; min-height: 1px; }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 12px 14px; border-radius: 8px; font-size: .9rem; font-weight: 300; margin-bottom: 16px; }
.password-field { position: relative; }
.password-field input { padding-right: 56px; }
.pw-toggle { position: absolute; right: 4px; top: 4px; bottom: 4px; border: 0; background: none; cursor: pointer; font-size: .78rem; font-weight: 700; color: var(--brand-ink); padding: 0 10px; }
.pw-toggle.pw-icon { display: inline-flex; align-items: center; color: var(--ink-2); padding: 0 8px; border-radius: 6px; }
.pw-toggle.pw-icon:hover { color: var(--ink); }
.pw-toggle.pw-icon .material-symbols-outlined { font-size: 22px; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 20px 0; color: var(--ink-2); font-size: .8rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Typography: Lato 700 titles, 400 body, 300 for boxed/callout text ---------- */
.box .plain, .how p, .widget .w-sub, .feedback, .review .rv, .gloss .g span { font-weight: 300; }
.feedback b, .review .rv b { font-weight: 700; }

/* ---------- Icons (Material Symbols, filled to match the classic Material Icons look) ---------- */
.material-symbols-outlined { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; vertical-align: middle; }

/* ---------- Account menu (top bar) ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.user-menu { position: relative; }
.avatar-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  background: var(--avatar-bg); color: var(--avatar-ink); display: inline-flex; align-items: center; justify-content: center;
}
.avatar-btn .material-symbols-outlined { font-size: 28px; }
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--line); }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; z-index: 50; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.ud-head { padding: 10px 12px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); font-size: .85rem; line-height: 1.4; }
.ud-head strong, .ud-head span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.ud-head span { color: var(--ink-2); font-size: .78rem; }
.ud-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px;
  background: none; color: var(--ink); font: 400 .9rem var(--font); text-decoration: none; text-align: left; cursor: pointer;
}
.ud-item .material-symbols-outlined { font-size: 20px; color: var(--ink-2); }
.ud-item:hover, .ud-item:focus-visible { background: var(--surface-2); }

/* ---------- Profile ---------- */
.profile { text-align: left; max-width: 820px; margin: 0 auto; }
.profile-card { padding: 26px 30px; margin-bottom: 22px; }
.profile-card h2 { font-size: 1.2rem; }
.detail-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.form-error + .detail-row { border-top: 0; }
.detail-label { font-size: .74rem; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; }
.detail-value { overflow-wrap: anywhere; font-weight: 400; }
.detail-value .field + .field { margin-top: 10px; }
.detail-actions { display: flex; gap: 6px; }
.row-btn {
  width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.row-btn:hover { border-color: var(--ink-2); color: var(--ink); }
.row-btn.save { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.row-btn[disabled] { opacity: .45; cursor: not-allowed; }
.profile-course + .profile-course { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.profile-course h3 { font-size: 1.05rem; margin-bottom: .2em; }
.profile-course h3 a { color: var(--ink); text-decoration: none; }
.profile-course h3 a:hover { color: var(--accent-ink); }
.profile-course > p { margin: 0 0 10px; font-size: .88rem; }
.profile-parts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.profile-parts li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: .9rem; }
.profile-parts .pp-count { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.profile-parts .bar { grid-column: 1 / -1; height: 8px; }
.profile-note { font-size: .82rem; text-align: center; }
.profile .tag { white-space: nowrap; }
.pt-course, .pt-attempts { display: none; }
.profile th, .pt-when-col { white-space: nowrap; }
.pt-sub { display: block; color: var(--ink-2); font-size: .78rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  .sidebar { position: fixed; left: 0; top: 68px; bottom: 0; width: 300px; max-width: 86vw; z-index: 40; transform: translateX(-100%); transition: transform .22s ease; background: var(--bg); box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim { display: block; position: fixed; inset: 68px 0 0 0; background: rgba(0,0,0,.35); z-index: 35; }
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .ring { width: 120px; height: 120px; }
  .how { grid-template-columns: 1fr; }
  .part-head { padding: 24px; }
}
@media (max-width: 560px) {
  :root { --base: 17px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand-text { display: none; }
  .progress-pill { display: none; }
  /* On phones the open search covers the whole top bar instead of squeezing in beside the buttons. */
  .site-search.open { position: absolute; inset: 12px 12px auto 12px; background: var(--bg); z-index: 40; }
  .site-search.open .search-field { width: auto; flex: 1; }
  .site-search .search-results { width: 100%; }
  .main { --main-pad-top: 22px; padding: var(--main-pad-top) 16px 60px; }
  .home-hero { border-radius: 0 0 50% 50% / 0 0 32px 32px; }
  .profile-card { padding: 20px 16px; }
  .detail-row { grid-template-columns: minmax(0, 1fr) auto; }
  .detail-label { grid-column: 1 / -1; margin-bottom: -8px; }
  .profile table { min-width: 0; font-size: .82rem; }
  .profile th, .profile td { padding: 10px 6px; }
  .pt-course-col, .pt-when-col, .pt-attempts-col { display: none; }
  .pt-attempts { display: block; color: var(--ink-2); font-size: .76rem; white-space: nowrap; }
  .profile th { white-space: normal; }
  .pt-course { display: block; color: var(--ink-2); font-size: .76rem; }
  .topic-q .n { width: 38px; height: 38px; font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Per-part colours: re-derive accent tokens wherever a local hue is set */
[style*="--accent-h"], .brand-mark {
  --accent: hsl(var(--accent-h) 80% 42%);
  --accent-ink: hsl(var(--accent-h) 75% 34%);
  --accent-soft: hsl(var(--accent-h) 85% 96%);
}
:root[data-theme="dark"] [style*="--accent-h"], :root[data-theme="dark"] .brand-mark {
  --accent: hsl(var(--accent-h) 85% 68%); --accent-ink: hsl(var(--accent-h) 90% 78%); --accent-soft: hsl(var(--accent-h) 35% 20%);
}

/* ---------- Information pages (privacy policy - app/Views/pages/) ---------- */
.legal-page { max-width: 860px; margin: 0 auto; text-align: left; }
.legal-body { padding: 30px 34px; }
.legal-body .legal-updated { color: var(--ink-2); font-size: .9rem; margin-top: 0; }
.legal-body h2 { font-size: 1.25rem; margin: 1.8em 0 .5em; scroll-margin-top: 80px; }
.legal-body ul { padding-left: 1.2em; }
.legal-body li { margin-bottom: .4em; }
.legal-body .table-wrap { overflow-x: auto; margin: 1em 0; }
.legal-body table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.legal-body th, .legal-body td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.legal-body th { background: var(--surface-2); }
@media (max-width: 640px) { .legal-body { padding: 22px 18px; } }
.form-note { font-size: .85rem; margin: 12px 0 0; text-align: center; }

/* ---------- Cookie consent banner (js/app.js "Cookie consent") ---------- */
.cookie-banner {
  position: fixed; z-index: 60; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(780px, calc(100% - 32px)); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 12px 40px -8px rgba(20,21,23,.35); padding: 22px 24px;
}
.cookie-banner:focus { outline: 3px solid var(--brand); outline-offset: 2px; }
.cookie-banner h2 { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; margin: 0 0 8px; }
.cookie-banner h2 .material-symbols-outlined { color: var(--brand-ink); }
.cookie-banner p { margin: 0 0 16px; font-size: .92rem; color: var(--ink-2); }
.cookie-groups { display: grid; gap: 10px; margin-bottom: 16px; }
.cookie-group { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.cg-text { display: flex; flex-direction: column; gap: 2px; }
.cg-text b { font-size: .95rem; }
.cg-text span { font-size: .85rem; color: var(--ink-2); font-weight: 300; }
.cg-switch { appearance: none; flex: none; width: 44px; height: 24px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.cg-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.cg-switch:checked { background: var(--brand); }
.cg-switch:checked::after { transform: translateX(20px); }
.cg-switch:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.cg-switch:disabled { opacity: .55; cursor: not-allowed; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 640px) {
  .cookie-banner { bottom: 8px; width: calc(100% - 16px); padding: 16px; max-height: calc(100vh - 16px); }
  .cookie-banner h2 { font-size: 1rem; }
  .cookie-banner p { font-size: .82rem; margin-bottom: 12px; }
  .cookie-groups { gap: 8px; margin-bottom: 12px; }
  .cookie-group { padding: 10px 12px; }
  .cg-text b { font-size: .88rem; }
  .cg-text span { font-size: .78rem; line-height: 1.4; }
  .cookie-actions { gap: 8px; }
  .cookie-actions .btn { flex: 1 1 40%; justify-content: center; padding: .75em 1em; font-size: .88rem; }
  .cookie-actions .btn.ghost { flex-basis: 100%; }
}

/* ---------- Environment badge (any APP_ENV but production - app/Views/home.php) ---------- */
.env-badge { margin-left: 12px; padding: .3em .75em; border-radius: 999px; background: var(--warn-soft); color: var(--warn-ink); font: 700 .7rem var(--font); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
/* Phones: just an amber dot (the word stays for screen readers and the tooltip). */
@media (max-width: 640px) { .env-badge { margin-left: 6px; padding: 0; width: 10px; height: 10px; flex: none; font-size: 0; background: var(--warn-ink); } }
