:root {
  --bg: #04070f;
  --bg-elevated: #080f1f;
  --panel: #0d1528;
  --panel-soft: #111a2f;
  --text: #e6eefc;
  --muted: #9cb1d6;
  --accent: #5db5ff;
  --accent-soft: rgba(93, 181, 255, 0.24);
  --gold: #f7c960;
  --gold-soft: rgba(247, 201, 96, 0.22);
  --shadow-strong: 0 24px 50px rgba(2, 6, 16, 0.75);
  --radius-lg: 20px;
  --radius-md: 14px;
  --transition-fast: 0.2s ease;
  --transition-pop: 0.25s cubic-bezier(0.2, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", Tahoma, Geneva, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% -10%, rgba(93, 181, 255, 0.12), transparent 35%),
    radial-gradient(circle at 80% 10%, rgba(93, 181, 255, 0.09), transparent 30%),
    var(--bg);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  background: var(--accent);
  color: #091328;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-weight: 700;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.page-shell {
  width: min(1100px, calc(100% - 1rem));
  margin: 1.25rem auto;
}

.site-header,
.site-footer,
.section-card {
  background: color-mix(in oklab, var(--panel) 85%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent) 25%, transparent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-strong);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  position: sticky;
  top: 1rem;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.brand {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-decoration: none;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
}

.nav-link {
  margin: 0.2rem;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  color: var(--muted);
  transition: color var(--transition-fast), background var(--transition-fast),
    box-shadow var(--transition-fast);
}

.nav-link:hover {
  color: var(--text);
  background: color-mix(in oklab, var(--accent-soft) 65%, transparent);
  box-shadow: 0 0 16px var(--accent-soft);
}

.nav-auth-link {
  border: 1px solid color-mix(in oklab, var(--accent) 28%, transparent);
}

.nav-auth-primary {
  color: #07101f;
  background: var(--accent);
  font-weight: 800;
  box-shadow: 0 0 18px rgba(93, 181, 255, 0.2);
}

.nav-auth-primary:hover {
  color: #020713;
  background: color-mix(in oklab, var(--accent) 86%, white);
}

.contact-copy {
  margin-top: 0.45rem;
  color: var(--muted);
}

main {
  margin-top: 1.25rem;
  display: grid;
  gap: 1rem;
}

.section-card {
  padding: 1.25rem;
}

.hero {
  display: grid;
  gap: 1.1rem;
  position: relative;
}

.hero-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.hero-card {
  border-radius: var(--radius-md);
  background: linear-gradient(140deg, var(--accent-soft), transparent);
  padding: 1rem;
  border: 1px solid color-mix(in oklab, var(--accent) 30%, transparent);
}

.hero-icon {
  font-size: 2.5rem;
  width: 4rem;
  height: 4rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(11, 22, 42, 0.75);
  border: 1px solid color-mix(in oklab, var(--accent) 40%, transparent);
}

.hero-icon svg {
  width: 2.15rem;
  height: 2.15rem;
  color: var(--accent);
}

.hero-card h2 {
  margin: 0.6rem 0 0.4rem;
}

.hero-stack {
  margin-top: 0.85rem;
  list-style: none;
}

.hero-highlights {
  list-style: none;
  margin: 0.9rem 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.hero-highlights li {
  margin: 0;
  border: 1px solid color-mix(in oklab, var(--accent) 24%, transparent);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  background: color-mix(in oklab, var(--panel-soft) 84%, transparent);
  line-height: 1.45;
}

.hero-highlights strong {
  color: color-mix(in oklab, var(--accent) 92%, var(--text));
}

.hero-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.hero-animation-area {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
}

.hero-mascot-frame {
  position: relative;
  isolation: isolate;
  width: min(640px, 100%);
  padding: 3.15rem 0.75rem 0.55rem;
  overflow: hidden;
  border: 1px solid color-mix(in oklab, var(--accent) 32%, transparent);
  border-radius: clamp(18px, 4vw, 30px);
  background:
    linear-gradient(145deg, rgba(18, 34, 62, 0.84), rgba(5, 11, 24, 0.9)),
    var(--panel-soft);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -32px 68px rgba(1, 5, 14, 0.36),
    0 24px 52px rgba(2, 7, 18, 0.5),
    0 0 52px rgba(93, 181, 255, 0.07);
}

.hero-mascot-frame::before,
.hero-mascot-frame::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(2px);
}

.hero-mascot-frame::before {
  width: 19rem;
  height: 19rem;
  top: -10rem;
  left: -7rem;
  background: radial-gradient(circle, rgba(93, 181, 255, 0.2), transparent 68%);
}

.hero-mascot-frame::after {
  width: 16rem;
  height: 16rem;
  right: -7rem;
  bottom: -9rem;
  background: radial-gradient(circle, rgba(183, 156, 255, 0.14), transparent 70%);
}

.hero-mascot-toolbar {
  position: absolute;
  z-index: 3;
  top: 0.75rem;
  left: 0.85rem;
  right: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.hero-mascot-status,
.cat-motion-toggle {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  border: 1px solid rgba(133, 196, 255, 0.2);
  border-radius: 999px;
  background: rgba(7, 15, 31, 0.72);
  color: color-mix(in oklab, var(--muted) 88%, white);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  font: 700 0.68rem/1 "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-mascot-status {
  padding: 0.55rem 0.72rem;
}

.hero-mascot-status-dot {
  width: 0.48rem;
  height: 0.48rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #79e6ad;
  box-shadow: 0 0 0 4px rgba(121, 230, 173, 0.1), 0 0 12px rgba(121, 230, 173, 0.72);
  animation: hcStatusPulse 2.4s ease-in-out infinite;
}

.cat-motion-toggle {
  appearance: none;
  padding: 0.48rem 0.72rem;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast),
    background var(--transition-fast), transform var(--transition-pop);
}

.cat-motion-toggle:hover {
  color: var(--text);
  border-color: rgba(124, 199, 255, 0.5);
  background: rgba(22, 42, 72, 0.88);
  transform: translateY(-1px);
}

.cat-motion-icon {
  position: relative;
  width: 0.72rem;
  height: 0.72rem;
  display: inline-block;
}

.cat-motion-icon::before,
.cat-motion-icon::after {
  content: "";
  position: absolute;
  top: 0;
  width: 0.2rem;
  height: 0.72rem;
  border-radius: 2px;
  background: var(--accent);
}

.cat-motion-icon::before { left: 0.08rem; }
.cat-motion-icon::after { right: 0.08rem; }

.hero-mascot-frame[data-motion="off"] .cat-motion-icon::before {
  left: 0.14rem;
  width: 0;
  height: 0;
  border-top: 0.36rem solid transparent;
  border-bottom: 0.36rem solid transparent;
  border-left: 0.55rem solid var(--accent);
  border-radius: 0;
  background: transparent;
}

.hero-mascot-frame[data-motion="off"] .cat-motion-icon::after {
  display: none;
}

.hero-mascot-frame[data-motion="off"] .hero-mascot-status-dot {
  animation: none;
  background: #7588a9;
  box-shadow: 0 0 0 4px rgba(117, 136, 169, 0.1);
}

/* ---------- Hero cat mascot (SVG scene) ----------
   Continuous motion lives in CSS keyframes; script.js layers short-lived
   state classes (is-typing, is-flicking, is-twitching, is-peeking,
   is-winking) onto #home-cat-actor for intermittent behaviors. */

.hero-cat {
  position: relative;
  z-index: 1;
  width: min(540px, 100%);
  height: auto;
  display: block;
  margin: 0 auto;
  pointer-events: none;
  filter: drop-shadow(0 20px 24px rgba(1, 5, 15, 0.48));
}

.hero-cat * {
  transform-box: view-box;
}

/* script.js adds .is-resting while the hero is scrolled out of view so the
   looping animations stop burning frames; the pose is untouched and every
   loop resumes exactly where it paused once the scene scrolls back in. */
.hero-cat.is-resting *,
.hero-cat.is-motion-paused * {
  animation-play-state: paused !important;
}

.hc-stage-panel {
  animation: hcStageGlow 5.8s ease-in-out infinite alternate;
}

.hc-orbit {
  animation: hcOrbitDrift 18s linear infinite;
}

.hc-orbit-b {
  animation-direction: reverse;
  animation-duration: 22s;
}

.hc-orbit-dot {
  transform-box: fill-box;
  transform-origin: center;
  animation: hcOrbitDot 3.2s ease-in-out infinite;
}

.hc-orbit-dot-b {
  animation-delay: 1.4s;
}

.hc-float {
  animation: hcFloat 7.2s ease-in-out infinite alternate;
}

.hc-aurora {
  transform-origin: 270px 235px;
  animation: hcAuroraPulse 5s ease-in-out infinite alternate;
}

.hc-spill {
  animation: hcSpillPulse 4s ease-in-out infinite alternate;
}

.hc-tail {
  transform-origin: 398px 300px;
  animation: hcTailSwish 2.9s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite alternate;
}

.hc-tail-flick {
  transform-origin: 398px 300px;
}

.is-flicking .hc-tail-flick {
  animation: hcTailFlick 0.72s cubic-bezier(0.2, 0.75, 0.3, 1);
}

.hc-torso {
  transform-origin: 335px 332px;
  animation: hcBreathe 3.8s ease-in-out infinite alternate;
}

.hc-head {
  transform-origin: 335px 224px;
  animation: hcHeadBob 3.6s ease-in-out infinite alternate;
}

.hc-head-tilt {
  transform-origin: 335px 224px;
  transition: transform 0.25s ease;
}

.is-typing .hc-head-tilt {
  transform: rotate(2.6deg) translateY(2px);
}

.is-peeking .hc-head-tilt {
  transform: rotate(-3deg);
}

.hc-ear-l {
  transform-origin: 288px 146px;
}

.hc-ear-r {
  transform-origin: 382px 146px;
}

.is-twitching .hc-ear-l {
  animation: hcEarTwitch 0.55s ease;
}

.is-twitching .hc-ear-r {
  animation: hcEarTwitch 0.55s ease 0.12s;
}

.hc-shades {
  transform-origin: 335px 162px;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.is-peeking .hc-shades {
  transform: translateY(-35px) rotate(-5deg);
}

.hc-eye-r-open {
  transition: opacity 0.1s ease;
}

.hc-eye-l {
  transform-origin: 308px 165px;
  animation: hcEyeBlink 6.8s ease-in-out infinite;
}

.hc-eye-r-open {
  transform-origin: 362px 165px;
  animation: hcEyeBlink 6.8s ease-in-out infinite;
}

.hc-eye-r-shut {
  opacity: 0;
  transition: opacity 0.1s ease;
}

.is-winking .hc-eye-r-open {
  opacity: 0;
}

.is-winking .hc-eye-r-shut {
  opacity: 1;
}

.hc-glint-1 {
  transform-origin: 282px 164px;
  animation: hcGlintSweep 4.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.hc-glint-2 {
  transform-origin: 294px 164px;
  animation: hcGlintSweep 4.8s cubic-bezier(0.4, 0, 0.2, 1) 0.12s infinite;
}

.hc-led-l {
  animation: hcLedPulse 1.6s ease-in-out infinite alternate;
}

.hc-led-r {
  animation: hcLedPulse 1.6s ease-in-out 0.8s infinite alternate;
}

.hc-code {
  opacity: 0.85;
  animation: hcCodeType 8.4s ease-out infinite;
}

.hc-code-1 { transform-origin: 86px 147px; animation-delay: 0s; }
.hc-code-2 { transform-origin: 86px 163px; animation-delay: 0.6s; }
.hc-code-3 { transform-origin: 98px 179px; animation-delay: 1.3s; }
.hc-code-4 { transform-origin: 98px 195px; animation-delay: 2s; }
.hc-code-5 { transform-origin: 86px 211px; animation-delay: 2.7s; }

.hc-code-hot {
  opacity: 1;
  filter: drop-shadow(0 0 5px currentColor);
}

.hc-cursor {
  animation: hcCursorBlink 1.05s steps(2, jump-none) infinite;
}

.hc-scan {
  animation: hcScan 5.6s linear infinite;
}

.hc-key {
  fill: #8fb0e6;
  opacity: 0.9;
  transition: fill 0.12s ease, opacity 0.12s ease;
}

.hc-keyboard {
  animation: hcKeyboardGlow 2.8s ease-in-out infinite alternate;
}

.hc-key-lit {
  fill: #dbeaff;
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(170, 217, 255, 0.9));
}

.hc-paw-group-l {
  animation: hcPawTap 0.78s ease-in-out infinite alternate;
}

.hc-paw-group-r {
  animation: hcPawTap 0.78s ease-in-out 0.39s infinite alternate;
}

.hc-paw-tap {
  transform-box: fill-box;
  transform-origin: center bottom;
}

.is-typing .hc-paw-group-l .hc-paw-tap {
  animation: hcPawType 0.42s ease-in-out 2;
}

.is-typing .hc-paw-group-r .hc-paw-tap {
  animation: hcPawType 0.42s ease-in-out 0.16s 2;
}

.hc-steam-1 {
  opacity: 0;
  animation: hcSteam 3.6s ease-in-out infinite;
}

.hc-steam-2 {
  opacity: 0;
  animation: hcSteam 3.6s ease-in-out 1.7s infinite;
}

.hc-collar circle {
  transform-box: fill-box;
  transform-origin: center top;
  animation: hcTagSwing 2.8s ease-in-out infinite alternate;
}

.hc-tongue {
  transition: opacity 0.18s ease;
}

.is-peeking .hc-tongue {
  opacity: 1;
}

.hc-purr-bubble {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: left bottom;
}

.is-peeking .hc-purr-bubble {
  animation: hcBubblePop 1.7s cubic-bezier(0.2, 1, 0.3, 1) 0.25s both;
}

.hc-note-1 {
  opacity: 0;
  transform-origin: 420px 150px;
  animation: hcNoteFloat 5.2s ease-in-out infinite;
}

.hc-note-2 {
  opacity: 0;
  transform-origin: 262px 96px;
  animation: hcNoteFloat 6s ease-in-out 2.6s infinite;
}

.hc-spark {
  opacity: 0.15;
  transform-box: fill-box;
  transform-origin: center;
  animation: hcTwinkle 3.6s ease-in-out infinite;
}

.hc-spark-1 { animation-delay: 0s; }
.hc-spark-2 { animation-delay: 0.9s; animation-duration: 4.2s; }
.hc-spark-3 { animation-delay: 1.5s; }
.hc-spark-4 { animation-delay: 2.2s; animation-duration: 4.6s; }
.hc-spark-5 { animation-delay: 2.8s; }

.eyebrow {
  color: var(--accent);
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8rem;
  font-weight: 700;
}

h1,
h2,
h3 { margin: 0; }

h1 {
  font-size: clamp(1.7rem, 4vw, 2.55rem);
  line-height: 1.1;
}

.lede,
p {
  color: var(--muted);
  max-width: 75ch;
  line-height: 1.55;
}

.section-head p { margin-top: 0.5rem; }

.about-grid {
  display: grid;
  gap: 0.75rem;
  color: var(--muted);
}

.project-grid {
  margin-top: 1rem;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr;
}

.project-card {
  border: 1px solid color-mix(in oklab, var(--accent) 20%, transparent);
  background: linear-gradient(160deg, color-mix(in oklab, var(--bg-elevated) 88%, transparent), transparent);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: grid;
  gap: 0.7rem;
}

.project-card h3 { margin-bottom: 0.2rem; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}

.chip {
  border: 1px solid color-mix(in oklab, var(--accent) 28%, transparent);
  color: color-mix(in oklab, var(--accent) 80%, var(--text));
  border-radius: 999px;
  padding: 0.18rem 0.65rem;
  font-size: 0.78rem;
}

.project-meta,
.project-outcome {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.project-meta strong { color: var(--text); }

.project-links {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.rpg-project { overflow: hidden; }
.rpg-project:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.rpg-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.8rem 2rem;
  align-items: end;
}

.rpg-heading > p { margin: 0; max-width: 48ch; }

.rpg-layout {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

.rpg-stage {
  padding: 0.7rem;
  border: 1px solid color-mix(in oklab, var(--accent) 28%, transparent);
  border-radius: var(--radius-md);
  background: #050914;
}

#rpg-canvas {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
  border-radius: 8px;
  background: #050914;
}

.rpg-status { margin: 0.7rem 0 0; min-height: 1.6em; }

.rpg-hud {
  display: grid;
  align-content: start;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid color-mix(in oklab, var(--accent) 20%, transparent);
  border-radius: var(--radius-md);
  background: color-mix(in oklab, var(--panel-soft) 86%, transparent);
}

.rpg-stats { display: grid; gap: 0.45rem; }
.rpg-stat { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); }
.rpg-stat strong { color: var(--text); }
.rpg-help { margin: 0; font-size: 0.92rem; }
.rpg-actions { display: grid; gap: 0.55rem; }

.rpg-controls {
  width: 11rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  justify-self: center;
}

.rpg-controls button {
  min-height: 2.7rem;
  border: 1px solid color-mix(in oklab, var(--accent) 35%, transparent);
  color: var(--text);
  background: var(--bg-elevated);
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
}
.rpg-controls button:first-child { grid-column: 2; }
.rpg-controls button:hover { border-color: var(--accent); background: var(--panel); }

@media (min-width: 850px) {
  .rpg-layout { grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.65fr); }
}

.btn,
.btn:visited {
  border-radius: 999px;
  border: 1px solid color-mix(in oklab, var(--accent) 35%, transparent);
  padding: 0.52rem 1rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-weight: 600;
  transition: transform var(--transition-pop), box-shadow var(--transition-pop), border-color var(--transition-pop);
  cursor: pointer;
  min-height: 42px;
}

.btn-primary {
  color: var(--bg);
  background: var(--accent);
}

.btn-secondary {
  color: var(--text);
  background: transparent;
}

.btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(93, 181, 255, 0.55), 0 0 40px rgba(93, 181, 255, 0.22);
}

