/* ==========================================================================
   Circumcised — a deliberate Frankenstein.
   Base: worn brick red, echinacea, film grain.
   Grafted parts: 1930s cartoon title cards · nixie tubes & lab terminals ·
   pixel inventory UI · parchment contracts · element tiles · bonfire ·
   visual-novel textbox · glowing forest wisps · back-room restaurant menu.
   ========================================================================== */

:root {
  --brick: #8a2e20;
  --brick-dark: #5a1b12;
  --brick-deep: #2e0d08;
  --soot: #170806;
  --parchment: #ecdcb8;
  --parchment-dark: #cdb488;
  --ink: #2a120c;
  --petal: #d4618c;
  --cone: #d9822b;
  --nixie: #ff8a2a;
  --wisp: #a8e6ff;
  --gold: #e8c46a;
  --pixel-bg: rgba(22, 28, 64, .86);
  --pixel-edge: #8f9bd8;

  --f-display: "IM Fell English SC", Georgia, serif;
  --f-serif: "IM Fell English", Georgia, serif;
  --f-body: "Spectral", Georgia, serif;
  --f-pixel: "VT323", ui-monospace, monospace;
  --f-hand: "Caveat", cursive;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .5, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dock-h: 76px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--parchment);
  font: 17px/1.6 var(--f-body);
  background: var(--brick-dark);
  padding-bottom: calc(var(--dock-h) + 24px);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
/* Fixed backdrop on its own compositor layer: no repaint while scrolling
   (background-attachment: fixed repaints the whole page every frame). */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 700px at 15% 0%, #a43a28 0%, transparent 60%),
    radial-gradient(900px 600px at 90% 30%, #7a2418 0%, transparent 65%),
    radial-gradient(800px 900px at 30% 100%, #4a140d 0%, transparent 70%),
    var(--brick-dark);
  transform: translateZ(0);
}
/* Lenis smooth scroll */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
::selection { background: var(--petal); color: #fff; }
a { color: inherit; }
kbd {
  font: 1em var(--f-pixel);
  padding: 0 .35em;
  border: 1px solid currentColor;
  border-bottom-width: 3px;
  border-radius: 3px;
}

/* ---------- Atmosphere ---------- */
#wisps { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.grain {
  position: fixed; inset: -10%; z-index: 60; pointer-events: none; opacity: .09;
  will-change: transform;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1.1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); } 60% { transform: translate(-4%, -1%); }
  80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
.vignette {
  position: fixed; inset: 0; z-index: 59; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(10, 2, 0, .55) 100%);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 24px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: linear-gradient(to bottom, rgba(30, 8, 5, .92), rgba(30, 8, 5, .6));
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(236, 220, 184, .12);
}
.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  font: 26px/1 var(--f-display); letter-spacing: .06em;
}
.brand-flower { width: 30px; height: 40px; transition: transform .6s var(--ease-spring); }
.brand:hover .brand-flower { transform: rotate(-14deg) scale(1.1); }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a {
  text-decoration: none; font: 20px var(--f-serif); opacity: .8; position: relative;
  transition: opacity .3s;
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px;
  background: var(--petal); transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease);
}
.nav a:hover { opacity: 1; }
.nav a:hover::after { transform: scaleX(1); }

