/* ============================================================
   NAVAL STRIKE — Cyberpunk Battleship Theme
   ============================================================ */

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

:root {
  /* Core palette */
  --bg-deep:    #06080f;
  --bg-surface: #0c1020;
  --bg-card:    #111630;
  --bg-hover:   #181e45;
  --border:     #1a2255;
  --border-bright: #2a3680;

  /* Neons */
  --cyan:       #00f0ff;
  --cyan-dim:   #007a82;
  --magenta:    #ff2daa;
  --magenta-dim:#8a1860;
  --gold:       #ffd700;
  --green:      #00ff88;
  --red:        #ff3355;
  --blue:       #4477ff;

  /* Text */
  --text:       #c8d0e8;
  --text-dim:   #6a7499;
  --text-bright:#eaf0ff;

  /* Grid */
  --cell-size:  42px;
  --grid-gap:   3px;
  --board-pad:  8px;

  /* Sizing */
  --header-h:   64px;

  /* Glow */
  --glow-cyan:   0 0 20px rgba(0,240,255,.35), 0 0 60px rgba(0,240,255,.12);
  --glow-mag:    0 0 20px rgba(255,45,170,.35), 0 0 60px rgba(255,45,170,.12);
  --glow-gold:   0 0 20px rgba(255,215,0,.35), 0 0 60px rgba(255,215,0,.12);
}

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

html { font-size: 16px; }

body {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 500;
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background grid pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(0,240,255,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,240,255,.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* Subtle radial glow */
body::after {
  content: '';
  position: fixed;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  width: 120vw;
  height: 80vh;
  background: radial-gradient(ellipse at center, rgba(0,240,255,.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* ============================================================
   SCREENS
   ============================================================ */
.screen {
  display: none;
  position: relative;
  z-index: 2;
  min-height: 100vh;
  animation: fadeIn .4s ease;
}
.screen.active { display: block; }

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

/* ============================================================
   LANDING SCREEN
   ============================================================ */
.landing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
  gap: 40px;
}

.logo-wrap {
  text-align: center;
  position: relative;
}

.logo-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 200px;
  background: radial-gradient(ellipse at center, rgba(0,240,255,.15) 0%, transparent 70%);
  filter: blur(40px);
  pointer-events: none;
}

.logo {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(3rem, 8vw, 6rem);
  letter-spacing: .08em;
  color: var(--text-bright);
  text-shadow: 0 0 40px rgba(0,240,255,.4);
  position: relative;
}

.logo-accent {
  color: var(--cyan);
  text-shadow: 0 0 40px rgba(0,240,255,.6), 0 0 80px rgba(0,240,255,.3);
}

.tagline {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.1rem;
  color: var(--text-dim);
  letter-spacing: .15em;
  text-transform: uppercase;
  margin-top: 8px;
}

/* Wallet */
.wallet-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.wallet-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.wallet-address {
  font-family: 'Share Tech Mono', monospace;
  font-size: .85rem;
  color: var(--cyan);
  letter-spacing: .05em;
}

.wallet-balance {
  font-family: 'Orbitron', sans-serif;
  font-size: .95rem;
  color: var(--text-bright);
}

.bal-sep {
  color: var(--text-dim);
  margin: 0 8px;
}

.wallet-icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
}

/* Menu */
.menu-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
  max-width: 680px;
  animation: fadeIn .5s ease;
}

.section-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--text-bright);
  text-transform: uppercase;
  letter-spacing: .1em;
  text-align: center;
}

/* Mode Cards */
.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  width: 100%;
}

.mode-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .25s ease;
  position: relative;
  overflow: hidden;
}

.mode-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top center, rgba(0,240,255,.05) 0%, transparent 60%);
  opacity: 0;
  transition: opacity .25s ease;
}

.mode-card:hover, .mode-card.selected {
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
  transform: translateY(-4px);
}
.mode-card:hover::before, .mode-card.selected::before { opacity: 1; }

.mode-card.selected {
  border-color: var(--cyan);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(0,240,255,.08) 100%);
}

