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

:root {
  --bg: #0a0f1e;
  --surface: #111827;
  --surface2: #1a2438;
  --border: #2a3a5c;
  --accent: #3b82f6;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --hit: #ef4444;
  --sunk: #991b1b;
  --ship: #1e40af;
  --miss: #334155;
  --green: #16a34a;
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* LANDING */
.landing { max-width: 900px; margin: 0 auto; padding: 3rem 1rem; text-align: center; }
.logo { margin-bottom: 1.5rem; }
.logo-icon { font-size: 48px; display: block; margin-bottom: 0.5rem; }
.logo h1 { font-size: 2.5rem; font-weight: 700; color: var(--accent); letter-spacing: -1px; }
.logo p { color: var(--muted); font-size: 1.1rem; margin-top: 0.25rem; }

.stats-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 2rem;
  display: inline-block;
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2rem 1.5rem; text-align: center; transition: border-color 0.2s; }
.card:hover { border-color: var(--accent); }
.card-icon { font-size: 2rem; margin-bottom: 1rem; }
.card h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
.card p { color: var(--muted); font-size: 0.875rem; margin-bottom: 1.25rem; line-height: 1.5; }

.join-form { display: flex; gap: 8px; }
.join-form input { flex: 1; padding: 8px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 1rem; letter-spacing: 3px; font-weight: 700; text-align: center; text-transform: uppercase; }
.join-form input::placeholder { letter-spacing: 1px; font-weight: 400; }
.join-form input:focus { outline: none; border-color: var(--accent); }

.btn { display: inline-block; padding: 10px 20px; border-radius: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: opacity 0.2s; width: 100%; }
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }

.msg { padding: 12px 16px; border-radius: 8px; font-size: 0.9rem; margin-top: 1rem; }
.msg-info { background: #1e3a5f; color: #93c5fd; }
.msg-success { background: #14532d; color: #86efac; }
.msg-error { background: #450a0a; color: #fca5a5; }

.footer { margin-top: 2rem; color: var(--muted); font-size: 0.8rem; opacity: 0.6; }

/* GAME PAGE */
#game-wrap { max-width: 820px; margin: 0 auto; padding: 1rem; }
header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.back-btn { color: var(--muted); text-decoration: none; font-size: 0.875rem; padding: 4px 8px; border-radius: 6px; }
.back-btn:hover { background: var(--surface2); color: var(--text); }
.header-title { font-weight: 600; font-size: 1rem; }
#header-info { color: var(--muted); font-size: 0.8rem; margin-left: auto; }

.room-info { background: var(--surface); border: 1px solid var(--accent); border-radius: 8px; padding: 8px 14px; font-size: 0.875rem; margin-bottom: 1rem; color: var(--muted); }
.room-info strong { color: var(--text); letter-spacing: 2px; font-size: 1rem; }

#setup-phase { margin-bottom: 1rem; }
.phase-hint { color: var(--muted); font-size: 0.875rem; margin-bottom: 10px; }
.ship-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ship-btn { font-size: 0.8rem; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface2); cursor: pointer; color: var(--text); }
.ship-btn:hover { border-color: var(--accent); }
.ship-btn.active { background: #1e3a8a; border-color: var(--accent); color: #93c5fd; }
.ship-btn.placed { text-decoration: line-through; color: var(--muted); cursor: default; opacity: 0.5; }
.setup-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.setup-btns button { font-size: 0.8rem; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface2); cursor: pointer; color: var(--text); }
.setup-btns button:hover { border-color: var(--accent); }
.btn-ready { background: var(--green) !important; border-color: var(--green) !important; color: #fff !important; font-weight: 600; }
.btn-ready:disabled { opacity: 0.5; cursor: not-allowed; }

.boards { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.board-wrap { flex: 1; min-width: 220px; }
.board-title { font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.grid { display: inline-grid; grid-template-columns: repeat(10, 28px); gap: 2px; }

.cell { width: 28px; height: 28px; border-radius: 3px; background: var(--surface2); border: 1px solid var(--border); cursor: default; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; transition: background 0.1s; user-select: none; }
.cell.clickable { cursor: crosshair; }
.cell.clickable:hover { background: #1e3a5f; border-color: var(--accent); }
.cell.ship { background: var(--ship); border-color: #1e3a8a; }
.cell.preview-ok { background: #1d4ed8; border-color: #3b82f6; }
.cell.preview-bad { background: #7f1d1d; border-color: var(--hit); }
.cell.hit { background: var(--hit); border-color: #b91c1c; color: #fff; }
.cell.sunk { background: var(--sunk); border-color: #7f1d1d; color: #fca5a5; }
.cell.miss { background: var(--miss); border-color: #475569; color: #64748b; }
.cell.reveal { background: #312e81; border-color: #4338ca; }

.status-box { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 0.875rem; min-height: 40px; color: var(--text); margin-bottom: 1rem; }

.game-over { text-align: center; padding: 2rem 1rem; background: var(--surface); border-radius: 12px; border: 1px solid var(--border); margin-top: 1rem; }
#go-text { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; }

@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(10, 24px); }
  .cell { width: 24px; height: 24px; }
  .boards { gap: 1rem; }
  .logo h1 { font-size: 1.75rem; }
  .stats-bar { font-size: 0.75rem; padding: 8px 12px; }
}
