/* University chrome, extra themes, mascot, play lab, downloads.
   Loads after shell.css. Offline. No CDN. */

html[data-theme="futuristic"] {
  color-scheme: dark;
  --bg: #030712;
  --bg-2: #0b1224;
  --bg-3: #111c36;
  --ink: #e8f4ff;
  --ink-dim: #d4e6ff;
  --muted: #9fb4d4;
  --line: rgba(125, 211, 252, 0.18);
  --line-strong: rgba(125, 211, 252, 0.38);
  --gold: #7dd3fc;
  --gold-2: #e0f2fe;
  --paper: #0b1224;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --glow: 0 0 32px rgba(56, 189, 248, 0.35);
  --accent: #38bdf8;
  --accent-2: #c4b5fd;
  --accent-ink: #082f49;
  --glass: rgba(3, 7, 18, 0.82);
  --card-bg: #0b1224;
  --field: #070d1c;
  --illu-bg: #07101f;
  --hero-ink: #e8f4ff;
  --mesh-a: rgba(56, 189, 248, 0.28);
  --mesh-b: rgba(167, 139, 250, 0.22);
  --mesh-c: rgba(34, 211, 238, 0.14);
  --mesh-d: rgba(196, 181, 253, 0.12);
  --sidebar: #050914;
  --grad: linear-gradient(120deg, #38bdf8, #818cf8, #c4b5fd, #38bdf8);
}
html[data-theme="gaming"] {
  color-scheme: dark;
  --bg: #07140c;
  --bg-2: #0d2416;
  --bg-3: #143222;
  --ink: #ecfccb;
  --ink-dim: #d9f99d;
  --muted: #bbf7d0;
  --line: rgba(250, 204, 21, 0.2);
  --line-strong: rgba(250, 204, 21, 0.42);
  --gold: #facc15;
  --gold-2: #fef08a;
  --paper: #0d2416;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --glow: 0 0 28px rgba(34, 197, 94, 0.35);
  --accent: #4ade80;
  --accent-2: #facc15;
  --accent-ink: #052e16;
  --glass: rgba(7, 20, 12, 0.84);
  --card-bg: #0d2416;
  --field: #07140c;
  --illu-bg: #07140c;
  --hero-ink: #ecfccb;
  --mesh-a: rgba(74, 222, 128, 0.22);
  --mesh-b: rgba(250, 204, 21, 0.16);
  --mesh-c: rgba(52, 211, 153, 0.14);
  --mesh-d: rgba(250, 204, 21, 0.1);
  --sidebar: #06110a;
  --grad: linear-gradient(120deg, #4ade80, #facc15, #22c55e, #4ade80);
}
html[data-theme="futuristic"] body.v4 {
  background:
    radial-gradient(circle at 12% 8%, rgba(56, 189, 248, 0.16), transparent 32%),
    radial-gradient(circle at 88% 0%, rgba(196, 181, 253, 0.16), transparent 28%),
    var(--bg);
}
html[data-theme="gaming"] body.v4 {
  background:
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(250, 204, 21, 0.03) 4px),
    radial-gradient(circle at 80% 10%, rgba(250, 204, 21, 0.12), transparent 26%),
    var(--bg);
}
html[data-theme="gaming"] .v4-app .topbar,
html[data-theme="futuristic"] .v4-app .topbar {
  box-shadow: var(--glow);
}

.lab-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  padding: 6px 12px;
  background: color-mix(in srgb, var(--accent) 12%, var(--sidebar));
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
}
.lab-links a, .lab-links button {
  color: var(--ink);
  text-decoration: none;
  background: transparent;
  border: 0;
  padding: 4px 2px;
  font: inherit;
  cursor: pointer;
}
.lab-links a:hover, .lab-links button:hover { color: var(--accent); }
.lab-links a:focus-visible, .lab-links button:focus-visible,
.lab-footer a:focus-visible, .next-labs a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.v4-stage > .lab-links { grid-column: 1 / -1; }

.lab-footer {
  margin: 28px 0 12px;
  padding: 18px 16px 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}
.lab-footer .lab-sign { color: var(--ink); font-weight: 700; margin: 0 0 6px; }
.lab-footer p { margin: 0 0 8px; }
.lab-footer a { color: var(--accent); }
.lab-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lab-actions button, .lab-actions a.ghost {
  border: 1px solid var(--line-strong);
  background: var(--card-bg);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}
.next-labs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 4px;
  scroll-snap-type: x mandatory;
}
.next-labs a {
  flex: none;
  scroll-snap-align: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  color: var(--ink);
  text-decoration: none;
  background: var(--card-bg);
}
.next-labs a small { display: block; color: var(--muted); }

.monkey {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 70;
  width: 84px;
  height: 96px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.35));
}
.monkey svg { width: 84px; height: 96px; display: block; }
html.v4-motion .monkey.is-live { animation: monkey-bob 3.6s ease-in-out infinite; }
@keyframes monkey-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.monkey-note {
  position: fixed;
  right: 16px;
  bottom: 116px;
  z-index: 70;
  max-width: 220px;
  background: var(--glass);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 0.8rem;
  backdrop-filter: blur(8px);
}
.egg-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
}
.egg-card {
  background: var(--card-bg);
  color: var(--ink);
  border-radius: 20px;
  padding: 24px;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--glow);
}