.btn-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  color: var(--muted);
  background: color-mix(in oklab, var(--bg-elevated) 85%, transparent);
}

.contact-form {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.55rem;
}

.form-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

label {
  color: var(--muted);
  font-size: 0.92rem;
}

input,
textarea {
  width: 100%;
  border: 1px solid color-mix(in oklab, var(--accent) 28%, transparent);
  border-radius: 10px;
  background: color-mix(in oklab, var(--bg-elevated) 85%, transparent);
  color: var(--text);
  padding: 0.65rem 0.75rem;
  font: inherit;
}

textarea { resize: vertical; }

.captcha-slot {
  margin-top: 0.4rem;
  min-height: 65px;
}

.form-actions {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.4rem;
}

.note {
  margin: 0.45rem 0 0;
  min-height: 1.2em;
  color: color-mix(in oklab, var(--accent) 90%, var(--text));
}

.note[data-state="error"] { color: #ff9aaa; }
.note[data-state="success"] { color: #8ce5bd; }

.site-footer {
  padding: 1rem 1.25rem;
  margin: 1rem 0 1.25rem;
  color: var(--muted);
  text-align: center;
}

@keyframes hcStatusPulse {
  0%, 100% { transform: scale(0.9); opacity: 0.72; }
  50% { transform: scale(1.08); opacity: 1; }
}

@keyframes hcStageGlow {
  from { stroke-opacity: 0.14; }
  to { stroke-opacity: 0.34; }
}

@keyframes hcOrbitDrift {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -136; }
}

@keyframes hcOrbitDot {
  0%, 100% { transform: scale(0.78); opacity: 0.4; }
  50% { transform: scale(1.22); opacity: 1; }
}

@keyframes hcFloat {
  from { transform: translateY(0); }
  to { transform: translateY(-5px); }
}

@keyframes hcAuroraPulse {
  from { transform: scale(1); opacity: 0.75; }
  to { transform: scale(1.06); opacity: 1; }
}

@keyframes hcSpillPulse {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

@keyframes hcTailSwish {
  from { transform: rotate(-8deg); }
  to { transform: rotate(12deg); }
}

@keyframes hcTailFlick {
  0%, 100% { transform: rotate(0deg); }
  28% { transform: rotate(7deg); }
  58% { transform: rotate(-5deg); }
  82% { transform: rotate(2deg); }
}

@keyframes hcBreathe {
  from { transform: scaleY(1) scaleX(1); }
  to { transform: scaleY(1.03) scaleX(1.012); }
}

@keyframes hcHeadBob {
  from { transform: rotate(-1.5deg) translateY(0); }
  to { transform: rotate(1.8deg) translateY(-2px); }
}

@keyframes hcEyeBlink {
  0%, 43%, 47%, 100% { transform: scaleY(1); }
  44.5%, 45.5% { transform: scaleY(0.08); }
}

@keyframes hcEarTwitch {
  0%, 100% { transform: rotate(0deg); }
  35% { transform: rotate(-10deg); }
  70% { transform: rotate(4deg); }
}

@keyframes hcGlintSweep {
  0% { transform: translateX(-26px) rotate(16deg); opacity: 0; }
  8% { opacity: 0.6; }
  22% { transform: translateX(120px) rotate(16deg); opacity: 0; }
  100% { transform: translateX(120px) rotate(16deg); opacity: 0; }
}

@keyframes hcLedPulse {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

@keyframes hcCodeType {
  0% { transform: scaleX(0); opacity: 0.9; }
  9% { transform: scaleX(1); opacity: 1; }
  76% { transform: scaleX(1); opacity: 0.8; }
  86%, 100% { transform: scaleX(0); opacity: 0; }
}

@keyframes hcCursorBlink {
  from { opacity: 1; }
  to { opacity: 0.1; }
}

@keyframes hcScan {
  0% { transform: translateX(0); opacity: 0; }
  12% { opacity: 0.22; }
  82% { transform: translateX(210px); opacity: 0.22; }
  100% { transform: translateX(210px); opacity: 0; }
}

@keyframes hcPawTap {
  from { transform: translateY(0); }
  to { transform: translateY(3px) rotate(0.5deg); }
}

@keyframes hcPawType {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  45% { transform: translateY(4px) rotate(1deg); }
}

@keyframes hcKeyboardGlow {
  from { opacity: 0.88; }
  to { opacity: 1; }
}

@keyframes hcSteam {
  0% { opacity: 0; transform: translateY(3px); }
  35% { opacity: 0.55; }
  100% { opacity: 0; transform: translateY(-9px); }
}

@keyframes hcTagSwing {
  from { transform: rotate(-5deg); }
  to { transform: rotate(5deg); }
}

@keyframes hcBubblePop {
  0% { opacity: 0; transform: translate(-5px, 8px) scale(0.5); }
  24%, 72% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(3px, -9px) scale(0.94); }
}

@keyframes hcNoteFloat {
  0% { opacity: 0; transform: translate(0, 6px) rotate(-6deg); }
  25% { opacity: 0.75; }
  60% { opacity: 0.35; }
  100% { opacity: 0; transform: translate(-6px, -26px) rotate(8deg); }
}

@keyframes hcTwinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.35) rotate(0deg); }
  50% { opacity: 0.95; transform: scale(1) rotate(35deg); }
}

