/* ============================================================
   MAKI-NOTES · NEO-TOKYO RUSH
   Estètica AAA cyberpunk · Vidre · Neó · Pluja digital
   ============================================================ */

:root {
  --bg-0: #05010f;
  --bg-1: #0d0221;
  --bg-2: #1a0936;
  --neon-mag: #ff2bd6;
  --neon-pink: #ff4081;
  --neon-cyan: #00f0ff;
  --neon-blue: #2a7bff;
  --neon-purple: #b14bff;
  --neon-yellow: #ffe14d;
  --neon-green: #2effa5;
  --txt-0: #ffffff;
  --txt-1: #c8d3ff;
  --txt-2: #7d89b8;
  --glass: rgba(20, 8, 48, 0.55);
  --glass-2: rgba(40, 16, 80, 0.45);
  --border: rgba(180, 120, 255, 0.35);
  --shadow-neon-mag: 0 0 6px var(--neon-mag), 0 0 18px var(--neon-mag), 0 0 38px rgba(255,43,214,.5);
  --shadow-neon-cyan: 0 0 6px var(--neon-cyan), 0 0 18px var(--neon-cyan), 0 0 38px rgba(0,240,255,.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  font-family: "Rajdhani", "Orbitron", "Inter", system-ui, sans-serif;
  color: var(--txt-0);
  background: var(--bg-0); /* fallback sòlid · el bar-bg es pinta per damunt */
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   FONS REAL · BAR DE SUSHI CIBERPUNK
   ============================================================ */
.bar-bg {
  position: fixed; inset: 0;
  z-index: 0;
  background: #050110 url("img/fondo.png") center center / cover no-repeat;
  filter: blur(10px) brightness(.50) saturate(1.05);
  transform: scale(1.06); /* evita franges blanques per la blur */
  transition: filter .8s ease, transform .8s ease;
}
.bar-vignette {
  position: fixed; inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse 90% 60% at 50% 50%, transparent 0%, rgba(5,1,15,.50) 75%, rgba(5,1,15,.80) 100%),
    linear-gradient(180deg, rgba(5,1,15,.40) 0%, transparent 30%, transparent 70%, rgba(5,1,15,.50) 100%);
  pointer-events: none;
  transition: opacity .8s ease, background .8s ease;
}
/* Dins el joc el bar es veu nítid · som al restaurant */
body.in-game .bar-bg {
  filter: blur(0px) brightness(.78) saturate(1.15);
  transform: scale(1.0);
}
body.in-game .bar-vignette {
  background:
    radial-gradient(ellipse 110% 80% at 50% 55%, transparent 0%, transparent 50%, rgba(5,1,15,.25) 90%, rgba(5,1,15,.55) 100%),
    linear-gradient(180deg, rgba(5,1,15,.20) 0%, transparent 22%, transparent 75%, rgba(5,1,15,.40) 100%);
}
/* Tutorial · entrant al bar */
body.in-tutorial .bar-bg     { filter: blur(3px) brightness(.55) saturate(1.05); transform: scale(1.03); }
body.in-tutorial .bar-vignette { opacity: .8; }

#rain {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 2; opacity: .22; pointer-events: none;
  mix-blend-mode: screen;
}
#scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 3;
  background: repeating-linear-gradient(
    0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px
  );
  mix-blend-mode: overlay;
}
#vapor {
  position: fixed; inset: 0; z-index: 3; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 30% at 50% 110%, rgba(255,43,214,.18), transparent 60%),
    radial-gradient(ellipse 50% 25% at 20% 105%, rgba(0,240,255,.15), transparent 60%),
    radial-gradient(ellipse 50% 25% at 80% 102%, rgba(177,75,255,.18), transparent 60%);
  filter: blur(8px);
  animation: vapor-rise 9s ease-in-out infinite alternate;
}
@keyframes vapor-rise {
  0%   { transform: translateY(0)    scale(1); opacity: .8; }
  100% { transform: translateY(-3vh) scale(1.05); opacity: 1; }
}

/* ============================================================
   PANTALLES (sistema)
   ============================================================ */
.screen {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  z-index: 5;
  padding: 32px;
  animation: screen-in .6s cubic-bezier(.2,.8,.2,1);
}
.screen.active { display: flex; }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* ============================================================
   LANDING
   ============================================================ */
.landing-wrap {
  text-align: center;
  position: relative;
  padding: 40px 24px;
}
.kanji-floater {
  position: absolute;
  top: -40px; left: 50%;
  transform: translateX(-50%);
  font-size: 28vmin;
  font-weight: 900;
  color: rgba(255,43,214,.06);
  text-shadow: 0 0 80px rgba(0,240,255,.15);
  z-index: -1;
  letter-spacing: .1em;
  pointer-events: none;
  animation: kanji-pulse 6s ease-in-out infinite;
}
@keyframes kanji-pulse {
  0%,100% { transform: translateX(-50%) scale(1);   opacity: .6; }
  50%     { transform: translateX(-50%) scale(1.05); opacity: 1; }
}

.title-neon {
  position: relative;
  font-family: "Orbitron", "Rajdhani", monospace;
  font-size: clamp(54px, 12vw, 168px);
  font-weight: 900;
  letter-spacing: .04em;
  line-height: .9;
  margin-bottom: 14px;
}
.title-neon .t-shadow,
.title-neon .t-front {
  display: block;
}
.title-neon .t-shadow {
  position: absolute; inset: 0;
  color: transparent;
  -webkit-text-stroke: 2px var(--neon-cyan);
  text-shadow: var(--shadow-neon-cyan);
  transform: translate(6px, 6px);
  animation: glitch-shadow 3.4s steps(40) infinite;
  opacity: .9;
}
.title-neon .t-front {
  background: linear-gradient(180deg, #fff 0%, var(--neon-mag) 60%, var(--neon-purple) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px var(--neon-mag));
  animation: title-flicker 5.2s infinite;
}
@keyframes title-flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { filter: drop-shadow(0 0 18px var(--neon-mag)); opacity: 1; }
  20%, 24%, 55% { filter: drop-shadow(0 0 4px var(--neon-mag)); opacity: .82; }
}
@keyframes glitch-shadow {
  0%, 96%, 100% { transform: translate(6px, 6px); }
  97% { transform: translate(-2px, 4px); }
  98% { transform: translate(8px, 9px); }
  99% { transform: translate(4px, 6px); }
}

.subtitle {
  font-family: "Orbitron", monospace;
  letter-spacing: .6em;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
  font-size: clamp(11px, 1.4vw, 16px);
  margin-bottom: 6px;
}
.tagline {
  color: var(--txt-2);
  letter-spacing: .3em;
  font-size: 13px;
  margin-bottom: 56px;
}

