/* Paper Pirates — MRBD additive-display palette per GDD §2.
   Black = transparent on glass. Bright saturated foreground colors. */

:root {
  --bg-primary: #000000;
  --bg-secondary: #07090d;
  --bg-tertiary: #0e1219;
  --bg-card: #131826;

  --text-primary: #ffffff;
  --text-secondary: #b8c4d4;
  --text-muted: #6b7a90;

  --accent-cyan: #00d4ff;
  --accent-cyan-soft: rgba(0, 212, 255, 0.4);
  --accent-water: #1a3a55;
  --accent-water-edge: #2dc8ff;

  --boat-frigate: #ff7a3a;   /* origami orange */
  --boat-cutter: #fff4c2;    /* paper-white */
  --boat-cutter-trim: #ffd23a; /* duck yellow */
  --boat-dinghy: #ff4d6d;    /* vivid coral */

  --result-miss: #ffffff;
  --result-hit: #ff7a3a;
  --result-sunk: #ff3955;

  --danger: #ff4466;
  --success: #00ff9c;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  width: 600px;
  height: 600px;
  overflow: hidden;
  font-size: 16px;
}

#app { width: 100%; height: 100%; position: relative; }

/* --- Screens --- */
.screen {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  position: absolute; top: 0; left: 0;
}
.screen.hidden { display: none; }

/* --- Header --- */
.header {
  display: flex; align-items: center;
  padding: 14px 20px;
  background: var(--bg-secondary);
  gap: 12px; flex-shrink: 0;
}
.header h1 { font-size: 22px; font-weight: 600; flex: 1; }
.header-meta { font-size: 14px; color: var(--accent-cyan); font-variant-numeric: tabular-nums; }
.back-btn {
  background: transparent; color: var(--text-primary);
  font-size: 22px; padding: 6px 12px;
  border-radius: var(--radius-sm); border: 2px solid transparent;
}

/* --- Content --- */
.content {
  flex: 1; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
}
.content-center { align-items: center; justify-content: center; gap: 20px; }
.content-board { padding: 12px 16px; gap: 10px; align-items: center; }

/* --- Focus ring (per GDD §4 / TDD §2.5) --- */
.focusable {
  transition: all 0.12s ease;
  border: 2px solid transparent;
  cursor: pointer;
  min-height: 44px;
  background: transparent;
  color: inherit;
  font: inherit;
}
.focusable:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 18px var(--accent-cyan-soft);
}

/* --- Splash --- */
.splash {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; padding: 40px;
}
.splash-mark {
  font-size: 96px; color: var(--accent-cyan);
  text-shadow: 0 0 24px var(--accent-cyan-soft);
}
.splash-title { font-size: 32px; font-weight: 700; letter-spacing: 1px; }
.splash-tag { font-size: 14px; }
.splash-start {
  margin-top: 12px;
  padding: 14px 36px;
  font-size: 18px; font-weight: 600;
  border-radius: var(--radius-md);
  background: var(--accent-cyan);
  color: #000;
  min-height: 56px;
}

/* --- Menu items (88px focus target per GDD §4) --- */
.menu-item {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 18px;
  min-height: 88px;
  text-align: left;
  color: var(--text-primary);
}
.menu-icon { font-size: 22px; color: var(--accent-cyan); width: 32px; text-align: center; }
.menu-label { flex: 1; }
.menu-count { color: var(--accent-cyan); }
.menu-meta { font-size: 14px; }