/* ---------- Fourfold geometry lab ---------- */

.geometry-lab {
  --geometry-bg: #050608;
  --geometry-panel: rgba(10, 11, 16, 0.72);
  --geometry-cyan: #06b6d4;
  --geometry-magenta: #f43f5e;
  --geometry-violet: #8b5cf6;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 0;
  color: #f5f7ff;
  background:
    radial-gradient(circle at 12% -20%, rgba(6, 182, 212, 0.16), transparent 38%),
    radial-gradient(circle at 86% 10%, rgba(244, 63, 94, 0.13), transparent 34%),
    linear-gradient(145deg, #0a0b10, var(--geometry-bg) 72%);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(139, 92, 246, 0.06) inset;
}

.geometry-watermark {
  position: absolute;
  top: -0.34em;
  right: -0.04em;
  z-index: 0;
  color: rgba(255, 255, 255, 0.022);
  font: 800 clamp(10rem, 28vw, 22rem) / 1 "Segoe UI", sans-serif;
  letter-spacing: -0.12em;
  user-select: none;
  pointer-events: none;
}

.geometry-lab-head {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 1.25rem;
  padding: clamp(1.25rem, 3vw, 2.1rem);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.geometry-lab-copy {
  max-width: 690px;
}

.geometry-kicker {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.65rem;
  color: #9ca3b7;
  font: 700 0.7rem / 1.3 ui-monospace, "JetBrains Mono", "Fira Code", Consolas, monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.geometry-kicker span {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--geometry-magenta), var(--geometry-violet));
  border-radius: 0.5rem;
  box-shadow: 0 0 24px rgba(244, 63, 94, 0.26);
}

.geometry-lab h2 {
  max-width: 700px;
  font-size: clamp(1.8rem, 5vw, 3.65rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  background: linear-gradient(112deg, #fff 8%, #dce9ff 50%, #a9b5cd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.geometry-lab-copy > p:last-child {
  max-width: 62ch;
  margin: 0.9rem 0 0;
  color: #8e9bb2;
  font-size: clamp(0.92rem, 1.7vw, 1.02rem);
}

.geometry-telemetry {
  align-self: start;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  color: #8792a7;
  font: 600 0.62rem / 1 ui-monospace, "JetBrains Mono", "Fira Code", Consolas, monospace;
  letter-spacing: 0.075em;
}

.geometry-telemetry > span {
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.68rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  white-space: nowrap;
}

.geometry-live-state i {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #6b7280;
  box-shadow: 0 0 0 rgba(6, 182, 212, 0);
}

.geometry-lab[data-render-state="active"] .geometry-live-state {
  color: #b8fbff;
}

.geometry-lab[data-render-state="active"] .geometry-live-state i {
  background: var(--geometry-cyan);
  animation: geometryLivePulse 1.8s ease-out infinite;
}

.geometry-lab[data-render-state="paused"] .geometry-live-state {
  color: #fda4af;
}

.geometry-lab[data-render-state="paused"] .geometry-live-state i {
  background: var(--geometry-magenta);
}

.geometry-stage {
  position: relative;
  min-height: clamp(620px, 68vw, 700px);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, rgba(139, 92, 246, 0.1), transparent 34%),
    radial-gradient(circle at 23% 62%, rgba(6, 182, 212, 0.07), transparent 30%),
    #050608;
}

.geometry-stage::before,
.geometry-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.geometry-stage::before {
  opacity: 0.24;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.027) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.027) 1px, transparent 1px);
  background-size: 42px 42px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 20%, black 76%, transparent);
  mask-image: linear-gradient(to bottom, transparent, black 20%, black 76%, transparent);
}

