/* ─────────────────────────────────────────
   GEO Risk – Dark Cartographic Theme
   Palette:
     #0A0D14 bg-deep
     #111827 bg-card
     #1E2A3A bg-panel
     #2D3F55 border
     #C4A35A gold
     #E8C97A gold-light
     #4CAF7D green-army
     #E05252 red-enemy
     #7EC8E3 blue-water
   Type: Cinzel (display) / Inter (body) / JetBrains Mono (data)
───────────────────────────────────────── */

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

:root {
  --bg: #0A0D14;
  --bg-card: #111827;
  --bg-panel: #1E2A3A;
  --border: #2D3F55;
  --gold: #C4A35A;
  --gold-light: #E8C97A;
  --green: #4CAF7D;
  --red: #E05252;
  --blue: #7EC8E3;
  --text: #D4DCE8;
  --text-muted: #6B7A96;
  --radius: 8px;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: 'Inter', sans-serif; font-size: 14px; overflow-x: hidden; }

/* ── HEADER ── */
#top-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: rgba(10,13,20,0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.logo-wrap { display: flex; align-items: center; gap: 10px; }
.logo-img { width: 26px; height: 26px; min-width: 26px; object-fit: contain; border-radius: 4px; }
.logo-text {
  font-family: 'Cinzel', serif; font-size: 18px; font-weight: 800;
  color: var(--gold);
  letter-spacing: 2px;
}
.logo-text em { color: var(--gold-light); font-style: normal; }

.lang-switcher { display: flex; gap: 4px; }
.btn-lang {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); padding: 3px 8px; border-radius: 4px;
  cursor: pointer; font-size: 11px; font-weight: 600; letter-spacing: 1px;
  transition: all .15s;
}
.btn-lang:hover { border-color: var(--gold); color: var(--gold); }

.wallet-strip { display: flex; align-items: center; gap: 12px; }
.wallet-info { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.addr-display { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--gold); }
.balance-display { font-size: 11px; color: var(--text-muted); }

