/* CSS Variables for Core Colors and Theme Styling */
:root {
    --bg-dark: #07090e;
    --bg-dark-panel: rgba(13, 18, 29, 0.75);
    --bg-glass-sub: rgba(22, 31, 51, 0.5);
    --border-glass: rgba(56, 75, 112, 0.4);
    --text-light: #f1f4f9;
    --text-muted: #8d9bb5;
    
    /* Ideology / Player Accent Colors */
    --color-militarist: #ff3344;
    --color-populist: #00e676;
    --color-socialist: #3399ff;
    --color-realist: #ffc107;
    --color-neutral: #8892b0;
    
    /* Glow/Shadow Filters */
    --glow-militarist: 0 0 10px rgba(255, 51, 68, 0.6);
    --glow-populist: 0 0 10px rgba(0, 230, 118, 0.6);
    --glow-socialist: 0 0 10px rgba(51, 153, 255, 0.6);
    --glow-realist: 0 0 10px rgba(255, 193, 7, 0.6);
    
    --font-heading: 'Orbitron', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* Reset & Base Rules */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(13, 20, 38, 0.8) 0%, rgba(7, 9, 14, 1) 90%),
        linear-gradient(rgba(18, 26, 46, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(18, 26, 46, 0.1) 1px, transparent 1px);
    background-size: 100% 100%, 30px 30px, 30px 30px;
}

/* Core Container & Layouts */
#app {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Screen States */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

/* Glassmorphism Panel styles */
.glass-panel {
    background: var(--bg-dark-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    padding: 24px;
}

.glass-subpanel {
    background: var(--bg-glass-sub);
    border: 1px solid rgba(56, 75, 112, 0.25);
    border-radius: 8px;
    padding: 16px;
}

.neon-timer {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ff1744;
    text-shadow: 0 0 5px #ff1744, 0 0 15px #ff1744, 0 0 20px #ff1744;
    background: rgba(20, 0, 0, 0.6);
    border: 1px solid rgba(255, 23, 68, 0.4);
    border-radius: 4px;
    padding: 2px 10px;
    letter-spacing: 2px;
    animation: none;
}

.neon-timer.pulse-urgent {
    animation: pulse-urgent 1s infinite;
}

@keyframes pulse-urgent {
    0% { opacity: 1; text-shadow: 0 0 5px #ff1744, 0 0 15px #ff1744; }
    50% { opacity: 0.7; text-shadow: 0 0 2px #ff1744; }
    100% { opacity: 1; text-shadow: 0 0 5px #ff1744, 0 0 15px #ff1744; }
}

/* Typography styles */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    letter-spacing: 1px;
}

/* ---------------- MENU SCREEN ---------------- */
#menu-screen {
    background: radial-gradient(circle at center, rgba(16, 28, 54, 0.6) 0%, rgba(7, 9, 14, 0.95) 80%);
}

.glow-container {
    text-align: center;
    padding: 40px;
    border-radius: 16px;
    background: rgba(13, 20, 38, 0.4);
    border: 1px solid rgba(51, 153, 255, 0.15);
    box-shadow: 0 0 40px rgba(51, 153, 255, 0.1);
}

.logo-box {
    margin-bottom: 40px;
}

.glitch-title {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--text-light);
    text-shadow: 0 0 15px rgba(241, 244, 249, 0.3), 0 0 3px rgba(51, 153, 255, 0.8);
    letter-spacing: 6px;
    margin-bottom: 5px;
}

.sub-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-militarist);
    text-shadow: 0 0 8px rgba(255, 51, 68, 0.5);
    letter-spacing: 12px;
    margin-left: 12px;
}

.tagline {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 320px;
    margin: 0 auto;
}

.footer-credit {
    position: absolute;
    bottom: 20px;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    opacity: 0.6;
}

/* ---------------- LOBBY SCREEN ---------------- */
.lobby-container {
    width: 90%;
    max-width: 980px;
    height: 82vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: rgba(10, 15, 30, 0.9);
    border: 1.5px solid rgba(56, 75, 112, 0.45);
    border-radius: 12px;
    box-shadow: 0 0 35px rgba(0, 229, 255, 0.15), inset 0 0 15px rgba(255,255,255,0.02);
    padding: 25px;
}

.lobby-header {
    text-align: center;
    border-bottom: 1.5px solid rgba(56, 75, 112, 0.3);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.lobby-header h2 {
    font-family: var(--font-heading);
    color: #fff;
    font-size: 2.2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.6);
}

.lobby-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.lobby-container.has-chat {
    max-width: 1400px;
    width: 96%;
    height: auto;
    min-height: 82vh;
}

/* Quando o lobby tem chat, o conteudo pode exceder a viewport;
   permitimos scroll na screen para que o container inteiro role
   sem cortar paineis nem exigir scroll interno em cada um. */
#lobby-screen.active:has(.has-chat) {
    justify-content: flex-start;
    overflow-y: auto;
    padding: 30px 0;
}

.lobby-content {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 20px;
    flex-grow: 1;
    overflow: hidden;
    margin-bottom: 20px;
    min-width: 0;
}

.lobby-content.has-chat {
    grid-template-columns: minmax(240px, 1fr) minmax(240px, 1fr) minmax(320px, 1.3fr);
    overflow: visible;
}

.lobby-settings, .lobby-players, #lobby-chat-panel {
    min-width: 0;
}

/* Com chat ativo, cada painel expande conforme seu conteudo */
.lobby-content.has-chat .lobby-settings,
.lobby-content.has-chat .lobby-players,
.lobby-content.has-chat #lobby-chat-panel {
    height: auto;
    min-height: 480px;
}

.lobby-content.has-chat #lobby-chat-panel {
    min-height: 520px;
}

.lobby-settings, .lobby-players, #lobby-chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: rgba(22, 31, 51, 0.4);
    border: 1px solid rgba(56, 75, 112, 0.3);
    border-radius: 8px;
    padding: 20px;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.lobby-settings {
    border-left: 3.5px solid #00e5ff;
}

.lobby-players {
    border-left: 3.5px solid #b026ff;
}