.geometry-stage::after {
  background:
    linear-gradient(to right, rgba(5, 6, 8, 0.7), transparent 12%, transparent 88%, rgba(5, 6, 8, 0.7)),
    linear-gradient(to bottom, rgba(5, 6, 8, 0.35), transparent 18%, transparent 68%, rgba(5, 6, 8, 0.74));
}

#fourfold-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#fourfold-canvas:active {
  cursor: grabbing;
}

#fourfold-canvas:focus-visible {
  outline: 2px solid var(--geometry-cyan);
  outline-offset: -4px;
}

.geometry-mode-switch {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 4;
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.28rem;
  padding: 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(10, 11, 16, 0.64);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.34);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.geometry-mode-button {
  min-height: 2.65rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #8490a6;
  background: transparent;
  font: 700 0.69rem / 1 ui-monospace, "JetBrains Mono", "Fira Code", Consolas, monospace;
  letter-spacing: 0.065em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.geometry-mode-button span {
  margin-right: 0.36rem;
  color: #596277;
}

.geometry-mode-button:hover {
  color: #e9f7ff;
}

.geometry-mode-button.is-active {
  color: #f7fbff;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.16), rgba(139, 92, 246, 0.18));
  border-color: rgba(6, 182, 212, 0.28);
  box-shadow: 0 0 22px rgba(6, 182, 212, 0.1) inset;
}

.geometry-mode-button.is-active span {
  color: var(--geometry-cyan);
}

.geometry-index {
  position: absolute;
  z-index: 3;
  color: rgba(172, 184, 205, 0.54);
  font: 600 0.58rem / 1.5 ui-monospace, "JetBrains Mono", "Fira Code", Consolas, monospace;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  pointer-events: none;
}

.geometry-index-top {
  top: 1.35rem;
  right: 1.4rem;
  display: grid;
  justify-items: end;
}

.geometry-index-top strong {
  color: rgba(236, 242, 255, 0.78);
  font-weight: 650;
}

.geometry-index-side {
  top: 50%;
  right: 1.1rem;
  display: flex;
  gap: 1.1rem;
  transform: translateY(-50%) rotate(90deg) translateX(50%);
  transform-origin: right center;
}

.geometry-instruction {
  position: absolute;
  right: 1.25rem;
  bottom: 7.35rem;
  left: 1.25rem;
  z-index: 4;
  margin: 0;
  color: rgba(169, 182, 204, 0.64);
  font: 600 0.62rem / 1.5 ui-monospace, "JetBrains Mono", "Fira Code", Consolas, monospace;
  letter-spacing: 0.055em;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
}

.geometry-instruction span {
  margin: 0 0.38rem;
  color: rgba(6, 182, 212, 0.72);
}

.geometry-controls {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 0.62rem;
  align-items: stretch;
  padding: 0.62rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  background: rgba(10, 11, 16, 0.66);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.44);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.geometry-lab[data-geometry-mode="quadtree"] .geometry-control {
  display: none;
}

.geometry-lab[data-geometry-mode="quadtree"] .geometry-controls {
  left: auto;
  grid-template-columns: auto;
}

.geometry-lab[data-geometry-mode="quadtree"] .geometry-instruction {
  bottom: 6.35rem;
}

.geometry-control {
  display: grid;
  align-content: center;
  gap: 0.68rem;
  min-width: 0;
  padding: 0.7rem 0.78rem;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 0.72rem;
  background: rgba(255, 255, 255, 0.025);
}

.geometry-control > span {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  color: #8d98ad;
  font: 600 0.59rem / 1.2 ui-monospace, "JetBrains Mono", "Fira Code", Consolas, monospace;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.geometry-control output {
  color: #e6faff;
  font-variant-numeric: tabular-nums;
}

.geometry-control input[type="range"] {
  width: 100%;
  height: 1rem;
  margin: 0;
  padding: 0;
  accent-color: var(--geometry-cyan);
  background: transparent;
  cursor: pointer;
}

.geometry-control input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.8), rgba(139, 92, 246, 0.54));
}

