/* ==========================================================================
   CYBER PINBALL // Neon Matrix Overdrive Stylesheet
   One upright column on every screen. The whole window is the touch surface.
   ========================================================================== */

:root {
  --neon-cyan: #00f3ff;
  --neon-pink: #ff007f;
  --neon-yellow: #ffe600;
  --neon-green: #05ffa1;
  --neon-purple: #a824ff;
  --bg-dark: #05020c;
  --bg-card: rgba(14, 7, 28, 0.97);
  --border: rgba(0, 243, 255, 0.35);
  /* Tall enough for the table at its 9:16 ratio */
  --column-w: min(100vw, calc((100dvh - 88px) * 9 / 16));
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: radial-gradient(circle at 50% 25%, #18072e 0%, #090314 65%, #020106 100%);
  background-color: var(--bg-dark);
  color: #fff;
  font-family: 'Rajdhani', -apple-system, BlinkMacSystemFont, sans-serif;
}

#app {
  display: flex;
  flex-direction: column;
  width: var(--column-w);
  min-width: min(100vw, 320px);
  height: 100dvh;
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* HUD */
.hud {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 8px;
}

.stat {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-score {
  flex: 1;
}

.stat-label {
  color: rgba(255, 255, 255, 0.55);
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 1px;
}

.stat-value {
  overflow: hidden;
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stat-score .stat-value {
  font-size: 21px;
}

.cyan { color: var(--neon-cyan); }
.pink { color: var(--neon-pink); }
.yellow { color: var(--neon-yellow); }
.green { color: var(--neon-green); }

.hud-buttons {
  display: flex;
  flex: none;
  gap: 4px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 243, 255, 0.06);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.ticker {
  flex: none;
  height: 24px;
  overflow: hidden;
  border-top: 1px solid rgba(168, 36, 255, 0.4);
  border-bottom: 1px solid rgba(168, 36, 255, 0.4);
  color: var(--neon-yellow);
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 1px;
  line-height: 22px;
  text-align: center;
  white-space: nowrap;
}

/* Table */
#table-wrap {
  display: flex;
  flex: 1;
  justify-content: center;
  align-items: flex-start;
  min-height: 0;
}

#table {
  display: block;
}

.thumb-strip {
  display: none;
  flex: none;
  justify-content: space-between;
  padding: 3px 12px;
  color: rgba(0, 243, 255, 0.5);
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 1px;
}

/* Menus */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  justify-content: center;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 12px) 12px calc(env(safe-area-inset-bottom) + 12px);
  background: rgba(3, 1, 8, 0.8);
}

.modal.active {
  display: flex;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(420px, 100%);
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 20px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: 0 0 34px rgba(255, 0, 127, 0.25);
}

.card * {
  touch-action: pan-y;
}

.card-small {
  width: min(320px, 100%);
}

.title {
  color: #fff;
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;
  text-align: center;
  text-shadow: 0 0 12px var(--neon-pink);
}

.subtitle {
  color: var(--neon-cyan);
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 3px;
  text-align: center;
}

.how-to {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
  font-size: 16px;
}

.how-to strong {
  color: var(--neon-cyan);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(168, 36, 255, 0.1);
  font-size: 15px;
}

.badge {
  display: inline-block;
  min-width: 92px;
  margin-right: 6px;
  color: var(--neon-yellow);
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 700;
}

.btn {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px;
  border-radius: 10px;
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  border: none;
  background: linear-gradient(90deg, var(--neon-pink), var(--neon-purple));
  color: #fff;
}

.btn-secondary {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--neon-cyan);
}

.final-score {
  color: var(--neon-cyan);
  font-family: 'Orbitron', sans-serif;
  font-size: 32px;
  font-weight: 900;
  text-align: center;
}

.final-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  font-family: 'Orbitron', sans-serif;
  font-size: 8px;
  text-align: center;
}

.final-stats span {
  display: block;
  color: var(--neon-yellow);
  font-size: 18px;
  font-weight: 700;
}

.records {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-left: 22px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 15px;
}

.records li span {
  display: inline-block;
  min-width: 100px;
}

.records strong {
  color: var(--neon-green);
}

/* Touch or keyboard help */
.touch-only,
.controls.touch-only {
  display: none;
}

@media (pointer: coarse) {
  .keys-only,
  .controls.keys-only {
    display: none;
  }

  .controls.touch-only {
    display: flex;
  }

  .thumb-strip.touch-only {
    display: flex;
  }
}

/* Short screens: drop the extras so the buttons stay in reach */
@media (max-height: 640px) {
  .how-to {
    display: none;
  }

  .stat-high {
    display: none;
  }
}

/* Phones held sideways */
.rotate-prompt {
  display: none;
}

@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rotate-prompt {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    background: var(--bg-dark);
  }

  .rotate-phone {
    width: 38px;
    height: 64px;
    border: 3px solid var(--neon-cyan);
    border-radius: 7px;
    animation: rotate-hint 2.4s ease-in-out infinite;
  }

  .rotate-title {
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 2px;
  }

  .rotate-sub {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    letter-spacing: 1px;
  }
}

@keyframes rotate-hint {
  0%, 25% { transform: rotate(-90deg); }
  60%, 100% { transform: rotate(0deg); }
}
