/* Conquiste o Mundo — Mobile CSS */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-dark: #040812;
    --bg-panel: rgba(0,0,0,0.6);
    --bg-panel-solid: #0a1628;
    --border-subtle: rgba(255,255,255,0.12);
    --text: #e8e8e8;
    --text-dim: rgba(255,255,255,0.55);
    --text-muted: rgba(255,255,255,0.35);
    --accent: #4caf50;
    --danger: #e24b4a;
    --ocean: #0a3d6b;
    --hud-radius: 10px;
    --hud-blur: blur(12px);
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

#app { width: 100%; height: 100%; position: relative; }

/* --- Rotate prompt (portrait) --- */
#rotate-prompt {
    display: none;
    position: fixed; inset: 0;
    background: linear-gradient(135deg, #040812 0%, #0a1628 55%, #0d2137 100%);
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 24px;
    text-align: center;
}
#rotate-prompt .rotate-icon { font-size: 64px; animation: rotateHint 2.4s ease-in-out infinite; }
#rotate-prompt p { font-size: 20px; font-weight: 600; color: var(--text); margin: 0; }
#rotate-prompt .rotate-sub { font-size: 13px; font-weight: 400; color: var(--text-dim); max-width: 280px; }
@keyframes rotateHint { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-90deg); } }

/* Só bloqueia a orientação quando a PARTIDA está ativa.
   Menu, lobby, multiplayer e login continuam usáveis em retrato. */
@media (orientation: portrait) {
    body.in-game #rotate-prompt { display: flex; }
    body.in-game #game-screen { display: none !important; }
}

/* --- Screens --- */
.screen { display: none; width: 100%; height: 100%; position: absolute; inset: 0; }
.screen.active { display: flex; }

