/* ═══════════════════════════════════════════ */
/* پایه                                         */
/* ═══════════════════════════════════════════ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a0f;
  color: #f4f7ff;
  font-family: "Courier New", monospace;
  user-select: none;
  -webkit-user-select: none;
}

.hidden { display: none !important; }

/* ═══════════════════════════════════════════ */
/* کانواس بازی                                  */
/* ═══════════════════════════════════════════ */
#game-container,
#game-container canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  touch-action: none;
}

/* ═══════════════════════════════════════════ */
/* عنوان نئونی                                  */
/* ═══════════════════════════════════════════ */
.neon-title {
  font-size: clamp(38px, 8vw, 64px);
  font-weight: 900;
  color: #00ffff;
  text-align: center;
  text-shadow: 0 0 20px #00ffff, 0 0 5px #00ffff;
  animation: flicker 3s infinite;
}

.neon-title.magenta {
  color: #ff2bd6;
  text-shadow: 0 0 20px #ff2bd6, 0 0 5px #ff2bd6;
}

.neon-title.red {
  color: #ff304f;
  text-shadow: 0 0 20px #ff304f, 0 0 5px #ff304f;
}

.neon-title.small {
  font-size: clamp(28px, 6vw, 44px);
}

@keyframes flicker {
  0%, 92%, 96%, 100% { opacity: 1; }
  94% { opacity: 0.4; }
}

.subtitle {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  margin-top: 6px;
}
.subtitle.magenta { color: #ff2bd6; }

.best {
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  margin-top: 10px;
}

/* ═══════════════════════════════════════════ */
/* صفحه‌ها                                      */
/* ═══════════════════════════════════════════ */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  overflow-y: auto;
  background: rgba(5, 6, 15, 0.86);
  backdrop-filter: blur(3px);
  z-index: 10;
}

.screen.overlay {
  background: rgba(2, 3, 9, 0.78);
}

/* ═══════════════════════════════════════════ */
/* دکمه‌ها (HTML واقعی - بدون باگ مختصات!)      */
/* ═══════════════════════════════════════════ */
.btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: #f4f7ff;
  background: rgba(15, 20, 42, 0.88);
  border: 1.5px solid rgba(0, 255, 255, 0.52);
  border-radius: 10px;
  padding: 12px 22px;
  min-width: 150px;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.25);
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s;
}

.btn:hover {
  background: rgba(0, 255, 255, 0.14);
  box-shadow: 0 0 18px rgba(0, 255, 255, 0.5);
}

.btn:active { transform: scale(0.96); }

.btn-big {
  font-size: 22px;
  padding: 16px 40px;
  min-width: 260px;
}

.btn-primary {
  background: rgba(0, 255, 255, 0.16);
  border-color: #00ffff;
  box-shadow: 0 0 18px rgba(0, 255, 255, 0.45);
}

.btn-yellow {
  color: #ffe600;
  border-color: #ffe600;
  background: rgba(255, 230, 0, 0.10);
  box-shadow: 0 0 10px rgba(255, 230, 0, 0.3);
}

.btn-magenta {
  color: #ffd9f7;
  border-color: #ff2bd6;
  background: rgba(255, 43, 214, 0.12);
  box-shadow: 0 0 10px rgba(255, 43, 214, 0.35);
}

.btn-danger {
  color: #ffd4da;
  border-color: #ff304f;
  background: rgba(255, 48, 79, 0.12);
  box-shadow: 0 0 10px rgba(255, 48, 79, 0.3);
}

.btn-ghost {
  color: #7d86a8;
  border-color: rgba(125, 134, 168, 0.45);
  background: rgba(10, 10, 15, 0.45);
  box-shadow: none;
  min-width: 90px;
  font-size: 12px;
}

.icon-btn {
  font-family: inherit;
  width: 44px;
  height: 44px;
  font-size: 14px;
  color: #7d86a8;
  background: rgba(10, 10, 15, 0.5);
  border: 1px solid rgba(125, 134, 168, 0.45);
  border-radius: 8px;
  cursor: pointer;
}

.icon-btn:hover {
  color: #00ffff;
  border-color: #00ffff;
}

/* ═══════════════════════════════════════════ */
/* چیدمان‌ها                                    */
/* ═══════════════════════════════════════════ */
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.row.wrap { flex-wrap: wrap; }
.small-row { gap: 8px; }

.col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.col .btn { width: 100%; }

/* ═══════════════════════════════════════════ */
/* تابلو امتیاز                                 */
/* ═══════════════════════════════════════════ */
.board {
  width: min(560px, 92vw);
  background: rgba(8, 10, 24, 0.76);
  border: 1px solid rgba(125, 134, 168, 0.25);
  border-radius: 16px;
  padding: 14px 18px;
}

.board h2 {
  font-size: 14px;
  color: #00ffff;
  margin-bottom: 8px;
}

.board ol { list-style: none; }

.board li {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
}

