@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

/* ============================================================
   POLAR GAMES THEME
   - Icy blue / light-blue / white, Antarctic photo backdrop
   - Small radius, thin borders, no gradients-as-text, no blur glass
   ============================================================ */

:root {
  /* Background: deep polar-night navy */
  --bg-primary: #060c14;
  --bg-secondary: #0a1420;
  --bg-card: #0f1c2c;
  --bg-card-hover: #142e38;
  --bg-elevated: #1b2f45;

  /* PRIMARY = Ice blue */
  --orange-bright: #6fd0ff;
  --orange-main: #2fa8f0;
  --orange-dark: #1976c4;
  --orange-darker: #0d3d75;
  --orange-glow: rgba(111, 208, 255, 0.20);
  --orange-glow-strong: rgba(111, 208, 255, 0.36);

  /* SECONDARY = Frost white / snow */
  --teal: #e6f5ff;
  --teal-bright: #ffffff;
  --teal-dark: #a9cfe8;
  --teal-glow: rgba(230, 245, 255, 0.14);

  /* Text */
  --text-primary: #f3f9ff;
  --text-secondary: #aecbe0;
  --text-muted: #6c8aa3;

  /* Borders */
  --border: #1c2f42;
  --border-hover: #33526e;
  --border-bright: #6fd0ff;

  /* Accent colors */
  --gold: #f0c419;
  --red: #ef4444;
  --blue: #6fd0ff;
  --money: #4ade80;

  /* Legacy aliases -> ice blue tones */
  --green-bright: #6fd0ff;
  --green-main: #2fa8f0;
  --green-dark: #1976c4;
  --green-darker: #0d3d75;
  --green-glow: rgba(111, 208, 255, 0.18);
  --green-glow-strong: rgba(111, 208, 255, 0.32);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  font-size: 14.5px;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.01em;
  overflow-x: hidden;
  min-height: 100vh;
  line-height: 1.5;
  position: relative;
  background-image:
    linear-gradient(180deg, rgba(6,12,20,0.55) 0%, rgba(6,12,20,0.88) 45%, rgba(6,12,20,0.98) 100%),
    url('/img/antarctica-bg.jpg');
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ===================== BACKGROUND CANVASES -> HIDDEN ===================== */
#particles-canvas, #matrix-canvas {
  display: none;
}

/* ===================== NAVIGATION ===================== */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(7, 10, 16, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 100%;
}

.nav-logo::before {
  content: '❄️';
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #eaf7ff, var(--orange-main) 75%);
  box-shadow: 0 0 10px var(--orange-glow);
}

.nav-logo span {
  color: var(--text-secondary);
  font-weight: 500;
}

.nav-links {
  display: flex;
  gap: 2px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s;
  letter-spacing: -0.005em;
}

.nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-balance {
  display: flex;
  align-items: center;
  gap: 8px;
}

.balance-display {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-weight: 600;
  color: var(--money);
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0;
}

.bot-status {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 2s infinite;
}

.bot-status.online {
  background: var(--money);
  box-shadow: 0 0 6px var(--money);
}

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 17px;
  border: none;
  border-radius: 7px;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  text-decoration: none;
  letter-spacing: -0.005em;
  line-height: 1.4;
}

.btn-primary {
  background: var(--orange-main);
  color: #fff;
}

.btn-primary:hover {
  background: var(--orange-bright);
  box-shadow: 0 4px 16px rgba(33, 150, 243, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--border-hover);
  background: var(--bg-card);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-gold {
  background: rgba(240, 196, 25, 0.1);
  color: var(--gold);
  border: 1px solid rgba(240, 196, 25, 0.25);
}

.btn-gold:hover {
  background: rgba(240, 196, 25, 0.18);
}

.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* ===================== CARDS ===================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  transition: border-color 0.15s, background 0.15s;
}

.card:hover {
  border-color: var(--border-hover);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  letter-spacing: -0.015em;
}

/* ===================== STATS GRID ===================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  transition: border-color 0.15s;
}

.stat-card:hover {
  border-color: var(--border-hover);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  margin-bottom: 3px;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
}

/* ===================== HERO ===================== */
.hero {
  position: relative;
  z-index: 1;
  padding: 100px 32px 80px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 12px;
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 22px;
}

.hero-title {
  font-size: clamp(36px, 5.5vw, 68px);
  line-height: 1.02;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 18px;
  letter-spacing: -0.04em;
}

.hero-title .highlight {
  color: var(--orange-bright);
}

.hero-subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 540px;
  line-height: 1.6;
  margin-bottom: 32px;
  font-weight: 400;
  letter-spacing: -0.005em;
}

.hero-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===================== TABLES ===================== */
.table-container {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

table tr:hover td {
  background: var(--bg-card-hover);
}

table tr:last-child td { border-bottom: none; }

/* ===================== FORMS ===================== */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 5px;
  letter-spacing: -0.005em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  transition: border-color 0.12s, box-shadow 0.12s;
  outline: none;
  letter-spacing: -0.005em;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--orange-main);
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.12);
}