/* --- Menu --- */
#menu-screen {
    background: linear-gradient(135deg, #040812 0%, #0a1628 50%, #0d2137 100%);
    align-items: center; justify-content: center;
}
.menu-container { text-align: center; padding: 20px; }
.menu-title {
    font-size: 32px; font-weight: 700;
    background: linear-gradient(135deg, #4caf50, #00e5ff);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; line-height: 1.1; margin-bottom: 8px;
}
.menu-subtitle { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; min-width: 240px; max-width: 320px; width: 100%; }
.menu-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin: -2px 0 8px;
    text-align: center;
    line-height: 1.3;
}
.menu-footnote {
    margin-top: 16px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    max-width: 320px;
    line-height: 1.4;
}
.auth-status-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 12px;
    margin-bottom: 16px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    max-width: 340px;
    width: 100%;
}
.auth-status-bar.guest {
    background: rgba(226, 75, 74, 0.12);
    border: 1px solid rgba(226, 75, 74, 0.35);
    color: #ffb4b0;
}
.auth-status-bar.logged {
    background: rgba(76, 175, 80, 0.12);
    border: 1px solid rgba(76, 175, 80, 0.4);
    color: #a5d6a7;
}
.auth-status-link {
    color: #00e5ff;
    font-weight: 600;
    text-decoration: none;
    font-size: 12px;
}
.auth-guest-btn {
    appearance: none;
    border: 1px solid rgba(255, 193, 7, 0.5);
    background: rgba(255, 193, 7, 0.12);
    color: #ffd54f;
    font: inherit;
    font-weight: 700;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(255, 213, 79, 0.3);
    touch-action: manipulation;
}
.auth-guest-btn:active { transform: scale(0.97); }
.ranked-badge {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 229, 255, 0.25);
    touch-action: manipulation;
    font: inherit;
}
.ranked-badge:disabled,
.ranked-badge[disabled] {
    cursor: default;
    opacity: 1;
}
.modal-login { max-width: min(400px, 94vw); text-align: center; }
.login-lead {
    font-size: 13px;
    color: var(--text-dim, #8b9bb4);
    line-height: 1.4;
    margin: 0 0 14px;
}
.login-lead b { color: #e8eef8; }
.google-signin-holder {
    display: flex;
    justify-content: center;
    min-height: 44px;
    margin-bottom: 12px;
}
.login-divider {
    font-size: 11px;
    color: var(--text-dim, #8b9bb4);
    margin: 4px 0 12px;
}
.config-rank-hint {
    width: 100%;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.4;
    margin-top: 8px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
}
.lobby-body-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(100% - 100px);
    padding-bottom: 8px;
}
.multi-panel { width: 100%; }
.multi-join-actions,
.multi-lobby-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
}
.btn-copy { min-height: 40px !important; padding: 8px 14px !important; flex-shrink: 0; }
.go-rank-note {
    font-size: 12px;
    line-height: 1.45;
    margin: 8px 0 12px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: var(--text-dim);
}
.go-rank-note.warn {
    background: rgba(226, 75, 74, 0.12);
    border: 1px solid rgba(226, 75, 74, 0.35);
    color: #ffcdd2;
}
.go-rank-note.ok {
    background: rgba(76, 175, 80, 0.12);
    border: 1px solid rgba(76, 175, 80, 0.35);
    color: #c8e6c9;
}

.ranked-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 8px;
    max-width: 340px;
}
.ranked-toggle input { width: 18px; height: 18px; accent-color: #00e5ff; }
.ranked-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 12px;
}
.ranked-badge.on {
    background: rgba(76,175,80,0.2);
    border: 1px solid rgba(76,175,80,0.5);
    color: #a5d6a7;
}
.ranked-badge.off {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    color: #9aa8bc;
}
.public-rooms-box {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
}
.public-rooms-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    max-height: 120px;
    overflow-y: auto;
}
.public-room-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(0,229,255,0.2);
    background: rgba(0,229,255,0.06);
    color: #e8eef8;
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font);
}
.public-room-row b { color: #00e5ff; letter-spacing: 1px; }
.login-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    text-align: left;
    font-size: 12px;
    color: var(--text-dim);
}
.login-field input {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: rgba(255,255,255,0.08);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
}
.login-error { color: #e24b4a; font-size: 12px; min-height: 16px; margin-bottom: 8px; }
.modal-tutorial ol.tutorial-steps {
    text-align: left;
    margin: 12px 0 12px 1.1rem;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-dim);
}
.modal-tutorial ol.tutorial-steps b { color: #e8eef8; }
.phase-dot[data-phase="draft"] { /* Reforçar */ }
#hud-phase-dots .phase-dot[data-phase="draft"]::after { content: none; }

/* --- Buttons --- */
.btn-primary {
    padding: 14px 24px; border: none; border-radius: 12px;
    background: var(--accent); color: white;
    font-size: 15px; font-weight: 600; font-family: var(--font);
    cursor: pointer; transition: transform 0.1s, opacity 0.15s;
    min-height: 48px;
}
.btn-primary:active { transform: scale(0.97); opacity: 0.9; }
.btn-secondary {
    padding: 14px 24px; border: 1px solid var(--border-subtle); border-radius: 12px;
    background: rgba(255,255,255,0.06); color: var(--text);
    font-size: 15px; font-weight: 500; font-family: var(--font);
    cursor: pointer; min-height: 48px;
}
.btn-secondary:active { background: rgba(255,255,255,0.12); }
.btn-link {
    display: inline-block; padding: 10px; color: var(--text-dim);
    font-size: 13px; text-decoration: none;
}
.btn-icon {
    width: 36px; height: 36px; border: none; border-radius: 50%;
    background: rgba(255,255,255,0.1); color: var(--text);
    font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-family: var(--font);
}
.btn-wide { width: 100%; }

/* --- Lobby --- */
.lobby-container {
    width: 100%; height: 100%; padding: 16px;
    padding-left: calc(16px + var(--safe-left));
    padding-right: calc(16px + var(--safe-right));
    display: flex; flex-direction: column;
    background: var(--bg-dark);
}
.lobby-header {
    display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.lobby-header h2 { font-size: 18px; font-weight: 600; }
.lobby-body { flex: 1; overflow-y: auto; display: flex; gap: 20px; flex-wrap: wrap; }
.lobby-settings { display: flex; flex-direction: column; gap: 10px; min-width: 200px; flex: 1; }
.lobby-settings label {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; background: rgba(255,255,255,0.05);
    border-radius: 8px; gap: 12px;
}
.lobby-settings label span { font-size: 13px; color: var(--text-dim); }
.lobby-settings select, .lobby-settings input {
    background: rgba(255,255,255,0.1); border: 1px solid var(--border-subtle);
    border-radius: 6px; color: var(--text); padding: 6px 10px;
    font-size: 14px; font-family: var(--font); min-width: 120px;
}
.ideology-grid {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.ideology-grid .ideo-btn {
    width: 44px; height: 44px; border-radius: 50%;
    border: 2px solid transparent; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: white; font-weight: 600;
    transition: border-color 0.15s, transform 0.1s;
}
.ideology-grid .ideo-btn.selected { border-color: white; transform: scale(1.15); }
.lobby-ideology span { font-size: 13px; color: var(--text-dim); }
.rooms-list { flex: 1; min-width: 200px; }

/* --- Game screen --- */
#game-screen { position: relative; overflow: hidden; background: #040c18; }

#map-container {
    position: absolute; inset: 0;
    z-index: 1;
    /* reserva faixa inferior para barra + legenda */
    bottom: calc(44px + var(--safe-bottom));
}
#map-canvas { width: 100%; height: 100%; }
#map-canvas svg { width: 100%; height: 100%; display: block; }

/* --- HUD groups --- */
.hud-group { position: absolute; z-index: 10; pointer-events: auto; }

#hud-top-left {
    top: 10px; left: calc(10px + var(--safe-left));
    display: flex; gap: 6px;
}
#hud-top-center {
    top: 10px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 6px;
    background: var(--bg-panel); backdrop-filter: var(--hud-blur);
    border-radius: 20px; padding: 5px 12px;
    border: 1px solid var(--border-subtle);
    max-width: min(92vw, 420px);
    flex-wrap: nowrap;
}
.hud-match-badge {
    font-family: 'Orbitron', system-ui, sans-serif;
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1.2;
    border: 1px solid;
}
.hud-match-badge.net-online {
    color: #9dffc3;
    border-color: rgba(0, 230, 118, 0.55);
    background: rgba(0, 230, 118, 0.12);
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.2);
}
.hud-match-badge.net-offline {
    color: #9aa8bc;
    border-color: rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
}
.hud-match-badge.rank-on {
    color: #ffd54f;
    border-color: rgba(255, 213, 79, 0.55);
    background: rgba(255, 213, 79, 0.12);
}
.hud-match-badge.rank-off {
    color: #b0bec5;
    border-color: rgba(176, 190, 197, 0.35);
    background: rgba(255,255,255,0.04);
}
.hud-match-badge.rank-na {
    color: #8b9bb4;
    border-color: rgba(139, 155, 180, 0.3);
    background: transparent;
}
@media (max-width: 380px) {
    #hud-top-center { gap: 4px; padding: 4px 8px; }
    .hud-match-badge { font-size: 0.5rem; padding: 2px 5px; letter-spacing: 0.3px; }
}
#hud-players {
    top: 10px; right: calc(10px + var(--safe-right));
    display: flex; flex-direction: column; gap: 5px;
    max-height: calc(100% - 70px); overflow-y: auto;
}
#hud-cards {
    bottom: calc(50px + var(--safe-bottom));
    left: calc(10px + var(--safe-left));
}
#hud-zoom {
    bottom: calc(50px + var(--safe-bottom));
    right: calc(10px + var(--safe-right));
    display: flex; flex-direction: column; gap: 4px;
}