.geometry-control input[type="range"]::-webkit-slider-thumb {
  width: 0.82rem;
  height: 0.82rem;
  margin-top: -0.34rem;
  border: 2px solid #dffcff;
  border-radius: 50%;
  background: var(--geometry-cyan);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.7);
  -webkit-appearance: none;
}

.geometry-control input[type="range"]::-moz-range-track {
  height: 3px;
  border: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.8), rgba(139, 92, 246, 0.54));
}

.geometry-control input[type="range"]::-moz-range-thumb {
  width: 0.72rem;
  height: 0.72rem;
  border: 2px solid #dffcff;
  border-radius: 50%;
  background: var(--geometry-cyan);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.7);
}

.geometry-pause-button {
  min-width: 6.6rem;
  min-height: 4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(244, 63, 94, 0.28);
  border-radius: 0.72rem;
  color: #fff1f4;
  background: linear-gradient(145deg, rgba(244, 63, 94, 0.14), rgba(139, 92, 246, 0.12));
  font: 700 0.64rem / 1 ui-monospace, "JetBrains Mono", "Fira Code", Consolas, monospace;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  cursor: pointer;
}

.geometry-pause-button:hover {
  border-color: rgba(244, 63, 94, 0.52);
  box-shadow: 0 0 24px rgba(244, 63, 94, 0.11) inset;
}