/* ── BUTTONS ── */
.btn-primary {
  background: linear-gradient(135deg, #C4A35A, #E8C97A);
  color: #0A0D14; border: none; padding: 10px 22px;
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 13px; letter-spacing: 1px;
  border-radius: var(--radius); cursor: pointer; transition: all .2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(196,163,90,.4); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn-accent {
  background: linear-gradient(135deg, #4CAF7D, #2E8B57);
  color: #fff; border: none; padding: 10px 22px;
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 13px; letter-spacing: 1px;
  border-radius: var(--radius); cursor: pointer; transition: all .2s;
}
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(76,175,125,.4); }
.btn-accent:disabled { opacity: .4; cursor: not-allowed; }

.btn-xl { padding: 14px 36px; font-size: 16px; }

.btn-wallet {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 7px 16px;
  border-radius: var(--radius);
  cursor: pointer; font-size: 12px; font-weight: 600;
  transition: all .15s;
}
.btn-wallet:hover { background: var(--gold); color: #0A0D14; }

.btn-back {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); padding: 6px 14px; border-radius: var(--radius);
  cursor: pointer; font-size: 12px; transition: all .15s;
}
.btn-back:hover { border-color: var(--gold); color: var(--gold); }

.btn-sm {
  background: var(--bg-panel); border: 1px solid var(--border);
  color: var(--text); padding: 5px 12px; border-radius: 6px;
  cursor: pointer; font-size: 12px; transition: all .15s;
}
.btn-sm:hover { border-color: var(--gold); color: var(--gold); }
.btn-sm.btn-accent { background: var(--green); border-color: var(--green); color: #fff; }

.btn-cancel {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); padding: 8px 18px; border-radius: var(--radius);
  cursor: pointer; margin-top: 12px; width: 100%;
}

.btn-phase {
  background: var(--bg-panel); border: 1px solid var(--blue);
  color: var(--blue); padding: 8px 16px; border-radius: var(--radius);
  cursor: pointer; font-size: 12px; width: 100%; margin-top: 8px;
  transition: all .15s;
}
.btn-phase:hover { background: var(--blue); color: #0A0D14; }
.btn-phase.btn-end { border-color: var(--green); color: var(--green); }
.btn-phase.btn-end:hover { background: var(--green); color: #fff; }

.btn-join {
  background: transparent; border: 1px solid var(--gold);
  color: var(--gold); padding: 5px 14px; border-radius: var(--radius);
  cursor: pointer; font-size: 12px; transition: all .15s;
}
.btn-join:hover { background: var(--gold); color: #0A0D14; }

.btn-dice {
  background: var(--bg-card); border: 1px solid var(--gold);
  color: var(--gold-light); padding: 10px 20px; border-radius: var(--radius);
  cursor: pointer; font-size: 16px; font-family: 'Cinzel', serif;
  transition: all .15s; flex: 1;
}
.btn-dice:hover { background: var(--gold); color: #0A0D14; transform: scale(1.05); }

/* ── SCREENS ── */
.screen { display: none; padding-top: 52px; min-height: 100vh; }
.screen.active { display: block; }

/* ── SPLASH ── */
.splash-inner {
  max-width: 580px; margin: 0 auto;
  padding: 32px 24px 40px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.splash-logo {
  width: 140px; height: 140px; max-width: 30vw;
  object-fit: contain;
  animation: pulse 3s infinite; margin-bottom: 8px;
  filter: drop-shadow(0 0 24px rgba(196,163,90,.35));
}
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }

.splash-sub { color: var(--text-muted); font-size: 15px; margin-bottom: 24px; }

.splash-tokens { display: flex; gap: 8px; justify-content: center; margin-bottom: 32px; }
.token-badge {
  background: var(--bg-panel); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 600; color: var(--gold);
  letter-spacing: 1px;
}

.splash-rules {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-top: 32px; text-align: left;
}
.splash-rules h3 {
  font-family: 'Cinzel', serif; color: var(--gold);
  font-size: 14px; margin-bottom: 14px; letter-spacing: 1px;
}
.rules-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.rules-list li { color: var(--text); font-size: 13px; padding-left: 4px; }

/* ── MAIN MENU ── */
.menu-layout {
  max-width: 900px; margin: 0 auto;
  padding: 40px 24px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px;
}
.section-title {
  font-family: 'Cinzel', serif; font-size: 18px; color: var(--gold);
  letter-spacing: 2px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border); padding-bottom: 8px;
}

.create-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.create-box h3 { font-family: 'Cinzel', serif; font-size: 13px; color: var(--text-muted); letter-spacing: 1px; }

.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.sel-input {
  background: var(--bg-panel); border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; border-radius: 6px; font-size: 13px;
}
.sel-input:focus { outline: none; border-color: var(--gold); }

.table-list { display: flex; flex-direction: column; gap: 8px; }
.table-row {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.table-row span { font-size: 13px; }
.muted { color: var(--text-muted); font-size: 13px; }

/* ── LOBBY ── */
.lobby-layout {
  max-width: 600px; margin: 0 auto;
  padding: 32px 24px;
  display: flex; flex-direction: column; gap: 20px;
}
.lobby-header { display: flex; align-items: center; gap: 16px; }
.lobby-body { display: flex; gap: 20px; flex-wrap: wrap; }
.lobby-players { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 200px; }
.player-row {
  background: var(--bg-card); padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; display: flex; align-items: center; gap: 8px;
}
.player-row em { color: var(--text-muted); font-style: normal; font-size: 11px; }

.lobby-pot-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  font-size: 14px; flex: 1;
}
.lobby-pot-box strong { color: var(--gold-light); font-family: 'JetBrains Mono', monospace; }
.fee-note { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.fee-note div { font-size: 12px; color: var(--text-muted); }
.lobby-actions { display: flex; gap: 12px; }

/* ── GAME ── */
.game-layout {
  display: grid;
  grid-template-columns: 220px 1fr 200px;
  grid-template-rows: calc(100vh - 52px);
  gap: 0;
}

/* Sidebar */
.sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 16px;
}
.sidebar-section h4 {
  font-family: 'Cinzel', serif; font-size: 11px; color: var(--text-muted);
  letter-spacing: 2px; text-transform: uppercase; margin-bottom: 8px;
  border-bottom: 1px solid var(--border); padding-bottom: 4px;
}

.turn-info {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
}
.turn-player { font-family: 'Cinzel', serif; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.phase-label { font-size: 12px; color: var(--gold); letter-spacing: 1px; }
.armies-left { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.armies-left strong { color: var(--green); }

.player-stat {
  padding: 8px 10px; margin-bottom: 4px; border-radius: 6px;
  background: var(--bg-panel);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px;
}
.player-stat.eliminated { opacity: .35; text-decoration: line-through; }
.pname { font-weight: 600; }
.pstat { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted); }

.cont-row { font-size: 11px; padding: 3px 0; color: var(--text-muted); }
.cont-row.owned { color: var(--gold-light); font-weight: 600; }

/* Chat */
.chat-log {
  height: 120px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px; font-size: 11px;
  display: flex; flex-direction: column; gap: 3px;
  margin-bottom: 6px;
}
.chat-line { color: var(--text-muted); }
.chat-line strong { color: var(--text); }
.chat-input-row { display: flex; gap: 4px; }
.chat-input-row input {
  flex: 1; background: var(--bg-panel); border: 1px solid var(--border);
  color: var(--text); padding: 5px 8px; border-radius: 6px; font-size: 11px;
}
.chat-input-row input:focus { outline: none; border-color: var(--gold); }

/* Map Area */
.map-area {
  background: #0D1520;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

/* Subtle ocean texture */
.map-area::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(126,200,227,0.04) 0%, transparent 70%),
    repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(45,63,85,.08) 40px, rgba(45,63,85,.08) 41px),
    repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(45,63,85,.08) 40px, rgba(45,63,85,.08) 41px);
  pointer-events: none;
}

.risk-canvas {
  max-width: 100%; max-height: 100%;
  cursor: crosshair;
  position: relative; z-index: 1;
}

.turn-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 10;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #0A0D14;
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 13px; letter-spacing: 2px;
  padding: 6px 20px; border-radius: 20px;
  animation: glow .8s ease-in-out infinite alternate;
}
@keyframes glow {
  from { box-shadow: 0 0 8px rgba(196,163,90,.4); }
  to { box-shadow: 0 0 20px rgba(196,163,90,.8); }
}

/* Dice overlay */
.dice-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,13,20,.7);
  backdrop-filter: blur(4px);
}
.dice-popup {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 32px; text-align: center;
  min-width: 240px;
}
.dice-row { display: flex; flex-direction: column; gap: 8px; font-size: 15px; font-family: 'JetBrains Mono', monospace; }
.conquered-msg { margin-top: 12px; color: var(--green); font-family: 'Cinzel', serif; font-size: 16px; font-weight: 700; }
.eliminated-msg { margin-top: 8px; color: var(--red); font-size: 13px; }