.mode-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 12px rgba(0,240,255,.4));
}

.mode-card h3 {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-bright);
  margin-bottom: 6px;
}

.mode-card p {
  font-size: .95rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.mode-tag {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-family: 'Share Tech Mono', monospace;
  font-size: .75rem;
  letter-spacing: .08em;
  background: rgba(0,240,255,.1);
  color: var(--cyan);
  border: 1px solid rgba(0,240,255,.2);
}

.mode-tag-hot {
  background: rgba(255,45,170,.1);
  color: var(--magenta);
  border-color: rgba(255,45,170,.25);
}

/* Bet Section */
.bet-section {
  width: 100%;
  animation: fadeIn .3s ease;
}

.bet-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}

.token-select {
  display: flex;
  gap: 8px;
}

.token-btn {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: .85rem;
  padding: 10px 28px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .2s ease;
  letter-spacing: .08em;
}

.token-btn.active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0,240,255,.08);
  box-shadow: 0 0 12px rgba(0,240,255,.2);
}

.token-btn:hover:not(.active) {
  border-color: var(--border-bright);
  color: var(--text);
}

.bet-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 8px 20px;
  transition: border-color .2s;
}

.bet-input-wrap:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(0,240,255,.15);
}

.bet-input {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.8rem;
  width: 160px;
  background: transparent;
  border: none;
  color: var(--text-bright);
  outline: none;
}

.bet-input::placeholder { color: var(--text-dim); opacity: .4; }

.bet-token-label {
  font-family: 'Orbitron', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--cyan);
}

.bet-presets {
  display: flex;
  gap: 8px;
}

.preset-btn {
  font-family: 'Share Tech Mono', monospace;
  font-size: .85rem;
  padding: 6px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .2s;
}

.preset-btn:hover {
  border-color: var(--cyan-dim);
  color: var(--cyan);
  background: rgba(0,240,255,.05);
}

.bet-pot {
  text-align: center;
  margin-top: 8px;
  animation: fadeIn .3s ease;
}

.pot-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: .8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .15em;
}

.pot-value {
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  font-size: 2rem;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(255,215,0,.4);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  font-family: 'Orbitron', sans-serif;
  font-weight: 600;
  font-size: .9rem;
  letter-spacing: .08em;
  padding: 12px 32px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan-dim) 0%, var(--cyan) 100%);
  color: var(--bg-deep);
  border-color: var(--cyan);
}

.btn-primary:hover {
  box-shadow: var(--glow-cyan);
  transform: translateY(-2px);
}

.btn-glow {
  animation: btnPulse 3s ease-in-out infinite;
}

@keyframes btnPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(0,240,255,.2); }
  50%      { box-shadow: 0 0 30px rgba(0,240,255,.45); }
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--cyan-dim);
  color: var(--cyan);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: transparent;
  font-size: .85rem;
  padding: 8px 16px;
}

.btn-ghost:hover { color: var(--cyan); }

.btn-large {
  padding: 16px 48px;
  font-size: 1.05rem;
}

.btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ============================================================
   GAME HEADER
   ============================================================ */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 24px;
  background: rgba(12,16,32,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-center { text-align: center; flex: 1; }

.phase-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-bright);
  letter-spacing: .1em;
}

.phase-sub {
  font-family: 'Share Tech Mono', monospace;
  font-size: .8rem;
  color: var(--cyan);
  margin-top: 2px;
}

.turn-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 600;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.turn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(0,255,136,.6);
  animation: dotPulse 1.5s ease-in-out infinite;
}

.turn-indicator.enemy .turn-dot {
  background: var(--red);
  box-shadow: 0 0 12px rgba(255,51,85,.6);
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .6; transform: scale(.8); }
}

.score-display {
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
}

.score-you { color: var(--cyan); }
.score-sep { color: var(--text-dim); margin: 0 6px; }
.score-enemy { color: var(--red); }