.atlas-grid, .sheet-grid, .badge-grid, .play-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.atlas-card, .sheet-card, .badge, .play-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
}
html.v4-motion .atlas-card { transition: transform 0.25s ease; }
html.v4-motion .atlas-card:hover { transform: translateY(-4px) rotateX(2deg); }
.atlas-card object, .diagram object { width: 100%; height: auto; min-height: 180px; background: #0b1020; border-radius: 12px; }
.mark-unverified, mark.unverified {
  background: #fde68a;
  color: #422006;
  padding: 0 4px;
  border-radius: 4px;
}

.play-board { display: grid; gap: 12px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-row button, .flow-palette button {
  border: 1px solid var(--line-strong);
  background: var(--field);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font: inherit;
}
.choice-row button.is-right { border-color: #22c55e; }
.choice-row button.is-wrong { border-color: #fb7185; }
.flow-lane {
  min-height: 72px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
}
.flow-node {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 10px;
  padding: 6px 10px;
  font-weight: 700;
}
.score-line { font-variant-numeric: tabular-nums; }
.map-explorer { width: 100%; overflow: auto; }
.map-explorer svg { width: 100%; height: auto; min-width: 640px; }
.map-explorer a:focus-visible rect { stroke: #fff; stroke-width: 3px; }

.badge.is-on { outline: 2px solid var(--accent); }
.badge small { display: block; color: var(--muted); }

@media (max-width: 720px) {
  .monkey { width: 64px; height: 74px; right: 8px; bottom: 8px; }
  .monkey svg { width: 64px; height: 74px; }
  .monkey-note { right: 8px; bottom: 88px; max-width: 70vw; }
  .lab-links { font-size: 0.72rem; }
  .next-labs a { min-width: 46vw; }
}
@media (prefers-reduced-motion: reduce) {
  .monkey, html.v4-motion .monkey.is-live { animation: none; }
  html.v4-motion .atlas-card { transition: none; }
}
.uni-fold {
  margin: 0 0 12px;
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.uni-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 8px;
}
.uni-menu a {
  flex: none;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  min-height: 44px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-weight: 700;
}
.uni-menu a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fold-grid {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 12px;
  align-items: center;
}
.fold-hero svg { width: 100%; height: auto; display: block; max-height: 120px; }
.fold-side { display: flex; flex-direction: column; gap: 8px; }
.fold-counts, .spark-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.fold-counts b, .spark-row b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.theme-switch, .mascot-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.theme-switch button {
  border: 1px solid var(--line-strong);
  background: var(--card-bg, transparent);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  cursor: pointer;
}
.mascot-row svg { width: 42px; height: 50px; }
.cube-scene { width: 46px; height: 46px; perspective: 280px; flex: none; }
.cube-3d {
  position: relative;
  width: 28px;
  height: 28px;
  margin: 9px;
  transform-style: preserve-3d;
  animation: cube-spin 9s linear infinite;
}
.cube-3d i {
  position: absolute;
  inset: 0;
  border: 1px solid #22d3ee;
  background: rgba(34, 211, 238, 0.18);
}
.cube-3d i:nth-child(1) { transform: rotateY(0deg) translateZ(14px); }
.cube-3d i:nth-child(2) { transform: rotateY(180deg) translateZ(14px); }
.cube-3d i:nth-child(3) { transform: rotateY(90deg) translateZ(14px); }
.cube-3d i:nth-child(4) { transform: rotateY(-90deg) translateZ(14px); }
.cube-3d i:nth-child(5) { transform: rotateX(90deg) translateZ(14px); }
.cube-3d i:nth-child(6) { transform: rotateX(-90deg) translateZ(14px); }
@keyframes cube-spin { to { transform: rotateX(360deg) rotateY(360deg); } }
.spark-icon { width: 42px; height: 42px; }
.track-spark { margin: 0 0 16px; }
.atlas-grid, .chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.atlas-card, .chart-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  background: color-mix(in srgb, var(--paper, var(--bg-2)) 86%, transparent);
}
.atlas-card object, .atlas-card img, .chart-card svg, .chart-card canvas { width: 100%; height: auto; }
.lab-chart { width: 100%; height: auto; aspect-ratio: 640 / 220; }
[data-d3] { display: block; width: 100%; min-height: 220px; }
.site-social {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.site-social a {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: color-mix(in srgb, var(--card-bg) 82%, transparent);
  text-decoration: none;
}
.site-social a:hover,
.site-social a:focus-visible {
  color: var(--accent-ink);
  background: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.site-social svg { width: 16px; height: 16px; display: block; }
.site-copy { margin: 4px 0 0; color: var(--ink); font-weight: 700; }
.lab-footer.site-footer { flex-direction: column; align-items: flex-start; }
[data-three] { width: 72px; height: 72px; }
[data-three] canvas { width: 72px; height: 72px; display: block; }
#mindmap { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 16px; }
.career-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.career-grid article { border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
@media (max-width: 720px) {
  .fold-grid { grid-template-columns: 1fr; }
  .fold-hero svg { max-height: 72px; }
  .uni-fold { padding: 4px 10px 8px; }
  .uni-menu a { padding: 8px 12px; font-size: 0.92rem; min-height: 44px; }
  .lab-links { flex-wrap: nowrap; overflow-x: auto; }
  .mascot-row svg { width: 34px; height: 40px; }
  [data-three] { display: none; }
  #mindmap { height: 280px; }
}
@media (prefers-reduced-motion: reduce) {
  .cube-3d { animation: none; }
}
@media print {
  .lab-links, .monkey, .monkey-note, .v4-sidebar, .v4-toc, .topbar, .uni-fold, .uni-menu { display: none !important; }
  .lab-footer { display: block !important; }
}
