:root {
  --bg: #000000;
  --glass: #121215;
  --edge: rgba(255, 255, 255, 0.13);
  --fill-top: #f7f7f9;
  --fill-low: #bdbdc6;
  --heat: #ff7a2f;
  --ink: #f4f4f5;
  --muted: #8a8a93;
  --icon-dark: #1b1b1f;
  --icon-light: #a6a6ae;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 3.4vh, 22px);
}

.capsule {
  position: relative;
  width: clamp(84px, min(24vw, 16vh), 104px);
  height: min(300px, 60vh);
  border-radius: clamp(28px, 7vh, 34px);
  outline: none;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.capsule.is-held { cursor: grabbing; }

.capsule__glass {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, 0.07), transparent 60%),
    linear-gradient(180deg, #1a1a1e 0%, var(--glass) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 0 1px var(--edge),
    inset 0 -14px 28px rgba(0, 0, 0, 0.45),
    0 30px 60px -28px rgba(0, 0, 0, 0.9),
    0 2px 0 rgba(255, 255, 255, 0.03);
  transform-origin: 50% 100%;
  transition: box-shadow 0.35s ease;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
}
.capsule:focus-visible .capsule__glass {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 0 1px var(--edge),
    0 0 0 2px #000, 0 0 0 4px rgba(255, 255, 255, 0.55);
}
@media (hover: hover) {
  .capsule:hover .capsule__glass {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.2),
      inset 0 0 0 1px rgba(255, 255, 255, 0.2),
      inset 0 -14px 28px rgba(0, 0, 0, 0.45),
      0 30px 60px -28px rgba(0, 0, 0, 0.9);
  }
  .capsule:hover .capsule__sheen { transform: translateX(6%); opacity: 0.9; }
}

.capsule__svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.capsule__trail { fill: rgba(255, 255, 255, 0.14); }
.capsule__crest { fill: none; stroke: rgba(255, 255, 255, 0.9); stroke-width: 1; }
.capsule__heat { mix-blend-mode: normal; }

.capsule__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.03) 28%, transparent 46%, transparent 78%, rgba(255, 255, 255, 0.05) 100%);
  opacity: 0.7;
  transition: transform 0.6s cubic-bezier(.2, .8, .2, 1), opacity 0.4s ease;
}

.capsule__grip {
  position: absolute;
  left: 50%;
  top: 0;
  width: 30px;
  height: 4px;
  margin-left: -15px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.32);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.capsule__icon {
  position: absolute;
  left: 50%;
  bottom: clamp(12px, 3.4vh, 18px);
  width: 26px;
  height: 26px;
  margin-left: -13px;
  color: var(--icon-dark);
  transition: color 0.25s ease;
  pointer-events: none;
}
.capsule__icon.is-light { color: var(--icon-light); }
.capsule__icon svg { width: 100%; height: 100%; display: block; overflow: visible; }
.spk__body { fill: currentColor; }
.spk__arc, .spk__slash { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.spk__arc { transform-box: fill-box; transform-origin: 0% 50%; }
.spk__slash { stroke-dasharray: 25; stroke-dashoffset: 25; }

.readout { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.readout__num {
  font-size: clamp(20px, 4.4vh, 26px);
  font-weight: 560;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  min-width: 4ch;
  text-align: center;
}
.readout__room {
  font: inherit;
  font-size: 12.5px;
  font-weight: 450;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 4px 10px;
  border-radius: 99px;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.readout__room:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.5); outline-offset: 2px; }
@media (hover: hover) { .readout__room:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); } }

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #fff;
  stroke: #000;
  stroke-width: 1.2;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.capsule::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -18%;
  width: 150%;
  height: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 122, 47, 0.42), rgba(255, 122, 47, 0) 100%);
  filter: blur(8px);
  opacity: var(--hot, 0);
  pointer-events: none;
}
