:root {
  --bg: #0b0b0e;
  --bezel: #0e0e14;
  --accent: #23f5a1;
  --crt-glow: rgba(70, 255, 170, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(1200px 800px at 50% 30%, #101016 0%, #0a0a0d 60%, #050507 100%);
  display: grid;
  place-items: center;
  font-family: var(--screen-font, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  color: #cde3d9;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.frame {
  padding: 24px;
}

#bezel {
  position: relative;
  background: linear-gradient(180deg, #14141b, #0c0c11);
  border-radius: 18px;
  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.6),
    inset 0 0 0 2px rgba(255, 255, 255, 0.04),
    inset 0 0 30px rgba(0, 0, 0, 0.6);
  padding: 18px 22px 38px 22px;
  overflow: hidden;
  --crt-radius: 12px;
  --crt-vignette-gradient: radial-gradient(90% 70% at 50% 40%, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0.1) 52%, rgba(0, 0, 0, 0.42) 100%);
  --crt-vignette-opacity: 1;
  --crt-overlay-filter: contrast(1.05) saturate(1.12);
  --crt-aperture-opacity: 0.16;
  --crt-scanline-alpha: 0.16;
  --crt-scanline-spacing: 2px;
  --crt-scanline-thickness: 1px;
  --crt-noise-image: none;
  --crt-glow-shadow: inset 0 0 60px rgba(0, 0, 0, 0.6);
}

.screen {
  position: relative;
  display: inline-block;
  border-radius: 8px;
}

#bezel canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  border-radius: 8px;
  background: #000;
  box-shadow:
    0 0 32px var(--crt-glow),
    0 0 4px rgba(0, 255, 160, 0.2);
}

.screen .crt-overlay,
.screen .crt-glow {
  inset: 0;
  border-radius: inherit;
  z-index: 1;
}

.hud {
  position: absolute;
  inset: 10px 22px auto 22px;
  display: flex;
  justify-content: space-between;
  font-size: clamp(10px, 1.4vw, 14px);
  text-shadow: 0 0 4px rgba(0, 255, 180, 0.25);
  pointer-events: none;
  z-index: 3;
}

.instruction {
  position: absolute;
  bottom: 10px;
  left: 22px;
  right: 22px;
  font-size: clamp(9px, 1.3vw, 13px);
  opacity: 0.9;
  pointer-events: none;
  z-index: 3;
}

.overlay-ui {
  position: absolute;
  inset: 18px 22px 38px 22px;
  display: grid;
  place-items: center;
  z-index: 4;
  pointer-events: none;
}

.overlay-ui .panel {
  pointer-events: auto;
  width: min(90%, 520px);
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), inset 0 0 24px rgba(0, 0, 0, 0.4);
}

.overlay-ui .title {
  color: #fff;
  margin-bottom: 8px;
}

.overlay-ui .hint {
  margin-top: 10px;
  color: #9adbc9;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .frame {
    padding: 12px;
  }

  #bezel {
    padding: 12px 14px 24px 14px;
  }
}