#lobby-chat-panel {
    border-left: 3.5px solid #00e676;
}

.lobby-settings:hover, .lobby-players:hover, #lobby-chat-panel:hover {
    border-color: rgba(0, 229, 255, 0.4);
    box-shadow: 0 4px 20px rgba(0, 229, 255, 0.08);
}

.lobby-settings h3, .lobby-players h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-light);
    border-left: 3px solid var(--color-socialist);
    padding-left: 10px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.control-group label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.control-group select, .control-group input {
    background: rgba(13, 20, 38, 0.8);
    border: 1px solid var(--border-glass);
    color: var(--text-light);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: var(--font-body);
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.control-group select:focus, .control-group input:focus {
    border-color: var(--color-socialist);
    box-shadow: 0 0 8px rgba(51, 153, 255, 0.3);
}

.players-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.players-list-header h3 {
    margin-bottom: 0;
}

.players-list-container {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 5px;
}

/* Custom Scrollbar for container */
.players-list-container::-webkit-scrollbar,
.log-container::-webkit-scrollbar {
    width: 6px;
}
.players-list-container::-webkit-scrollbar-thumb,
.log-container::-webkit-scrollbar-thumb {
    background: rgba(56, 75, 112, 0.4);
    border-radius: 3px;
}

/* Individual Lobby Player Slot */
.player-slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: rgba(22, 31, 51, 0.3);
    border: 1px solid rgba(56, 75, 112, 0.2);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.player-slot.active {
    border-color: rgba(51, 153, 255, 0.3);
}

.player-slot-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
}

.player-avatar-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--color-neutral);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

.player-slot-name {
    background: transparent;
    border: none;
    border-bottom: 1.5px solid transparent;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 2px 5px;
    outline: none;
    max-width: 120px;
}

.player-slot-name:focus {
    border-color: var(--color-socialist);
}

.player-slot-type, .player-slot-ideology {
    background: rgba(13, 20, 38, 0.8);
    border: 1px solid var(--border-glass);
    color: var(--text-light);
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    outline: none;
    cursor: pointer;
}

.player-slot-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}

.btn-remove-player {
    background: rgba(255, 51, 68, 0.15);
    border: 1px solid rgba(255, 51, 68, 0.3);
    color: var(--color-militarist);
    border-radius: 4px;
    width: 26px;
    height: 26px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-remove-player:hover {
    background: var(--color-militarist);
    color: var(--text-light);
}

.lobby-footer {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid rgba(56, 75, 112, 0.3);
    padding-top: 15px;
    margin-top: 20px;
}

/* ---------------- GAMEPLAY SCREEN ---------------- */
#game-screen {
    background: #040508;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Dashboard */
.game-dashboard {
    height: 60px;
    background: rgba(13, 18, 29, 0.9);
    border-bottom: 1px solid var(--border-glass);
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.dash-left {
    display: flex;
    align-items: center;
}

.active-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(22, 31, 51, 0.6);
    border: 1px solid rgba(56, 75, 112, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.player-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    background-color: var(--color-neutral);
    box-shadow: 0 0 8px currentColor;
}

.ideology-label {
    font-size: 0.7rem;
    font-family: var(--font-heading);
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-muted);
}

/* Stepper of game phases */
.phase-stepper {
    display: flex;
    justify-content: center;
    gap: 5px;
    background: rgba(7, 9, 14, 0.6);
    border: 1px solid var(--border-glass);
    padding: 3px;
    border-radius: 30px;
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
}

.phase-step {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 20px;
    transition: all 0.3s;
}

.phase-step.active {
    color: var(--text-light);
    background: var(--color-socialist);
    box-shadow: var(--glow-socialist);
}

.dash-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.turn-counter {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--text-light);
    background: rgba(22, 31, 51, 0.6);
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid rgba(56, 75, 112, 0.3);
}

.btn-hud {
    background: rgba(35, 45, 65, 0.8);
    color: var(--text-light);
    border: 1px solid rgba(100, 120, 160, 0.5);
    font-size: 0.8rem;
    padding: 6px 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.btn-hud:hover {
    background: rgba(51, 153, 255, 0.15);
    border-color: var(--color-socialist);
}

/* Main Grid Layout */
.game-layout {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    gap: 15px;
    padding: 15px;
    height: calc(100vh - 60px);
    overflow: hidden;
}

.sidebar-left, .sidebar-right {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.sidebar-left {
    gap: 15px;
}

.panel-section {
    background: rgba(7, 9, 14, 0.4);
    border: 1px solid rgba(56, 75, 112, 0.2);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.panel-section h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(56, 75, 112, 0.2);
    padding-bottom: 6px;
}

.ranks-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

/* Score Rank Row */
.rank-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(22, 31, 51, 0.2);
    border: 1px solid rgba(56, 75, 112, 0.15);
    border-radius: 6px;
    font-size: 0.8rem;
    transition: all 0.3s;
}

.rank-item.active-turn {
    border-color: var(--active-border-color, var(--border-glass));
    background: rgba(22, 31, 51, 0.5);
    box-shadow: 0 0 8px var(--active-glow-color, transparent);
}

.rank-item.eliminated {
    opacity: 0.35;
    text-decoration: line-through;
}

.rank-color-block {
    width: 8px;
    height: 24px;
    border-radius: 3px;
    background-color: var(--color-neutral);
}

.rank-info {
    display: flex;
    flex-direction: column;
}

.rank-info .name {
    font-weight: 600;
    color: var(--text-light);
}

.rank-info .sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: var(--font-heading);
    text-transform: uppercase;
}

.rank-stats {
    text-align: right;
}

.rank-stats .territories {
    font-weight: bold;
    color: var(--text-light);
}

