:root {
  color-scheme: dark;
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, Helvetica, sans-serif;
  background: #070611;
  color: #eef5ff;
  --cyan: #22f3ff;
  --magenta: #ff2a9d;
  --amber: #ffd447;
  --panel: #100e22;
  --border: #2c2552;
  --muted: #939bc2;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background:
    radial-gradient(ellipse at 50% 12%, rgba(255, 42, 157, 0.22), transparent 58%),
    radial-gradient(ellipse at 16% 84%, rgba(34, 243, 255, 0.14), transparent 50%),
    radial-gradient(ellipse at 86% 78%, rgba(124, 58, 237, 0.2), transparent 52%),
    #070611;
}

main {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 6px 10px;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--cyan); }

.label {
  font: 10px monospace;
  letter-spacing: 2px;
  color: var(--muted);
  margin: 2px 0 0;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(90, 82, 155, 0.35);
}

h1 {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-weight: 900;
  font-style: italic;
  font-size: 24px;
  letter-spacing: -0.5px;
  line-height: 1;
  margin: 0;
  background: linear-gradient(95deg, #22f3ff 0%, #ffffff 48%, #ff2a9d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 12px rgba(34, 243, 255, 0.35));
}

h1 span {
  font-family: monospace;
  font-style: normal;
  font-size: 9px;
  letter-spacing: 3px;
  display: block;
  margin-top: 5px;
  color: #cbd5ff;
}

.heading-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.arcade-exit {
  font: 600 10px monospace;
  color: #ff9fd2;
  background: rgba(74, 14, 52, 0.65);
  border: 1px solid rgba(255, 42, 157, 0.45);
  padding: 5px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  transition: border-color 0.14s, color 0.14s, background 0.14s, box-shadow 0.14s;
}

.arcade-exit:hover {
  border-color: var(--magenta);
  background: rgba(116, 20, 78, 0.85);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(255, 42, 157, 0.35);
}

button {
  font: 600 11px monospace;
  color: #e9f2ff;
  background: rgba(20, 17, 44, 0.88);
  border: 1px solid #3c3470;
  padding: 7px 10px;
  cursor: pointer;
  border-radius: 7px;
  touch-action: none;
  transition: border-color 0.14s, background 0.14s, box-shadow 0.14s, transform 0.08s;
}

.heading-actions button {
  font-size: 10px;
  padding: 5px 8px;
  border-radius: 6px;
}

button:hover {
  border-color: var(--cyan);
  background: rgba(28, 32, 74, 0.94);
  box-shadow: 0 0 14px rgba(34, 243, 255, 0.22);
}

button:active { transform: translateY(1px); }

.machine {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr) 224px;
  gap: 10px;
  min-height: 0;
  height: 100%;
  align-items: stretch;
}

aside {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(19, 16, 40, 0.88), rgba(10, 9, 24, 0.94));
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  min-height: 0;
}

.hud-left strong {
  font: 900 28px monospace;
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(34, 243, 255, 0.45);
  line-height: 1.05;
}

.hud-left b {
  font: 700 17px monospace;
  color: #f4f7ff;
}

.hud-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 7px 0 3px;
  border-top: 1px solid rgba(90, 82, 155, 0.35);
}

.hud-row .label { font-size: 9px; margin: 0 0 2px; }
.hud-row b { font-size: 14px; }
#gear { color: var(--amber); }
#speed { color: var(--magenta); }

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.pill {
  font: 700 9.5px monospace;
  letter-spacing: 0.7px;
  padding: 3.5px 6.5px;
  border-radius: 999px;
  background: rgba(25, 22, 48, 0.9);
  border: 1px solid #352e64;
  color: #6d749c;
  transition: all 0.16s;
}

.pill.on {
  color: #06121a;
  background: var(--cyan);
  border-color: #a6fbff;
  box-shadow: 0 0 12px rgba(34, 243, 255, 0.55);
}

.pill.hot {
  color: #fff;
  background: var(--magenta);
  border-color: #ff9dd2;
  box-shadow: 0 0 14px rgba(255, 42, 157, 0.65);
}

.rule {
  height: 1px;
  background: rgba(90, 82, 155, 0.35);
  margin: 2px 0;
}

.status-label { margin: 2px 0 0; }
#status {
  margin: 0 0 4px;
  min-height: 30px;
  font: 600 11px/1.35 monospace;
  color: #d7e4ff;
}

#start, #play {
  background: linear-gradient(135deg, #22f3ff, #ff2a9d);
  color: #080614;
  font-weight: 900;
  border: none;
  box-shadow: 0 0 20px rgba(34, 243, 255, 0.35);
}

#start:hover, #play:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 26px rgba(255, 42, 157, 0.5);
}