.geometry-pause-icon {
  width: 0.75rem;
  height: 0.85rem;
  border-right: 3px solid currentColor;
  border-left: 3px solid currentColor;
}

.geometry-lab[data-render-state="paused"] .geometry-pause-icon {
  width: 0;
  height: 0;
  border-top: 0.43rem solid transparent;
  border-right: 0;
  border-bottom: 0.43rem solid transparent;
  border-left: 0.7rem solid currentColor;
}

@keyframes geometryLivePulse {
  0% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.55); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(6, 182, 212, 0); }
}

@media (max-width: 767px) {
  .geometry-stage {
    min-height: 700px;
  }

  .geometry-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .geometry-pause-button {
    grid-column: 1 / -1;
  }

  .geometry-instruction {
    bottom: 11.3rem;
  }
}

@media (min-width: 768px) {
  .page-shell { width: min(1100px, calc(100% - 2rem)); }

  .geometry-lab-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .geometry-telemetry {
    justify-content: flex-end;
    max-width: 250px;
  }

  .hero-body {
    grid-template-columns: 1.35fr 1fr;
  }

  .project-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }

  .hero-cat {
    width: clamp(410px, 52vw, 560px);
  }
}

@media (min-width: 1024px) {
  .site-header {
    align-items: center;
    padding: 1rem 1.4rem;
  }

  .project-card { padding: 1.1rem; }
}