.cta {
  display: flex; gap: 22px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   BOTONS
   ============================================================ */
.btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 18px 36px;
  font-family: "Orbitron", "Rajdhani", monospace;
  font-weight: 700;
  letter-spacing: .18em;
  font-size: 15px;
  color: white;
  border: 1.5px solid var(--border);
  background: linear-gradient(180deg, rgba(255,43,214,.12), rgba(177,75,255,.05));
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  transition: transform .25s cubic-bezier(.2,.9,.3,1.4),
              box-shadow .35s ease,
              border-color .25s ease,
              background .25s ease;
  text-shadow: 0 0 6px rgba(255,255,255,.6);
}
.btn::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-110%);
  transition: transform .55s ease;
}
.btn:hover::before { transform: translateX(110%); }

.btn-primary {
  border-color: var(--neon-mag);
  box-shadow: 0 0 0 1px rgba(255,43,214,.2), 0 0 22px rgba(255,43,214,.35), inset 0 0 18px rgba(255,43,214,.18);
}
.btn-primary:hover {
  box-shadow: 0 0 0 1px var(--neon-mag), 0 0 36px var(--neon-mag), inset 0 0 28px rgba(255,43,214,.35);
  background: linear-gradient(180deg, rgba(255,43,214,.28), rgba(255,43,214,.05));
}
.btn-secondary {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 1px rgba(0,240,255,.2), 0 0 22px rgba(0,240,255,.3), inset 0 0 18px rgba(0,240,255,.15);
}
.btn-secondary:hover {
  box-shadow: 0 0 0 1px var(--neon-cyan), 0 0 36px var(--neon-cyan), inset 0 0 28px rgba(0,240,255,.3);
  background: linear-gradient(180deg, rgba(0,240,255,.22), rgba(0,240,255,.05));
}

.btn-icon { font-size: 18px; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--txt-1);
  padding: 8px 16px;
  font-family: inherit;
  letter-spacing: .15em;
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
  transition: all .2s ease;
}
.btn-ghost:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  text-shadow: 0 0 6px var(--neon-cyan);
}
.btn-ghost.danger:hover { border-color: var(--neon-mag); color: var(--neon-mag); text-shadow: 0 0 6px var(--neon-mag); }

.landing-footer {
  position: absolute; bottom: -90px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px; align-items: center;
  color: var(--txt-2);
  font-family: "Orbitron", monospace;
  font-size: 11px;
  letter-spacing: .3em;
}
.blink { color: var(--neon-green); animation: blink 1.4s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ============================================================
   PANELL DE VIDRE (Glassmorphism)
   ============================================================ */
.glass {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow:
    0 12px 40px rgba(0,0,0,.6),
    inset 0 1px 0 rgba(255,255,255,.08),
    0 0 60px rgba(177,75,255,.15);
}

.panel {
  width: min(96vw, 1080px);
  padding: 30px 36px 36px;
  position: relative;
}
.panel.wide { width: min(98vw, 1280px); }

.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(180,120,255,.2);
  padding-bottom: 14px;
}
.panel-head h2 {
  font-family: "Orbitron", monospace;
  font-size: clamp(20px, 2.6vw, 30px);
  letter-spacing: .12em;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-mag));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(255,43,214,.3);
}
.panel-sub { color: var(--txt-2); font-size: 14px; letter-spacing: .1em; margin-bottom: 24px; }

/* ============================================================
   TUTORIAL
   ============================================================ */
.tutorial-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: 14px 0 22px;
}
.tut-card {
  position: relative;
  background: linear-gradient(160deg, rgba(0,240,255,.06), rgba(255,43,214,.04));
  border: 1px solid rgba(180,120,255,.25);
  border-radius: 10px;
  padding: 22px 20px 20px;
  transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease;
}
.tut-card:hover {
  transform: translateY(-3px);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 25px rgba(0,240,255,.25);
}
.tut-num {
  position: absolute; top: -12px; left: 16px;
  background: var(--bg-1);
  color: var(--neon-mag);
  font-family: "Orbitron", monospace;
  font-size: 12px;
  padding: 4px 10px;
  letter-spacing: .2em;
  border: 1px solid var(--neon-mag);
  border-radius: 3px;
  box-shadow: 0 0 12px rgba(255,43,214,.45);
}
.tut-card h3 {
  font-family: "Orbitron", monospace;
  font-size: 17px;
  margin-bottom: 10px;
  color: var(--neon-cyan);
  letter-spacing: .08em;
}
.tut-card p { color: var(--txt-1); line-height: 1.55; font-size: 14.5px; }
.tut-card b { color: var(--neon-yellow); font-weight: 600; }

.key-row {
  display: flex; gap: 6px; margin-top: 14px; justify-content: center;
}
.key-row.labels span {
  flex: 1; text-align: center;
  font-family: "Orbitron", monospace;
  font-size: 10px; letter-spacing: .15em;
  color: var(--txt-2);
}
kbd {
  flex: 1;
  display: inline-block;
  padding: 8px 0;
  text-align: center;
  font-family: "Orbitron", monospace;
  font-size: 14px;
  background: linear-gradient(180deg, #2a1058, #14062c);
  border: 1px solid var(--neon-purple);
  border-radius: 4px;
  color: white;
  box-shadow: 0 2px 0 rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.1);
}

.tut-actions { display: flex; justify-content: center; margin-top: 8px; }

/* ============================================================
   SELECTOR DE NIVELLS
   ============================================================ */
.level-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  margin-bottom: 22px;
}
.level-card {
  position: relative;
  aspect-ratio: 1.05;
  background: linear-gradient(160deg, rgba(0,240,255,.08), rgba(255,43,214,.06));
  border: 1px solid rgba(180,120,255,.3);
  border-radius: 10px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform .25s cubic-bezier(.2,.9,.3,1.4),
              border-color .25s ease,
              box-shadow .25s ease;
  overflow: hidden;
}
.level-card:hover:not(.locked) {
  transform: translateY(-4px) scale(1.04);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 28px rgba(0,240,255,.35);
}
.level-card .lvl-num {
  font-family: "Orbitron", monospace;
  font-size: 36px; font-weight: 900;
  color: white;
  text-shadow: 0 0 14px var(--neon-mag);
}
.level-card .lvl-tag {
  font-family: "Orbitron", monospace;
  font-size: 9px; letter-spacing: .2em;
  color: var(--txt-2);
  margin-top: 4px;
}
.level-card.easy .lvl-num { text-shadow: 0 0 14px var(--neon-green); }
.level-card.easy { border-color: rgba(46,255,165,.45); }
.level-card.mid  .lvl-num { text-shadow: 0 0 14px var(--neon-cyan); }
.level-card.mid  { border-color: rgba(0,240,255,.45); }
.level-card.hard .lvl-num { text-shadow: 0 0 14px var(--neon-mag); }
.level-card.hard { border-color: rgba(255,43,214,.5); }