.rank-stats .label {
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* Sidebar Revolt and Objective Panels */
.revolt-sidebar-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.objective-sidebar-desc {
    background: rgba(22, 31, 51, 0.35);
    border-left: 3px solid var(--color-realist);
    padding: 8px 10px;
    border-radius: 0 4px 4px 0;
    margin-top: 5px;
    border: 1px solid rgba(56, 75, 112, 0.1);
    border-left-color: var(--color-realist);
}

/* Log panel */
.log-section {
    flex-grow: 1;
    overflow: hidden;
}

.log-container {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.75rem;
    padding-right: 5px;
}

.log-entry {
    line-height: 1.4;
    padding: 6px 8px;
    background: rgba(22, 31, 51, 0.25);
    border-left: 3.5px solid rgba(56, 75, 112, 0.3);
    border-radius: 0 4px 4px 0;
    transition: all 0.2s;
}

.log-entry.log-action-system { color: #cfd8dc; } /* Cinza Claro Neutro */
.log-entry.log-action-draft { color: #80deea; }  /* Ciano Digital (Reforço) */
.log-entry.log-action-battle { color: #ffb74d; } /* Laranja (Combate) */
.log-entry.log-action-battle-loss { color: #ff5252; } /* Vermelho Suave (Perda) */
.log-entry.log-action-conquest { color: #69f0ae; } /* Verde Claro (Conquistas) */
.log-entry.log-action-revolt { color: #ff5252; } /* Vermelho Suave (Revoltas) */
.log-entry.log-action-fortify { color: #a5d6a7; } /* Verde Claro Mudo (Manobras) */
.log-entry.log-action-victory { color: #ea80fc; } /* Roxo Brilhante (Vitória) */

/* ---------------- CENTER MAP VIEWPORT ---------------- */
.map-viewport {
    position: relative;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.map-controls {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.map-controls button, .map-controls span, .map-controls select {
    pointer-events: auto;
}

.map-controls .btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    background: rgba(13, 18, 29, 0.85);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
}

.map-controls .btn-icon:hover {
    background: rgba(51, 153, 255, 0.2);
    border-color: var(--color-socialist);
}

.map-guide {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(13, 18, 29, 0.85);
    border: 1px solid var(--border-glass);
    padding: 6px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.map-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: radial-gradient(circle at center, #0f1626 0%, #05070a 100%);
    cursor: grab;
}

.map-container:active {
    cursor: grabbing;
}

#world-map {
    width: 100%;
    height: 100%;
    max-height: 100%;
    transition: transform 0.1s ease-out;
    transform-origin: center center;
    user-select: none;
}

/* SVG Elements style */
.continent-boundary {
    fill: none;
    stroke: rgba(56, 75, 112, 0.15);
    stroke-width: 2;
    stroke-dasharray: 6, 6;
}

.connection-line {
    fill: none;
    stroke: rgba(56, 75, 112, 0.35);
    stroke-width: 1.5;
    stroke-dasharray: 4, 4;
}

.connection-line.sea-route {
    stroke: rgba(51, 153, 255, 0.35);
    stroke-width: 1.5;
    stroke-dasharray: 5, 5;
    animation: dash-flow 20s linear infinite;
}

@keyframes dash-flow {
    to {
        stroke-offset: -100;
    }
}

/* SVG Node Territories */
.territory-node {
    cursor: pointer;
}

.territory-polygon {
    fill: #162033;
    fill-opacity: 0.75;
    stroke: #07090e;
    stroke-width: 2.5px;
    filter: drop-shadow(2px 4px 5px rgba(0, 0, 0, 0.75));
    transition: all 0.25s ease;
}

.territory-node:hover .territory-polygon {
    fill-opacity: 0.9;
    stroke-width: 3.5px !important;
    filter: drop-shadow(0px 0px 8px var(--continent-hover-color, rgba(51, 153, 255, 0.6))) drop-shadow(2px 4px 5px rgba(0, 0, 0, 0.75));
}



.territory-node.selected .territory-polygon {
    fill-opacity: 0.95;
    stroke-width: 3.5px !important;
    stroke: #ffffff !important;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.85)) drop-shadow(2px 4px 5px rgba(0, 0, 0, 0.75));
}

.territory-node.valid-target .territory-polygon {
    stroke: #e0e0e0;
    stroke-width: 3px;
    stroke-dasharray: 6, 4;
    animation: target-pulse 1.5s infinite;
}

@keyframes target-pulse {
    0% { filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3)) drop-shadow(2px 4px 5px rgba(0, 0, 0, 0.75)); }
    50% { filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8)) drop-shadow(2px 4px 5px rgba(0, 0, 0, 0.75)); }
    100% { filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3)) drop-shadow(2px 4px 5px rgba(0, 0, 0, 0.75)); }
}

.territory-label {
    fill: var(--text-light);
    font-size: 8.5px;
    font-weight: 600;
    font-family: var(--font-body);
    text-anchor: middle;
    pointer-events: none;
}

/* Badge for armies inside SVG */
.army-badge-bg {
    fill: rgba(7, 9, 14, 0.85);
    stroke: var(--border-glass);
    stroke-width: 1;
}

.territory-node.owned-militarist .army-badge-bg { stroke: var(--color-militarist); }
.territory-node.owned-populist .army-badge-bg { stroke: var(--color-populist); }
.territory-node.owned-socialist .army-badge-bg { stroke: var(--color-socialist); }
.territory-node.owned-realist .army-badge-bg { stroke: var(--color-realist); }

.army-badge-text {
    fill: #ffffff;
    font-size: 10px;
    font-weight: bold;
    font-family: var(--font-heading);
    text-anchor: middle;
    pointer-events: none;
}

/* Mapa Padrão: números menores com contorno escuro para leitura sobre cores vivas */
#map-canvas.view-faction .army-badge-text,
.army-badge-text.army-badge-text-faction {
    font-size: 6px !important;
    dominant-baseline: central;
    fill: #ffffff;
    stroke: #1a1f2e;
    stroke-width: 0.65px;
    paint-order: stroke fill;
    stroke-linejoin: round;
}

/* Ideology Icon indicators on territories */
.ideology-icon-bg {
    fill: rgba(0, 0, 0, 0.4);
}
.ideology-icon-text {
    font-size: 8px;
    font-weight: bold;
    text-anchor: middle;
    pointer-events: none;
}

/* ---------------- RIGHT SIDEBAR ACTIONS ---------------- */
.action-card {
    display: none;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.action-card.active {
    display: flex;
}

.wait-turn-panel {
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 12px;
}

.wait-turn-icon {
    font-size: 2.4rem;
    opacity: 0.85;
    margin-bottom: 8px;
}

.wait-turn-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    letter-spacing: 2px;
    color: var(--color-cyan);
    text-transform: uppercase;
    border-bottom: none;
    margin-bottom: 10px;
    padding-bottom: 0;
}

.wait-turn-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 220px;
}

.wait-skip-btn {
    margin-top: 18px;
    max-width: 240px;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-color: rgba(176, 38, 255, 0.45);
    color: #e0b0ff;
}

.wait-skip-btn:hover {
    border-color: #b026ff;
    box-shadow: 0 0 12px rgba(176, 38, 255, 0.35);
}

.wait-skip-btn.is-fast {
    border-color: rgba(0, 229, 255, 0.55);
    color: var(--color-cyan);
    animation: comboPulse 1.4s infinite;
}

.action-card h3 {
    font-size: 1.1rem;
    border-bottom: 1.5px solid var(--border-glass);
    padding-bottom: 8px;
    margin-bottom: 5px;
}

.action-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(22, 31, 51, 0.4);
    border-radius: 6px;
    font-size: 0.9rem;
}

.neon-text {
    color: var(--color-socialist);
    text-shadow: var(--glow-socialist);
    font-family: var(--font-heading);
    font-size: 1.2rem;
}

/* Combat Setup HUD */
.battle-setup, .fortify-setup {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(7, 9, 14, 0.6);
    border: 1px solid rgba(56, 75, 112, 0.25);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.combatant, .maneuver-node {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 42%;
}

.combatant.attacker, .maneuver-node.src { text-align: left; }
.combatant.defender, .maneuver-node.dest { text-align: right; }

.combatant .label, .maneuver-node .label {
    font-size: 0.6rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.combatant .name, .maneuver-node .name {
    font-size: 0.8rem;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-light);
}

.vs-divider, .maneuver-arrow {
    font-family: var(--font-heading);
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--color-militarist);
}

.maneuver-arrow {
    color: var(--color-socialist);
}

/* Transferência origem → destino (Ficando | Movendo) */
.transfer-setup {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 10px;
    background: rgba(7, 9, 14, 0.6);
    border: 1px solid rgba(56, 75, 112, 0.35);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}

.transfer-node {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.transfer-origin { text-align: left; }
.transfer-dest { text-align: right; }

.transfer-label {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-family: var(--font-heading);
}

.transfer-territory {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transfer-count {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.transfer-val {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
}

.transfer-val--stay { color: #ff3344; }
.transfer-val--move { color: #00e5ff; }

.transfer-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--color-socialist);
    flex-shrink: 0;
    padding: 0 4px;
}

.occupation-transfer-setup {
    margin: 16px 0 8px;
}

/* Ranges and sliders custom style */
input[type="range"] {
    width: 100%;
    margin: 10px 0;
    background: rgba(22, 31, 51, 0.8);
    border: 1px solid var(--border-glass);
    border-radius: 4px;
    height: 8px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-socialist);
    box-shadow: var(--glow-socialist);
    cursor: pointer;
}

.slider-val {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-light);
}

/* Cards drawer container inside sidebar-right */
.sub-overlay-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #080e1e; /* Cor sólida para evitar sobreposição de textos de baixo */
    border: 1.5px solid rgba(176, 38, 255, 0.4);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100; /* Z-index alto para ficar por cima de qualquer card de fase */
    transform: translateX(105%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sub-overlay-panel.active {
    transform: translateX(0);
}

.sub-overlay-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(176, 38, 255, 0.3);
    padding-bottom: 8px;
}

.sub-overlay-panel .panel-header h4 {
    font-size: 1rem;
    font-family: 'Orbitron', sans-serif;
    color: #b026ff;
    text-shadow: 0 0 6px rgba(176, 38, 255, 0.4);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}
.btn-close:hover {
    color: var(--text-light);
}

.sub-overlay-panel .instructions {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cards-grid {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 4px;
    scroll-behavior: smooth;
}

.cards-grid .card-item {
    flex: 0 0 auto;
}

/* Card item estilo Risk premium */
.card-item {
    width: 110px;
    height: 160px;
    background: linear-gradient(135deg, #101c36 0%, #060a14 100%);
    border: 2px solid rgba(56, 75, 112, 0.6);
    border-radius: 10px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    text-align: center;
    position: relative;
    user-select: none;
}

.card-item:hover {
    border-color: #00e5ff;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 229, 255, 0.25);
}

.card-item.selected {
    background: linear-gradient(135deg, #162a54 0%, #0b152d 100%);
    border-color: #00e5ff;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.5), inset 0 0 10px rgba(0, 229, 255, 0.2);
    transform: translateY(-3px) scale(1.02);
}

.card-item .symbol {
    font-size: 1.8rem;
    margin: 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.05);
}

.card-item.selected .symbol {
    border-color: rgba(0, 229, 255, 0.4);
    background: rgba(0, 229, 255, 0.08);
}

.card-item .cname {
    font-size: 0.7rem;
    font-weight: bold;
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
}

.card-item .ctype {
    font-size: 0.6rem;
    font-weight: bold;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Tactical Card Premium */
.tactical-card {
    width: 120px;
    height: 180px;
    background: linear-gradient(135deg, #101c36 0%, #060a14 100%);
    border: 2px solid rgba(56, 75, 112, 0.8);
    border-radius: 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease;
    text-align: center;
    position: relative;
    user-select: none;
    overflow: hidden;
}

.tactical-card:hover {
    border-color: #00e5ff;
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 229, 255, 0.3), inset 0 0 15px rgba(0, 229, 255, 0.1);
    filter: brightness(1.1);
}

.tactical-card.selected {
    background: linear-gradient(135deg, #162a54 0%, #0b152d 100%);
    border-color: #b026ff;
    box-shadow: 0 0 20px rgba(176, 38, 255, 0.5), inset 0 0 15px rgba(176, 38, 255, 0.2);
    transform: translateY(-5px) scale(1.03);
}

/* Banner / Faixa no topo da carta */
.tactical-card .card-banner {
    width: 100%;
    background: rgba(56, 75, 112, 0.3);
    padding: 4px 0;
    font-size: 0.65rem;
    font-weight: bold;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(56, 75, 112, 0.5);
}

.tactical-card.selected .card-banner {
    background: rgba(176, 38, 255, 0.2);
    color: #e5b0ff;
    border-bottom-color: rgba(176, 38, 255, 0.4);
}

/* Font family for textareas to ensure consistency */
#lobby-chat-input, #game-chat-input {
    font-family: var(--font-body);
}

#lobby-chat-input::-webkit-scrollbar, #game-chat-input::-webkit-scrollbar {
    width: 4px;
}
#lobby-chat-input::-webkit-scrollbar-thumb, #game-chat-input::-webkit-scrollbar-thumb {
    background: rgba(176, 38, 255, 0.4);
    border-radius: 4px;
}

/* ---------------- BUTTONS & CONTROLS ---------------- */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.btn-primary {
    background: var(--color-socialist);
    color: var(--text-light);
    box-shadow: 0 4px 14px rgba(51, 153, 255, 0.3);
}

.btn-primary:hover {
    background: #4fa8ff;
    box-shadow: var(--glow-socialist);
}

.btn-glow {
    animation: btn-glow-pulse 2s infinite;
}

@keyframes btn-glow-pulse {
    0% { box-shadow: 0 4px 10px rgba(51, 153, 255, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(51, 153, 255, 0.6); }
    100% { box-shadow: 0 4px 10px rgba(51, 153, 255, 0.3); }
}

.btn-secondary {
    background: rgba(30, 41, 64, 0.8);
    border: 1px solid var(--border-glass);
    color: var(--text-light);
}

.btn-secondary:hover {
    background: rgba(56, 75, 112, 0.4);
}

.btn-danger {
    background: rgba(255, 51, 68, 0.2);
    border: 1px solid rgba(255, 51, 68, 0.4);
    color: var(--color-militarist);
}

.btn-danger:hover {
    background: var(--color-militarist);
    color: var(--text-light);
    box-shadow: var(--glow-militarist);
}

.btn-block {
    display: block;
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    font-size: 0.8rem;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.7rem;
    border-radius: 4px;
}

/* ---------------- MODALS & OVERLAYS ---------------- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 9, 14, 0.85);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 90%;
    max-width: 480px;
    text-align: center;
    border: 1.5px solid var(--border-glass);
    animation: zoom-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zoom-in {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
}

/* Objective Card inside modal */
.objective-card-view {
    background: #0d121d;
    border: 2px solid #384b70;
    border-radius: 8px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
}

.objective-card-view::before {
    content: "SECRET";
    position: absolute;
    top: 20px;
    right: -30px;
    transform: rotate(45deg);
    background: rgba(255, 51, 68, 0.2);
    color: var(--color-militarist);
    border: 1px solid var(--color-militarist);
    font-size: 0.55rem;
    font-weight: bold;
    padding: 3px 25px;
    letter-spacing: 2px;
}

.objective-header {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--color-militarist);
    letter-spacing: 4px;
    margin-bottom: 12px;
}

.objective-desc {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-light);
    margin-bottom: 16px;
    font-weight: 500;
}

.objective-footer {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ---------------- DICE OVERLAY ---------------- */
.dice-overlay {
    /* Painel compacto no canto: nao bloqueia a visao do mapa durante combates */
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 120;
    display: none;
    pointer-events: none;
}

.dice-overlay.active {
    display: flex;
}

.dice-container {
    width: 340px;
    max-width: 85vw;
    border: 1.5px solid var(--border-glass);
    padding: 16px;
    text-align: center;
    pointer-events: auto;
    background: rgba(10, 15, 30, 0.94);
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 0 0 20px rgba(255, 23, 68, 0.12);
    animation: dicePanelIn 0.3s ease-out;
}

@keyframes dicePanelIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.dice-container h3 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.battle-header {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 12px;
    font-family: var(--font-heading);
    font-size: 1.1rem;
}

.title-attacker {
    color: var(--color-militarist);
    text-shadow: var(--glow-militarist);
}

.title-defender {
    color: var(--color-socialist);
    text-shadow: var(--glow-socialist);
}

.dice-vs {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dice-tray {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 35px;
    height: 80px;
}

.dice-group {
    display: flex;
    justify-content: center;
    gap: 12px;
    align-items: center;
}

/* 3D Dice styled in CSS */
.die {
    width: 46px;
    height: 46px;
    background: #ffffff;
    color: #000000;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 900;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.5s;
    animation: die-spin 0.5s ease-out;
}

.dice-group.attacker .die {
    background: #b026ff; /* Roxo Neon */
    color: #ffffff;
    box-shadow: 0 0 15px rgba(176, 38, 255, 0.8), inset 0 0 5px rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.dice-group.defender .die {
    background: #ffffff; /* Branco Neon */
    color: #050a19;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.die.ignored {
    opacity: 0.4;
    transform: scale(0.85);
}

@keyframes die-spin {
    0% { transform: rotate(0deg) scale(0.5); }
    100% { transform: rotate(360deg) scale(1); }
}

.dice-result {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-light);
    height: 30px;
}

/* ---------------- REVOLT OVERLAY ---------------- */
.revolt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 51, 68, 0.25);
    backdrop-filter: blur(5px);
    z-index: 150;
    display: none;
    justify-content: center;
    align-items: center;
}

.revolt-overlay.active {
    display: flex;
}

.revolt-container {
    width: 90%;
    max-width: 440px;
    padding: 30px;
    text-align: center;
    border: 2px solid var(--color-militarist) !important;
}

.warning-glow {
    box-shadow: 0 0 30px rgba(255, 51, 68, 0.6) !important;
    background: rgba(13, 10, 15, 0.9) !important;
}

.warning-header {
    font-family: var(--font-heading);
    color: var(--color-militarist);
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

#revolt-details {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-light);
    margin: 15px 0 25px;
}

/* Final Game Over layout */
.final-glow {
    box-shadow: 0 0 30px rgba(51, 153, 255, 0.4) !important;
    border-color: var(--color-socialist) !important;
}

.final-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 10px 0 20px;
}

.match-summary {
    text-align: left;
    margin-bottom: 20px;
}

.match-summary h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(56, 75, 112, 0.2);
    padding-bottom: 4px;
}

#game-over-stats .stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    padding: 5px 0;
}

