:root {
  --ink: #fff6e8;
  --gold: #ffb84d;
  --card: rgba(30, 20, 11, 0.8);
  --line: rgba(255, 214, 150, 0.22);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

/* Todo el HUD escala con el alto del escenario 16:9 (1rem = alto/42): 10 px a 420 px, ~17 px a 720 px. */
html { font-size: calc(100vh / 42); }
[hidden] { display: none !important; }

body {
  margin: 0;
  overflow: hidden;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 1.3rem;
  color: var(--ink);
  background: radial-gradient(130% 100% at 50% 0%, #33220f 0%, #20140a 55%, #140c06 100%);
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  box-shadow: 0 1.2rem 3.2rem rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

/* ───────── barra superior ───────── */
.hud.top {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 1.2rem 1.4rem; pointer-events: none; z-index: 10;
}
.hud.top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 1rem; }
.brand h1 { margin: 0; font-size: 2.1rem; text-shadow: 0 2px 8px rgba(0,0,0,.55); }
.chip {
  background: linear-gradient(180deg, #ffc25e, #f59b1e);
  color: #2b1503; font-weight: 700; font-size: 1.25rem;
  padding: .4rem 1rem; border-radius: 999px; white-space: nowrap;
}
.right { display: flex; align-items: center; gap: 1rem; }
.steps { display: flex; gap: .6rem; }
.step {
  width: 3.4rem; height: 3.4rem; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(255,255,255,.08);
  color: var(--ink); font-weight: 700; font-size: 1.4rem; cursor: pointer;
  transition: transform .12s, background .2s;
}
.step:hover { background: rgba(255,255,255,.16); }
.step.active { background: linear-gradient(180deg, #ffc25e, #f59b1e); color: #2b1503; border-color: #ffd79a; }

.btn {
  border: 1px solid var(--line); background: rgba(255,255,255,.09);
  color: var(--ink); border-radius: 1.2rem; padding: .9rem 1.8rem;
  font-size: 1.4rem; font-family: inherit; cursor: pointer;
  transition: transform .12s, filter .2s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(180deg, #ffc25e, #ef9315); color: #2b1503; font-weight: 700; border-color: #ffd79a; }
.btn.accent { background: linear-gradient(180deg, #8fd7ff, #4aa8e8); color: #06263a; font-weight: 700; border-color: #bde6ff; }
.btn.ghost { background: rgba(255,255,255,.06); }
.btn.small { padding: .6rem 1rem; font-size: 1.2rem; border-radius: 1rem; }
.btn.big { padding: 1.2rem 2.6rem; font-size: 1.6rem; border-radius: 1.4rem; }

/* ───────── columna izquierda: pedido + punto de cocción ───────── */
.left {
  position: fixed; left: 1.4rem; top: 5rem; width: 26rem; z-index: 9;
  display: flex; flex-direction: column; gap: .8rem;
}
.mission { padding: .9rem 1.2rem; }
.goal { margin: 0; font-size: 1.4rem; font-weight: 700; line-height: 1.25; }
.steps3 { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .2rem; counter-reset: s; }
.steps3 li {
  counter-increment: s; display: flex; align-items: center; gap: .7rem;
  font-size: 1.15rem; line-height: 1.2; opacity: .5; transition: opacity .25s;
}
.steps3 li::before {
  content: counter(s); flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 1rem; font-weight: 800; background: rgba(255,255,255,.16);
}
.steps3 li.now { opacity: 1; color: #ffe2a8; font-weight: 700; }
.steps3 li.now::before { background: linear-gradient(180deg, #ffc25e, #f59b1e); color: #2b1503; }
.steps3 li.done { opacity: .85; }
.steps3 li.done::before { content: '✓'; background: #5fae5f; color: #fff; }
.hint { margin: .5rem 0 0; font-size: 1rem; line-height: 1.3; color: #ffd79a; }

.cook { padding: .8rem 1.2rem; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; padding: .15rem 0; font-size: 1.2rem; }
.row b { font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0; }
.row.slim { font-size: 1.05rem; opacity: .85; margin-top: .3rem; }
.row.sides { color: #ffd79a; font-size: 1.05rem; }
.meter {
  position: relative; border-radius: .7rem; overflow: hidden; margin-top: .3rem;
  background: linear-gradient(90deg, rgba(239,224,192,.28), rgba(227,180,90,.28) 45%, rgba(168,102,42,.3) 75%, rgba(58,36,16,.5));
}
.meter.big { height: 1.5rem; }
.meter.small { height: .6rem; }
.meter .zone {
  position: absolute; top: 0; bottom: 0; z-index: 1;
  background: rgba(95,200,95,.55); border: 1px solid #9be59b; border-radius: .4rem;
  display: grid; place-items: center; font-size: .9rem; font-weight: 800; letter-spacing: .08em; color: #0c2b0c;
}
.meter .zone::after { content: attr(data-label); }
.meter .fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; z-index: 2;
  border-radius: .7rem; transition: width .18s;
}
.fill.gold { background: linear-gradient(90deg, rgba(255,210,122,.85), rgba(232,150,30,.9)); border-right: 3px solid #fff; }
.fill.burn { background: linear-gradient(90deg, #8a8a8a, #1e1e1e); }

/* ───────── termómetro (derecha) ───────── */
.thermo {
  position: fixed; right: 1.4rem; top: 5rem; width: 12.8rem; z-index: 9;
  bottom: calc(135px + 1rem); /* deja libre la esquina del crédito de Crezendo */
  padding: .9rem 1.1rem; display: flex; flex-direction: column;
}
.thermo-body { flex: 1; min-height: 0; display: flex; gap: .8rem; margin: .7rem 0; }
.tube {
  position: relative; width: 2.4rem; border-radius: 1.2rem; overflow: hidden;
  background: rgba(255,255,255,.1); border: 1px solid var(--line);
}
.band { position: absolute; left: 0; right: 0; }
.band.steam { bottom: 36.6%; height: 19.5%; background: rgba(120,180,230,.45); }
.band.brown { bottom: 56.1%; height: 29.3%; background: rgba(110,210,110,.6); }
.band.burn  { bottom: 85.4%; height: 14.6%; background: rgba(235,90,60,.65); }
.needle {
  position: absolute; left: 0; right: 0; bottom: 0; height: .5rem; margin-bottom: -.25rem;
  background: #fff; border-radius: 3px; box-shadow: 0 0 8px rgba(255,255,255,.9); transition: bottom .15s;
}
.aim {
  position: absolute; left: 50%; bottom: 0; width: 1rem; height: 1rem; margin: 0 0 -.5rem -.5rem;
  border-radius: 50%; border: 2px dashed #ffd27a; transition: bottom .15s;
}
.scale { list-style: none; margin: 0; padding: 0; position: relative; flex: 1; font-size: 1.05rem; line-height: 1.1; }
.scale li { position: absolute; left: 0; transform: translateY(50%); white-space: nowrap; font-weight: 700; }
.s-steam { bottom: 36.6%; color: #9fd0ff; }
.s-brown { bottom: 56.1%; color: #8fe08f; }
.s-burn  { bottom: 85.4%; color: #ff9a80; }

/* ───────── abajo: estado + controles ───────── */
.bottom {
  position: fixed; left: 1.4rem; bottom: 1.4rem; z-index: 10;
  width: min(46rem, calc(100vw - 2.8rem - 340px)); /* no llega a la esquina del crédito de Crezendo */
  display: flex; flex-direction: column; align-items: flex-start; gap: .8rem; pointer-events: none;
}
.bottom > * { pointer-events: auto; }
.status {
  margin: 0; max-width: 100%; font-size: 1.25rem; line-height: 1.3; padding: .55rem 1rem; border-radius: 1rem;
  background: rgba(20,12,6,.8); border: 1px solid var(--line); text-shadow: 0 1px 4px rgba(0,0,0,.7);
  opacity: 0; transition: opacity .35s; pointer-events: none;
}
.status:empty { display: none; }
.status.show { opacity: 1; }
.status.info { color: #ffe9c9; }
.status.warn { color: #ffb14d; }
.status.bad { color: #ff8a70; }
.dock { width: 100%; padding: .8rem 1.2rem; display: flex; flex-direction: row; align-items: center; gap: 1.2rem; }
.dock .heat-wrap { flex: 1; min-width: 0; }
.dock .controls .btn { padding: .7rem 1.2rem; font-size: 1.3rem; }
.heat-wrap { display: flex; align-items: center; gap: 1rem; }
.heat-wrap label { font-size: 1.3rem; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.heat-wrap b { font-variant-numeric: tabular-nums; min-width: 4.4rem; text-align: right; font-size: 1.3rem; white-space: nowrap; flex-shrink: 0; }
input[type='range'] { flex: 1; height: 2.6rem; cursor: pointer; background: transparent; -webkit-appearance: none; appearance: none; }
/* La pista enseña el fuego: gris = no dora; verde = dora (≈59–90 %); rojo = se quema. */
input[type='range']::-webkit-slider-runnable-track { height: 1rem; border-radius: .5rem; background: linear-gradient(90deg, #4d5a68 0 59%, #7bbd5a 59% 90%, #d9553b 90% 100%); }
input[type='range']::-moz-range-track { height: 1rem; border-radius: .5rem; background: linear-gradient(90deg, #4d5a68 0 59%, #7bbd5a 59% 90%, #d9553b 90% 100%); }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 2.2rem; height: 2.2rem; margin-top: -.6rem; border-radius: 50%; background: #fff; border: 3px solid #f59b1e; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
input[type='range']::-moz-range-thumb { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: #fff; border: 3px solid #f59b1e; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.controls { display: flex; gap: .7rem; justify-content: center; flex-wrap: nowrap; }

.overlay {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(10, 6, 3, .55);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  width: min(52rem, 92vw); padding: 2.4rem; text-align: center;
  display: flex; flex-direction: column; gap: 1.4rem;
}
.modal h2 { margin: 0; font-size: 2.6rem; color: #ffd27a; }
.modal p { margin: 0; font-size: 1.5rem; line-height: 1.5; }
.modal .actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.intro-overlay { z-index: 25; background: rgba(10, 6, 3, .68); }
.intro-modal { width: min(56rem, 90vw); padding: 1.8rem 2.2rem; text-align: left; gap: 1rem; }
.intro-modal h2 { text-align: center; font-size: 2.3rem; }
.intro-lead { text-align: center; font-size: 1.35rem; line-height: 1.38; color: #ffe9c9; }
.intro-zones { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.intro-zones li {
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line);
  border-radius: 1rem; padding: .75rem .9rem; font-size: 1.1rem; line-height: 1.3;
}
.intro-zones b { display: block; font-size: 1.18rem; margin-bottom: .25rem; }
.intro-zones .z-steam b { color: #9fd0ff; }
.intro-zones .z-brown b { color: #8fe08f; }
.intro-zones .z-burn b { color: #ff9a80; }
.intro-how { margin: 0; font-size: 1.2rem; line-height: 1.35; color: #ffd79a; text-align: center; }
.intro-modal .btn.big { padding: .95rem 2.2rem; font-size: 1.45rem; }

.loading {
  position: fixed; inset: 0; z-index: 30; background: #1c130b;
  display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center;
  transition: opacity .4s;
}
.loading.gone { opacity: 0; pointer-events: none; }
.load-bar { width: min(320px, 70vw); height: 10px; border-radius: 6px; background: rgba(255,255,255,.12); overflow: hidden; }
.load-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffd27a, #f59b1e); transition: width .25s; }
.loading p { margin: 0; font-size: 13px; opacity: .8; }
