@font-face {
  font-family: "Work Sans";
  src: url("/static/fonts/worksans-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --desk: #ece8de;
  --desk-2: #e2ddcf;
  --font-body: "Work Sans", system-ui, sans-serif;

  /* the shell */
  --shell: #c6ccb2;
  --shell-hi: #dbe0ca;
  --shell-lo: #9ba387;
  --shell-line: #7f866e;
  --ink: #3a4030;
  --ink-soft: #565d47;

  /* the recessed screen surround */
  --bezel: #565e49;
  --bezel-lo: #3f4636;
  --lcd: #9bbc0f;

  /* controls */
  --pad: #3f4247;
  --pad-hi: #565a60;
  --pad-lo: #2c2f33;
  --ab: #9e4b52;
  --ab-hi: #b4656c;
  --ab-lo: #7c3a40;
  --pill: #8f957f;
  --pill-lo: #717762;
  --led: #d1493f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(120% 120% at 50% 18%, var(--desk), var(--desk-2) 80%);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.4rem, 1.5vw, 1rem);
}

/* ---- the console ---- */
.device {
  container-type: inline-size;
  width: min(94vw, 26rem, 52dvh);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(0.7rem, 3.2cqw, 1.2rem);
  padding: clamp(0.95rem, 4.6cqw, 1.55rem) clamp(0.95rem, 4.6cqw, 1.6rem) clamp(1.05rem, 5cqw, 1.7rem);
  background:
    linear-gradient(180deg, var(--shell-hi), var(--shell) 42%, var(--shell) 66%, var(--shell-lo));
  border: 1px solid var(--shell-line);
  border-radius: 0.7rem 2.4rem 0.9rem 0.9rem;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    inset 0 -6px 14px rgba(60, 70, 40, 0.18),
    0 18px 30px rgba(40, 45, 30, 0.28),
    0 3px 8px rgba(40, 45, 30, 0.25);
  position: relative;
  touch-action: manipulation;
}

/* top row: power lamp, "dot matrix" line, sound switch */
.toprow {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: clamp(0.5rem, 2.1cqw, 0.66rem);
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  font-weight: 600;
}
.led {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8f86, var(--led) 60%, #8f2a22);
  box-shadow: 0 0 0.5rem rgba(209, 73, 63, 0.7), inset 0 0 2px rgba(0, 0, 0, 0.4);
}
.dmx { margin-left: 0.15rem; }
.sound {
  margin-left: auto;
  font: inherit;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(180deg, var(--shell-hi), var(--shell-lo));
  border: 1px solid var(--shell-line);
  border-radius: 0.4rem;
  padding: 0.28rem 0.6rem;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
}
.sound[aria-pressed="false"] { color: var(--ink-soft); opacity: 0.75; }

/* brand line */
.brand {
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.32em;
  font-size: clamp(1rem, 4.4cqw, 1.3rem);
  color: var(--ink);
  text-indent: 0.32em; /* optically re-centres tracked type */
}
.brand b {
  color: var(--ab);
  font-style: italic;
  letter-spacing: 0.24em;
}

/* the screen */
.screen {
  background:
    linear-gradient(180deg, var(--bezel-lo), var(--bezel));
  border-radius: 0.5rem;
  padding: clamp(0.55rem, 3.2cqw, 0.9rem) clamp(0.7rem, 4cqw, 1.1rem);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.screen::before {
  content: "";
  display: block;
  text-align: right;
  font-size: clamp(0.42rem, 1.9cqw, 0.55rem);
  letter-spacing: 0.28em;
  color: rgba(255, 255, 255, 0.32);
  font-weight: 600;
  margin-bottom: clamp(0.35rem, 1.8cqw, 0.5rem);
  padding-right: 0.2rem;
}
.lcd {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 160 / 144;
  background: var(--lcd);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  box-shadow: inset 0 0 12px rgba(20, 40, 10, 0.35);
}

/* controls block */
.controls {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.15rem, 5.2cqw, 1.75rem);
}
.crow {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* D-pad */
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 15cqw);
  grid-template-rows: repeat(3, 15cqw);
  filter: drop-shadow(0 2px 2px rgba(40, 45, 30, 0.35));
}
.dkey {
  border: none;
  background: linear-gradient(180deg, var(--pad-hi), var(--pad) 55%, var(--pad-lo));
  color: transparent;
  padding: 0;
  margin: 0;
  font-size: 0;
  cursor: pointer;
  touch-action: none;
}
.dkey.center {
  grid-column: 2;
  grid-row: 2;
  background:
    radial-gradient(circle at 50% 45%, var(--pad-hi) 0 42%, var(--pad) 70%);
  border-radius: 0;
}
.dkey.up { grid-column: 2; grid-row: 1; border-radius: 0.5rem 0.5rem 0 0; }
.dkey.down { grid-column: 2; grid-row: 3; border-radius: 0 0 0.5rem 0.5rem; }
.dkey.left { grid-column: 1; grid-row: 2; border-radius: 0.5rem 0 0 0.5rem; }
.dkey.right { grid-column: 3; grid-row: 2; border-radius: 0 0.5rem 0.5rem 0; }
.dkey:active { filter: brightness(0.82); }

/* A / B buttons */
.ab {
  display: flex;
  gap: clamp(0.55rem, 2.8cqw, 1rem);
  transform: rotate(-25deg);
  filter: drop-shadow(0 3px 3px rgba(40, 45, 30, 0.4));
}
.abkey {
  width: clamp(54px, 17cqw, 70px);
  height: clamp(54px, 17cqw, 70px);
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 34% 30%, var(--ab-hi), var(--ab) 55%, var(--ab-lo));
  box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.35), inset 0 2px 3px rgba(255, 255, 255, 0.25);
  color: rgba(255, 240, 240, 0.85);
  font-weight: 800;
  font-size: clamp(0.9rem, 4.2cqw, 1.1rem);
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: none;
}
.abkey:active { filter: brightness(0.85) translateY(1px); }
.abkey.b { transform: translateY(0.9rem); }

/* select / start pills */
.ss {
  display: flex;
  gap: clamp(0.7rem, 3cqw, 1.1rem);
  transform: rotate(-25deg);
}
.pill {
  width: clamp(44px, 13cqw, 58px);
  height: 0.9rem;
  min-height: 0;
  border: none;
  border-radius: 0.6rem;
  background: linear-gradient(180deg, var(--pill), var(--pill-lo));
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.3);
  cursor: pointer;
  position: relative;
  touch-action: none;
}
.pill::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  top: -1.15rem;
  transform: translateX(-50%) rotate(25deg);
  font-size: clamp(0.44rem, 2cqw, 0.6rem);
  letter-spacing: 0.18em;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
}
.pill:active { filter: brightness(0.85); }

/* speaker grille, decorative */
.speaker {
  position: absolute;
  right: clamp(0.4rem, 2cqw, 0.9rem);
  bottom: -0.2rem;
  width: clamp(2.4rem, 11cqw, 3.4rem);
  height: clamp(2.4rem, 11cqw, 3.4rem);
  transform: rotate(-25deg);
  background: repeating-linear-gradient(
    -25deg,
    transparent 0 3px,
    rgba(60, 70, 40, 0.32) 3px 4px
  );
  border-radius: 0.4rem;
  opacity: 0.5;
  pointer-events: none;
}

@media (max-height: 560px) {
  .device { width: min(92vw, 20rem); }
  .ss { display: none; }
}