.name-entry-section {
    margin-bottom: 25px;
    text-align: left;
}

.name-entry-section label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
}

.input-row {
    display: flex;
    gap: 10px;
}

.input-row input {
    flex-grow: 1;
    background: rgba(13, 20, 38, 0.8);
    border: 1px solid var(--border-glass);
    color: var(--text-light);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
}
.input-row input:focus {
    border-color: var(--color-socialist);
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* ---------------- HALL OF FAME SCREEN ---------------- */
.scores-container {
    width: 90%;
    max-width: 800px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.scores-container h2 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.scores-container p {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.scores-list-container {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

.scores-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.scores-table th, .scores-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(56, 75, 112, 0.2);
}

.scores-table th {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.scores-table tr:hover td {
    background: rgba(51, 153, 255, 0.05);
}

.scores-table td .badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-family: var(--font-heading);
}

.scores-table td .badge.militarist { background: rgba(255, 51, 68, 0.2); color: var(--color-militarist); }
.scores-table td .badge.populist { background: rgba(0, 230, 118, 0.2); color: var(--color-populist); }
.scores-table td .badge.socialist { background: rgba(51, 153, 255, 0.2); color: var(--color-socialist); }
.scores-table td .badge.realist { background: rgba(255, 193, 7, 0.2); color: var(--color-realist); }

.empty-msg {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    font-size: 0.9rem;
}

.scores-actions {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid rgba(56, 75, 112, 0.3);
    padding-top: 15px;
}

/* --- ESTILOS MULTIPLAYER E CHAT PREMIUM --- */
.player-slot-ready-badge {
    padding: 3px 8px;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: #00e676;
    background: rgba(0, 230, 118, 0.15);
    border: 1px solid rgba(0, 230, 118, 0.4);
    border-radius: 4px;
    text-transform: uppercase;
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.2);
}

.player-slot-not-ready-badge {
    padding: 3px 8px;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: #ff9100;
    background: rgba(255, 145, 0, 0.1);
    border: 1px solid rgba(255, 145, 0, 0.3);
    border-radius: 4px;
    text-transform: uppercase;
}

.moderator-crown {
    color: #ffd700;
    font-size: 0.8rem;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 215, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

/* Bolhas de Mensagem no Chat (WhatsApp Style) */
.chat-msg-entry {
    max-width: 85%;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    line-height: 1.4;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.05);
    animation: slide-in-chat 0.25s ease-out;
}

@keyframes slide-in-chat {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Minhas mensagens (alinhadas à direita) */
.chat-msg-entry.msg-me {
    align-self: flex-end;
    background: rgba(176, 38, 255, 0.15); /* Roxo neon suave */
    border-right: 3px solid #b026ff;
    border-bottom-right-radius: 2px;
}

/* Mensagens de outros (alinhadas à esquerda) */
.chat-msg-entry.msg-other {
    align-self: flex-start;
    background: rgba(56, 75, 112, 0.15); /* Cinza azulado */
    border-left: 3px solid rgba(255, 255, 255, 0.3);
    border-bottom-left-radius: 2px;
}

/* Mensagens em que fui marcado (destacadas com brilho dourado) */
.chat-msg-entry.mentioned {
    border: 1px solid #ffd700 !important;
    background: rgba(255, 215, 0, 0.15) !important;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5) !important;
    animation: mention-pulse 1.5s infinite alternate;
}

@keyframes mention-pulse {
    0% { box-shadow: 0 0 8px rgba(255, 215, 0, 0.4); }
    100% { box-shadow: 0 0 14px rgba(255, 215, 0, 0.7); }
}

.chat-msg-entry .sender {
    font-weight: bold;
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.chat-msg-entry .time {
    font-size: 0.6rem;
    color: var(--text-muted);
    align-self: flex-end;
    margin-top: 4px;
}

.chat-msg-entry .text {
    font-size: 0.8rem;
    color: #ffffff;
    margin-top: 2px;
    word-break: break-word;
}

/* Custom Scrollbar para Chat */
.chat-messages-container::-webkit-scrollbar,
#lobby-chat-messages::-webkit-scrollbar {
    width: 4px;
}
.chat-messages-container::-webkit-scrollbar-thumb,
#lobby-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(56, 75, 112, 0.6);
    border-radius: 2px;
}

/* Efeito Premium nos Painéis HUD */
.glass-panel {
    background: rgba(7, 10, 19, 0.72) !important;
    border: 1px solid rgba(56, 75, 112, 0.35) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6) !important;
}