.mini-wallet {
  font-family: 'Share Tech Mono', monospace;
  font-size: .75rem;
  color: var(--text-dim);
}

/* ============================================================
   GAME BOARDS
   ============================================================ */
.placement-area, .battle-area {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 40px;
  padding: 24px;
  flex-wrap: wrap;
}

.board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.board-label {
  font-family: 'Orbitron', sans-serif;
  font-weight: 600;
  font-size: .75rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.board {
  display: grid;
  grid-template-columns: repeat(10, var(--cell-size));
  grid-template-rows: repeat(10, var(--cell-size));
  gap: var(--grid-gap);
  padding: var(--board-pad);
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  position: relative;
}

.board::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(0,240,255,.15), transparent 40%, transparent 60%, rgba(0,240,255,.1));
  pointer-events: none;
  z-index: 0;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  background: rgba(0,240,255,.03);
  border: 1px solid rgba(0,240,255,.08);
  border-radius: 4px;
  cursor: pointer;
  transition: all .15s ease;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.cell:hover {
  background: rgba(0,240,255,.1);
  border-color: rgba(0,240,255,.25);
}

/* Ship cells */
.cell.ship {
  background: linear-gradient(135deg, rgba(0,122,130,.3) 0%, rgba(0,240,255,.15) 100%);
  border-color: rgba(0,240,255,.3);
  box-shadow: inset 0 0 8px rgba(0,240,255,.15);
}

/* Ship being placed (preview) */
.cell.preview {
  background: rgba(0,240,255,.2);
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0,240,255,.3);
}

.cell.preview-invalid {
  background: rgba(255,51,85,.15);
  border-color: rgba(255,51,85,.5);
}

/* Hit / Miss */
.cell.hit {
  background: radial-gradient(circle, rgba(255,51,85,.6) 0%, rgba(255,51,85,.15) 70%);
  border-color: var(--red);
  animation: hitFlash .5s ease;
}

.cell.hit::after {
  content: '💥';
  font-size: 1.2rem;
  filter: drop-shadow(0 0 6px rgba(255,51,85,.8));
}

.cell.miss {
  background: rgba(100,120,180,.08);
  border-color: rgba(100,120,180,.2);
}

.cell.miss::after {
  content: '•';
  font-size: 1.4rem;
  color: var(--text-dim);
  opacity: .5;
}

.cell.sunk {
  background: radial-gradient(circle, rgba(255,45,170,.5) 0%, rgba(255,45,170,.1) 70%);
  border-color: var(--magenta);
  animation: sunkFlash .6s ease;
}

.cell.sunk::after {
  content: '💀';
  font-size: 1rem;
}

@keyframes hitFlash {
  0%   { transform: scale(1.3); box-shadow: 0 0 25px rgba(255,51,85,.8); }
  100% { transform: scale(1); }
}

@keyframes sunkFlash {
  0%   { transform: scale(1.2); box-shadow: 0 0 30px rgba(255,45,170,.9); }
  100% { transform: scale(1); }
}

/* Enemy board cells */
#board-enemy .cell.ship {
  background: rgba(0,240,255,.03);
  border-color: rgba(0,240,255,.08);
  box-shadow: none;
}

#board-enemy .cell.sunk {
  background: radial-gradient(circle, rgba(255,45,170,.4) 0%, rgba(255,45,170,.08) 70%);
  border-color: var(--magenta);
}

/* ============================================================
   FLEET ROSTER & STATUS
   ============================================================ */
.fleet-roster {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 200px;
}

.roster-ship {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
}

.roster-ship:hover { border-color: var(--cyan-dim); }
.roster-ship.active {
  border-color: var(--cyan);
  background: rgba(0,240,255,.06);
  box-shadow: 0 0 12px rgba(0,240,255,.1);
}
.roster-ship.placed {
  opacity: .5;
  border-color: var(--green);
}

.roster-ship .ship-name {
  font-family: 'Orbitron', sans-serif;
  font-weight: 600;
  font-size: .75rem;
  letter-spacing: .05em;
  color: var(--text-bright);
  flex: 1;
}