.hud-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg-panel); backdrop-filter: var(--hud-blur);
    border: 1px solid var(--border-subtle);
    color: rgba(255,255,255,0.85); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 500; position: relative;
    font-family: var(--font);
}
.hud-btn:active { background: rgba(255,255,255,0.15); }
.hud-btn svg { pointer-events: none; }

.badge {
    position: absolute; top: -2px; right: -2px;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--danger); color: white;
    font-size: 9px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

.hud-label { font-size: 11px; color: var(--text-dim); }
.hud-value { font-size: 15px; font-weight: 600; color: white; }
.hud-accent { color: var(--accent); }
.hud-divider { width: 1px; height: 18px; background: var(--border-subtle); }

/* Player cards in HUD */
.hud-player {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg-panel); backdrop-filter: var(--hud-blur);
    border-radius: 8px; padding: 5px 8px;
    border: 1px solid var(--border-subtle);
    min-width: 110px;
}
.hud-player.active-player { border-color: rgba(255,255,255,0.5); }
.hud-player.eliminated { opacity: 0.4; }
.hud-player-avatar {
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: white; font-weight: 600;
}
.hud-player-meta { line-height: 1.15; }
.hud-player-name { font-size: 11px; color: white; font-weight: 500; display: block; }
.hud-player-stats { font-size: 9px; color: var(--text-dim); display: block; }

/* Cards button */
.hud-btn-cards {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg-panel); backdrop-filter: var(--hud-blur);
    border-radius: 8px; padding: 8px 12px;
    border: 1px solid var(--border-subtle);
    color: rgba(255,255,255,0.85); cursor: pointer;
    font-family: var(--font);
}
.hud-btn-cards:active { background: rgba(255,255,255,0.15); }
.card-count { font-size: 14px; font-weight: 600; color: white; }

/* --- Bottom bar --- */
#hud-bottom-bar {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: calc(44px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(0,0,0,0.75); backdrop-filter: var(--hud-blur);
    border-top: 1px solid var(--border-subtle);
    display: flex; align-items: center;
    padding-left: calc(12px + var(--safe-left));
    padding-right: calc(12px + var(--safe-right));
    gap: 12px; z-index: 10;
}
#hud-player-info { display: flex; align-items: center; gap: 8px; }
#hud-player-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; color: white;
}
#hud-player-details { line-height: 1.15; }
#hud-player-name { font-size: 12px; font-weight: 600; color: white; }
#hud-player-ideology { font-size: 10px; color: var(--text-dim); }