.glass-subpanel {
    background: rgba(7, 10, 19, 0.5) !important;
    border: 1px solid rgba(56, 75, 112, 0.25) !important;
}

.active-badge {
    box-shadow: 0 0 15px rgba(51, 153, 255, 0.25);
    border-color: rgba(51, 153, 255, 0.5) !important;
}

.phase-step.active {
    box-shadow: 0 0 12px var(--glow-color, rgba(51, 153, 255, 0.4));
    transition: all 0.3s ease;
}

/* Estilos para as Abas de Ranking no Hall da Fama */
.ranking-tabs .btn {
    border: 1px solid var(--border-color);
    background: rgba(10, 20, 40, 0.6);
    color: var(--text-muted);
    transition: all 0.3s ease;
}
.ranking-tabs .btn.active {
    background: var(--color-populist);
    color: #050a19;
    font-weight: bold;
    box-shadow: var(--glow-populist);
    border-color: var(--color-populist);
}
.ranking-tabs .btn:hover:not(.active) {
    background: rgba(56, 75, 112, 0.3);
    color: var(--text-light);
}

/* Estilos para o mapa mundi interativo D3 */
.country-path {
    fill: #111b30;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 0.5px;
    transition: fill 0.2s ease, fill-opacity 0.2s ease, stroke 0.2s ease, stroke-width 0.2s ease;
}
.country-path:hover {
    fill-opacity: 0.85 !important;
    stroke: #ffffff !important;
    stroke-width: 1px !important;
}
.country-path.territory-path-neutral {
    fill: #0c1220;
    fill-opacity: 0.4;
    cursor: default;
    pointer-events: none; /* Países neutros não-mapeados ficam inativos */
}