.level-card.locked {
  cursor: not-allowed;
  filter: grayscale(.6) brightness(.55);
}
.level-card.locked::after {
  content: "🔒";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  background: rgba(5,1,15,.4);
}
.level-card.cleared::before {
  content: "★";
  position: absolute; top: 6px; right: 8px;
  color: var(--neon-yellow);
  text-shadow: 0 0 10px var(--neon-yellow);
  font-size: 18px;
}
.level-card .lvl-score {
  position: absolute;
  bottom: 4px; left: 50%;
  transform: translateX(-50%);
  font-family: "Orbitron", monospace;
  font-size: 9px; letter-spacing: .15em;
  color: var(--neon-yellow);
  text-shadow: 0 0 6px rgba(255,225,77,.6);
  background: rgba(0,0,0,.4);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid rgba(255,225,77,.4);
}

.level-legend {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  font-size: 13px; color: var(--txt-2);
  letter-spacing: .1em;
}
.level-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-easy { background: var(--neon-green); box-shadow: 0 0 8px var(--neon-green); }
.dot-mid  { background: var(--neon-cyan); box-shadow: 0 0 8px var(--neon-cyan); }
.dot-hard { background: var(--neon-mag);  box-shadow: 0 0 8px var(--neon-mag); }
.level-legend button { margin-left: auto; }

/* ============================================================
   GAMEPLAY
   ============================================================ */
.game-screen {
  padding: 0 !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  flex-direction: column;
}
.game-screen.shake { animation: cam-shake .35s linear; }
@keyframes cam-shake {
  0%   { transform: translate(0,0); }
  15%  { transform: translate(-7px, 4px); }
  30%  { transform: translate(6px, -5px); }
  45%  { transform: translate(-5px, -3px); }
  60%  { transform: translate(7px, 3px); }
  75%  { transform: translate(-3px, 4px); }
  100% { transform: translate(0,0); }
}

#hud {
  display: flex; align-items: center; gap: 26px;
  padding: 14px 28px;
  background: linear-gradient(180deg, rgba(13,2,33,.85), rgba(13,2,33,.4));
  border-bottom: 1px solid var(--border);
  z-index: 4;
  flex-shrink: 0;
}
.hud-cell {
  display: flex; flex-direction: column; gap: 2px;
  padding: 4px 14px;
  border-left: 1px solid rgba(180,120,255,.18);
}
.hud-cell:first-child { border-left: none; padding-left: 0; }
.hud-label {
  font-family: "Orbitron", monospace;
  font-size: 10px; letter-spacing: .3em;
  color: var(--txt-2);
}
.hud-val {
  font-family: "Orbitron", monospace;
  font-size: 22px; font-weight: 700;
  color: white;
  text-shadow: 0 0 10px var(--neon-cyan);
}
#hud-lives { color: var(--neon-mag); text-shadow: 0 0 10px var(--neon-mag); letter-spacing: .12em; }
#pause-game { margin-left: auto; }

/* HUD volume slider */
.hud-vol { min-width: 130px; }
.hud-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 5px; margin-top: 8px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-mag));
  border-radius: 3px;
  outline: none;
  box-shadow: 0 0 6px rgba(0,240,255,.4);
  cursor: pointer;
}
.hud-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: white;
  box-shadow: 0 0 8px var(--neon-mag);
  cursor: pointer;
}
.hud-slider::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: white; border: none;
  box-shadow: 0 0 8px var(--neon-mag);
  cursor: pointer;
}

/* ODÒMETRE: dígits que rodolen */
.odometer {
  display: flex; gap: 1px;
  font-family: "Orbitron", monospace;
  font-size: 22px; font-weight: 800;
}
.odo-digit {
  position: relative;
  width: 16px; height: 28px;
  overflow: hidden;
  background: linear-gradient(180deg, #14062c, #050110);
  border: 1px solid rgba(180,120,255,.3);
  border-radius: 3px;
  text-align: center;
  box-shadow: inset 0 0 8px rgba(0,0,0,.7);
}
.odo-strip {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center;
  transition: transform .55s cubic-bezier(.2,.85,.3,1.05);
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
  line-height: 28px;
}
.odo-strip span { height: 28px; }

#kitchen {
  flex: 1;
  position: relative;
  display: flex; flex-direction: column;
  background:
    radial-gradient(ellipse 100% 60% at 50% 100%, rgba(255,43,214,.08), transparent 70%),
    linear-gradient(180deg, transparent 0%, rgba(0,0,0,.35) 100%);
  overflow: hidden;
}

#led-strip-top, #led-strip-bot {
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan) 20%, var(--neon-mag) 80%, transparent);
  box-shadow: 0 0 18px var(--neon-cyan), 0 0 28px var(--neon-mag);
  flex-shrink: 0;
  animation: led-flow 5s linear infinite;
  background-size: 200% 100%;
}
#led-strip-bot {
  background: linear-gradient(90deg, transparent, var(--neon-mag) 20%, var(--neon-cyan) 80%, transparent);
  animation: led-flow 6s linear infinite reverse;
  background-size: 200% 100%;
}
@keyframes led-flow {
  from { background-position: 0% 0%; }
  to   { background-position: 200% 0%; }
}

/* ====== CINTA TRANSPORTADORA ====== */
#belt {
  position: relative;
  flex: 1;
  margin: 0;
  overflow: hidden;
  perspective: 900px;
}

#belt-rail {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 36%;
  transform: translateY(-50%) rotateX(28deg);
  background:
    linear-gradient(180deg, #1a0936 0%, #0a0220 100%);
  border-top: 2px solid var(--neon-purple);
  border-bottom: 2px solid var(--neon-cyan);
  box-shadow:
    0 -2px 18px var(--neon-purple),
    0 2px 24px var(--neon-cyan),
    inset 0 0 80px rgba(0,0,0,.7);
}
#belt-pattern {
  position: absolute;
  left: -50px; right: -50px;
  top: 50%;
  height: 36%;
  transform: translateY(-50%) rotateX(28deg);
  background-image: repeating-linear-gradient(
    90deg,
    rgba(0,240,255,.0) 0,
    rgba(0,240,255,.0) 60px,
    rgba(0,240,255,.35) 60px,
    rgba(0,240,255,.35) 64px,
    rgba(255,43,214,.0) 64px,
    rgba(255,43,214,.0) 124px,
    rgba(255,43,214,.4) 124px,
    rgba(255,43,214,.4) 128px
  );
  animation: belt-roll 1.4s linear infinite;
  opacity: .7;
  pointer-events: none;
}
@keyframes belt-roll {
  from { background-position: 0 0; }
  to   { background-position: -128px 0; }
}

/* ====== TRASH (escombraries) ====== */
#trash {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 110px; height: 70%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  pointer-events: none;
  z-index: 3;
}
#trash .trash-mouth {
  width: 100%; height: 80%;
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, #190a32, #03000a 70%);
  border: 2px solid var(--neon-mag);
  border-radius: 12px 12px 24px 24px;
  box-shadow: 0 0 28px rgba(255,43,214,.55), inset 0 -22px 30px rgba(0,0,0,.85);
  position: relative;
}
#trash .trash-mouth::before {
  content: "";
  position: absolute; inset: 6px;
  background: repeating-linear-gradient(180deg, rgba(255,43,214,.1) 0 4px, transparent 4px 8px);
  border-radius: 8px;
}
#trash span {
  font-family: "Orbitron", monospace;
  font-size: 9px; letter-spacing: .25em;
  color: var(--neon-mag);
  text-shadow: 0 0 8px var(--neon-mag);
  margin-top: 6px;
}