.roster-ship .ship-len {
  font-family: 'Share Tech Mono', monospace;
  font-size: .75rem;
  color: var(--text-dim);
}

.roster-ship .ship-pips {
  display: flex;
  gap: 3px;
}

.roster-ship .pip {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: rgba(0,240,255,.15);
  border: 1px solid rgba(0,240,255,.3);
}

.roster-ship.placed .pip {
  background: rgba(0,255,136,.2);
  border-color: rgba(0,255,136,.4);
}

.placement-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.fleet-status {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 6px;
}

.fleet-pip {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--cyan);
  opacity: .6;
  transition: all .3s;
}

.fleet-pip.dead {
  background: var(--red);
  opacity: .3;
}

/* ============================================================
   BATTLE LOG
   ============================================================ */
.battle-log {
  max-width: 800px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 120px;
  overflow-y: auto;
}

.log-entry {
  font-family: 'Share Tech Mono', monospace;
  font-size: .8rem;
  color: var(--text-dim);
  padding: 2px 0;
  animation: fadeIn .3s ease;
}

.log-entry.hit { color: var(--red); }
.log-entry.miss { color: var(--text-dim); }
.log-entry.sunk { color: var(--magenta); font-weight: 700; }
.log-entry.info { color: var(--cyan); }

/* ============================================================
   WAITING OVERLAY
   ============================================================ */
.waiting-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6,8,15,.92);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .3s ease;
}

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

.waiting-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.waiting-spinner {
  width: 60px;
  height: 60px;
  border: 3px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.waiting-content h2 {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text-bright);
}

.waiting-content p {
  color: var(--text-dim);
  max-width: 300px;
}

/* ============================================================
   RESULT SCREEN
   ============================================================ */
.result-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 24px;
  padding: 40px 20px;
}

.result-icon {
  font-size: 5rem;
  animation: resultBounce .6s ease;
}

@keyframes resultBounce {
  0%   { transform: scale(0); opacity: 0; }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

.result-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(2.5rem, 6vw, 4rem);
  letter-spacing: .1em;
}

.result-title.win {
  color: var(--gold);
  text-shadow: 0 0 40px rgba(255,215,0,.5);
}

.result-title.lose {
  color: var(--red);
  text-shadow: 0 0 40px rgba(255,51,85,.4);
}

.result-sub {
  font-size: 1.1rem;
  color: var(--text-dim);
  text-align: center;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.stat-card .stat-val {
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--cyan);
}

.stat-card .stat-lbl {
  font-size: .75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-top: 4px;
}

.result-payout {
  background: var(--bg-card);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 20px 32px;
  text-align: center;
  box-shadow: var(--glow-gold);
  animation: fadeIn .5s ease .3s both;
}

.result-payout .payout-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: .8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.result-payout .payout-amount {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 2rem;
  color: var(--gold);
}

.result-actions {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ============================================================
   BATTLE BET DISPLAY
   ============================================================ */
.bet-display {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: .85rem;
  color: var(--gold);
  background: rgba(255,215,0,.08);
  border: 1px solid rgba(255,215,0,.2);
  border-radius: 8px;
  padding: 4px 16px;
  display: inline-block;
  margin-top: 4px;
}

/* ============================================================
   TOAST
   ============================================================ */
#toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: .9rem;
  padding: 12px 20px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  animation: toastIn .3s ease, toastOut .3s ease 2.7s forwards;
  max-width: 320px;
}

.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red); color: var(--red); }
.toast.info    { border-color: var(--cyan); color: var(--cyan); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(-10px); }
}

/* ============================================================
   LOBBY
   ============================================================ */
.lobby-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 24px 20px;
  max-width: 600px;
  margin: 0 auto;
}

.lobby-create {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lobby-create .bet-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.lobby-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lobby-games {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100px;
}

.lobby-empty {
  text-align: center;
  color: var(--text-dim);
  font-family: 'Share Tech Mono', monospace;
  font-size: .85rem;
  padding: 30px 0;
}

.lobby-game-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all .2s;
}