/* --- FLOATING CHAT WINDOW --- */
.floating-window { 
    position: fixed; 
    top: 100px; 
    left: 100px; 
    width: 450px; 
    height: 500px; 
    background: rgba(10, 15, 30, 0.95); 
    border: 1.5px solid rgba(176, 38, 255, 0.6); 
    box-shadow: 0 0 20px rgba(176, 38, 255, 0.2); 
    border-radius: 8px; 
    display: flex; 
    flex-direction: column; 
    z-index: 10000; 
    resize: both; 
    overflow: hidden; 
    min-width: 300px; 
    min-height: 250px; 
}
.floating-header { 
    padding: 8px 12px; 
    background: rgba(5, 10, 25, 0.9); 
    border-bottom: 1px solid rgba(176, 38, 255, 0.4); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    cursor: move; 
    user-select: none; 
}
.window-controls { display: flex; gap: 4px; }
.win-btn { 
    background: transparent; 
    border: 1px solid rgba(176, 38, 255, 0.3); 
    color: #fff; 
    padding: 2px 8px; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 0.7rem; 
}
.win-btn:hover { background: rgba(176, 38, 255, 0.3); }
.win-btn-close:hover { background: #ff3344; border-color: #ff3344; }

.chat-window-body { display: flex; flex: 1; min-height: 0; }
.chat-main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-players-col { 
    width: 130px; 
    background: rgba(0, 0, 0, 0.3); 
    border-left: 1px solid rgba(176, 38, 255, 0.2); 
    padding: 8px; 
    display: flex; 
    flex-direction: column; 
}

/* States */
.floating-window.minimized { 
    height: 42px !important; 
    width: 250px !important; 
    resize: none; 
    overflow: hidden; 
}
.floating-window.minimized .chat-window-body { display: none; }

.floating-window.docked { 
    top: 20px !important; 
    bottom: auto !important; 
    left: auto !important; 
    right: 20px !important; 
    width: 340px !important; 
    height: calc(100vh - 40px) !important; 
    resize: none; 
}

/* --- COMBAT PULSE ANIMATIONS --- */
@keyframes pulsePurple {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(176, 38, 255, 0.75)) drop-shadow(0 0 12px rgba(176, 38, 255, 0.4)); }
    50% { filter: drop-shadow(0 0 18px rgba(200, 60, 255, 1)) drop-shadow(0 0 32px rgba(176, 38, 255, 0.75)); }
}