/* ====== ARM (braç mecànic) ====== */
#arm {
  position: absolute;
  left: 0; top: 0;
  width: 60px; height: 200px;
  display: flex; flex-direction: column; align-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
  z-index: 12;
}
#arm.active { opacity: 1; }
#arm .arm-stem {
  width: 6px;
  flex: 1;
  background: linear-gradient(180deg, var(--neon-cyan), var(--neon-purple));
  box-shadow: 0 0 12px var(--neon-cyan);
  border-radius: 3px;
}
#arm .arm-claw {
  font-size: 38px;
  color: var(--neon-cyan);
  text-shadow: 0 0 14px var(--neon-cyan), 0 0 26px var(--neon-mag);
  margin-top: -4px;
  animation: claw-spin 1.2s linear infinite;
}
@keyframes claw-spin { to { transform: rotate(360deg); } }

/* ====== PLATS ====== */
.plate {
  position: absolute;
  width: 140px; height: 138px;
  left: 0; top: 50%;
  transform: translate(-200px, -50%);
  pointer-events: none;
  z-index: 5;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.6));
  will-change: transform;
}
.plate-base {
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 130px; height: 18px;
  background:
    radial-gradient(ellipse at 50% 30%, #fff7fb 0%, #d56fa8 50%, #6e0c46 100%);
  border-radius: 50%;
  box-shadow:
    0 0 18px rgba(255,109,184,.55),
    inset 0 -5px 7px rgba(0,0,0,.5),
    inset 0 2px 3px rgba(255,255,255,.4);
}
.plate-base::after {
  content: "";
  position: absolute;
  left: 14%; right: 14%; top: 20%;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
  border-radius: 50%;
}
.sushi-piece {
  position: absolute;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  width: 76px; height: 38px;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
}
.sushi-piece svg { width: 100%; height: 100%; display: block; }

.staff-card {
  position: absolute;
  bottom: 38px; left: 50%;
  transform: translateX(-50%);
  width: 116px; height: 82px;
  background:
    linear-gradient(180deg, #fff8e8 0%, #f5e6c0 100%);
  border: 2px solid #4a2a08;
  border-radius: 7px;
  box-shadow: 0 0 18px rgba(0,240,255,.4), 0 4px 8px rgba(0,0,0,.4);
  overflow: hidden;
  z-index: 3;
}
.staff-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 14px,
      rgba(74,42,8,.04) 14px 15px
    );
  pointer-events: none;
}
.note-hint {
  position: absolute;
  bottom: 2px; left: 50%;
  transform: translateX(-50%);
  font-family: "Orbitron", monospace;
  font-size: 11px; font-weight: 800;
  letter-spacing: .12em;
  color: #4a2a08;
  background: rgba(255, 248, 232, .85);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid #4a2a08;
  z-index: 4;
}

/* Estat pause: aturem totes les animacions actives de la cinta */
.game-screen.paused #belt-pattern,
.game-screen.paused .plate,
.game-screen.paused .chef,
.game-screen.paused #led-strip-top,
.game-screen.paused #led-strip-bot {
  animation-play-state: paused !important;
}
.plate svg.staff-svg {
  width: 100%; height: 100%;
  display: block;
}

/* Estat permanent quan el plat ja cau a les escombraries */
.plate.miss .staff-card {
  border-color: #555;
  box-shadow: 0 0 12px rgba(120,120,120,.4);
  filter: grayscale(.95) brightness(.7);
}
.plate.miss .plate-base {
  background: radial-gradient(ellipse at 50% 30%, #777 0%, #333 60%, #000 100%);
}
.plate.miss .sushi-piece { filter: grayscale(.95) brightness(.55) drop-shadow(0 2px 4px rgba(0,0,0,.4)); }

/* Flash transitori en cada intent fallit · es retira sol */
.plate.shake-red .staff-card {
  animation: card-shake-red .35s ease;
}
@keyframes card-shake-red {
  0%, 100% {
    box-shadow: 0 0 18px rgba(0,240,255,.4), 0 4px 8px rgba(0,0,0,.4);
    border-color: #4a2a08;
    transform: translateX(-50%);
  }
  25% {
    box-shadow: 0 0 28px var(--neon-mag), 0 0 40px var(--neon-mag);
    border-color: var(--neon-mag);
    transform: translateX(calc(-50% - 4px));
  }
  75% {
    box-shadow: 0 0 28px var(--neon-mag), 0 0 40px var(--neon-mag);
    border-color: var(--neon-mag);
    transform: translateX(calc(-50% + 4px));
  }
}
@keyframes miss-flash {
  50% { filter: brightness(1.6) hue-rotate(-30deg); }
}

.plate.fall {
  animation: plate-fall .9s cubic-bezier(.4,0,.7,1) forwards;
}
@keyframes plate-fall {
  to {
    transform: translate(0, 240%) rotate(80deg) scale(.55);
    opacity: 0;
  }
}

.plate.snatch {
  animation: plate-snatch .55s cubic-bezier(.5,-0.2,.4,1.4) forwards;
}
@keyframes plate-snatch {
  60%  { transform: translate(0, -160%) scale(1.05) rotate(-6deg); opacity: 1; }
  100% { transform: translate(0, -260%) scale(.2)  rotate(-12deg); opacity: 0; }
}

/* ====== TUBS DE LLIURAMENT ====== */
#tubes {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  padding: 12px 18px 18px;
  background: linear-gradient(180deg, transparent, rgba(13,2,33,.7));
  flex-shrink: 0;
}
.tube {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 8px 10px;
  background: linear-gradient(180deg, rgba(20,8,48,.8), rgba(40,16,80,.4));
  border: 2px solid rgba(180,120,255,.4);
  border-radius: 10px 10px 18px 18px;
  cursor: pointer;
  transition: transform .15s ease, border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.tube::before {
  content: "";
  position: absolute;
  top: -8px; left: 18%; right: 18%;
  height: 6px;
  background: linear-gradient(180deg, currentColor, transparent);
  border-radius: 3px 3px 0 0;
  opacity: .5;
}
.tube .tube-glyph {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-family: "Orbitron", monospace;
  font-weight: 900;
  font-size: 13px;
  margin-bottom: 6px;
  box-shadow: 0 0 12px currentColor, inset 0 0 8px rgba(255,255,255,.1);
  background: rgba(0,0,0,.45);
  text-shadow: 0 0 6px currentColor;
}
.tube .tube-key {
  font-family: "Orbitron", monospace;
  font-size: 11px; letter-spacing: .2em;
  color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.07);
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,.1);
}
.tube:hover {
  transform: translateY(-4px);
  border-color: currentColor;
  box-shadow: 0 0 20px currentColor;
  background: linear-gradient(180deg, rgba(20,8,48,.95), rgba(40,16,80,.7));
}
.tube.fired {
  animation: tube-fire .4s ease;
}
@keyframes tube-fire {
  0%   { transform: translateY(0); }
  35%  { transform: translateY(-10px) scale(1.06); box-shadow: 0 0 38px currentColor; }
  100% { transform: translateY(0); }
}
.tube.fired-bad { animation: tube-fire-bad .4s ease; }
@keyframes tube-fire-bad {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateX(-4px) translateY(2px); box-shadow: 0 0 20px var(--neon-mag); border-color: var(--neon-mag); }
}