/* --- Nav-style button --- */
.nav-item {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px; font-weight: 500;
  text-align: center;
  min-height: 56px;
}
.nav-item.primary { background: var(--accent-cyan); color: #000; }
.nav-item.danger  { background: var(--danger); color: #fff; }

/* --- Dial (moniker + room code) --- */
.dial {
  display: flex; gap: 12px;
  align-items: center; justify-content: center;
}
.dial-code { gap: 8px; }
.dial-slot {
  width: 64px; height: 88px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 700;
  color: var(--accent-cyan);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-variant-numeric: tabular-nums;
}
.dial-code .dial-slot { width: 52px; height: 80px; font-size: 30px; }
.dial-slot:focus { color: #000; background: var(--accent-cyan); border-color: var(--accent-cyan); }
.dial-done {
  padding: 14px 22px; min-height: 88px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 18px; font-weight: 600;
  margin-left: 6px;
}
.dial-done:focus { background: var(--accent-cyan); color: #000; }

/* --- Room code display --- */
.room-code {
  font-size: 48px; font-weight: 700;
  letter-spacing: 8px;
  color: var(--accent-cyan);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 22px var(--accent-cyan-soft);
}

.waiting-row {
  display: flex; align-items: center; gap: 10px;
}
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-cyan);
  display: inline-block;
}
.dot-pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50%      { opacity: 1;   transform: scale(1.15); }
}
.dot-miss { background: var(--result-miss); }
.dot-hit  { background: var(--result-hit); }
.dot-sunk { background: var(--result-sunk); }

/* --- Board (7x7 grid, ~70px cells per GDD §4) --- */
.board-frame {
  padding: 8px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(45, 200, 255, 0.04), rgba(0, 0, 0, 0) 70%);
  border: 1px solid rgba(45, 200, 255, 0.18);
}
.board {
  display: grid;
  grid-template-columns: repeat(7, 56px);
  grid-template-rows: repeat(7, 56px);
  gap: 2px;
}
.cell {
  width: 56px; height: 56px;
  background: rgba(26, 58, 85, 0.35);
  border: 1px solid rgba(45, 200, 255, 0.22);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: var(--text-primary);
  position: relative;
}
.cell:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 14px var(--accent-cyan-soft), inset 0 0 12px rgba(0, 212, 255, 0.2);
  z-index: 2;
}
/* Boat ghost during placement */
.cell.ghost          { background: rgba(255, 122, 58, 0.35); }
.cell.ghost-invalid  { background: rgba(255, 68, 102, 0.45); }
.cell.placed-frigate { background: var(--boat-frigate); }
.cell.placed-cutter  { background: var(--boat-cutter); color: #000; }
.cell.placed-dinghy  { background: var(--boat-dinghy); }
/* Shot results */
.cell.miss::after {
  content: ''; width: 10px; height: 10px; border-radius: 50%;
  background: var(--result-miss); opacity: 0.85;
}
.cell.hit  { background: rgba(255, 122, 58, 0.45); }
.cell.hit::after  { content: '!'; color: var(--result-hit); font-weight: 700; }
.cell.sunk { background: rgba(255, 57, 85, 0.55); }
.cell.sunk::after { content: 'X'; color: #fff; font-weight: 700; }

.board-hint { font-size: 12px; margin-top: 6px; }
.board-legend {
  display: flex; justify-content: center; gap: 18px;
  font-size: 13px; color: var(--text-secondary);
  margin-top: 4px;
}
.legend-item { display: flex; align-items: center; gap: 6px; }

/* --- Board tabs (salvo own/opponent) --- */
.board-tabs {
  display: flex; gap: 8px;
}
.tab-pill {
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  min-height: 36px;
}
.tab-pill.active { background: var(--accent-cyan); color: #000; }
.tab-pill:focus { background: var(--accent-cyan); color: #000; }

/* --- Game over stats --- */
.stats-card {
  width: 100%;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.stat-row {
  display: flex; justify-content: space-between;
  font-size: 16px;
}

/* --- Lists (resume match) --- */
.list-container {
  display: flex; flex-direction: column; gap: 8px;
}
.list-item {
  display: flex; align-items: center;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  gap: 12px; min-height: 72px;
}
.list-item-content { flex: 1; min-width: 0; }
.list-item-title { font-size: 17px; font-weight: 600; }
.list-item-meta { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* --- Utility --- */
.hidden { display: none !important; }
.text-center  { text-align: center; }
.text-muted   { color: var(--text-secondary); }
.text-danger  { color: var(--danger); }