@keyframes pulseWhite {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.65)) drop-shadow(0 0 14px rgba(255, 255, 255, 0.35)); stroke-width: 2.5px; }
    50% { filter: drop-shadow(0 0 20px rgba(255, 255, 255, 1)) drop-shadow(0 0 36px rgba(255, 255, 255, 0.7)); stroke-width: 4px; }
}

@keyframes pulsePurpleSpectator {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(176, 38, 255, 1)) drop-shadow(0 0 22px rgba(176, 38, 255, 0.7));
        stroke-width: 3px;
    }
    50% {
        filter: drop-shadow(0 0 26px rgba(230, 100, 255, 1)) drop-shadow(0 0 48px rgba(176, 38, 255, 0.95));
        stroke-width: 5px;
    }
}

@keyframes pulseWhiteSpectator {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 24px rgba(255, 255, 255, 0.55));
        stroke-width: 3px;
    }
    50% {
        filter: drop-shadow(0 0 28px rgba(255, 255, 255, 1)) drop-shadow(0 0 52px rgba(255, 255, 255, 0.85));
        stroke-width: 5px;
    }
}

.pulse-source {
    animation: pulsePurple 1.1s infinite ease-in-out !important;
    stroke: #b026ff !important;
    stroke-width: 2.5px !important;
}

.pulse-target {
    animation: pulseWhite 1.1s infinite ease-in-out !important;
    stroke: #ffffff !important;
    stroke-width: 2.5px !important;
}

.pulse-source-spectator {
    animation: pulsePurpleSpectator 0.85s infinite ease-in-out !important;
    stroke: #d050ff !important;
}

.pulse-target-spectator {
    animation: pulseWhiteSpectator 0.85s infinite ease-in-out !important;
    stroke: #ffffff !important;
}
.custom-scrollbar::-webkit-scrollbar { width: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(176, 38, 255, 0.4); border-radius: 2px; }

/* Botao de encerrar turno: destacado e separado para evitar cliques acidentais */
#btn-finish-turn {
    margin-top: 28px;
    padding: 14px;
    background: linear-gradient(135deg, #ff8f00 0%, #e65100 100%);
    border: 1.5px solid #ffb300;
    color: #fff;
    font-weight: 900;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    box-shadow: 0 0 14px rgba(255, 143, 0, 0.35);
    position: relative;
}

#btn-finish-turn::before {
    content: "";
    position: absolute;
    top: -15px;
    left: 10%;
    width: 80%;
    border-top: 1px solid rgba(140, 156, 184, 0.25);
}

#btn-finish-turn:hover:not(:disabled) {
    box-shadow: 0 0 22px rgba(255, 143, 0, 0.6);
    transform: translateY(-1px);
}

#btn-finish-turn:disabled {
    opacity: 0.35;
    box-shadow: none;
}

/* Banner de anuncio de turno */
#turn-banner {
    position: fixed;
    top: 18%;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    z-index: 200;
    padding: 14px 42px;
    background: rgba(7, 10, 20, 0.92);
    border: 2px solid #fff;
    border-radius: 10px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(6px);
}