.nixie {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 4px 12px; border-radius: 6px;
  background: linear-gradient(#120604, #241009);
  border: 1px solid #4b2a18;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, .8);
}
.nixie-label { font: 11px var(--f-pixel); letter-spacing: .2em; color: #a9764e; }
.nixie-digits {
  font: 26px/1 var(--f-pixel); letter-spacing: .12em; color: var(--nixie);
  text-shadow: 0 0 4px var(--nixie), 0 0 12px rgba(255, 110, 20, .7), 0 0 24px rgba(255, 80, 0, .4);
  font-variant-numeric: tabular-nums;
}
.nixie.shift .nixie-digits { animation: flick .35s steps(3) 2; }
@keyframes flick { 50% { opacity: .2; filter: blur(1px); } }

/* ---------- Hero: 1930s title card ---------- */
.hero {
  position: relative; min-height: 88vh;
  display: grid; place-items: center;
  padding: 60px 20px; overflow: hidden; isolation: isolate;
}
.rays {
  position: absolute; left: 50%; top: 50%; width: 220vmax; height: 220vmax;
  translate: -50% -50%; z-index: -1; opacity: .35;
  background: repeating-conic-gradient(from 0deg, #b8452e 0 7.5deg, transparent 7.5deg 15deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 55%);
          mask: radial-gradient(circle, #000 0, transparent 55%);
  animation: spin 90s linear infinite;
}
@keyframes spin { to { rotate: 360deg; } }
.hero-card {
  position: relative; text-align: center; max-width: 760px;
  padding: 56px clamp(24px, 6vw, 72px) 40px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, .35), transparent 60%),
    radial-gradient(ellipse at 80% 90%, rgba(120, 70, 20, .25), transparent 60%),
    var(--parchment);
  border-radius: 50% / 18%;
  box-shadow:
    0 0 0 6px var(--parchment), 0 0 0 9px var(--ink), 0 0 0 14px var(--parchment-dark),
    0 30px 80px rgba(0, 0, 0, .55);
}
.hero-kicker { font: 22px var(--f-serif); font-style: italic; margin: 0 0 4px; }
.hero-title {
  margin: 0; font: clamp(52px, 10vw, 112px)/.9 var(--f-display);
  letter-spacing: .02em; color: var(--brick);
  text-shadow: 3px 3px 0 var(--ink), 6px 6px 0 rgba(42, 18, 12, .25);
  display: flex; flex-direction: column; align-items: center;
}
.hero-title .amp { font-family: var(--f-serif); font-style: italic; font-size: .5em; color: var(--ink); text-shadow: none; }
.hero-sub { font: italic 20px var(--f-serif); margin: 14px 0 28px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.note { font: 24px/1.2 var(--f-hand); color: #9b3159; }
.note-hero { margin: 26px 0 0; transform: rotate(-2deg); }
.note-hero kbd { font-size: 18px; }

.flower { pointer-events: none; position: absolute; width: 170px; height: 220px; z-index: 1; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .5)); transform-origin: 50% 100%; }
.f1 { left: 4%; bottom: -10px; animation: sway 7s ease-in-out infinite; }
.f2 { right: 6%; bottom: -30px; width: 210px; height: 270px; animation: sway 9s ease-in-out -2s infinite; }
.f3 { right: 18%; top: 8%; width: 90px; height: 120px; opacity: .55; filter: blur(1.5px); animation: sway 11s ease-in-out -5s infinite; }
@keyframes sway { 0%, 100% { rotate: -3deg; } 50% { rotate: 4deg; } }
/* scroll parallax: --p goes 0 → 1 as the hero scrolls away (set in app.js) */
.hero { --p: 0; }
.hero-card { translate: 0 calc(var(--p) * 90px); }
.hero .f1 { translate: 0 calc(var(--p) * -140px); }
.hero .f2 { translate: 0 calc(var(--p) * -220px); }
.hero .f3 { translate: 0 calc(var(--p) * 120px); }
.rays { opacity: calc(.35 - var(--p) * .3); }

/* ---------- Buttons ---------- */
.btn {
  --c: var(--brick);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border: 2px solid var(--ink); border-radius: 999px;
  font: 20px/1 var(--f-display); letter-spacing: .05em; text-decoration: none;
  cursor: pointer; transition: transform .35s var(--ease-spring), box-shadow .35s var(--ease), background .3s;
}
.btn-ember { background: var(--c); color: var(--parchment); box-shadow: 0 4px 0 var(--ink); }
.btn-ember:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--ink), 0 0 24px rgba(255, 138, 42, .45); }
.btn-ember:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: rgba(42, 18, 12, .08); transform: translateY(-2px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none !important; }
.btn-small { padding: 9px 16px; font-size: 17px; }

/* ---------- Sections ---------- */
.section { position: relative; z-index: 2; max-width: 1180px; margin: 0 auto; padding: 100px clamp(16px, 4vw, 40px) 40px; }
.section-head { text-align: center; margin-bottom: 44px; }
.section-num { margin: 0; font: 28px var(--f-serif); color: var(--gold); opacity: .8; }
.section-head h2 {
  margin: 0; font: clamp(38px, 6vw, 64px)/1 var(--f-display); letter-spacing: .03em;
  text-shadow: 0 2px 0 var(--brick-deep);
}
.section-head h2::after {
  content: ""; display: block; width: 180px; height: 14px; margin: 14px auto 0;
  background:
    radial-gradient(circle at 50% 50%, var(--gold) 0 3px, transparent 4px),
    linear-gradient(var(--gold), var(--gold)) left 50% / 70px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) right 50% / 70px 1px no-repeat;
  opacity: .7;
}
.section-lede { font: italic 20px var(--f-serif); opacity: .8; margin: 14px 0 0; }

/* Scroll reveal */
.reveal {
  opacity: 0; transform: translateY(36px) scale(.985); filter: blur(6px);
  transition: opacity 1.1s var(--ease-out), transform 1.3s var(--ease-out), filter 1.1s var(--ease-out);
}
.reveal.in { opacity: 1; transform: none; filter: none; }
/* ---------- Periodic table of beats ---------- */
.table {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.element {
  position: relative; aspect-ratio: 1 / 1.08;
  padding: 10px 12px; text-align: left; cursor: pointer;
  color: var(--ink); font-family: var(--f-body);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, .35), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(120, 60, 20, .25), transparent 60%),
    var(--parchment);
  border: 2px solid var(--ink); border-radius: 3px;
  box-shadow: 4px 4px 0 var(--brick-deep);
  transition: transform .6s var(--ease-out), box-shadow .6s var(--ease-out), opacity .9s var(--ease-out), filter .9s var(--ease-out);
  display: flex; flex-direction: column;
  transform-style: preserve-3d;
}
.element:hover, .element:focus-visible {
  transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-6px);
  box-shadow: calc(4px - var(--sx, 0px)) 12px 0 var(--brick-deep), 0 18px 30px rgba(0, 0, 0, .35);
  outline: none;
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out), opacity .4s, filter .4s;
}
/* sheen that follows the cursor */
.element::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .35), transparent 60%);
  opacity: 0; transition: opacity .4s var(--ease-out);
}
.element:hover::after { opacity: 1; }
.element .el-num { font: 18px var(--f-pixel); }
.element .el-bpm { position: absolute; top: 10px; right: 12px; font: 18px var(--f-pixel); opacity: .75; }
.element .el-sym {
  margin: auto 0 0; font: 64px/1 var(--f-display); color: var(--brick);
  text-shadow: 2px 2px 0 rgba(42, 18, 12, .2);
}
.element .el-name { font: 600 15px/1.2 var(--f-body); margin-top: 6px; }
.element .el-key { font: italic 14px var(--f-serif); opacity: .75; }
.element.dim { opacity: .18; filter: grayscale(1); transform: scale(.96); pointer-events: none; }
.element.playing {
  box-shadow: 4px 4px 0 var(--brick-deep), 0 0 0 3px var(--nixie), 0 0 32px rgba(255, 138, 42, .55);
}
.element.playing .el-sym { color: #b44a12; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { text-shadow: 0 0 14px rgba(255, 138, 42, .8); } }
.el-buy {
  position: absolute; right: 8px; top: 8px; z-index: 2;
  padding: 4px 10px; border: 2px solid var(--ink); border-radius: 999px; cursor: pointer;
  font: 15px/1 var(--f-display); color: var(--parchment); background: var(--brick);
  opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .3s var(--ease-spring);
}
.element:hover .el-buy, .element:focus-within .el-buy { opacity: 1; transform: none; }
.element.playing .el-buy { opacity: 1; transform: none; }
.element .el-bpm { transition: opacity .25s; }
.element:hover .el-bpm, .element:focus-within .el-bpm, .element.playing .el-bpm { opacity: 0; }
@media (hover: none) { .element .el-bpm, .element.playing .el-bpm { opacity: .75; } }
@media (hover: none) {
  .el-buy, .element.playing .el-buy { position: static; align-self: flex-start; margin-top: 6px; opacity: 1; transform: none; }
  .note-hero { display: none; }
}
.element .el-eq { position: absolute; right: 12px; bottom: 12px; display: none; gap: 2px; align-items: flex-end; height: 18px; }
.element.playing .el-eq { display: flex; }
.el-eq i { width: 4px; background: var(--brick); animation: eq .9s ease-in-out infinite; }
.el-eq i:nth-child(2) { animation-delay: -.3s; } .el-eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 18px; } }