#hud-phase-dots { display: flex; gap: 5px; align-items: center; }
.phase-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transition: background 0.2s, transform 0.2s;
}
.phase-dot.active { background: var(--accent); transform: scale(1.3); }
.phase-dot.phase-attack.active { background: var(--danger); }

#hud-actions { display: flex; gap: 6px; margin-left: auto; }
.btn-action {
    padding: 7px 18px; border: none; border-radius: 16px;
    background: var(--accent); color: white;
    font-size: 13px; font-weight: 600; cursor: pointer;
    font-family: var(--font); min-height: 36px;
    transition: transform 0.1s;
}
.btn-action:active { transform: scale(0.96); }
.btn-action.attack { background: var(--danger); }
.btn-pass {
    padding: 7px 14px; border: 1px solid var(--border-subtle);
    border-radius: 16px; background: rgba(255,255,255,0.08);
    color: var(--text-dim); font-size: 12px; cursor: pointer;
    font-family: var(--font); min-height: 36px;
}
#hud-round-info { font-size: 10px; color: var(--text-muted); white-space: nowrap; }

/* --- Territory tooltip --- */
#territory-tooltip {
    position: absolute; z-index: 20;
    background: var(--bg-panel); backdrop-filter: var(--hud-blur);
    border-radius: 8px; padding: 8px 12px;
    border: 1px solid var(--border-subtle);
    pointer-events: none;
    max-width: 200px;
}
#tt-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
#tt-details { font-size: 11px; color: var(--text-dim); }

/* --- Modals --- */
.modal {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.72);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}
.modal[hidden] { display: none !important; }
.modal-content {
    background: var(--bg-panel-solid);
    border: 1px solid var(--border-subtle);
    border-radius: 16px; padding: 20px;
    max-width: 400px; width: 90%;
    max-height: 80vh; overflow-y: auto;
}
.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; font-size: 16px; font-weight: 600;
}

/* Attack modal */
.attack-header {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    margin-bottom: 16px;
}
.atk-card {
    flex: 1; padding: 12px; border-radius: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    text-align: center;
}
.atk-card .atk-label { font-size: 10px; color: var(--text-dim); margin-bottom: 4px; }
.atk-card .atk-name { font-size: 14px; font-weight: 600; }
.atk-card .atk-troops { font-size: 20px; font-weight: 700; margin-top: 4px; }
.atk-vs { font-size: 16px; font-weight: 700; color: var(--text-muted); }

.dice-area {
    display: flex; justify-content: center; gap: 20px;
    margin-bottom: 16px; min-height: 50px;
}
.dice-group { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dice-group-label { font-size: 10px; color: var(--text-dim); }
.dice-row { display: flex; gap: 4px; }
.die {
    width: 32px; height: 32px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; color: white;
}
.die.winner { box-shadow: 0 0 8px rgba(255,255,255,0.4); }
.die.loser { opacity: 0.5; }

.attack-actions { display: flex; gap: 8px; }
.attack-actions button { flex: 1; }

/* Occupation */
#occupation-modal .modal-content { text-align: center; }
#occupation-modal h3 { margin-bottom: 12px; }
#occ-slider { width: 100%; margin: 12px 0; accent-color: var(--accent); }
#occ-count { font-size: 28px; font-weight: 700; margin-bottom: 12px; }

/* Cards modal */
.modal-cards { max-width: 480px; }
#cards-hand {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 12px; justify-content: center;
}
.card-item {
    width: 60px; height: 80px; border-radius: 8px;
    border: 2px solid var(--border-subtle);
    background: rgba(255,255,255,0.05);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    cursor: pointer; transition: border-color 0.15s, transform 0.1s;
    font-size: 10px; text-align: center; padding: 4px;
}
.card-item.selected { border-color: var(--accent); transform: scale(1.08); }
.card-item .card-symbol { font-size: 22px; margin-bottom: 2px; }
.card-item .card-territory { font-size: 8px; color: var(--text-dim); }

/* Game over */
.modal-gameover { text-align: center; }
.modal-gameover h2 { font-size: 22px; margin-bottom: 12px; }
#go-stats { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; line-height: 1.6; }
#go-score { font-size: 32px; font-weight: 700; color: var(--accent); margin-bottom: 16px; }

/* Log */
.log-entries {
    max-height: 300px; overflow-y: auto;
    font-size: 12px; line-height: 1.5;
}
.log-entries .log-entry { padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }

/* ========== Chat Operacional (bottom sheet) ========== */
.chat-sheet {
    position: fixed; inset: 0; z-index: 280;
    display: flex; flex-direction: column; justify-content: flex-end;
    pointer-events: none;
}
.chat-sheet:not([hidden]) { pointer-events: auto; }
.chat-sheet[hidden] { display: none !important; }
.chat-sheet-backdrop {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.45);
}
.chat-sheet-panel {
    position: relative;
    display: flex; flex-direction: column;
    max-height: min(72vh, 560px);
    background: linear-gradient(180deg, #0c1528 0%, #08101c 100%);
    border: 1px solid rgba(176, 38, 255, 0.35);
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.55);
    padding: 0 10px 10px;
    z-index: 1;
}
.chat-sheet-handle {
    width: 40px; height: 4px; border-radius: 2px;
    background: rgba(255,255,255,0.2);
    margin: 8px auto 4px;
}
.chat-sheet-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 4px 2px 8px;
}
.chat-sheet-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-sheet-title strong { display: block; font-size: 14px; color: #e8eef8; }
.chat-sheet-title small { display: block; font-size: 11px; color: #8892b0; }
.chat-sheet-icon { font-size: 18px; }

.chat-filters {
    display: flex; gap: 6px; padding-bottom: 8px; flex-wrap: wrap;
}
.chat-filter {
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: #a8b2c8;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
}
.chat-filter.active {
    background: rgba(176, 38, 255, 0.22);
    border-color: rgba(176, 38, 255, 0.55);
    color: #f0e6ff;
}

.chat-body-row {
    display: flex; gap: 8px;
    flex: 1; min-height: 0;
    height: min(38vh, 280px);
}
.chat-messages {
    flex: 1; overflow-y: auto; min-width: 0;
    display: flex; flex-direction: column; gap: 8px;
    padding: 4px 2px 8px;
    font-size: 13px; line-height: 1.4;
    -webkit-overflow-scrolling: touch;
}
.chat-roster {
    width: 92px; flex-shrink: 0;
    overflow-y: auto;
    border-left: 1px solid rgba(255,255,255,0.08);
    padding-left: 6px;
    display: flex; flex-direction: column; gap: 6px;
}
.chat-roster-item {
    display: flex; flex-direction: column; gap: 1px;
    padding: 4px 4px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    border: 1px solid transparent;
}
.chat-roster-item:active, .chat-roster-item:hover {
    border-color: rgba(176, 38, 255, 0.4);
}
.chat-roster-top { display: flex; align-items: center; gap: 4px; }
.chat-roster-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.chat-roster-name {
    font-size: 10px; font-weight: 600; color: #e8eef8;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-roster-meta {
    font-size: 9px; color: #8892b0; padding-left: 12px;
}
.chat-roster-item.eliminated { opacity: 0.45; }
.chat-roster-item.ai .chat-roster-name::after { content: " 🤖"; font-size: 8px; }

/* Message bubbles */
.chat-msg {
    display: flex; flex-direction: column; gap: 2px;
    max-width: 92%;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.06);
    align-self: flex-start;
}
.chat-msg.me {
    align-self: flex-end;
    background: rgba(176, 38, 255, 0.12);
}
.chat-msg.system, .chat-msg.event {
    align-self: center;
    max-width: 96%;
    background: rgba(0, 229, 255, 0.06);
    border-color: rgba(0, 229, 255, 0.15);
    text-align: center;
    font-size: 12px;
    color: #a8d8e8;
}
.chat-msg.mentioned {
    box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.55), 0 0 12px rgba(255, 215, 0, 0.15);
}
.chat-msg.ping { border-color: rgba(0, 229, 255, 0.35); }
.chat-msg.quick { border-style: dashed; }
.chat-msg-head {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.chat-msg-sender {
    font-size: 11px; font-weight: 700;
}
.chat-msg-ideo {
    font-size: 9px; opacity: 0.75; font-weight: 500;
}
.chat-msg-time {
    font-size: 9px; color: #6b7690; margin-left: auto;
}
.chat-msg-text {
    color: #e8eef8; word-break: break-word;
}
.chat-msg-text .chat-mention-token {
    color: #ffd700; font-weight: 600;
}
.chat-msg-text .chat-ping-link {
    color: #00e5ff; text-decoration: underline;
    cursor: pointer; font-weight: 600;
}
.chat-empty {
    text-align: center; color: #6b7690; font-size: 12px;
    padding: 24px 12px; font-style: italic;
}

.chat-emoji-tray {
    display: flex; flex-wrap: wrap; gap: 4px;
    padding: 6px 0; border-top: 1px solid rgba(255,255,255,0.08);
}
.chat-emoji-tray[hidden] { display: none !important; }
.chat-emoji-btn {
    width: 36px; height: 36px;
    border: none; background: rgba(255,255,255,0.06);
    border-radius: 8px; font-size: 18px; cursor: pointer;
}
.chat-quick-row {
    display: flex; gap: 6px; overflow-x: auto;
    padding: 6px 0; -webkit-overflow-scrolling: touch;
}
.chat-quick {
    flex-shrink: 0;
    border: 1px solid rgba(176, 38, 255, 0.3);
    background: rgba(176, 38, 255, 0.1);
    color: #dcc8f5;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.chat-input-row {
    display: flex; gap: 6px; align-items: center;
    padding-top: 4px;
}
.chat-input-row input {
    flex: 1; min-width: 0;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border-subtle); border-radius: 10px;
    color: var(--text); padding: 10px 12px; font-size: 14px;
    font-family: var(--font);
}
.chat-input-row input:focus {
    outline: none; border-color: rgba(176, 38, 255, 0.55);
}
.chat-tool, .chat-send {
    width: 40px; height: 40px; flex-shrink: 0;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: #e8eef8;
    font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.chat-send {
    background: linear-gradient(135deg, #7b2cbf, #b026ff);
    border-color: transparent;
    font-weight: 700;
}
.chat-mention-list {
    position: absolute;
    left: 10px; right: 10px; bottom: 118px;
    max-height: 140px; overflow-y: auto;
    background: #0e1830;
    border: 1px solid rgba(176, 38, 255, 0.4);
    border-radius: 10px;
    z-index: 5;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.chat-mention-list[hidden] { display: none !important; }
.chat-mention-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    font-size: 13px; color: #e8eef8;
    cursor: pointer;
    border: none; background: transparent; width: 100%; text-align: left;
}
.chat-mention-item:active, .chat-mention-item:hover {
    background: rgba(176, 38, 255, 0.15);
}

.chat-tool-mini {
    margin-left: auto;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: #c8d0e0;
    border-radius: 8px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}
.chat-hint {
    margin: 4px 0 0;
    font-size: 10px;
    color: #6b7690;
    text-align: center;
}
.chat-tray-tabs {
    display: flex; gap: 6px; width: 100%; margin-bottom: 4px;
}
.chat-tray-tab {
    flex: 1;
    border: 1px solid rgba(255,255,255,0.1);
    background: transparent;
    color: #a8b2c8;
    border-radius: 8px;
    padding: 4px;
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
}
.chat-tray-tab.active {
    background: rgba(176, 38, 255, 0.2);
    border-color: rgba(176, 38, 255, 0.45);
    color: #f0e6ff;
}
.chat-emoji-list, .chat-sticker-list {
    display: flex; flex-wrap: wrap; gap: 4px; width: 100%;
}
.chat-sticker-btn {
    display: flex; flex-direction: column; align-items: center;
    gap: 2px; width: 56px; padding: 6px 4px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    cursor: pointer;
    color: #e8eef8;
    font-family: inherit;
}
.chat-sticker-btn span:first-child { font-size: 22px; }
.chat-sticker-btn span:last-child { font-size: 9px; color: #8892b0; }
.chat-sticker-card {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 6px;
}
.chat-sticker-emoji { font-size: 40px; line-height: 1; }
.chat-sticker-label { font-size: 11px; color: #a8b2c8; }
.chat-emote { color: #c9b8ff; font-style: italic; }
.chat-msg.emote {
    align-self: center;
    background: rgba(176, 38, 255, 0.08);
    border-style: dashed;
}
.chat-msg.sticker { background: rgba(0, 229, 255, 0.06); }
.chat-msg-reacts {
    display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
}
.chat-react-chip {
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
    padding: 1px 6px;
    font-size: 11px;
    color: #e8eef8;
    cursor: pointer;
    font-family: inherit;
}
.chat-react-chip.mine {
    border-color: rgba(176, 38, 255, 0.55);
    background: rgba(176, 38, 255, 0.18);
}
.chat-react-bar {
    display: flex; gap: 2px; margin-top: 4px; opacity: 0.85;
}
.chat-react-add {
    border: none; background: transparent;
    font-size: 12px; cursor: pointer; padding: 0 3px;
    opacity: 0.7;
}
.chat-roster-item.muted { outline: 1px dashed #e24b4a; }
.chat-roster-mute {
    font-size: 9px; color: #e24b4a; padding-left: 12px;
}
.chat-channel-team {
    font-size: 9px; color: #7ee787; margin-left: 4px;
}

/* Keyboard / visualViewport safe area */
.chat-sheet-panel.keyboard-open {
    max-height: min(58vh, 420px);
}

/* Legacy modal-chat fallback */
.modal-chat { display: flex; flex-direction: column; max-height: 70vh; }

/* Turn banner */
#turn-banner {
    position: fixed; top: 20%; left: 50%; transform: translateX(-50%);
    z-index: 40;
    background: var(--bg-panel); backdrop-filter: var(--hud-blur);
    border-radius: 12px; padding: 12px 28px;
    border: 1px solid var(--border-subtle);
    font-size: 16px; font-weight: 600;
    animation: bannerIn 0.3s ease-out;
    pointer-events: none;
}
#turn-banner[hidden] { display: none; }
@keyframes bannerIn { from { opacity: 0; transform: translateX(-50%) translateY(-20px); } }

/* Revolt overlay */
#revolt-overlay .modal-content { text-align: center; }
#revolt-title { font-size: 20px; color: var(--danger); margin-bottom: 8px; }

/* --- SVG map styles (blocos limpos estilo RISK) --- */
.land-base {
    pointer-events: none;
}

.territory-bloc {
    stroke: rgba(255, 255, 255, 0.55);
    stroke-width: 1.15;
    stroke-linejoin: round;
    cursor: pointer;
    transition: filter 0.12s, stroke 0.12s, stroke-width 0.12s;
    paint-order: stroke fill;
}
.territory-bloc:hover, .territory-bloc.touch-hover {
    stroke: #fff;
    stroke-width: 1.8;
    filter: brightness(1.12);
}
.territory-bloc.selected {
    stroke: #00e5ff;
    stroke-width: 2.4;
    filter: brightness(1.18) drop-shadow(0 0 6px rgba(0, 229, 255, 0.65));
}
.territory-bloc.target-candidate {
    stroke: #ffea00;
    stroke-width: 2;
    stroke-dasharray: none;
    filter: brightness(1.1) drop-shadow(0 0 5px rgba(255, 234, 0, 0.45));
}
.territory-path { display: none; } /* legado — não usar países soltos */

.army-badge {
    cursor: pointer;
    pointer-events: all;
}
.army-badge-hit { pointer-events: all; }
.army-badge-circle {
    stroke: rgba(255,255,255,0.9);
    stroke-width: 1.6;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.55));
    pointer-events: none;
}
.army-badge-text {
    font-family: var(--font);
    font-weight: 800;
    fill: #fff;
    paint-order: stroke;
    stroke: rgba(0,0,0,0.45);
    stroke-width: 2.5px;
    pointer-events: none;
}
.army-badge-glow { pointer-events: none; }
/* Bolinha de ideologia nativa — sempre visível sobre o badge */
.ideology-indicator {
    display: block !important;
    pointer-events: none;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.6));
}
.army-badge:active .army-badge-circle {
    filter: brightness(1.25) drop-shadow(0 0 6px rgba(255,255,255,0.5));
}

.sea-route {
    stroke: rgba(120, 190, 255, 0.45);
    stroke-width: 1.4;
    stroke-dasharray: 5 4;
    fill: none;
    pointer-events: none;
}

@keyframes pulseTerritory {
    0%, 100% { filter: brightness(1.18); }
    50% { filter: brightness(1.35); }
}

/* Modal reforços do turno */
.modal-draft-income { text-align: center; max-width: min(420px, 92vw); }
.modal-draft-income h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #e8f7ff;
}
.draft-income-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
    max-height: 40vh;
    overflow-y: auto;
    text-align: left;
}
.draft-income-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
}
.draft-income-row.negative { opacity: 0.85; }
.draft-income-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.draft-income-label strong {
    font-size: 13px;
    color: #f0f4fa;
}
.draft-income-label span {
    font-size: 11px;
    color: var(--text-dim);
}
.draft-income-amt {
    font-size: 16px;
    font-weight: 800;
    color: #4caf50;
    flex-shrink: 0;
}
.draft-income-row.negative .draft-income-amt { color: #e24b4a; }
.draft-income-total {
    font-size: 28px;
    font-weight: 800;
    color: #00e5ff;
    margin-bottom: 8px;
    text-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
}
.draft-income-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 14px;
    line-height: 1.35;
}