/* Color per tub (set per JS) */
.tube[data-note="DO"]  { color: #ff006e; }
.tube[data-note="RE"]  { color: #fb5607; }
.tube[data-note="MI"]  { color: #ffbe0b; }
.tube[data-note="FA"]  { color: #2effa5; }
.tube[data-note="SOL"] { color: #00f0ff; }
.tube[data-note="LA"]  { color: #b14bff; }
.tube[data-note="SI"]  { color: #ff2bd6; }

/* ====== COMBO POP ====== */
#combo-pop {
  position: absolute;
  top: 30%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: "Orbitron", monospace;
  font-size: 64px; font-weight: 900;
  color: white;
  text-shadow: 0 0 18px var(--neon-mag), 0 0 40px var(--neon-cyan);
  pointer-events: none;
  opacity: 0;
  z-index: 20;
}
#combo-pop.show {
  animation: combo-pop .8s cubic-bezier(.2,1.4,.4,1) forwards;
}
@keyframes combo-pop {
  0%   { opacity: 0; transform: translate(-50%, -20%) scale(.6); }
  30%  { opacity: 1; transform: translate(-50%, -55%) scale(1.1); }
  70%  { opacity: 1; transform: translate(-50%, -55%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(.9); }
}

/* ====== FLASH ====== */
#flash {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.9), transparent 60%);
  opacity: 0;
  z-index: 18;
}
#flash.flash-good { animation: flash-good .35s ease; }
#flash.flash-bad  { animation: flash-bad  .35s ease; background: radial-gradient(circle at 50% 50%, rgba(255,43,214,.7), transparent 60%); }
@keyframes flash-good {
  0%, 100% { opacity: 0; }
  30%      { opacity: .4; }
}
@keyframes flash-bad {
  0%, 100% { opacity: 0; }
  30%      { opacity: .55; }
}

/* ====== OVERLAY ====== */
.overlay {
  position: absolute; inset: 0;
  background: rgba(5,1,15,.7);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  animation: ov-in .4s ease;
}
.overlay.hidden { display: none; }
@keyframes ov-in { from { opacity: 0; } to { opacity: 1; } }
.overlay-card {
  width: min(90vw, 520px);
  padding: 32px 36px 28px;
  text-align: center;
}
.overlay-card h2 {
  font-family: "Orbitron", monospace;
  font-size: 36px; letter-spacing: .15em;
  margin-bottom: 12px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-mag));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(255,43,214,.4);
}
.overlay-card p { color: var(--txt-1); margin-bottom: 16px; }
.ov-stats {
  display: flex; justify-content: center; gap: 24px;
  margin: 18px 0 24px;
  flex-wrap: wrap;
}
.ov-stat {
  display: flex; flex-direction: column; gap: 4px;
}
.ov-stat .lbl {
  font-family: "Orbitron", monospace;
  font-size: 10px; letter-spacing: .3em;
  color: var(--txt-2);
}
.ov-stat .val {
  font-family: "Orbitron", monospace;
  font-size: 26px; font-weight: 800;
  color: var(--neon-cyan);
  text-shadow: 0 0 12px var(--neon-cyan);
}
.ov-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ====== COUNTDOWN ====== */
#countdown {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5,1,15,.55);
  backdrop-filter: blur(4px);
  z-index: 60;
}
#countdown.hidden { display: none; }
#countdown #cd-num {
  font-family: "Orbitron", monospace;
  font-size: 220px; font-weight: 900;
  color: white;
  text-shadow: 0 0 40px var(--neon-mag), 0 0 80px var(--neon-cyan);
  animation: cd-pop 1s ease;
}
@keyframes cd-pop {
  0%   { transform: scale(.4); opacity: 0; }
  20%  { transform: scale(1.15); opacity: 1; }
  60%  { transform: scale(1); }
  100% { transform: scale(.6); opacity: 0; }
}

/* ============================================================
   PARAL·LAX FONS · 4 capes de Tokyo
   ============================================================ */
#parallax {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.px-layer {
  position: absolute;
  left: -10%; right: -10%;
  bottom: 0;
  height: 100%;
  background-repeat: repeat-x;
  background-position: 0 100%;
  opacity: .85;
}
/* Capa més llunyana: silueta de gratacels foscos */
.px-far {
  background-image:
    linear-gradient(180deg, transparent 60%, #07041a 80%),
    repeating-linear-gradient(
      90deg,
      transparent 0 60px,
      #0a0428 60px 80px,
      transparent 80px 110px,
      #0d052e 110px 140px,
      transparent 140px 200px,
      #0a0428 200px 260px,
      transparent 260px 290px,
      #0c042b 290px 340px
    );
  background-size: auto, 400px 60%;
  background-position: 0 100%, 0 100%;
  animation: px-scroll-far 90s linear infinite;
  opacity: .9;
}
/* Capa mitjana: edificis amb finestres neó */
.px-mid {
  background-image:
    repeating-linear-gradient(
      90deg,
      transparent 0 100px,
      rgba(13,2,46,.95) 100px 180px,
      transparent 180px 260px,
      rgba(20,6,60,.95) 260px 360px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0 12px,
      rgba(255,43,214,.4) 12px 14px,
      transparent 14px 26px,
      rgba(0,240,255,.35) 26px 28px
    );
  background-size: 460px 50%, 460px 50%;
  background-position: 0 100%, 0 100%;
  background-blend-mode: source-over, multiply;
  animation: px-scroll-mid 60s linear infinite;
  opacity: .55;
  height: 50%;
}
/* Capa propera: cartells hologràfics */
.px-near {
  background-image:
    repeating-linear-gradient(
      90deg,
      transparent 0 200px,
      rgba(255,43,214,.18) 200px 230px,
      transparent 230px 380px,
      rgba(0,240,255,.18) 380px 410px,
      transparent 410px 600px
    );
  background-size: 600px 30%;
  background-position: 0 70%;
  animation: px-scroll-near 30s linear infinite;
  opacity: .6;
  filter: blur(1px);
}
/* Capa frontal: vapor / partícules estàtiques */
.px-front {
  background:
    radial-gradient(ellipse 18% 10% at 12% 100%, rgba(255,43,214,.25), transparent 70%),
    radial-gradient(ellipse 20% 12% at 70% 100%, rgba(0,240,255,.22), transparent 70%),
    radial-gradient(ellipse 25% 14% at 92% 100%, rgba(46,255,165,.18), transparent 70%);
  filter: blur(20px);
  animation: px-front-pulse 8s ease-in-out infinite alternate;
  opacity: .9;
}
@keyframes px-scroll-far  { to { background-position: -2000px 100%, -2000px 100%; } }
@keyframes px-scroll-mid  { to { background-position: -2000px 100%, -2000px 100%; } }
@keyframes px-scroll-near { to { background-position: -2000px 70%; } }
@keyframes px-front-pulse {
  0%, 100% { transform: translateY(0); opacity: .9; }
  50%      { transform: translateY(-10px); opacity: 1; }
}

/* ============================================================
   BOOT SEQUENCE
   ============================================================ */
.boot {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 50%, #1a0936 0%, #050110 100%);
  z-index: 999;
  cursor: pointer;
}
.boot.active { display: flex; }
.boot.fade-out { animation: boot-fade .8s ease forwards; }
@keyframes boot-fade {
  to { opacity: 0; transform: scale(1.08); pointer-events: none; }
}
.boot-inner {
  text-align: center;
  width: min(540px, 90vw);
}
.boot-logo {
  font-size: 120px;
  color: var(--neon-mag);
  text-shadow: 0 0 40px var(--neon-mag), 0 0 80px var(--neon-cyan);
  margin-bottom: 18px;
  animation: boot-logo-spin 3s ease-in-out infinite alternate;
}
@keyframes boot-logo-spin {
  from { transform: rotate(-2deg) scale(.97); filter: drop-shadow(0 0 12px var(--neon-mag)); }
  to   { transform: rotate(2deg)  scale(1.03); filter: drop-shadow(0 0 24px var(--neon-cyan)); }
}
.boot-title {
  font-family: "Orbitron", monospace;
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: .25em;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-mag));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  margin-bottom: 4px;
}
.boot-version {
  font-family: "Orbitron", monospace;
  font-size: 11px; letter-spacing: .35em;
  color: var(--txt-2);
  margin-bottom: 28px;
}
.boot-bar {
  width: 100%; height: 8px;
  background: rgba(0,240,255,.1);
  border: 1px solid rgba(0,240,255,.3);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow: inset 0 0 12px rgba(0,0,0,.7);
}
.boot-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-mag));
  box-shadow: 0 0 14px var(--neon-cyan);
  transition: width .15s linear;
}
.boot-log {
  height: 130px;
  text-align: left;
  font-family: "Courier New", monospace;
  font-size: 12px;
  color: var(--neon-green);
  overflow: hidden;
  text-shadow: 0 0 6px var(--neon-green);
  white-space: pre-wrap;
}
.boot-skip {
  margin-top: 18px;
  font-family: "Orbitron", monospace;
  font-size: 10px;
  color: var(--txt-2);
  letter-spacing: .25em;
  animation: blink 1.4s steps(2) infinite;
}

