:root {
  --bg: #0b0d12;
  --surface: #131722;
  --surface-alt: #191f2d;
  --ink: #f4f6fb;
  --muted: #9da8be;
  --border: #252c3d;
  --gold: #fbb917;
  --gold-bright: #ffd24d;
  --gold-deep: #d99300;
  --radius: 18px;
}

html[data-theme="light"] {
  --bg: #f8f6f0;
  --surface: #ffffff;
  --surface-alt: #f2ede0;
  --ink: #12151c;
  --muted: #586070;
  --border: #e2dac4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }

.container {
  width: min(1220px, calc(100% - 32px));
  margin-inline: auto;
}

/* Header */
.mg-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 13, 18, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

html[data-theme="light"] .mg-header {
  background: rgba(255, 255, 255, 0.92);
}

.mg-header-inner {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.mg-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.mg-brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: contain;
}

.mg-brand strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.mg-brand small {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

html[data-theme="light"] .mg-brand small { color: #9a6900; }

.mg-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mg-nav a {
  padding: 9px 13px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.16s, color 0.16s;
}

.mg-nav a:hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.mg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.14s, background 0.16s, border-color 0.16s, color 0.16s;
}

.btn:active { transform: translateY(1px); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #121212;
  box-shadow: 0 8px 24px rgba(251, 185, 23, 0.25);
}

.btn-gold:hover { filter: brightness(1.06); }

.btn-outline {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
}

.btn-outline:hover {
  border-color: var(--gold);
  background: var(--surface-alt);
}

.btn-outline.active {
  background: rgba(251, 185, 23, 0.16);
  border-color: var(--gold);
  color: var(--gold-bright);
}

html[data-theme="light"] .btn-outline.active {
  color: #825600;
}

/* Hero */
.mg-hero {
  padding: 46px 0 36px;
}

.mg-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 28px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(251, 185, 23, 0.14);
  border: 1px solid rgba(251, 185, 23, 0.35);
  color: var(--gold-bright);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

html[data-theme="light"] .eyebrow {
  color: #825600;
  background: #fff3cf;
}

.mg-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 3.3vw, 2.85rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
}

.mg-hero h1 span { color: var(--gold); }
html[data-theme="light"] .mg-hero h1 span { color: #b77900; }

.hero-lead {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 1.03rem;
  max-width: 560px;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.hero-showcase-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.static-stage {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 410px;
  margin-inline: auto;
  width: 100%;
  border-radius: 16px;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: radial-gradient(circle at 50% 42%, #242938 0%, #0b0d12 100%);
  transition: background 0.2s;
}

.static-stage.bg-light {
  background: radial-gradient(circle at 50% 40%, #ffffff 0%, #ede7d6 100%);
}

.static-stage.bg-checker {
  background-color: #1a1f2b;
  background-image:
    linear-gradient(45deg, #232938 25%, transparent 25%),
    linear-gradient(-45deg, #232938 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #232938 75%),
    linear-gradient(-45deg, transparent 75%, #232938 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.static-stage img {
  width: min(88%, 350px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.45));
  transition: transform 0.35s ease;
}

.static-stage:hover img {
  transform: scale(1.03) rotate(-1deg);
}

.stage-caption-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Sections */
.mg-section {
  padding: 34px 0 46px;
}

.sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.sec-head h2 {
  margin: 0 0 4px;
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
}

.sec-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

/* Grids */
.grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.demo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.demo-stage {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 360px;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 45%, #1c2231 0%, #0b0d12 100%);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

html[data-theme="light"] .demo-stage {
  background: radial-gradient(circle at 50% 45%, #ffffff 0%, #eee7d4 100%);
}

.demo-stage .sc-svg {
  width: 100%;
  height: 100%;
  max-width: 290px;
  max-height: 290px;
  overflow: visible;
}

.demo-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.demo-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(251, 185, 23, 0.14);
  color: var(--gold-bright);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

html[data-theme="light"] .demo-badge {
  color: #825600;
}

.demo-body h3 {
  margin: 0;
  font-size: 1.06rem;
}

.demo-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  flex: 1;
}

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* ==================== 2D ANIMATIONS (#1, #3, #5, #12) ==================== */
/* 1. Intro Reveal */
.anim-intro.go .sc-disc-wrap {
  transform-box: view-box;
  transform-origin: 320px 320px;
  animation: scPop 1.8s cubic-bezier(.34, 1.56, .64, 1) infinite alternate;
}
.anim-intro.go .sc-master {
  animation: scDrop 2.2s ease-out infinite;
}
.anim-intro.go .sc-g {
  stroke-dasharray: 1 1;
  animation: scDraw 2.2s ease-in-out infinite;
}
.anim-intro.go .sc-mag {
  transform-box: view-box;
  transform-origin: 420px 365px;
  animation: scPop 2.2s ease-out infinite;
}

@keyframes scPop {
  0% { transform: scale(.2) rotate(-25deg); opacity: 0; }
  45%, 100% { transform: none; opacity: 1; }
}
@keyframes scDrop {
  0% { transform: translateY(-90px); opacity: 0; }
  40%, 100% { transform: none; opacity: 1; }
}
@keyframes scDraw {
  0% { stroke-dashoffset: 1; }
  55%, 100% { stroke-dashoffset: 0; }
}

/* 3. Morphing */
.anim-morph.go .mp-gear {
  transform-box: view-box;
  transform-origin: 320px 320px;
  animation: mpGear 4s ease-in-out infinite;
}
.anim-morph.go .mp-logo {
  transform-box: view-box;
  transform-origin: 320px 320px;
  animation: mpLogo 4s ease-in-out infinite;
}

@keyframes mpGear {
  0% { transform: scale(1) rotate(0deg); opacity: 1; }
  38% { transform: scale(.25) rotate(180deg); opacity: 0; }
  85%, 100% { transform: scale(1) rotate(360deg); opacity: 1; }
}
@keyframes mpLogo {
  0%, 28% { transform: scale(.2) rotate(-90deg); opacity: 0; }
  46%, 76% { transform: scale(1) rotate(0deg); opacity: 1; }
  92%, 100% { transform: scale(.2); opacity: 0; }
}

/* 5. Liquid Gooey */
.anim-liquid.go .lq-b2 { animation: lq2 3.6s ease-in-out infinite; }
.anim-liquid.go .lq-b3 { animation: lq3 3.6s ease-in-out infinite; }
.anim-liquid.go .lq-b4 { animation: lq4 3.6s ease-in-out infinite; }
.anim-liquid.go .lq-b5 { animation: lq5 3.6s ease-in-out infinite; }
.anim-liquid.go .lq-core {
  transform-box: view-box;
  transform-origin: 320px 320px;
  animation: lqCore 3.6s ease-in-out infinite;
}
.anim-liquid.go .lq-ink { animation: lqInk 3.6s ease-in-out infinite; }

@keyframes lq2 { 0%, 100% { transform: translate(-70px, -70px) scale(.9); } 45%, 75% { transform: translate(110px, 110px) scale(1.1); } }
@keyframes lq3 { 0%, 100% { transform: translate(70px, 70px) scale(.9); } 45%, 75% { transform: translate(-110px, -110px) scale(1.1); } }
@keyframes lq4 { 0%, 100% { transform: translate(65px, -65px) scale(.85); } 45%, 75% { transform: translate(-105px, 105px) scale(1.1); } }
@keyframes lq5 { 0%, 100% { transform: translate(-65px, 65px) scale(.85); } 45%, 75% { transform: translate(105px, -105px) scale(1.1); } }
@keyframes lqCore { 0%, 18% { transform: scale(.42); } 45%, 78% { transform: scale(1.02); } 100% { transform: scale(.42); } }
@keyframes lqInk { 0%, 35% { opacity: 0; } 52%, 82% { opacity: 1; } 100% { opacity: 0; } }

/* 12. 2D Particles */
.pt-box {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 300px;
  max-height: 300px;
  display: grid;
  place-items: center;
}
.pt-box canvas, .pt-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.pt-svg {
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.25s linear;
}
.pt-svg.is-visible { opacity: 1; }

/* Player & 3D Studio */
.player-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.player-main {
  flex: 1;
  padding: 24px 0 42px;
}

.stage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.3);
}

.stage-3d-viewport {
  position: relative;
  height: clamp(360px, 66vh, 650px);
  width: 100%;
  background: radial-gradient(circle at 50% 44%, #1e2331 0%, #090b10 100%);
  touch-action: none;
  cursor: grab;
  overflow: hidden;
}

.stage-3d-viewport:active { cursor: grabbing; }

.stage-3d-viewport.is-light {
  background: radial-gradient(circle at 50% 42%, #ffffff 0%, #ebe3cd 100%);
}

.stage-3d-viewport canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.stage-badge-overlay {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 3;
  pointer-events: none;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(11, 13, 18, 0.78);
  border: 1px solid rgba(251, 185, 23, 0.35);
  color: #ffd24d;
  font-size: 0.76rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.stage-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.stage-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.slider-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 700;
}

.slider-wrap input[type="range"] {
  accent-color: var(--gold);
  width: 120px;
  cursor: pointer;
}

.mg-footer {
  padding: 24px 0 34px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.88rem;
}

.mg-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 920px) {
  .mg-hero-grid,
  .grid-2x2,
  .grid-2col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .mg-nav { display: none; }
  .mg-header-inner {
    flex-wrap: wrap;
    padding: 10px 0;
    gap: 10px;
  }
  .mg-brand { min-height: 36px; }
  .mg-brand img { width: 34px; height: 34px; }
  .mg-brand small { display: none; }
  .mg-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
  .mg-actions .btn {
    flex: 1 1 auto;
    min-height: 38px;
    padding: 7px 11px;
    font-size: 0.8rem;
  }
  .stage-toolbar { padding: 12px 14px; }
}