/* ===================== BADGES ===================== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
}

.badge-green { background: rgba(33, 150, 243, 0.1); color: var(--orange-bright); }
.badge-red { background: rgba(239, 68, 68, 0.1); color: var(--red); }
.badge-gold { background: rgba(240, 196, 25, 0.1); color: var(--gold); }
.badge-blue { background: rgba(91, 141, 239, 0.1); color: var(--blue); }
.badge-gray { background: rgba(95, 100, 112, 0.15); color: #a1a1ab; }

/* ===================== PAGE LAYOUT ===================== */
.page-wrapper {
  position: relative;
  z-index: 1;
  padding-top: 56px;
  min-height: 100vh;
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 32px;
}

@media (max-width: 768px) {
  .container { padding: 0 18px; }
}

.page-header {
  padding: 36px 0 24px;
  text-align: center;
}

.page-title {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.025em;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 400;
}

/* ===================== ALERTS ===================== */
.alert {
  padding: 11px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-weight: 500;
  font-size: 13.5px;
}

.alert-success { background: rgba(33, 150, 243, 0.06); border: 1px solid rgba(33, 150, 243, 0.2); color: var(--orange-bright); }
.alert-error { background: rgba(239, 68, 68, 0.06); border: 1px solid rgba(239, 68, 68, 0.2); color: var(--red); }
.alert-info { background: rgba(91, 141, 239, 0.06); border: 1px solid rgba(91, 141, 239, 0.2); color: var(--blue); }
.alert-warning { background: rgba(240, 196, 25, 0.06); border: 1px solid rgba(240, 196, 25, 0.2); color: var(--gold); }

/* ===================== LEADERBOARD ===================== */
.leaderboard-rank-1 td:first-child { color: var(--gold); }
.leaderboard-rank-2 td:first-child { color: #C0C0C0; }
.leaderboard-rank-3 td:first-child { color: #CD7F32; }

/* ===================== LOADING SPINNER ===================== */
.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--orange-main);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 28px auto;
}

/* ===================== CODE BOX ===================== */
.code-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
}

.code-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--orange-bright);
  letter-spacing: 6px;
  margin: 12px 0;
}

.code-instruction {
  font-size: 13.5px;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.3);
  border-radius: 7px;
  padding: 9px 14px;
  margin-top: 12px;
  border-left: 2px solid var(--orange-main);
}

/* ===================== GAME CARDS ===================== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  padding: 20px 0;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.game-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.game-icon {
  font-size: 32px;
  margin-bottom: 10px;
  display: block;
}

.game-card-title {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
  letter-spacing: -0.01em;
}

.game-card-desc {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.game-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ===================== TURN INDICATOR ===================== */
.turn-indicator { padding: 8px 16px; border-radius: 7px; font-weight: 600; font-size: 13.5px; text-align: center; margin-bottom: 14px; }
.your-turn { background: rgba(33, 150, 243, 0.08); border: 1px solid rgba(33, 150, 243, 0.25); color: var(--orange-bright); }
.opponent-turn { background: rgba(239, 68, 68, 0.06); border: 1px solid rgba(239, 68, 68, 0.2); color: var(--red); }

/* ===================== MODAL ===================== */
.deposit-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
}

.deposit-modal.open {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ===================== WALLET MODAL ===================== */
.wallet-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.wallet-section:last-child { border-bottom: none; margin-bottom: 0; }

/* ===================== ANIMATIONS ===================== */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 10px var(--orange-glow); }
  50% { box-shadow: 0 0 18px var(--orange-glow-strong); }
}

@keyframes codeGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

.animate-fade-in { animation: fadeIn 0.4s ease forwards; }
.animate-slide-in { animation: slideIn 0.25s ease forwards; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* ===================== TOAST ===================== */
.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  border-radius: 9px;
  padding: 11px 16px;
  min-width: 240px;
  max-width: 340px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: slideIn 0.25s ease;
  font-weight: 500;
  font-size: 13.5px;
}

.toast.success { border-left: 2px solid var(--orange-bright); }
.toast.error { border-left: 2px solid var(--red); }
.toast.info { border-left: 2px solid var(--blue); }

/* ===================== FOOTER ===================== */
footer {
  position: relative;
  z-index: 1;
  padding: 24px 32px;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12.5px;
}

footer a { color: var(--text-muted); text-decoration: none; }
footer a:hover { color: var(--text-secondary); }

/* ===================== UTILITY: legacy font overrides ===================== */
[style*="Orbitron"], [style*="Press Start"], [style*="VT323"] {
  font-family: 'Inter', sans-serif !important;
  letter-spacing: -0.025em !important;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  nav { padding: 0 18px; }
  .nav-links { display: none; }
  .hero { padding: 80px 18px 50px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .games-grid { grid-template-columns: 1fr; gap: 10px; }
}