/* ============================================================
   BOTÓ ENGRANATGE GLOBAL
   ============================================================ */
.cog-btn {
  position: fixed;
  top: 18px; right: 18px;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(20,8,48,.7);
  border: 1px solid var(--border);
  color: var(--neon-cyan);
  font-size: 22px;
  cursor: pointer;
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(10px);
  transition: transform .25s ease, border-color .2s ease, box-shadow .2s ease;
}
.cog-btn:hover {
  transform: rotate(60deg) scale(1.1);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 18px var(--neon-cyan);
}
.cog-btn.hidden { display: none; }

/* ============================================================
   CONFIGURACIÓ
   ============================================================ */
.settings-grid {
  display: flex; flex-direction: column;
  gap: 14px;
  margin: 18px 0 24px;
  text-align: left;
}
.setting-row {
  display: grid;
  grid-template-columns: 1fr 200px 50px;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: rgba(20,8,48,.4);
  border: 1px solid rgba(180,120,255,.18);
  border-radius: 6px;
}
.setting-row label {
  font-family: "Orbitron", monospace;
  font-size: 12px; letter-spacing: .15em;
  color: var(--txt-1);
}
.setting-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%; height: 6px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-mag));
  border-radius: 3px;
  outline: none;
  box-shadow: 0 0 8px rgba(0,240,255,.4);
}
.setting-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 10px var(--neon-mag);
  cursor: pointer;
}
.setting-row input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: white;
  border: none;
  box-shadow: 0 0 10px var(--neon-mag);
  cursor: pointer;
}
.setting-row input[type="checkbox"] {
  width: 22px; height: 22px;
  accent-color: var(--neon-mag);
  cursor: pointer;
  justify-self: center;
  grid-column: 2 / 4;
}
.setting-row .vol-val {
  font-family: "Orbitron", monospace;
  color: var(--neon-cyan);
  font-size: 14px;
  text-align: right;
  text-shadow: 0 0 6px var(--neon-cyan);
}

/* ============================================================
   ACHIEVEMENT TOAST
   ============================================================ */
.ach-toast {
  position: fixed;
  top: 80px; right: 24px;
  z-index: 200;
  padding: 14px 22px;
  background: linear-gradient(135deg, rgba(255,43,214,.22), rgba(0,240,255,.22));
  border: 1px solid var(--neon-yellow);
  border-radius: 8px;
  box-shadow: 0 0 22px var(--neon-yellow), inset 0 0 12px rgba(255,225,77,.15);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; gap: 12px;
  transform: translateX(420px);
  opacity: 0;
  pointer-events: none;
  transition: transform .5s cubic-bezier(.2,.9,.3,1.4), opacity .4s ease;
  max-width: 380px;
}
.ach-toast.show {
  transform: translateX(0);
  opacity: 1;
}
.ach-toast .ach-icon {
  font-size: 30px;
  color: var(--neon-yellow);
  text-shadow: 0 0 12px var(--neon-yellow);
  flex-shrink: 0;
}
.ach-toast .ach-body { display: flex; flex-direction: column; gap: 2px; }
.ach-toast .ach-title {
  font-family: "Orbitron", monospace;
  font-size: 11px; letter-spacing: .2em;
  color: var(--neon-yellow);
}
.ach-toast .ach-name {
  font-family: "Orbitron", monospace;
  font-size: 14px; font-weight: 700;
  color: white;
}

/* ============================================================
   XEF · ASSET PREMIUM amb tall cintura difuminat
   ============================================================ */
