/* FLOBTRIS — neon 80s / outrun */

@font-face {
  font-family: 'Orbitron';
  src: url('fonts/Orbitron-Variable.ttf') format('truetype');
  font-weight: 500 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0D0221;
  --pink: #FF2975;
  --purple: #B026FF;
  --cyan: #2DE2E6;
  --yellow: #FFD319;
  --mint: #01F9C6;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[x-cloak] { display: none !important; }

html, body {
  height: 100%;
  background: var(--bg);
  color: #E8E3F5;
  font-family: 'Orbitron', 'Segoe UI', sans-serif;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

#bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.18) 0px,
    rgba(0, 0, 0, 0.18) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
}

.frame {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
}

.title {
  font-size: clamp(28px, 5vh, 48px);
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.12em;
  background: linear-gradient(180deg, #fff 0%, var(--cyan) 35%, var(--purple) 65%, var(--pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(176, 38, 255, 0.6));
}

.layout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 130px;
}

.panel {
  border: 1px solid rgba(45, 226, 230, 0.35);
  border-radius: 6px;
  background: rgba(13, 2, 33, 0.75);
  padding: 8px;
  box-shadow: 0 0 12px rgba(45, 226, 230, 0.12), inset 0 0 20px rgba(176, 38, 255, 0.05);
  text-align: center;
}

.panel h2 {
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(45, 226, 230, 0.7);
  margin-bottom: 6px;
}

.panel canvas { display: block; margin: 0 auto; }

.keys-hint p {
  font-size: 9px;
  line-height: 1.8;
  color: rgba(232, 227, 245, 0.65);
  letter-spacing: 0.05em;
}

.stats .stat-big {
  font-size: 18px;
  color: var(--yellow);
  text-shadow: 0 0 10px rgba(255, 211, 25, 0.7);
  margin-bottom: 8px;
}

.stats .stat-mid {
  font-size: 15px;
  color: #fff;
  margin-bottom: 8px;
}

.item-slot .slot-icon {
  font-size: 34px;
  line-height: 1.3;
  filter: grayscale(1) opacity(0.4);
  transition: filter 0.2s;
}

.item-slot.armed .slot-icon { filter: none; }

.item-slot.armed {
  border-color: var(--yellow);
  box-shadow: 0 0 16px rgba(255, 211, 25, 0.45), inset 0 0 24px rgba(255, 211, 25, 0.08);
  animation: armed-pulse 1.2s ease-in-out infinite;
}

@keyframes armed-pulse {
  50% { box-shadow: 0 0 26px rgba(255, 211, 25, 0.75), inset 0 0 24px rgba(255, 211, 25, 0.15); }
}

.item-slot .slot-name {
  font-size: 9px;
  letter-spacing: 0.15em;
  margin-top: 4px;
  color: rgba(232, 227, 245, 0.8);
}

.effects .effect-line {
  font-size: 10px;
  line-height: 2;
  color: var(--mint);
  text-shadow: 0 0 8px rgba(1, 249, 198, 0.6);
  white-space: nowrap;
}

.board-wrap {
  position: relative;
  border: 2px solid var(--purple);
  border-radius: 4px;
  box-shadow: 0 0 24px rgba(176, 38, 255, 0.5), inset 0 0 30px rgba(176, 38, 255, 0.08);
  line-height: 0;
}

#board {
  display: block;
  max-height: 76vh;
  width: auto;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 2, 33, 0.78);
  backdrop-filter: blur(2px);
  z-index: 20;
  line-height: 1.4;
}

.overlay-box {
  text-align: center;
  padding: 24px 28px;
  border: 1px solid rgba(45, 226, 230, 0.5);
  border-radius: 8px;
  background: rgba(13, 2, 33, 0.9);
  box-shadow: 0 0 30px rgba(45, 226, 230, 0.25);
}

.tagline {
  font-size: 14px;
  letter-spacing: 0.3em;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(45, 226, 230, 0.8);
  margin-bottom: 16px;
}

.tagline.small { font-size: 10px; margin-bottom: 10px; }

.final-score {
  font-size: 26px;
  color: var(--yellow);
  text-shadow: 0 0 12px rgba(255, 211, 25, 0.8);
  margin-bottom: 16px;
}

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.2em;
  padding: 10px 26px;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  border: none;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(255, 41, 117, 0.5);
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn:hover { transform: scale(1.05); box-shadow: 0 0 26px rgba(255, 41, 117, 0.8); }
.btn:active { transform: scale(0.97); }

