@font-face {
  font-family: 'Fidget Display';
  font-style: normal;
  font-weight: 700;
  font-display: block;
  src: url('fonts/NotoSansTC-Bold.woff2') format('woff2');
}

:root {
  --bg-0: #0a0812;
  --bg-1: #120e1e;
  --metal-1: #1e1a2a;
  --metal-2: #2a2438;
  --metal-hi: #3c3450;
  --ink: #f4f0ff;
  --ink-dim: #9c93b5;
  --magenta: #ff2e6d;
  --cyan: #22e0ff;
  --gold: #ffcc33;
  --font-display: 'Fidget Display', 'PingFang HK', 'Heiti TC', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background-color: var(--bg-0);
  background-image:
    radial-gradient(circle at 50% 0%, rgba(26, 20, 40, 0.75) 0%, rgba(10, 8, 18, 0.85) 55%, rgba(5, 3, 8, 0.9) 100%),
    url('https://audio.zeytee.com/image.jpg');
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
  color: var(--ink);
  font-family: var(--font-display);
  overflow: hidden;
  touch-action: manipulation;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* ---------- ambient texture layers ---------- */

.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.0) 0px,
    rgba(0,0,0,0.0) 2px,
    rgba(0,0,0,0.18) 3px,
    rgba(0,0,0,0.0) 4px
  );
  opacity: 0.5;
}

/* ---------- cabinet chassis ---------- */

.cabinet {
  position: relative;
  width: min(92vw, 86vh, 460px);
  width: min(92vw, 86dvh, 460px);
  padding: 22px 22px 18px;
  border-radius: 28px;
  background: linear-gradient(155deg, var(--metal-2), var(--metal-1) 60%, #14101e);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 2px 0 rgba(255,255,255,0.06) inset,
    0 30px 60px -20px rgba(0,0,0,0.8),
    0 0 80px -10px rgba(255,46,109,0.15);
}

/* corner screws */
.cabinet::before,
.cabinet::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6a6280, #171320 70%);
  box-shadow: 0 1px 1px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,0,0,0.4);
  top: 14px;
}
.cabinet::before { left: 14px; }
.cabinet::after { right: 14px; }

/* ---------- marquee ---------- */

.marquee {
  position: relative;
  text-align: center;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
}

.marquee-tape {
  overflow: hidden;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  opacity: 0.55;
  margin-bottom: 6px;
}

.marquee-tape span {
  display: inline-block;
  padding-left: 100%;
  animation: tape-scroll 14s linear infinite;
}

@keyframes tape-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

.cabinet-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 8vw, 40px);
  color: var(--ink);
  text-shadow:
    0 0 6px rgba(255,255,255,0.5),
    0 0 18px rgba(255,46,109,0.55),
    0 0 40px rgba(34,224,255,0.25);
  animation: flicker 4.2s infinite steps(1);
}

.glow-word {
  color: var(--magenta);
  text-shadow:
    0 0 8px var(--magenta),
    0 0 22px var(--magenta),
    0 0 46px rgba(255,46,109,0.6);
}

@keyframes flicker {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: 0.55; }
  94% { opacity: 1; }
  96% { opacity: 0.7; }
  97% { opacity: 1; }
}

.cabinet-subtitle {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(34,224,255,0.7);
}

/* ---------- keypad grid ---------- */

.keypad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 2px 2px 14px;
}

.key {
  --key-hue: 200;
  --key-glow: #22e0ff;
  position: relative;
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 18px;
  padding: 0;
  cursor: pointer;
  background: linear-gradient(160deg, var(--metal-hi), var(--metal-1));
  box-shadow:
    0 10px 0 rgba(0,0,0,0.5),
    0 14px 24px -6px rgba(0,0,0,0.6);
  transform: translateY(0);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.key:hover .key-face {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--key-glow) 60%, transparent) inset,
    0 0 22px 2px color-mix(in srgb, var(--key-glow) 55%, transparent),
    0 6px 14px rgba(0,0,0,0.45) inset;
}

.key:active,
.key.is-pressed {
  transform: translateY(8px);
  box-shadow:
    0 2px 0 rgba(0,0,0,0.5),
    0 4px 10px -2px rgba(0,0,0,0.6);
}

.key-face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--key-glow) 22%, transparent), transparent 60%),
    linear-gradient(165deg, #2c2640, #17131f 80%);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--key-glow) 35%, transparent) inset,
    0 0 14px 0 color-mix(in srgb, var(--key-glow) 30%, transparent),
    0 6px 14px rgba(0,0,0,0.45) inset;
  overflow: hidden;
  transition: box-shadow 0.12s ease;
}

.key.is-pressed .key-face {
  box-shadow:
    0 0 0 2px var(--key-glow) inset,
    0 0 36px 4px color-mix(in srgb, var(--key-glow) 80%, transparent),
    0 6px 14px rgba(0,0,0,0.6) inset;
}

.key-shine {
  position: absolute;
  top: -40%;
  left: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%);
  transform: rotate(25deg);
  pointer-events: none;
}

.key-label {
  font-family: var(--font-display);
  font-size: clamp(30px, 9vw, 42px);
  color: var(--ink);
  text-shadow:
    0 0 8px color-mix(in srgb, var(--key-glow) 70%, transparent),
    0 0 20px color-mix(in srgb, var(--key-glow) 40%, transparent);
  letter-spacing: 0.05em;
  user-select: none;
  text-align: center;
  line-height: 1.15;
}

.key-label--stacked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05em;
}

.key-label-line {
  display: block;
}

.key-tag {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--ink-dim);
  opacity: 0.7;
}

/* ---------- counter strip ---------- */

.counter-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
}

.counter-label { opacity: 0.75; }

.counter-value {
  font-weight: 600;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255,204,51,0.6);
  min-width: 3.5ch;
  display: inline-block;
  text-align: center;
}

.counter-value.bump {
  animation: bump 0.22s ease;
}

@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.counter-divider {
  opacity: 0.3;
  margin: 0 2px;
}

.counter-hint {
  opacity: 0.5;
  font-size: 10px;
}

/* ---------- flying phrase burst ---------- */

#burst-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
}

.burst-phrase {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 700;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  animation: burst-up 0.9s cubic-bezier(.15,.8,.3,1) forwards;
}

@keyframes burst-up {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.6) rotate(var(--rot, -4deg));
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -60%) scale(1.15) rotate(var(--rot, -4deg));
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -160%) scale(1) rotate(var(--rot, -4deg));
  }
}

@media (max-width: 380px) {
  .cabinet { padding: 22px 16px 18px; }
}