.lobby-game-card:hover {
  border-color: var(--cyan-dim);
  background: var(--bg-hover);
}

.lobby-game-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lobby-game-creator {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: .9rem;
  color: var(--text-bright);
}

.lobby-game-bet {
  font-family: 'Share Tech Mono', monospace;
  font-size: .75rem;
  color: var(--gold);
}

.lobby-waiting {
  position: fixed;
  inset: 0;
  background: rgba(6,8,15,.92);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  animation: fadeIn .3s ease;
}

.lobby-waiting h3 {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text-bright);
}

.lobby-waiting p {
  color: var(--text-dim);
  font-size: .9rem;
}

/* ============================================================
   SCOREBOARD
   ============================================================ */
.scoreboard {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
  text-align: center;
}

.scoreboard .section-title {
  margin-bottom: 14px;
  font-size: 1rem;
}

.scoreboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.sb-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sb-val {
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--cyan);
}

.sb-stat-gold .sb-val {
  color: var(--gold);
}

.sb-lbl {
  font-family: 'Share Tech Mono', monospace;
  font-size: .7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.sb-username {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.sb-name-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: .75rem;
  color: var(--text-dim);
}

.sb-name-val {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: .9rem;
  color: var(--gold);
  letter-spacing: .05em;
}

/* ============================================================
   USERNAME
   ============================================================ */
.username-section {
  width: 100%;
  max-width: 360px;
  animation: fadeIn .3s ease;
}

.username-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--cyan-dim);
  border-radius: 12px;
}

.username-label {
  font-family: 'Orbitron', sans-serif;
  font-weight: 600;
  font-size: .85rem;
  color: var(--text-bright);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.username-input-wrap {
  display: flex;
  gap: 8px;
  width: 100%;
}

.username-input {
  flex: 1;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  text-transform: uppercase;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--text-bright);
  outline: none;
  letter-spacing: .1em;
  transition: border-color .2s;
}

.username-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0,240,255,.2);
}

.username-input::placeholder {
  color: var(--text-dim);
  opacity: .4;
  font-size: .8rem;
}

/* ============================================================
   TURN TIMER
   ============================================================ */
.turn-timer {
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: var(--cyan);
  background: var(--bg-surface);
  border: 2px solid var(--cyan-dim);
  border-radius: 8px;
  min-width: 36px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  margin-left: 8px;
  transition: all .3s;
}

.turn-timer.warning {
  color: var(--gold);
  border-color: rgba(255,215,0,.4);
  animation: timerPulse .5s ease-in-out infinite;
}

.turn-timer.critical {
  color: var(--red);
  border-color: var(--red);
  animation: timerPulse .3s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}

/* ============================================================
   UTILITY
   ============================================================ */
.hidden { display: none !important; }

/* ============================================================
   MOBILE-FIRST RESPONSIVE
   ============================================================ */

/* Tablet / small desktop */
@media (max-width: 960px) {
  :root { --cell-size: 36px; }
  .battle-area, .placement-area {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }
  .battle-divider { display: none; }
  .placement-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  .fleet-roster { flex-direction: row; flex-wrap: wrap; justify-content: center; }
}

