:root {
  --bg: #000000;
  --card: #14151a;
  --ink: #f3f4f1;
  --soft: rgba(243, 244, 241, 0.55);
  --line: rgba(243, 244, 241, 0.12);
  --live: #36d399;
  --test: #ffb020;
  --tone: var(--live);
}

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

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 10px 12px;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; outline: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.tm { position: relative; width: min(318px, 100%); border-radius: 24px; background: linear-gradient(165deg, #1b1c22, var(--card) 60%); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 34px 54px -34px color-mix(in srgb, var(--tone) 34%, transparent); overflow: hidden; transition: box-shadow 0.4s; }
.tm[data-mode="test"] { --tone: var(--test); }

/* the test band: zero tall in live mode, the script opens it */
.tm__band { position: relative; height: 0; overflow: hidden; background: var(--test); color: #1c1300; }
.tm__stripes { position: absolute; inset: 0 -40px; background: repeating-linear-gradient(-45deg, rgba(28, 19, 0, 0.16) 0 10px, rgba(28, 19, 0, 0) 10px 20px); }
.tm__note { position: absolute; left: 0; right: 0; bottom: 0; display: grid; place-items: center; height: 30px; font-size: 12px; font-weight: 720; letter-spacing: 0.01em; white-space: nowrap; }

.tm__in { padding: 16px 16px 16px; }
.tm__head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.tm__brand { display: grid; gap: 1px; }
.tm__brand strong { font-size: 15px; font-weight: 700; letter-spacing: -0.005em; white-space: nowrap; }
.tm__env { display: block; height: 15px; overflow: hidden; font-size: 11.5px; line-height: 15px; font-weight: 600; color: var(--tone); transition: color 0.3s; }
.tm__env span { display: block; }
.tm__switch { display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 4px 0 2px; border-radius: 18px; }
.tm__label { font-size: 12.5px; font-weight: 620; color: var(--soft); white-space: nowrap; transition: color 0.25s; }
.tm[data-mode="test"] .tm__label { color: var(--ink); }
.tm__track { position: relative; display: block; flex: none; width: 46px; height: 28px; border-radius: 14px; background: rgba(243, 244, 241, 0.16); box-shadow: inset 0 0 0 1px var(--line), inset 0 2px 4px rgba(0, 0, 0, 0.4); transition: background-color 0.3s; }
.tm[data-mode="test"] .tm__track { background: var(--test); }
.tm__knob { position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 11px; background: #ffffff; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); }
.tm__switch:focus-visible .tm__track { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--tone); }

.tm__cap { display: block; font-size: 11.5px; color: var(--soft); }
.tm__stat { display: grid; gap: 2px; margin-top: clamp(10px, 3.4vh, 18px); }
.tm__stat strong { font-size: clamp(30px, 9.500vh, 38px); line-height: 1.05; font-weight: 720; font-stretch: 88%; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.tm__sub { font-size: 12px; color: var(--soft); font-variant-numeric: tabular-nums; }
.tm__sub b { font-weight: 660; color: var(--ink); }
.tm__key { display: grid; gap: 6px; margin-top: clamp(10px, 3vh, 16px); }
.tm__key code { display: block; height: 38px; padding: 0 12px; border-radius: 11px; background: rgba(0, 0, 0, 0.4); box-shadow: inset 0 0 0 1px var(--line), inset 3px 0 0 var(--tone); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 38px; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: box-shadow 0.3s; }

/* an empty box as big as the card with its band open: the preview frames this */
.frame { position: absolute; left: 50%; top: 50%; width: 334px; height: 262px; margin: -131px 0 0 -167px; pointer-events: none; }
.live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ghost { position: absolute; left: 0; top: 0; width: 24px; height: 24px; margin: -3px 0 0 -5px; transform-origin: 20% 15%; pointer-events: none; opacity: 0; fill: #ffffff; stroke: #0b0b0d; stroke-width: 1.300; stroke-linejoin: round; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); z-index: 6; }

@media (prefers-reduced-motion: reduce) { .tm, .tm__env, .tm__label, .tm__track, .tm__key code { transition: none; } }