.overlay-box .btn { display: block; margin-left: auto; margin-right: auto; }

.btn-small { font-size: 10px; padding: 8px 10px; letter-spacing: 0.1em; }

/* Spinner */
.spin-box {
  min-width: 220px;
  border-color: var(--yellow);
  box-shadow: 0 0 34px rgba(255, 211, 25, 0.35);
}

.spin-icon {
  font-size: 56px;
  line-height: 1.4;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

.spin-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.18em;
  margin-top: 8px;
  color: #fff;
}

.spin-box.landed-good {
  border-color: var(--mint);
  box-shadow: 0 0 40px rgba(1, 249, 198, 0.7);
  animation: landed-pop 0.25s ease-out;
}

.spin-box.landed-good .spin-name { color: var(--mint); text-shadow: 0 0 12px rgba(1, 249, 198, 0.9); }

.spin-box.landed-bad {
  border-color: var(--pink);
  box-shadow: 0 0 40px rgba(255, 41, 117, 0.7);
  animation: landed-shake 0.3s ease-out;
}

.spin-box.landed-bad .spin-name { color: var(--pink); text-shadow: 0 0 12px rgba(255, 41, 117, 0.9); }

@keyframes landed-pop {
  0% { transform: scale(0.9); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes landed-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.target-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: max-content;
  max-width: 92%;
  padding: 6px 16px;
  background: rgba(13, 2, 33, 0.92);
  border: 1px solid rgba(255, 41, 117, 0.5);
  border-radius: 999px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--pink);
  text-shadow: 0 0 10px rgba(255, 41, 117, 0.9);
  box-shadow: 0 0 14px rgba(255, 41, 117, 0.25);
  animation: banner-blink 0.8s step-end infinite;
  pointer-events: none;
}

@keyframes banner-blink { 50% { opacity: 0.35; } }

/* High scores */
.hiscores {
  margin: 0 auto 16px;
  min-width: 190px;
}

.hiscores h3 {
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--yellow);
  text-shadow: 0 0 8px rgba(255, 211, 25, 0.7);
  margin-bottom: 8px;
}

.hs-row {
  display: flex;
  gap: 10px;
  font-size: 12px;
  line-height: 1.9;
  color: #E8E3F5;
}

.hs-rank { color: var(--purple); width: 18px; text-align: right; }
.hs-name { color: var(--cyan); letter-spacing: 0.2em; }
.hs-score { margin-left: auto; color: var(--yellow); }

.hiscores-empty {
  font-size: 10px;
  letter-spacing: 0.15em;
  color: rgba(232, 227, 245, 0.5);
  margin-bottom: 16px;
}

.hint {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: rgba(232, 227, 245, 0.45);
  margin-top: 10px;
}

.rank-line {
  font-size: 13px;
  letter-spacing: 0.25em;
  color: var(--mint);
  text-shadow: 0 0 10px rgba(1, 249, 198, 0.8);
  margin: -8px 0 12px;
}

.glow-good {
  color: var(--mint);
  text-shadow: 0 0 12px rgba(1, 249, 198, 0.9);
  animation: banner-blink 1s step-end infinite;
}

/* Arcade initials entry */
.entry-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 6px 0 16px;
}

.entry-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.entry-letter {
  width: 44px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  border: 2px solid rgba(45, 226, 230, 0.4);
  border-radius: 6px;
  background: rgba(13, 2, 33, 0.9);
  cursor: pointer;
}

.entry-letter.active {
  border-color: var(--yellow);
  color: var(--yellow);
  box-shadow: 0 0 16px rgba(255, 211, 25, 0.5);
  animation: armed-pulse 1s ease-in-out infinite;
}

.entry-slot .arrow {
  font-family: inherit;
  font-size: 12px;
  padding: 4px 12px;
  color: var(--cyan);
  background: rgba(45, 226, 230, 0.08);
  border: 1px solid rgba(45, 226, 230, 0.4);
  border-radius: 4px;
  cursor: pointer;
}

.entry-slot .arrow:active { background: rgba(45, 226, 230, 0.3); }

.audio-btns { display: flex; gap: 6px; }
.audio-btns .btn-small { flex: 1; padding: 8px 4px; }

.tappable { cursor: pointer; }
.tappable:active { filter: brightness(1.3); }

.btn-ghosted {
  background: transparent;
  border: 1px solid rgba(255, 41, 117, 0.5);
  box-shadow: none;
  margin-top: 8px;
  font-size: 11px;
  padding: 8px 18px;
}