/* Lobby multi: código da sala */
.room-code-card {
    width: 100%;
    padding: 14px;
    margin-bottom: 12px;
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 12px;
}
.room-code-label {
    display: block;
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 6px;
}
.room-code-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.room-code-row strong {
    font-size: 28px;
    letter-spacing: 4px;
    color: #00e5ff;
    font-weight: 800;
}
.room-code-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.35;
}

/* Botão lateral — abre/fecha legenda de continentes */
.continent-legend-toggle {
    position: absolute;
    left: calc(8px + var(--safe-left));
    top: 50%;
    transform: translateY(-50%);
    z-index: 14;
    width: auto !important;
    min-width: 40px;
    height: 40px;
    padding: 0 10px !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(6, 14, 28, 0.82) !important;
    border: 1px solid rgba(0, 229, 255, 0.28) !important;
    color: #cfefff !important;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font);
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.continent-legend-toggle.active {
    border-color: rgba(0, 229, 255, 0.65) !important;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
    color: #00e5ff !important;
}
.legend-toggle-icon { font-size: 14px; line-height: 1; }
.legend-toggle-label { font-size: 10px; letter-spacing: 0.3px; }

/* Painel da legenda (só quando aberto) */
.continent-legend {
    position: absolute;
    left: calc(54px + var(--safe-left));
    top: 50%;
    transform: translateY(-50%);
    z-index: 13;
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-width: min(46vw, 220px);
    padding: 10px 12px;
    background: rgba(4, 10, 20, 0.9);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    border: 1px solid rgba(0, 229, 255, 0.22);
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
    pointer-events: auto;
}
.continent-legend[hidden] { display: none !important; }
.continent-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.continent-legend-item b {
    color: #00e5ff;
    font-weight: 700;
    margin-left: auto;
    padding-left: 8px;
}
.continent-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    flex-shrink: 0;
    box-shadow: 0 0 5px currentColor;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* Safe area spacing for notch phones */
@supports (padding: env(safe-area-inset-left)) {
    #hud-bottom-bar {
        padding-left: calc(12px + env(safe-area-inset-left));
        padding-right: calc(12px + env(safe-area-inset-right));
    }
}