@media (max-width: 900px) {
  .hero-cat {
    margin: 0 auto;
  }
}

@media (max-width: 520px) {
  .hero-mascot-frame {
    padding: 3.1rem 0.2rem 0.25rem;
    border-radius: 20px;
  }

  .hero-mascot-toolbar {
    top: 0.65rem;
    left: 0.65rem;
    right: 0.65rem;
  }

  .hero-mascot-status,
  .cat-motion-toggle {
    min-height: 32px;
    font-size: 0.61rem;
    letter-spacing: 0.055em;
  }

  .hero-mascot-status {
    padding-inline: 0.58rem;
  }

  .cat-motion-toggle {
    padding-inline: 0.6rem;
  }

  .hero-cat {
    width: min(470px, 112%);
    margin-left: -6%;
    max-width: none;
  }

  .geometry-lab-head {
    padding: 1.15rem;
  }

  .geometry-lab h2 {
    max-width: 9ch;
  }

  .geometry-telemetry > span {
    padding-inline: 0.58rem;
    font-size: 0.56rem;
  }

  .geometry-stage {
    min-height: 720px;
  }

  .geometry-mode-switch {
    right: 0.75rem;
    left: 0.75rem;
  }

  .geometry-mode-button {
    padding-inline: 0.6rem;
  }

  .geometry-index-top {
    top: 4.75rem;
    right: 0.9rem;
  }

  .geometry-index-side {
    display: none;
  }

  .geometry-instruction {
    right: 1rem;
    bottom: 15.5rem;
    left: 1rem;
  }

  .geometry-controls {
    right: 0.72rem;
    bottom: 0.72rem;
    left: 0.72rem;
    grid-template-columns: 1fr;
  }

  .geometry-control {
    gap: 0.54rem;
    padding: 0.62rem 0.7rem;
  }

  .geometry-pause-button {
    min-height: 3.25rem;
  }
}

/* ---------- Site design polish ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

main section[id] {
  scroll-margin-top: 5.75rem;
}

.section-head h2,
.rpg-heading h2 {
  background: linear-gradient(120deg, var(--text) 30%, color-mix(in oklab, var(--accent) 75%, var(--text)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.project-card {
  transition: transform var(--transition-pop), border-color var(--transition-pop),
    box-shadow var(--transition-pop);
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in oklab, var(--accent) 55%, transparent);
  box-shadow: 0 14px 34px rgba(2, 6, 16, 0.6), 0 0 24px rgba(93, 181, 255, 0.12);
}

.project-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.14rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #241703;
  background: linear-gradient(180deg, #ffe9a8, var(--gold));
  box-shadow: 0 0 14px var(--gold-soft);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

/* ---------- Tower of Greed ---------- */

body.tg-page {
  background:
    radial-gradient(circle at 18% -8%, rgba(247, 201, 96, 0.11), transparent 34%),
    radial-gradient(circle at 82% 8%, rgba(247, 201, 96, 0.07), transparent 30%),
    var(--bg);
}