/* Action Panel */
.action-panel-wrap {
  background: var(--bg-card); border-left: 1px solid var(--border);
  overflow-y: auto;
}
.action-panel { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.action-panel p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.qty-row { display: flex; gap: 6px; flex-wrap: wrap; }
.waiting-msg { color: var(--text-muted); font-size: 12px; text-align: center; margin-top: 16px; }
.hint { font-size: 11px; color: var(--text-muted); font-style: italic; }

/* ── GAME OVER ── */
.gameover-inner {
  max-width: 500px; margin: 0 auto;
  padding: 80px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}
.gameover-logo {
  width: 140px; height: 140px; object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(196,163,90,.4));
}
.gameover-title {
  font-family: 'Cinzel', serif; font-size: 40px; font-weight: 800;
  color: var(--gold); letter-spacing: 4px;
}
.gameover-winner { font-size: 16px; color: var(--text-muted); }
.prize-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 28px;
  display: flex; flex-direction: column; gap: 10px; width: 100%;
}
.prize-box div { font-size: 15px; }
.prize-box strong { color: var(--gold-light); font-family: 'JetBrains Mono', monospace; font-size: 18px; }

/* ── MODAL ── */
.modal {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(10,13,20,.8); align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal.open { display: flex; }
.modal-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; min-width: 280px; text-align: center;
}
.modal-box h3 { font-family: 'Cinzel', serif; color: var(--gold); margin-bottom: 12px; letter-spacing: 2px; }
.modal-box p { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.modal-dice-btns { display: flex; gap: 10px; justify-content: center; }

/* ── TOASTS ── */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 10px 18px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  animation: slide-in .3s ease;
  min-width: 200px;
}
@keyframes slide-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success { background: #1a3a2a; border: 1px solid var(--green); color: var(--green); }
.toast-error   { background: #3a1a1a; border: 1px solid var(--red);   color: var(--red); }
.toast-info    { background: var(--bg-panel); border: 1px solid var(--border); color: var(--text); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Map toolbar */
.map-toolbar {
  position: absolute; top: 8px; right: 8px; z-index: 15;
  display: flex; gap: 6px;
}
.btn-map-tool {
  background: rgba(10,13,20,0.75); border: 1px solid var(--border);
  color: var(--gold); width: 34px; height: 34px; border-radius: 6px;
  cursor: pointer; font-size: 16px; backdrop-filter: blur(4px);
  transition: all .15s; display: flex; align-items: center; justify-content: center;
}
.btn-map-tool:hover { background: var(--gold); color: #0A0D14; }

/* Fullscreen mode */
:fullscreen .game-layout,
:-webkit-full-screen .game-layout {
  grid-template-columns: 180px 1fr 170px;
  height: 100vh;
}
:fullscreen .risk-canvas,
:-webkit-full-screen .risk-canvas {
  max-height: calc(100vh - 52px);
}

/* Mobile landscape */
@media (max-width: 900px) and (orientation: landscape) {
  .game-layout {
    grid-template-columns: 150px 1fr !important;
    grid-template-rows: 100vh;
  }
  .action-panel-wrap {
    display: none; /* em landscape mobile, painel fica dentro do sidebar */
  }
  .sidebar {
    overflow-y: auto;
  }
  .risk-canvas {
    max-height: 100vh;
  }
}

@media (max-width: 900px) and (orientation: portrait) {
  .game-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .sidebar {
    flex-direction: row; flex-wrap: wrap; height: auto; max-height: 160px;
    overflow-y: auto;
  }
  .map-area { min-height: 220px; }
  .action-panel-wrap {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    max-height: 30vh; overflow-y: auto;
  }
}