/* Help overlay */
.help-overlay {
  z-index: 30;
  padding: 10px;
}

.help-box {
  text-align: left;
  max-width: 280px;
  max-height: 100%; /* never taller than the board area — scrolls inside */
  overflow-y: auto;
}

.help-box .tagline { text-align: center; }

.help-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 10px;
  line-height: 1.6;
  margin-bottom: 8px;
  color: rgba(232, 227, 245, 0.85);
}

.help-icon { font-size: 16px; line-height: 1.2; }

.help-row .hg { color: var(--mint); font-weight: 800; }
.help-row .hb { color: var(--pink); font-weight: 800; }

.help-note {
  font-size: 9px;
  line-height: 1.8;
  text-align: center;
  color: rgba(232, 227, 245, 0.6);
  margin: 10px 0 14px;
}

.help-box .btn { display: block; margin: 0 auto; }

.challenge-banner {
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--yellow);
  text-shadow: 0 0 10px rgba(255, 211, 25, 0.7);
  margin: -8px 0 14px;
}

.challenge-standings {
  margin: 0 auto 14px;
  min-width: 190px;
}

.challenge-standings h3 {
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--mint);
  margin-bottom: 8px;
}

.hs-tries {
  color: rgba(232, 227, 245, 0.45);
  font-size: 10px;
  min-width: 28px;
  text-align: right;
}

.challenge-share { margin: 12px 0; }
.challenge-code {
  font-size: 22px;
  letter-spacing: 0.3em;
  color: var(--yellow);
  text-shadow: 0 0 12px rgba(255, 211, 25, 0.7);
  margin-bottom: 10px;
}

.submit-line {
  font-size: 11px;
  letter-spacing: 0.2em;
  margin: -6px 0 12px;
  color: var(--cyan);
}
.submit-line.accepted { color: var(--mint); }
.submit-line.rejected, .submit-line.error { color: var(--pink); }
.submit-line.pending, .submit-line.queued { color: var(--yellow); }
.submit-line.offline { color: rgba(232, 227, 245, 0.55); }

.mode-banner {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--pink);
  text-shadow: 0 0 8px rgba(255, 41, 117, 0.6);
  margin: -6px 0 12px;
}

.build-tag {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: rgba(232, 227, 245, 0.35);
  margin-top: -4px;
  margin-bottom: 2px;
}

/* Touch controls */
.touch-controls {
  display: none;
  gap: 8px;
  padding: 8px 0 4px;
}

.tbtn {
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  min-width: 52px;
  min-height: 52px;
  color: var(--cyan);
  background: rgba(13, 2, 33, 0.85);
  border: 1px solid rgba(45, 226, 230, 0.5);
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(45, 226, 230, 0.2);
  touch-action: none;
}

.tbtn:active { background: rgba(45, 226, 230, 0.25); }

@media (pointer: coarse), (max-width: 700px) {
  /* dvh = actual visible height (excludes browser chrome) — vh clipped the
     title at the top and buried the buttons under the bottom toolbar */
  .frame {
    height: 100dvh;
    justify-content: flex-start;
    gap: 4px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .touch-controls {
    display: flex;
    width: min(100%, 430px);
    justify-content: center;
    margin-top: auto; /* pin to the bottom of the visible area */
    padding: 4px 0 0;
  }
  .tbtn {
    flex: 1;
    min-width: 0;
    min-height: 54px;
    padding: 0 2px;
    font-size: 20px;
  }
  .side.side-left { display: none; }
  .side { width: 88px; gap: 6px; }
  .side canvas { width: 100%; height: auto; } /* shrink minis to column width */
  .layout { gap: 6px; }
  .title { font-size: clamp(16px, 3.2dvh, 28px); }
  #board { max-height: 52dvh; }
  .panel { padding: 5px; }
  .panel h2 { font-size: 9px; margin-bottom: 3px; }
  .stats .stat-big { font-size: 13px; margin-bottom: 4px; }
  .stats .stat-mid { font-size: 11px; margin-bottom: 4px; }
  .item-slot .slot-icon { font-size: 24px; }
  .item-slot .slot-name { font-size: 8px; }
  .effects .effect-line { font-size: 8px; }
  .audio-btns .btn-small { padding: 6px 2px; font-size: 9px; }
  .overlay-box {
    padding: 14px 12px;
    max-width: 96%;
  }
  .hiscores { min-width: 0; }
  .spin-box { min-width: 0; }
  .spin-icon { font-size: 42px; }
  .entry-letter { width: 38px; height: 46px; font-size: 24px; }
}