#table {
  position: relative;
  min-height: 0;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #3a2f6e;
  background: radial-gradient(circle at 50% 35%, #161134, #070611 72%);
  box-shadow:
    0 0 0 1px rgba(34, 243, 255, 0.16),
    0 20px 55px rgba(0, 0, 0, 0.72),
    inset 0 0 40px rgba(255, 42, 157, 0.12);
}

#table.multiball {
  border-color: var(--magenta);
  box-shadow:
    0 0 26px rgba(255, 42, 157, 0.5),
    0 0 50px rgba(34, 243, 255, 0.3);
}

.gl-canvas, .hud-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hud-canvas { pointer-events: none; }

#overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  background: radial-gradient(circle at 50% 45%, rgba(16, 12, 36, 0.84), rgba(6, 5, 16, 0.94));
  backdrop-filter: blur(5px);
}

#overlay p {
  font: 700 11px monospace;
  letter-spacing: 3px;
  color: var(--cyan);
  margin: 0 0 8px;
}

#overlay h2 {
  font: italic 900 42px/1 'Segoe UI', system-ui, sans-serif;
  margin: 0 0 12px;
  background: linear-gradient(95deg, #22f3ff, #ffffff, #ff2a9d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

#overlay span {
  max-width: 390px;
  font: 500 13px/1.55 system-ui, sans-serif;
  color: #cdd6f6;
  margin-bottom: 20px;
}

#play {
  padding: 13px 26px;
  font-size: 14px;
  letter-spacing: 1px;
  border-radius: 10px;
}

.instructions .bolt-mark {
  font-size: 22px;
  line-height: 1;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(34, 243, 255, 0.7);
}

.instructions h2 {
  margin: 0 0 2px;
  font: italic 900 20px/1.05 'Segoe UI', system-ui, sans-serif;
  color: #ffffff;
}

.instructions p {
  margin: 0;
  font: 400 11.5px/1.45 system-ui, sans-serif;
  color: #bcc6ea;
}

.instructions strong { color: #ffffff; }
.instructions em { color: var(--cyan); font-style: normal; font-weight: 700; }

.keys {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid rgba(90, 82, 155, 0.35);
  font: 600 10.5px monospace;
  color: var(--muted);
}

kbd {
  display: inline-block;
  padding: 1.5px 4.5px;
  border-radius: 4px;
  background: #1b1738;
  border: 1px solid #483d82;
  color: #eef5ff;
  font: 700 9.5px monospace;
}

/* Hide touch controls on desktop so the pinball machine runs edge-to-edge full height! */
.touch-bar {
  display: none;
  grid-template-columns: 1fr 1.2fr 0.9fr 1fr;
  gap: 8px;
}

.touch-bar button {
  padding: 11px 8px;
  font-size: 12px;
  letter-spacing: 1px;
}

/* Keep the playfield and touch controls together on phones and tablets. */
@media (pointer: coarse), (max-width: 980px) {
  html, body { overflow: hidden; }
  main { height: 100dvh; min-height: 0; padding: 8px; grid-template-rows: minmax(0, 1fr) auto; gap: 6px; }
  .machine { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 6px; }
  .hud-left { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; padding: 8px 10px; overflow: visible; }
  .hud-left .brand { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; gap: 6px; }
  .brand h1 { font-size: 14px; letter-spacing: -.5px; white-space: nowrap; }
  .brand h1 span { display: none; }
  .heading-actions { flex-wrap: nowrap; gap: 4px; }
  .heading-actions button, .heading-actions a { font-size: 9px; min-height: 28px; padding: 4px 5px; }
  .hud-left > .label, .hud-left > #best, .hud-left > .rule,
  .hud-left > .status-pills, .hud-left > #start { display: none; }
  .hud-left > #score { grid-column: 1; grid-row: 2; align-self: center; font-size: 24px; }
  .hud-left > #pause { grid-column: 1; grid-row: 3; min-height: 26px; padding: 3px 8px; font-size: 10px; }
  .hud-left > #status { grid-column: 1 / -1; grid-row: 4; min-height: 0; margin: 0; font-size: 10px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hud-row { grid-column: 2; grid-row: 2; gap: 12px; padding: 0; border: 0; }
  .hud-row .label { font-size: 8px; letter-spacing: .5px; }
  .hud-row b { font-size: 12px; }
  .hud-left .az-scores-launch { grid-column: 2; grid-row: 3; padding: 3px 8px; min-height: 26px; font-size: 10px; margin: 0; }
  #table { min-height: 0; height: 100%; }
  .instructions { display: none; }
  .touch-bar { display: grid; padding-bottom: env(safe-area-inset-bottom, 0px); gap: 5px; }
  .touch-bar button { padding: 8px 4px; min-height: 44px; font-size: 11px; letter-spacing: 0; }
}