/* Tile with a video loop: the clip fills the tile, the element data sits on top */
.element.has-video { color: var(--parchment); background: #140604; overflow: hidden; }
.element > span, .element > .el-buy { z-index: 2; }
.element > span:not(.el-bpm):not(.el-eq) { position: relative; }
.el-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0;
  filter: saturate(.92) contrast(1.05) sepia(.12);
  transition: transform 1.2s var(--ease-out), filter .6s var(--ease-out);
}
.element.has-video::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(to top, rgba(20, 6, 3, .92) 0%, rgba(20, 6, 3, .45) 38%, transparent 62%),
    linear-gradient(to bottom, rgba(20, 6, 3, .55), transparent 28%);
}
.element.has-video:hover .el-video { transform: scale(1.07); filter: saturate(1.05) contrast(1.08) sepia(0); }
.element.has-video .el-sym { font-size: 38px; color: var(--parchment); text-shadow: 0 2px 10px rgba(0, 0, 0, .7); }
.element.has-video .el-num, .element.has-video .el-bpm { text-shadow: 0 1px 4px rgba(0, 0, 0, .8); opacity: 1; }
.element.has-video .el-key { opacity: .85; }
.element.has-video .el-eq i { background: var(--nixie); }
.element.has-video::after { z-index: 3; }