#chef-host {
  position: absolute;
  bottom: 80px; left: 24px;
  z-index: 6;
  pointer-events: none;
  width: 150px; height: 200px;
  /* Màscara: cap a la base es difumina suau · cap mai es talla */
  -webkit-mask-image: linear-gradient(180deg,
    rgba(0,0,0,1) 0%,
    rgba(0,0,0,1) 60%,
    rgba(0,0,0,.85) 78%,
    rgba(0,0,0,.4) 92%,
    rgba(0,0,0,0) 100%);
  mask-image: linear-gradient(180deg,
    rgba(0,0,0,1) 0%,
    rgba(0,0,0,1) 60%,
    rgba(0,0,0,.85) 78%,
    rgba(0,0,0,.4) 92%,
    rgba(0,0,0,0) 100%);
}
/* Halo lluminós darrere del xef */
.chef-aura {
  position: absolute;
  inset: -10% -20% 10% -20%;
  background: radial-gradient(ellipse 60% 50% at 50% 35%, rgba(0,240,255,.35), transparent 70%);
  filter: blur(14px);
  z-index: -1;
  transition: opacity .35s ease, background .35s ease;
}
.chef-base {
  position: absolute;
  bottom: -6px; left: 50%;
  transform: translateX(-50%);
  width: 130px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255,43,214,.55), transparent 70%);
  filter: blur(4px);
  z-index: -1;
}
.chef {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  height: 100%;
  width: auto;
  max-width: none;
  display: block;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,.65));
  transition: filter .3s ease;
  image-rendering: -webkit-optimize-contrast;
}
/* Estats · animacions a transform · filter en static perquè es mantingui durant l'animació */
.chef.hit {
  filter:
    drop-shadow(0 12px 18px rgba(0,0,0,.65))
    drop-shadow(0 0 18px var(--neon-cyan))
    brightness(1.15) saturate(1.2);
  animation: chef-hit .4s ease;
}
.chef.miss {
  filter:
    drop-shadow(0 12px 18px rgba(0,0,0,.65))
    brightness(.62) saturate(.5) hue-rotate(-15deg);
  animation: chef-miss .55s ease;
}
.chef.combo {
  filter:
    drop-shadow(0 12px 18px rgba(0,0,0,.65))
    drop-shadow(0 0 26px var(--neon-yellow))
    brightness(1.2) saturate(1.3);
  animation: chef-combo .6s ease infinite alternate;
}
/* Aura per estat */
#chef-host:has(.chef.hit) .chef-aura {
  background: radial-gradient(ellipse 70% 55% at 50% 35%, rgba(0,240,255,.55), transparent 70%);
}
#chef-host:has(.chef.miss) .chef-aura {
  background: radial-gradient(ellipse 60% 50% at 50% 35%, rgba(255,43,214,.35), transparent 70%);
}
#chef-host:has(.chef.combo) .chef-aura {
  background: radial-gradient(ellipse 80% 60% at 50% 35%, rgba(255,225,77,.6), transparent 70%);
  animation: aura-pulse .6s ease infinite alternate;
}
@keyframes aura-pulse {
  from { opacity: .7; }
  to   { opacity: 1; }
}

@keyframes chef-hit {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  40%      { transform: translateX(-50%) translateY(-14px) rotate(-3deg); }
}
@keyframes chef-miss {
  0%, 100% { transform: translateX(-50%) rotate(0); }
  20%      { transform: translateX(calc(-50% - 6px)) rotate(-3deg); }
  60%      { transform: translateX(calc(-50% + 5px)) rotate(2deg); }
}
@keyframes chef-combo {
  from { transform: translateX(-50%) translateY(0) scale(1); }
  to   { transform: translateX(-50%) translateY(-6px) scale(1.04); }
}

/* ============================================================
   PARTÍCULES
   ============================================================ */
#particles {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

/* ============================================================
   PLAT ACTIU · halo
   ============================================================ */
.plate.active .staff-card {
  box-shadow: 0 0 28px var(--neon-cyan), 0 4px 8px rgba(0,0,0,.4);
  border-color: var(--neon-cyan);
  animation: active-pulse 1.1s ease-in-out infinite alternate;
}
@keyframes active-pulse {
  from { box-shadow: 0 0 18px var(--neon-cyan), 0 4px 8px rgba(0,0,0,.4); }
  to   { box-shadow: 0 0 38px var(--neon-cyan), 0 0 56px rgba(0,240,255,.35), 0 4px 8px rgba(0,0,0,.4); }
}

/* ============================================================
   STATS PER NOTA (overlay final)
   ============================================================ */
.note-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 8px;
  margin: 14px 0 10px;
}
.note-stat {
  background: rgba(20,8,48,.5);
  border: 1px solid rgba(180,120,255,.25);
  border-radius: 6px;
  padding: 8px 6px;
  text-align: center;
}
.note-stat .ns-name {
  font-family: "Orbitron", monospace;
  font-size: 12px; font-weight: 700;
  letter-spacing: .1em;
  color: var(--neon-cyan);
}
.note-stat .ns-acc {
  font-family: "Orbitron", monospace;
  font-size: 18px; font-weight: 800;
  color: white;
  margin: 2px 0;
}
.note-stat .ns-bar {
  height: 4px;
  background: rgba(255,255,255,.08);
  border-radius: 2px;
  overflow: hidden;
}
.note-stat .ns-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-mag), var(--neon-green));
  transition: width .8s ease;
}

/* ============================================================
   MODE DALTÒNIC
   ============================================================ */