/* Phone landscape + small tablets */
@media (max-width: 700px) {
  :root {
    --cell-size: 32px;
    --grid-gap: 2px;
    --board-pad: 5px;
  }

  .game-header {
    padding: 0 10px;
    height: 52px;
  }
  .phase-title { font-size: .8rem; }
  .phase-sub { font-size: .7rem; }
  .score-display { font-size: 1rem; }

  .landing-container { padding: 20px 16px; gap: 28px; }
  .logo { font-size: 2.6rem; }
  .tagline { font-size: .85rem; }

  .mode-cards { grid-template-columns: 1fr; gap: 14px; }
  .mode-card { padding: 20px 16px; }
  .mode-icon { font-size: 2.2rem; }

  .bet-input { font-size: 1.4rem; width: 120px; }
  .preset-btn { padding: 8px 16px; font-size: .9rem; }
  .token-btn { padding: 10px 22px; }

  .btn { padding: 14px 28px; font-size: .85rem; }
  .btn-large { padding: 16px 36px; font-size: .95rem; }

  /* Placement */
  .placement-area { padding: 16px 10px; gap: 16px; }
  .roster-ship { padding: 6px 10px; gap: 6px; }
  .roster-ship .ship-name { font-size: .7rem; }
  .placement-actions { gap: 8px; }
  .placement-actions .btn { padding: 10px 16px; font-size: .75rem; }

  /* Battle */
  .battle-area { padding: 16px 10px; gap: 16px; }
  .board-wrap { gap: 6px; }
  .board-label { font-size: .65rem; }
  .battle-log { max-height: 80px; padding: 8px 16px; }
  .log-entry { font-size: .7rem; }

  /* Result */
  .result-container { padding: 24px 16px; gap: 16px; }
  .result-icon { font-size: 3.5rem; }
  .result-title { font-size: 2rem; }
  .result-sub { font-size: .95rem; }
  .result-stats { gap: 10px; }
  .stat-card { padding: 12px; }
  .stat-card .stat-val { font-size: 1.2rem; }
}

/* Phone portrait — primary mobile target */
@media (max-width: 440px) {
  :root {
    --cell-size: 30px;
    --grid-gap: 2px;
    --board-pad: 4px;
  }

  .landing-container { padding: 16px 12px; gap: 24px; }
  .logo { font-size: 2.2rem; }
  .tagline { font-size: .75rem; letter-spacing: .1em; }
  .section-title { font-size: 1rem; }

  .mode-card { padding: 16px 14px; }
  .mode-card h3 { font-size: 1rem; }
  .mode-card p { font-size: .85rem; margin-bottom: 8px; }

  .wallet-section { width: 100%; }
  .wallet-section .btn { width: 100%; }
  .wallet-info { width: 100%; padding: 10px 16px; }

  .bet-section { width: 100%; }
  .bet-controls { gap: 12px; }
  .bet-input-wrap { padding: 6px 14px; }
  .bet-input { font-size: 1.3rem; width: 100px; }
  .bet-token-label { font-size: .85rem; }
  .presets .preset-btn { padding: 8px 14px; font-size: .8rem; }

  .btn-start { width: 100%; }
  .btn-large { width: 100%; padding: 16px 24px; }

  .game-header { height: 48px; padding: 0 8px; }
  .phase-title { font-size: .7rem; letter-spacing: .06em; }
  .turn-indicator { font-size: .7rem; }
  .turn-dot { width: 8px; height: 8px; }
  .score-display { font-size: .9rem; }

  .board-label { font-size: .6rem; letter-spacing: .1em; }

  /* On phone portrait, show only the ENEMY board prominently during battle */
  .battle-area .board-wrap:first-child {
    order: 2;
    opacity: .7;
    transform: scale(.75);
    transform-origin: top center;
    margin-bottom: -20px;
  }
  .battle-area .board-wrap:last-child {
    order: 1;
  }
  .battle-divider { display: none; }

  .fleet-status { gap: 4px; }
  .fleet-pip { width: 6px; height: 6px; }

  .battle-log { max-height: 60px; padding: 6px 12px; font-size: .65rem; }

  /* Placement */
  .placement-area { padding: 12px 8px; gap: 12px; }
  .fleet-roster { gap: 6px; }
  .roster-ship { padding: 5px 8px; gap: 4px; }
  .roster-ship .pip { width: 8px; height: 8px; }
  .placement-actions { gap: 6px; }
  .placement-actions .btn { padding: 10px 14px; font-size: .7rem; }

  /* Result */
  .result-title { font-size: 1.8rem; }
  .result-payout .payout-amount { font-size: 1.5rem; }
  .result-actions { flex-direction: column; width: 100%; }
  .result-actions .btn { width: 100%; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }
