@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Inter:wght@300;400;600;700&display=swap');

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

:root {
  --accent: #a855f7;
  --accent2: #f059da;
  --hot: #ff6b35;
  --cold: #4ecdc4;
  --correct: #00ff88;
  --bg: #08050f;
  --bg2: #120a1e;
  --card: rgba(168,85,247,0.07);
  --border: rgba(168,85,247,0.25);
  --text: #f0e8ff;
  --muted: #8b74b0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  font-family: 'Inter', sans-serif;
  color: var(--text);
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(168,85,247,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(240,89,218,0.1) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.game-wrapper {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 12px 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Header ── */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  font-family: 'Orbitron', monospace;
  font-size: 0.6rem;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(168,85,247,0.5);
  letter-spacing: 2px;
}

.game-title {
  font-family: 'Orbitron', monospace;
  font-size: 1.15rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  flex: 1;
}

.header-stats { display: flex; gap: 8px; }

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  min-width: 52px;
}

.stat-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.5rem;
  color: var(--muted);
  letter-spacing: 1px;
}

.stat-value {
  font-family: 'Orbitron', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(168,85,247,0.5);
}

/* ── Difficulty ── */
.difficulty-row {
  display: flex;
  gap: 8px;
}

.diff-btn {
  flex: 1;
  padding: 10px 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(168,85,247,0.05);
  color: var(--muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  line-height: 1.4;
}

.diff-btn small { font-size: 0.65rem; opacity: 0.8; }

.diff-btn:hover, .diff-btn.active {
  background: rgba(168,85,247,0.18);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 14px rgba(168,85,247,0.3);
}

/* ── Game Card ── */
.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 30px rgba(168,85,247,0.08);
}

/* ── Number reveal ── */
.number-reveal {
  font-family: 'Orbitron', monospace;
  font-size: 3.5rem;
  font-weight: 900;
  text-align: center;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(168,85,247,0.6), 0 0 60px rgba(168,85,247,0.2);
  letter-spacing: 4px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.number-reveal.win  { color: var(--correct); text-shadow: 0 0 30px rgba(0,255,136,0.7); }
.number-reveal.lose { color: var(--hot); text-shadow: 0 0 30px rgba(255,107,53,0.7); }

/* ── Hint bar ── */
.hint-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(168,85,247,0.15);
  min-height: 44px;
  transition: all 0.3s;
}

.hint-icon { font-size: 1.4rem; transition: transform 0.2s; }
.hint-text { font-size: 0.9rem; font-weight: 500; color: var(--text); flex: 1; }

.hint-bar.hot  { border-color: var(--hot);  background: rgba(255,107,53,0.12); }
.hint-bar.cold { border-color: var(--cold); background: rgba(78,205,196,0.12); }
.hint-bar.win  { border-color: var(--correct); background: rgba(0,255,136,0.12); }

/* ── Number line ── */
.number-line-wrap { padding: 0 4px; }
.number-line { display: flex; flex-direction: column; gap: 4px; }

.nl-track {
  position: relative;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: visible;
}

.nl-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nl-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: white;
  border: 2px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(168,85,247,0.6);
  transition: left 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}

.nl-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--muted);
  font-family: 'Orbitron', monospace;
}

/* ── Input ── */
.input-area { display: flex; gap: 8px; }

.guess-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0,0,0,0.4);
  color: var(--text);
  font-size: 1.1rem;
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: all 0.2s;
  -moz-appearance: textfield;
}
.guess-input::-webkit-inner-spin-button,
.guess-input::-webkit-outer-spin-button { display: none; }
.guess-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(168,85,247,0.3);
}

.check-btn {
  padding: 12px 22px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  font-family: 'Orbitron', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(168,85,247,0.4);
}

.check-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(168,85,247,0.5); }
.check-btn:active { transform: translateY(0); }
.check-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Stats row ── */
.stats-row {
  display: flex;
  gap: 8px;
  justify-content: space-around;
}

.mini-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.mini-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.5rem;
  color: var(--muted);
  letter-spacing: 1px;
}

.mini-val {
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.score-val { color: var(--accent); text-shadow: 0 0 8px rgba(168,85,247,0.5); }

/* ── Guess history ── */
.guess-history {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
}

.guess-chip {
  padding: 4px 10px;
  border-radius: 20px;
  font-family: 'Orbitron', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid;
  animation: chipIn 0.2s ease;
}

@keyframes chipIn {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.chip-hot  { background: rgba(255,107,53,0.15); border-color: var(--hot); color: var(--hot); }
.chip-cold { background: rgba(78,205,196,0.15); border-color: var(--cold); color: var(--cold); }
.chip-win  { background: rgba(0,255,136,0.15); border-color: var(--correct); color: var(--correct); }

/* ── Action row ── */
.action-row { display: flex; justify-content: center; }

.action-btn {
  padding: 10px 30px;
  border-radius: 10px;
  font-family: 'Orbitron', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn.secondary {
  background: rgba(168,85,247,0.1);
  border: 1px solid var(--border);
  color: var(--accent);
}

.action-btn.secondary:hover {
  background: rgba(168,85,247,0.2);
  box-shadow: 0 0 15px rgba(168,85,247,0.25);
}

/* ── Result overlay ── */
.result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.result-overlay.hidden { display: none; }

.result-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 0 60px rgba(168,85,247,0.2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.result-emoji { font-size: 3rem; }
.result-title { font-family: 'Orbitron', monospace; font-size: 1.3rem; font-weight: 900; color: var(--accent); }
.result-msg   { font-size: 0.9rem; color: var(--muted); }
.result-score { font-family: 'Orbitron', monospace; font-size: 0.8rem; color: var(--muted); }
.result-score-num { font-size: 1.5rem; font-weight: 900; color: var(--correct); margin-left: 6px; }

/* ── Confetti ── */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ── Shake animation ── */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.shake { animation: shake 0.35s ease; }

/* ── Mobile ── */
@media (max-width: 480px) {
  .game-title { font-size: 0.95rem; }
  .number-reveal { font-size: 2.8rem; }
  .game-card { padding: 18px 14px; gap: 12px; }
  .check-btn { padding: 12px 14px; font-size: 0.65rem; }
}