#turn-banner.show {
    animation: turnBannerPop 2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes turnBannerPop {
    0% { opacity: 0; transform: translateX(-50%) scale(0.7); }
    12% { opacity: 1; transform: translateX(-50%) scale(1.05); }
    20% { transform: translateX(-50%) scale(1); }
    80% { opacity: 1; transform: translateX(-50%) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) scale(0.95); }
}

/* Seletor de modo de vista do mapa (mesmo estilo do map-guide) */
.map-view-select {
    font-size: 0.75rem;
    font-family: var(--font-main, 'Inter', sans-serif);
    color: var(--text-light, #f4f6fc);
    background: rgba(13, 18, 29, 0.85);
    border: 1px solid var(--border-glass);
    padding: 6px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    backdrop-filter: blur(5px);
    outline: none;
}

.map-view-select:hover {
    border-color: rgba(0, 229, 255, 0.5);
}

.map-view-select option {
    background: #0d121d;
    color: #f4f6fc;
    text-transform: none;
}

/* --- MODOS DE VISTA DO MAPA --- */
/* Ideologico: so a letra da ideologia (esconde contagem de armas) */
#map-canvas.view-ideology .army-badge-circle,
#map-canvas.view-ideology .army-badge-text { display: none; }

/* Armas: so a contagem (esconde indicador de ideologia) */
#map-canvas.view-armies .native-ideology-indicator,
#map-canvas.view-armies .native-ideology-letter { display: none; }

/* Politico: sem badges, apenas as cores dos paises */
#map-canvas.view-political .army-badge-group { display: none; }

/* Minimalista: badges so aparecem com zoom >= 200% */
#map-canvas.view-minimal:not(.map-zoomed) .army-badge-group { display: none; }

/* Interacoes (origem/destino/alvos validos) sempre exibem o badge completo,
   independentemente do modo de vista */
#map-canvas .army-badge-group.badge-highlight,
#map-canvas .army-badge-group.badge-highlight circle,
#map-canvas .army-badge-group.badge-highlight text { display: inline !important; }

/* Mapa de Blocos: territorios mesclados sem fronteiras internas de paises */
#map-canvas .territory-blocs-layer { display: none; }
#map-canvas.view-blocs .territory-blocs-layer { display: inline; }
#map-canvas.view-blocs .country-path { display: none; }

/* Barra de rolagem do deck (aparece com 5+ cartas) */
.cards-scroll-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.cards-count-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Pulso branco: combinacao de cartas disponivel */
@keyframes comboPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(255, 255, 255, 0.25); border-color: rgba(255, 255, 255, 0.45); }
    50% { box-shadow: 0 0 16px rgba(255, 255, 255, 0.85); border-color: #ffffff; }
}

.card-item.combo-possible {
    animation: comboPulse 1.4s infinite;
}

#btn-show-cards.combo-alert,
#btn-draft-exchange-cards.combo-alert,
.draft-exchange-btn.combo-alert {
    animation: comboPulse 1.4s infinite;
    color: #fff;
}

.draft-income-breakdown {
    margin: 10px 0 4px;
    font-size: 0.68rem;
    color: var(--text-light);
}

.draft-income-breakdown table {
    width: 100%;
    border-collapse: collapse;
}

.draft-income-breakdown td {
    padding: 3px 4px;
    border-bottom: 1px solid rgba(56, 75, 112, 0.25);
    vertical-align: top;
}

.draft-income-breakdown td:last-child {
    text-align: right;
    font-weight: 600;
    color: var(--color-cyan);
    white-space: nowrap;
}

.draft-income-breakdown tr.draft-income-total td {
    border-bottom: none;
    border-top: 1px solid rgba(0, 229, 255, 0.35);
    padding-top: 6px;
    color: #fff;
}

.draft-income-breakdown tr.draft-income-total td:last-child {
    color: var(--color-populist);
    font-size: 0.78rem;
}

/* Botao e tooltip de pontuacao ao vivo */
#btn-live-score.score-locked {
    color: var(--text-muted);
}

.live-score-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 230px;
    background: rgba(10, 15, 30, 0.97);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 12px;
    z-index: 300;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    text-align: left;
    cursor: default;
}

.live-score-tooltip .lst-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    font-size: 0.75rem;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.live-score-tooltip .lst-row:last-child { border-bottom: none; }

/* ---------------- RESPONSIVE LAYOUT (MOBILE) ---------------- */
@media (max-width: 1280px) {
    .lobby-content.has-chat {
        grid-template-columns: 1fr 1fr;
    }
    .lobby-content.has-chat #lobby-chat-panel {
        grid-column: 1 / -1;
        height: 360px;
        min-height: 360px;
    }
}

@media (max-width: 768px) {
    body {
        overflow: auto;
        height: auto;
    }
    
    .screen {
        position: relative;
        height: auto;
        min-height: 100vh;
        display: none;
    }
    
    .screen.active {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 20px 10px;
    }
    
    /* Lobby screen */
    .lobby-container {
        width: 100%;
        height: auto;
        padding: 15px;
    }
    
    .lobby-content {
        grid-template-columns: 1fr !important;
        height: auto;
        overflow: visible;
    }
    
    .lobby-settings, .lobby-players, #lobby-chat-panel {
        height: auto;
    }
    
    .lobby-actions {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    /* Setup screen */
    .multi-setup-container {
        grid-template-columns: 1fr !important;
        height: auto;
    }
    
    /* Game Layout (Main Screen) */
    .game-layout {
        flex-direction: column !important;
        height: auto;
        overflow: visible;
        gap: 15px;
    }
    
    .sidebar-left, .sidebar-right {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }
    
    .map-viewport {
        height: 50vh !important;
        min-height: 380px;
    }
    
    .dash-header {
        flex-direction: column;
        height: auto;
        gap: 10px;
        padding: 15px 5px;
    }
    
    .dash-center {
        margin: 10px 0;
    }
    
    .dash-right {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }
    
    .phase-stepper {
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }
    
    /* Ranks & Tooltips size adjustments */
    .ranks-container {
        max-height: 200px;
    }
    
    .log-container {
        height: 150px !important;
    }
}