.board li:nth-child(odd) { background: rgba(255, 255, 255, 0.03); }
.board li:first-child { color: #ffe600; font-weight: 800; }

.board li .nm { flex: 1; }
.board li .sc { color: #00ffff; font-weight: 800; width: 90px; text-align: right; }
.board li .cb { color: #ff2bd6; width: 50px; text-align: right; }
.board li .cr { color: #39ff88; width: 40px; text-align: right; }

/* ═══════════════════════════════════════════ */
/* متن‌های کوچک                                 */
/* ═══════════════════════════════════════════ */
.footnote {
  font-size: 10px;
  color: #7d86a8;
  text-align: center;
}

.hint {
  font-size: 12px;
  color: #7d86a8;
  text-align: center;
}

/* ═══════════════════════════════════════════ */
/* کارت‌های راهنما                              */
/* ═══════════════════════════════════════════ */
.cards {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.card {
  width: 240px;
  background: rgba(8, 10, 24, 0.78);
  border-radius: 16px;
  padding: 16px;
}

.card h2 {
  font-size: 16px;
  margin-bottom: 10px;
}

.card p {
  font-size: 13px;
  line-height: 1.8;
  color: #c5cbe2;
}

.card.cyan { border: 1px solid rgba(0, 255, 255, 0.4); }
.card.cyan h2 { color: #00ffff; }

.card.magenta { border: 1px solid rgba(255, 43, 214, 0.4); }
.card.magenta h2 { color: #ff2bd6; }

.card.yellow { border: 1px solid rgba(255, 230, 0, 0.4); }
.card.yellow h2 { color: #ffe600; }

/* ═══════════════════════════════════════════ */
/* پنل‌ها                                       */
/* ═══════════════════════════════════════════ */
.panel {
  background: rgba(7, 9, 22, 0.96);
  border: 1px solid rgba(0, 255, 255, 0.45);
  border-radius: 16px;
  padding: 26px 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  width: min(420px, 92vw);
}

.panel.wide { width: min(560px, 92vw); }

#entry-input {
  font-family: inherit;
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  color: #f4f7ff;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(0, 255, 255, 0.45);
  border-radius: 10px;
  padding: 12px;
  width: 100%;
  outline: none;
}

#entry-input:focus {
  border-color: #00ffff;
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.4);
}

.pause-score {
  font-size: 26px;
  font-weight: 900;
  color: #f4f7ff;
}

.record {
  color: #ffe600;
  font-weight: 900;
  font-size: 20px;
  text-shadow: 0 0 14px #ffe600;
}

.go-score {
  font-size: 44px;
  font-weight: 900;
  color: #00ffff;
  text-shadow: 0 0 18px #00ffff;
}

.stats {
  display: flex;
  gap: 18px;
  font-size: 14px;
  color: #7d86a8;
  flex-wrap: wrap;
  justify-content: center;
}

.stats b { color: #f4f7ff; }

.code {
  font-size: 26px;
  font-weight: 900;
  color: #dba1ff;
  text-shadow: 0 0 14px #bd4bff;
  letter-spacing: 3px;
}

/* ═══════════════════════════════════════════ */
/* HUD                                          */
/* ═══════════════════════════════════════════ */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

#hud-score {
  position: absolute;
  top: 16px;
  left: 20px;
  font-size: 30px;
  font-weight: 900;
  color: #00ffff;
  text-shadow: 0 0 14px #00ffff;
}

#hud-combo {
  position: absolute;
  top: 20px;
  right: 110px;
  font-size: 18px;
  font-weight: 800;
  color: #ff2bd6;
  text-shadow: 0 0 10px #ff2bd6;
}

#hud-powerups {
  position: absolute;
  top: 60px;
  left: 20px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.6;
}

#hud-right {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

#hud-speedbar {
  position: absolute;
  bottom: 16px;
  left: 20px;
  width: 200px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

#hud-speed-fill {
  height: 100%;
  width: 0%;
  background: #00ffff;
  border-radius: 3px;
  box-shadow: 0 0 8px #00ffff;
}

#hud-distance {
  position: absolute;
  bottom: 26px;
  right: 20px;
  font-size: 11px;
  color: #7d86a8;
}

#hud-mode {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 800;
  color: #ffe600;
}

/* ═══════════════════════════════════════════ */
/* Toast                                        */
/* ═══════════════════════════════════════════ */
#toast {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5, 6, 15, 0.92);
  border: 1px solid #00ffff;
  border-radius: 10px;
  padding: 10px 26px;
  font-size: 14px;
  font-weight: 800;
  color: #00ffff;
  box-shadow: 0 0 16px rgba(0, 255, 255, 0.4);
  z-index: 50;
}

/* ═══════════════════════════════════════════ */
/* موبایل                                       */
/* ═══════════════════════════════════════════ */
@media (max-width: 600px) {
  .btn {
    min-width: 120px;
    font-size: 13px;
    padding: 11px 16px;
  }
  .btn-big {
    min-width: 220px;
    font-size: 19px;
  }
  .card { width: 92vw; }
  #hud-combo { right: 100px; font-size: 15px; }
}
/* ═══ تب‌های تابلو امتیاز ═══ */
.board-tabs {
  margin-bottom: 8px;
  justify-content: flex-start;
}
.board-tabs .btn {
  min-width: 80px;
  padding: 6px 12px;
  font-size: 11px;
}
.tab-active {
  color: #00ffff;
  border-color: #00ffff;
  background: rgba(0, 255, 255, 0.12);
}