* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--background, #0b111c);
}

#sim-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#center-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 34px;
  font-family: 'DotGothic16', monospace;
  text-align: center;
  white-space: nowrap;
  z-index: 10;
}

#center-overlay::before {
  content: '';
  position: absolute;
  inset: -14px -26px;
  border-radius: 999px;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.08) 48%, rgba(255, 255, 255, 0) 76%);
  filter: blur(18px);
  z-index: -1;
  pointer-events: none;
}

#station-label {
  font-weight: 500;
  font-size: clamp(18px, 3.2vw, 28px);
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.52), 0 4px 12px rgba(0, 0, 0, 0.34);
  opacity: 1;
  transition: opacity 0.6s ease;
}

#station-label.fading {
  opacity: 0;
}

#tokyo-meta {
  font-weight: 400;
  font-size: clamp(11px, 1.5vw, 14px);
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55), 0 3px 8px rgba(0, 0, 0, 0.32);
}

#controls {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-btn {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 20, 30, 0.34);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: 'DotGothic16', monospace;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.84);
  cursor: pointer;
  opacity: 0.58;
  transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.pill-btn:hover {
  opacity: 1;
  background: rgba(15, 20, 30, 0.58);
  border-color: rgba(255, 255, 255, 0.45);
  color: #ffffff;
}

.cat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  line-height: 1;
}

.cat-btn.armed {
  opacity: 0.96;
  color: #ffffff;
  border-color: rgba(126, 194, 66, 0.84);
  background: rgba(126, 194, 66, 0.24);
  box-shadow: 0 0 0 1px rgba(126, 194, 66, 0.35), 0 0 10px rgba(126, 194, 66, 0.28);
}

.cat-btn.aboard {
  opacity: 0.92;
  color: #fff6dc;
  border-color: rgba(255, 214, 128, 0.72);
  background: rgba(255, 196, 92, 0.20);
}

.radio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  line-height: 1;
}

@keyframes radioPulse {
  0%, 100% {
    opacity: 0.62;
    border-color: rgba(116, 198, 255, 0.42);
  }
  50% {
    opacity: 0.96;
    border-color: rgba(116, 198, 255, 0.92);
  }
}

.radio-btn.loading {
  color: #dff2ff;
  background: rgba(88, 178, 248, 0.18);
  animation: radioPulse 1.2s ease-in-out infinite;
}

.radio-btn.playing {
  opacity: 0.96;
  color: #ffffff;
  border-color: rgba(116, 198, 255, 0.84);
  background: rgba(88, 178, 248, 0.24);
  box-shadow: 0 0 0 1px rgba(116, 198, 255, 0.34), 0 0 10px rgba(88, 178, 248, 0.28);
}

.radio-btn.error {
  opacity: 0.88;
  color: #ffd6d6;
  border-color: rgba(255, 112, 112, 0.72);
  background: rgba(255, 92, 92, 0.20);
}

.radio-menu {
  position: fixed;
  right: 12px;
  bottom: 44px;
  z-index: 25;
  min-width: 176px;
  max-width: calc(100vw - 24px);
  padding: 5px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 20, 30, 0.68);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.44);
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transform: translateY(6px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.radio-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.84);
  font-family: 'DotGothic16', monospace;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.radio-option:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.radio-option.active {
  background: rgba(88, 178, 248, 0.18);
  color: #ffffff;
}

.radio-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.22);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.radio-option.active .radio-dot {
  background: #74c6ff;
  box-shadow: 0 0 6px rgba(116, 198, 255, 0.85);
}

.radio-option[data-station="off"].active .radio-dot {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

#ad-lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(8, 12, 20, 0.36);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  opacity: 0;
  pointer-events: none;
  cursor: zoom-out;
  transition: opacity 0.28s ease;
}

#ad-lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

#ad-lightbox-img {
  max-width: min(86vw, 720px);
  max-height: 78vh;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.16);
  transform: scale(0.94);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

#ad-lightbox.open #ad-lightbox-img {
  transform: scale(1);
}