/* ---------- Pixel tooltip with lore ---------- */
.tooltip {
  position: fixed; z-index: 70; max-width: 290px; pointer-events: none;
  padding: 12px 14px; color: #e6e9ff; font: 19px/1.15 var(--f-pixel);
  background: var(--pixel-bg);
  box-shadow: inset 0 0 0 2px var(--pixel-edge), 0 8px 24px rgba(0, 0, 0, .5);
  border-radius: 4px;
  opacity: 0; transform: translateY(6px) scale(.98); transition: opacity .18s, transform .18s var(--ease);
}
.tooltip.show { opacity: 1; transform: none; }
.tooltip .tt-name { color: #ffd84a; font-size: 22px; }
.tooltip .tt-tags { color: #9fe39a; }
.tooltip .tt-lore { font: italic 15px/1.35 var(--f-serif); color: #d8cfb8; margin-top: 8px; border-top: 1px solid rgba(143, 155, 216, .4); padding-top: 8px; }
.tooltip .tt-hint { color: #8f9bd8; margin-top: 6px; font-size: 16px; }

/* ---------- Contract board ---------- */
.board {
  display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  padding: 40px clamp(16px, 3vw, 40px);
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .18) 0 2px, transparent 2px 120px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .03) 0 1px, transparent 1px 7px),
    linear-gradient(#3a2414, #2a190d);
  border: 10px solid #1d1008; border-radius: 6px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .7), 0 20px 50px rgba(0, 0, 0, .5);
}
.contract {
  position: relative; padding: 36px 26px 26px; color: var(--ink);
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, .4), transparent 50%),
    radial-gradient(ellipse at 90% 100%, rgba(110, 60, 20, .35), transparent 55%),
    var(--parchment);
  clip-path: polygon(0 2%, 6% 0, 40% 1.5%, 70% 0, 100% 1%, 99% 30%, 100% 65%, 98.5% 100%, 60% 98.5%, 25% 100%, 0 98%, 1% 60%);
  transform: rotate(var(--r, 0deg));
  transition: transform .5s var(--ease-spring), filter .4s;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, .5));
}
.contract:hover { transform: rotate(0deg) translateY(-6px) scale(1.02); }
.contract::before {
  content: ""; position: absolute; top: 12px; left: 50%; width: 14px; height: 14px; translate: -50% 0;
  border-radius: 50%; background: radial-gradient(circle at 35% 35%, #c9c3b6, #4b4640 60%, #1b1917);
  box-shadow: 0 2px 2px rgba(0, 0, 0, .6);
}
.contract h3 { margin: 0; font: 30px/1 var(--f-display); text-align: center; color: var(--brick); }
.contract .c-file { text-align: center; font: italic 16px var(--f-serif); margin: 6px 0 16px; }
.contract ul { list-style: none; padding: 0; margin: 0 0 22px; }
.contract li { padding: 6px 0 6px 26px; border-bottom: 1px dashed rgba(42, 18, 12, .25); position: relative; font-size: 15.5px; }
.contract li::before { content: "✠"; position: absolute; left: 4px; color: var(--brick); }
.contract .seal {
  flex: none; width: 70px; height: 70px; display: grid; place-items: center;
  border-radius: 50%; color: #f3dccb; font: 22px/1 var(--f-display); rotate: -12deg;
  background: radial-gradient(circle at 35% 30%, #c4412f, #7d1a10 70%);
  box-shadow: 0 0 0 4px #7d1a10, inset 0 0 10px rgba(0, 0, 0, .5), 0 4px 6px rgba(0, 0, 0, .35);
}
.contract .c-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.contract .seal { transition: rotate .5s var(--ease-spring); }
.contract .c-actions .btn { white-space: nowrap; }
.contract:hover .seal { rotate: 6deg; }
.contract.exclusive h3 { animation: glitch 4s steps(1) infinite; }
@keyframes glitch {
  0%, 92%, 100% { text-shadow: none; transform: none; }
  93% { text-shadow: -2px 0 #d4618c, 2px 0 #4cc9f0; transform: translateX(1px); }
  95% { text-shadow: 2px 0 #d4618c, -2px 0 #4cc9f0; transform: translateX(-2px) skewX(-6deg); }
  97% { text-shadow: none; transform: none; }
}

/* ---------- Back room ---------- */
.backroom { display: grid; gap: 28px; grid-template-columns: 1.1fr 1fr; align-items: start; }
.menu {
  position: relative; padding: 44px 34px 30px; color: var(--ink);
  border: 14px solid transparent;
  background:
    linear-gradient(var(--parchment), var(--parchment)) padding-box,
    repeating-conic-gradient(#a8261c 0 25%, #f3ead6 0 50%) 0 0 / 14px 14px border-box;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
}
.menu h3 { margin: 0 0 18px; font: 40px/1 var(--f-display); text-align: center; letter-spacing: .08em; }
.menu dl { margin: 0; }
.menu dl > div { padding: 12px 0; border-bottom: 1px solid rgba(42, 18, 12, .2); }
.menu dt { font: 600 17px var(--f-body); }
.menu dd { margin: 2px 0 0; font: italic 16px var(--f-serif); }
.neon {
  position: absolute; top: -30px; right: 18px; padding: 2px 14px 6px; border-radius: 10px;
  font: 700 32px/1 var(--f-hand); color: #ffd1e6; background: #1a0b10; rotate: 4deg;
  text-shadow: 0 0 4px #ff5fa2, 0 0 12px #ff2d86, 0 0 24px #ff2d86;
  box-shadow: 0 0 0 2px #3a1724, 0 6px 16px rgba(0, 0, 0, .6);
  animation: neon 6s infinite;
}
@keyframes neon { 0%, 18%, 22%, 60%, 64%, 100% { opacity: 1; } 20%, 62% { opacity: .35; } }

.terminal {
  background: #0a0f0a; border-radius: 10px; overflow: hidden; position: relative;
  box-shadow: 0 0 0 2px #233021, 0 20px 50px rgba(0, 0, 0, .6), inset 0 0 60px rgba(60, 255, 120, .06);
}
.terminal::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px);
}
.terminal-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: #142014; font: 16px var(--f-pixel); color: #6f9a6f; }
.terminal-bar span { width: 10px; height: 10px; border-radius: 50%; background: #2f4a2f; }
.terminal-bar b { margin-left: auto; font-weight: normal; }
.terminal-body {
  margin: 0; padding: 16px 18px; min-height: 230px; white-space: pre-wrap;
  font: 20px/1.25 var(--f-pixel); color: #8cff9e; text-shadow: 0 0 6px rgba(120, 255, 150, .5);
}
.terminal-body .amber { color: var(--nixie); text-shadow: 0 0 6px rgba(255, 138, 42, .6); }
.terminal-body .cursor { display: inline-block; width: .55em; background: #8cff9e; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.terminal-link {
  display: block; padding: 12px 18px 18px; font: 22px var(--f-pixel); color: var(--nixie);
  text-decoration: none; text-shadow: 0 0 6px rgba(255, 138, 42, .6);
}
.terminal-link:hover { color: #ffd84a; }

/* ---------- Footer ---------- */
.footer { position: relative; z-index: 2; text-align: center; padding: 60px 20px 20px; font: italic 17px var(--f-serif); opacity: .8; }
.footer-flower { width: 60px; height: 80px; }
.socials a { margin: 0 8px; font: 20px var(--f-pixel); text-decoration: none; color: var(--gold); }

/* ---------- Player dock ---------- */
.dock {
  position: fixed; z-index: 50; left: 50%; bottom: 14px; translate: -50% 0;
  width: min(940px, calc(100% - 24px)); height: var(--dock-h);
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: linear-gradient(rgba(28, 10, 6, .94), rgba(18, 6, 4, .96));
  border: 1px solid rgba(232, 196, 106, .25); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .05);
  backdrop-filter: blur(8px);
}
.dock-art {
  position: relative; flex: none; width: 56px; height: 56px; border-radius: 10px; overflow: hidden;
  display: grid; place-items: center;
  background: #120503; box-shadow: 0 0 0 1px rgba(232, 196, 106, .3), 0 4px 12px rgba(0, 0, 0, .5);
  transition: transform .5s var(--ease-spring), box-shadow .5s var(--ease-out);
}
.dock-art.has-video { box-shadow: 0 0 0 1px rgba(232, 196, 106, .45), 0 0 18px rgba(255, 138, 42, .25), 0 4px 12px rgba(0, 0, 0, .5); }
.dock-art.swap { transform: scale(.9) rotate(-3deg); }
.dock-vid {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.12); filter: saturate(.95) sepia(.1);
  transition: opacity .7s var(--ease-out), transform 1.2s var(--ease-out);
}
.dock-vid.on { opacity: 1; transform: scale(1); }
.dock-art.has-video .bonfire { opacity: 0; transform: scale(.6); }
.bonfire { width: 36px; height: 42px; image-rendering: pixelated; flex: none; transition: opacity .4s, transform .5s var(--ease-out); }
.dock-controls { display: flex; gap: 4px; flex: none; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: transparent; color: var(--parchment); font-size: 16px;
  transition: background .2s, transform .25s var(--ease-spring);
}
.icon-btn:hover { background: rgba(236, 220, 184, .1); transform: scale(1.1); }
.icon-btn.play { width: 48px; height: 48px; background: var(--brick); font-size: 18px; box-shadow: 0 0 0 2px var(--ink), 0 3px 0 var(--ink); }
.icon-btn.play:hover { background: #a33a28; }
.dock-info { flex: 1; min-width: 0; }
.dock-title { font: 20px/1.1 var(--f-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-meta { font: 16px/1.2 var(--f-pixel); color: #b99a74; }
.progress { margin-top: 6px; height: 6px; border-radius: 3px; background: rgba(236, 220, 184, .12); cursor: pointer; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--petal), var(--nixie)); box-shadow: 0 0 10px var(--nixie); }
.viz { width: 160px; height: 40px; flex: none; }

/* ---------- Visual-novel buy dialog ---------- */
.vn { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; padding: 20px; }
.vn[hidden] { display: none; }
.vn-backdrop { position: absolute; inset: 0; background: rgba(15, 4, 2, .6); backdrop-filter: blur(3px); animation: fade .4s var(--ease); }
.vn-box {
  position: relative; width: min(820px, 100%); margin-bottom: calc(var(--dock-h) + 10px);
  padding: 34px 30px 24px; border-radius: 18px;
  background: linear-gradient(rgba(255, 241, 248, .96), rgba(255, 228, 240, .96));
  color: #3b1a2a; border: 3px solid #f2a7c6;
  box-shadow: 0 0 0 3px #fff inset, 0 20px 60px rgba(0, 0, 0, .55);
  animation: rise .5s var(--ease-spring);
}
.vn-name {
  position: absolute; top: -22px; left: 26px; padding: 6px 20px;
  font: 700 26px/1 var(--f-hand); color: #fff; background: #d4618c;
  border: 3px solid #fff; border-radius: 12px; box-shadow: 0 4px 10px rgba(0, 0, 0, .25);
}
.vn-text { margin: 0 0 18px; min-height: 3.2em; font: 19px/1.5 var(--f-body); }
.vn-choices { display: grid; gap: 10px; }
.vn-choice {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 18px; border-radius: 999px; cursor: pointer; text-align: left;
  font: 18px var(--f-body); color: #3b1a2a; text-decoration: none;
  background: #fff; border: 2px solid #f2a7c6;
  opacity: 0; transform: translateX(-12px);
  transition: background .25s, transform .3s var(--ease-spring), border-color .25s;
}
.vn-choice.in { opacity: 1; transform: none; transition: opacity .4s, transform .5s var(--ease-spring), background .25s, border-color .25s; }
.vn-choice:hover, .vn-choice:focus-visible { background: #ffe0ee; border-color: #d4618c; transform: translateX(6px); outline: none; }
.vn-choice b { font: 22px var(--f-pixel); color: #9b3159; }
.vn-choice.soon { opacity: .55; cursor: default; }
.vn-choice.glitchy:hover { animation: glitch 1.2s steps(1) infinite; }
.vn-close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 18px; color: #9b3159; cursor: pointer; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(30px); } }

/* ---------- "Contract sealed" banner ---------- */
.acquired { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; pointer-events: none; }
.acquired[hidden] { display: none; }
.acquired-band {
  width: 100%; padding: 26px 0; text-align: center;
  background: linear-gradient(90deg, transparent, rgba(8, 3, 2, .88) 20%, rgba(8, 3, 2, .88) 80%, transparent);
  animation: band 2.6s var(--ease) forwards;
}
.acquired-band span {
  display: inline-block; font: clamp(34px, 6vw, 68px)/1 var(--f-display); color: var(--gold);
  text-shadow: 0 0 18px rgba(232, 196, 106, .45);
  animation: letters 2.6s var(--ease) forwards;
}
@keyframes band { 0% { opacity: 0; } 15%, 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes letters { 0% { letter-spacing: .05em; opacity: 0; } 20% { opacity: 1; } 100% { letter-spacing: .28em; } }

/* ---------- Worldline shift easter egg (Konami) ---------- */
body.worldline { filter: hue-rotate(95deg) saturate(.8); transition: filter 1.2s var(--ease); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .backroom { grid-template-columns: 1fr; }
  .nav { display: none; }
  .nixie { margin-left: auto; }
  .viz { display: none; }
  .flower.f2 { width: 140px; height: 180px; }
  .flower.f1 { width: 110px; height: 140px; }
}
@media (max-width: 540px) {
  :root { --dock-h: 68px; }
  .nixie-digits { font-size: 20px; }
  .brand { font-size: 21px; }
  .table { grid-template-columns: repeat(2, 1fr); }
  .element .el-sym { font-size: 52px; }
  .element { aspect-ratio: auto; min-height: 170px; }
  .dock { gap: 8px; padding: 0 10px; }
  .dock-controls #prevBtn, .dock-controls #nextBtn { display: none; }
  .bonfire { width: 28px; height: 33px; }
  .dock-art { width: 46px; height: 46px; border-radius: 8px; }
  .hero-card { border-radius: 40px; }
  .hero .f1 { translate: 0 calc(var(--p) * -40px); }
  .hero .f2 { translate: 0 calc(var(--p) * -60px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