.tg-hero .eyebrow {
  color: var(--gold);
}

.tg-title {
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #ffe9a8, var(--gold) 55%, #c98f2c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 14px rgba(247, 201, 96, 0.28));
}

.tg-rules {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.tg-rules li {
  border: 1px solid color-mix(in oklab, var(--gold) 26%, transparent);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  background: color-mix(in oklab, var(--panel-soft) 84%, transparent);
  color: var(--muted);
  line-height: 1.45;
}

.tg-rules strong {
  color: color-mix(in oklab, var(--gold) 88%, var(--text));
}

.tg-project {
  overflow: hidden;
}

.tg-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

.tg-stage {
  padding: 0.7rem;
  border: 1px solid color-mix(in oklab, var(--gold) 32%, transparent);
  border-radius: var(--radius-md);
  background: #0b0805;
  box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.55), 0 0 26px rgba(247, 201, 96, 0.07);
}

#tg-canvas {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
  border-radius: 8px;
  background: #0b0805;
}

.tg-status {
  margin: 0.7rem 0 0;
  min-height: 1.6em;
  color: color-mix(in oklab, var(--gold) 55%, var(--muted));
}

.tg-hud {
  display: grid;
  align-content: start;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid color-mix(in oklab, var(--gold) 22%, transparent);
  border-radius: var(--radius-md);
  background: color-mix(in oklab, var(--panel-soft) 86%, transparent);
}

.tg-stats {
  display: grid;
  gap: 0.45rem;
}

.tg-stat {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
}

.tg-stat strong {
  color: var(--text);
}

.tg-help {
  margin: 0;
  font-size: 0.92rem;
}

.tg-actions {
  display: grid;
  gap: 0.55rem;
}

.tg-controls {
  width: 11rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  justify-self: center;
}

.tg-controls button {
  min-height: 2.7rem;
  border: 1px solid color-mix(in oklab, var(--gold) 35%, transparent);
  color: var(--text);
  background: var(--bg-elevated);
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
}

.tg-controls button:nth-child(1) { grid-area: 1 / 2; }
.tg-controls button:nth-child(2) { grid-area: 2 / 1; }
.tg-controls button:nth-child(3) { grid-area: 2 / 2; }
.tg-controls button:nth-child(4) { grid-area: 2 / 3; }
.tg-controls button:nth-child(5) { grid-area: 3 / 2; }

.tg-controls button:hover {
  border-color: var(--gold);
  background: var(--panel);
}

#tg-act {
  color: #241703;
  font-weight: 800;
  background: linear-gradient(180deg, #ffe9a8, var(--gold));
}

#tg-act:hover {
  background: linear-gradient(180deg, #fff3c9, #ffd97e);
}

.tg-log {
  margin: 0;
  padding: 0 0 0 1.1rem;
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.tg-log li:first-child {
  color: var(--text);
}

.tg-notes {
  margin-top: 1rem;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr;
}

.tg-note {
  border: 1px solid color-mix(in oklab, var(--gold) 22%, transparent);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: linear-gradient(160deg, color-mix(in oklab, var(--bg-elevated) 88%, transparent), transparent);
}

.tg-note h3 {
  margin-bottom: 0.4rem;
  color: color-mix(in oklab, var(--gold) 80%, var(--text));
}

.tg-note p {
  margin: 0;
  font-size: 0.95rem;
}

.tg-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.tg-teaser {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-color: color-mix(in oklab, var(--gold) 30%, transparent);
  background:
    radial-gradient(circle at 12% 0%, rgba(247, 201, 96, 0.12), transparent 55%),
    color-mix(in oklab, var(--panel) 85%, transparent);
}

.tg-teaser h2 {
  background: linear-gradient(180deg, #ffe9a8, var(--gold) 60%, #c98f2c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tg-teaser p {
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .tg-rules {
    grid-template-columns: 1fr 1fr;
  }

  .tg-notes {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 850px) {
  .tg-layout {
    grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.65fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .geometry-live-state i {
    animation: none !important;
  }

  .geometry-mode-button {
    transition: none;
  }

  .hero-mascot-frame:not([data-motion="on"]) .hero-mascot-status-dot,
  .hero-cat:not([data-motion="on"]),
  .hero-cat:not([data-motion="on"]) * {
    animation: none !important;
    transition: none !important;
  }

  /* Keep the static pose cozy: faint steam instead of invisible-by-default. */
  .hero-cat:not([data-motion="on"]) .hc-steam {
    opacity: 0.35;
  }

  .project-card,
  .project-card:hover,
  .btn,
  .btn:hover {
    transition: none !important;
    transform: none !important;
  }
}
/* Explicit, optional first-party measurement controls; no blocking overlay. */
.analytics-preferences { max-width: 70rem; margin: 1.5rem auto; padding: 1rem; border: 1px solid #385070; border-radius: .75rem; color: #c4d2e8; background: #101d32; font-size: .875rem; }
.analytics-preferences summary { cursor: pointer; font-weight: 600; }
.analytics-preferences p { max-width: 70ch; }
.analytics-preferences-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .75rem; }
.analytics-preferences button:focus-visible, .analytics-preferences summary:focus-visible { outline: 2px solid #76d9ef; outline-offset: 4px; }