/* --- Audit polish: chips, objectives, dice, conquest --- */
.multi-status { font-size: 12px; color: var(--text-dim); margin-bottom: 10px; width: 100%; }
.lobby-players-title { font-size: 12px; color: var(--text-dim); margin: 8px 0; }
.lobby-player-row {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; background: rgba(255,255,255,0.05);
    border-radius: 8px; margin-bottom: 6px; font-size: 13px;
}
.text-dim { color: var(--text-dim); font-size: 11px; }
.hud-player-chip {
    display: flex; align-items: center; gap: 6px;
    background: rgba(6, 14, 28, 0.78); backdrop-filter: var(--hud-blur);
    border-radius: 10px; padding: 6px 9px;
    border: 1px solid rgba(255,255,255,0.12); min-width: 96px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
.hud-player-chip.active {
    border-color: rgba(0, 229, 255, 0.65);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.28);
}
.hud-player-chip.eliminated { opacity: 0.35; }
.chip-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 6px currentColor; }
.chip-name { font-size: 11px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #f2f5fa; }
.chip-count { font-size: 12px; font-weight: 800; color: #00e5ff; }

#hud-top-center {
    border-color: rgba(0, 229, 255, 0.25) !important;
    box-shadow: 0 2px 14px rgba(0,0,0,0.4);
}
#hud-bottom-bar {
    background: rgba(3, 8, 16, 0.88) !important;
    border-top-color: rgba(0, 229, 255, 0.15) !important;
}
.btn-action {
    box-shadow: 0 0 14px rgba(76, 175, 80, 0.35);
    letter-spacing: 0.4px;
}
.objective-tip {
    position: absolute; bottom: calc(72px + var(--safe-bottom)); left: 50%;
    transform: translateX(-50%); z-index: 12;
    max-width: 70vw; padding: 6px 12px;
    background: var(--bg-panel); backdrop-filter: var(--hud-blur);
    border: 1px solid var(--border-subtle); border-radius: 10px;
    font-size: 11px; color: var(--text-dim); text-align: center;
    pointer-events: none;
}
.territory-label { display: none; } /* labels de país poluem o mapa mobile */
.territory-bloc.conquer-flash {
    filter: brightness(1.8) drop-shadow(0 0 8px #fff);
    animation: conquerPulse 0.7s ease-out;
}
@keyframes conquerPulse {
    0% { filter: brightness(2.2); stroke-width: 3; }
    100% { filter: brightness(1); }
}
.die-roll { animation: diePop 0.35s ease-out both; }
@keyframes diePop {
    0% { transform: scale(0.3) rotate(-20deg); opacity: 0; }
    70% { transform: scale(1.15) rotate(5deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}
#turn-banner.show { animation: bannerIn 0.3s ease-out; }
@keyframes pulseTerritory {
    0%, 100% { stroke-opacity: 1; }
    50% { stroke-opacity: 0.5; }
}
.sea-route {
    stroke: rgba(100, 180, 255, 0.35);
    stroke-width: 1.2;
    stroke-dasharray: 4 3;
    pointer-events: none;
}
/* (legacy .chat-msg list style removed — bubbles above) */
.btn-wide + .btn-wide, .btn-wide + .btn-secondary, .btn-secondary.btn-wide {
    margin-top: 8px;
}