body.cb-mode .tube[data-note="DO"]  { color: #ffffff; }
body.cb-mode .tube[data-note="RE"]  { color: #ffd966; }
body.cb-mode .tube[data-note="MI"]  { color: #ffaa33; }
body.cb-mode .tube[data-note="FA"]  { color: #66ff99; }
body.cb-mode .tube[data-note="SOL"] { color: #66ddff; }
body.cb-mode .tube[data-note="LA"]  { color: #cc99ff; }
body.cb-mode .tube[data-note="SI"]  { color: #ff66cc; }
body.cb-mode .tube .tube-glyph { background: rgba(0,0,0,.7); }

/* ============================================================
   TUTORIAL INTERACTIU
   ============================================================ */
.tut-panel { width: min(96vw, 1180px); }
.tut-controls {
  display: flex; gap: 14px; align-items: center;
}
.tut-step-label {
  font-family: "Orbitron", monospace;
  font-size: 11px; letter-spacing: .25em;
  color: var(--neon-yellow);
  text-shadow: 0 0 8px rgba(255,225,77,.5);
  padding: 4px 10px;
  border: 1px solid rgba(255,225,77,.4);
  border-radius: 4px;
  background: rgba(255,225,77,.08);
}

.tut-room {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  margin-top: 20px;
}

.tut-chef-side {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.tut-chef-wrap {
  position: relative;
  width: 200px; height: 240px;
  /* màscara cap-a-cintura · més alta que al joc perquè es vegi més tronc */
  -webkit-mask-image: linear-gradient(180deg,
    rgba(0,0,0,1) 0%,
    rgba(0,0,0,1) 70%,
    rgba(0,0,0,.6) 88%,
    rgba(0,0,0,0) 100%);
  mask-image: linear-gradient(180deg,
    rgba(0,0,0,1) 0%,
    rgba(0,0,0,1) 70%,
    rgba(0,0,0,.6) 88%,
    rgba(0,0,0,0) 100%);
}
.tut-chef-wrap .chef-aura.tut-aura {
  position: absolute;
  inset: -5% -25% 8% -25%;
  background: radial-gradient(ellipse 65% 50% at 50% 30%, rgba(0,240,255,.4), transparent 70%);
  filter: blur(16px);
  z-index: -1;
}
.tut-chef-img {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  height: 100%;
  width: auto;
  display: block;
  filter: drop-shadow(0 12px 22px rgba(0,0,0,.6));
  transition: filter .3s ease;
}
.tut-chef-img.hit {
  filter: drop-shadow(0 12px 22px rgba(0,0,0,.6))
          drop-shadow(0 0 18px var(--neon-cyan))
          brightness(1.18) saturate(1.25);
  animation: chef-hit .4s ease;
}
.tut-chef-img.miss {
  filter: drop-shadow(0 12px 22px rgba(0,0,0,.6))
          brightness(.65) saturate(.5) hue-rotate(-15deg);
  animation: chef-miss .55s ease;
}
.tut-bubble {
  position: relative;
  background: linear-gradient(160deg, rgba(0,240,255,.12), rgba(255,43,214,.08));
  border: 1px solid var(--neon-cyan);
  border-radius: 12px;
  padding: 18px 18px 16px;
  width: 100%;
  box-shadow: 0 0 22px rgba(0,240,255,.25), inset 0 0 12px rgba(0,240,255,.1);
}
.tut-bubble::before {
  content: "";
  position: absolute;
  top: -10px; left: 36px;
  border: 10px solid transparent;
  border-bottom-color: var(--neon-cyan);
  filter: drop-shadow(0 -2px 4px rgba(0,240,255,.5));
}
.tut-bubble-name {
  font-family: "Orbitron", monospace;
  font-size: 11px; letter-spacing: .25em;
  color: var(--neon-mag);
  text-shadow: 0 0 8px var(--neon-mag);
  margin-bottom: 10px;
}
.tut-bubble-text {
  color: white;
  line-height: 1.55;
  font-size: 14.5px;
  min-height: 92px;
  letter-spacing: .01em;
}
.tut-bubble-text b {
  color: var(--neon-yellow);
  text-shadow: 0 0 8px rgba(255,225,77,.6);
  font-family: "Orbitron", monospace;
  font-size: 16px;
  padding: 0 4px;
}
.tut-next-btn {
  margin-top: 14px;
  width: 100%;
  padding: 10px 18px;
  font-size: 13px;
  animation: tut-next-pulse 1.5s ease-in-out infinite alternate;
}
@keyframes tut-next-pulse {
  from { box-shadow: 0 0 0 1px var(--neon-mag), 0 0 18px rgba(255,43,214,.4); }
  to   { box-shadow: 0 0 0 1px var(--neon-mag), 0 0 36px rgba(255,43,214,.8); }
}

.tut-stage-area {
  display: flex; flex-direction: column; gap: 18px;
}
.tut-mini-belt {
  position: relative;
  height: 220px;
  background: radial-gradient(ellipse 80% 50% at 50% 100%, rgba(255,43,214,.1), transparent),
              linear-gradient(180deg, transparent, rgba(0,0,0,.4));
  border: 1px solid rgba(180,120,255,.3);
  border-radius: 10px;
  overflow: hidden;
  perspective: 700px;
}
.tut-mini-rail {
  position: absolute; left: 0; right: 0; top: 50%;
  height: 90px; transform: translateY(-50%) rotateX(20deg);
  background: linear-gradient(180deg, #1a0936, #0a0220);
  border-top: 2px solid var(--neon-purple);
  border-bottom: 2px solid var(--neon-cyan);
  box-shadow: 0 -2px 18px var(--neon-purple), 0 2px 18px var(--neon-cyan);
}
.tut-mini-pattern {
  position: absolute; left: -30px; right: -30px; top: 50%;
  height: 90px; transform: translateY(-50%) rotateX(20deg);
  background-image: repeating-linear-gradient(90deg,
    transparent 0 50px,
    rgba(0,240,255,.3) 50px 53px,
    transparent 53px 100px,
    rgba(255,43,214,.35) 100px 103px);
  pointer-events: none;
  opacity: .6;
}
.tut-plate-slot {
  position: absolute;
  left: 25%; top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 4;
}
.tut-plate-slot .plate {
  position: relative !important;
  left: auto !important; top: auto !important;
  transform: translateY(0);
  animation: tut-plate-float 3s ease-in-out infinite alternate;
}
@keyframes tut-plate-float {
  from { transform: translateY(0) rotate(-1deg); }
  to   { transform: translateY(-6px) rotate(1deg); }
}
.tut-plate-slot .plate.snatch {
  animation: tut-plate-snatch .55s cubic-bezier(.5,-0.2,.4,1.4) forwards !important;
}
@keyframes tut-plate-snatch {
  60%  { transform: translateY(-80px) scale(1.05) rotate(-6deg); opacity: 1; }
  100% { transform: translateY(-160px) scale(.2) rotate(-12deg); opacity: 0; }
}
.tut-plate-slot .plate.shake-red .staff-card {
  animation: card-shake-red .35s ease;
}
.tut-mini-trash {
  position: absolute; right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 70px; height: 80%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  pointer-events: none;
  z-index: 3;
}
.tut-mini-trash-mouth {
  width: 100%; height: 75%;
  background: radial-gradient(ellipse 80% 60% at 50% 30%, #190a32, #03000a 70%);
  border: 2px solid var(--neon-mag);
  border-radius: 8px 8px 16px 16px;
  box-shadow: 0 0 18px rgba(255,43,214,.5), inset 0 -16px 22px rgba(0,0,0,.85);
}
.tut-mini-trash span {
  font-family: "Orbitron", monospace;
  font-size: 8px; letter-spacing: .2em;
  color: var(--neon-mag);
  text-shadow: 0 0 6px var(--neon-mag);
  margin-top: 4px;
}
.tut-mini-tubes {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.tut-mini-tubes .tube { padding: 8px 4px; }

.tut-mini-tubes .tube.highlight {
  animation: tube-highlight 1s ease-in-out infinite alternate;
  border-color: currentColor !important;
}
@keyframes tube-highlight {
  from { box-shadow: 0 0 12px currentColor; transform: translateY(0); }
  to   { box-shadow: 0 0 32px currentColor, 0 0 48px currentColor; transform: translateY(-4px); }
}

/* Cog amagat dins el joc · evita conflicte amb el botó Sortir del HUD */
body.in-game .cog-btn { display: none; }

/* ====== RESPONSIVITAT BÀSICA ====== */
@media (max-width: 720px) {
  .plate { width: 100px; height: 88px; }
  .plate-body { width: 92px; height: 22px; }
  .staff-card { width: 88px; height: 60px; bottom: 12px; }
  #hud { gap: 14px; padding: 10px 14px; flex-wrap: wrap; }
  .hud-cell { padding: 4px 8px; }
  .hud-val { font-size: 18px; }
  .tube .tube-glyph { width: 30px; height: 30px; font-size: 11px; }
  .tube { padding: 8px 4px; }
  .title-neon { font-size: 16vw; }
}


/* ── DUA: respecta prefers-reduced-motion (afegit per auditoria d'accessibilitat) ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
