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

body {
    background: #0a0e17;
    color: #e0e0e0;
    font-family: 'Segoe UI', Arial, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Setup Screen ── */
#setup-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: radial-gradient(ellipse at center, #1a1e2e 0%, #0a0e17 70%);
}

.setup-box {
    background: #141824;
    border: 1px solid #2a3050;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    min-width: 350px;
}

.setup-box h1 {
    font-size: 2.5em;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ff4444, #ff8800);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900;
    letter-spacing: 2px;
}

.setup-box p {
    color: #888;
    margin-bottom: 30px;
    font-size: 0.95em;
}

.setup-box label {
    display: block;
    text-align: left;
    margin-bottom: 6px;
    color: #aaa;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.setup-box input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background: #0d1020;
    border: 1px solid #2a3050;
    border-radius: 8px;
    color: #fff;
    font-size: 1.1em;
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.2s;
}

.setup-box input[type="text"]:focus {
    border-color: #ff6600;
}

.color-picker-row {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    align-items: center;
}

.color-picker-row input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

.color-preview {
    flex: 1;
    height: 40px;
    border-radius: 6px;
    border: 1px solid #2a3050;
}

#btn-start {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #ff4444, #ff6600);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 1px;
    transition: transform 0.1s, box-shadow 0.2s;
}

#btn-start:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(255, 68, 68, 0.4);
}

/* ── Game Screen ── */
#game-screen {
    display: none;
    flex-direction: column;
    height: 100vh;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: #111628;
    border-bottom: 1px solid #2a3050;
    flex-shrink: 0;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff3;
}

.player-name {
    font-weight: 700;
    font-size: 1.1em;
}

.stats {
    display: flex;
    gap: 24px;
    font-size: 0.95em;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-label { color: #888; }
.stat-value { font-weight: 700; color: #fff; }

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #080c14;
    cursor: grab;
}

.map-container:active { cursor: grabbing; }

#map-wrapper {
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
}

#world-map {
    width: 100%;
    height: 100%;
    display: block;
}

/* Country groups in the SVG */
.country {
    cursor: pointer;
    transition: filter 0.2s;
}

.country path {
    fill: #1e2540;
    stroke: #2a3a60;
    stroke-width: 0.5;
    transition: fill 0.3s;
}

.country:hover path {
    filter: brightness(1.4);
    stroke: #fff;
    stroke-width: 1;
}

.country.owned path {
    stroke-width: 0.6;
    stroke: rgba(255,255,255,0.3);
}

.country.neighbor-highlight path {
    stroke: #ffcc00 !important;
    stroke-width: 2 !important;
    stroke-dasharray: 4 2;
    animation: pulse-border 1s infinite;
}

.country.selected path {
    stroke: #fff !important;
    stroke-width: 2 !important;
    filter: brightness(1.3);
}

/* ── Country Labels Overlay ── */
#labels-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.country-label-overlay {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    pointer-events: none;
    text-shadow: 0 0 4px #000, 0 0 8px #000;
}

.country-label-overlay .label-name {
    font-size: 9px;
    color: #ccc;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1;
}

.country-label-overlay .label-units {
    font-size: 11px;
    color: #fff;
    font-weight: 900;
    line-height: 1;
}

.country-label-overlay.owned-label .label-units {
    color: #fff;
    text-shadow: 0 0 6px rgba(255,255,255,0.5), 0 0 3px #000;
}

.country-label-overlay.owned-label .label-name {
    color: #fff;
}

@keyframes pulse-border {
    0%, 100% { stroke-opacity: 1; }
    50% { stroke-opacity: 0.4; }
}

/* Bottom Panel */
.bottom-panel {
    background: #111628;
    border-top: 1px solid #2a3050;
    padding: 12px 20px;
    min-height: 70px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.country-info {
    flex: 1;
}

.country-info h3 {
    font-size: 1.2em;
    margin-bottom: 4px;
}

.country-info .owner-text {
    font-size: 0.9em;
    color: #888;
}

.country-info .owner-text span {
    font-weight: 700;
}

.bottom-panel .hint-text {
    color: #555;
    font-style: italic;
}

/* Attack Button */
#btn-attack {
    padding: 12px 32px;
    background: linear-gradient(135deg, #cc0000, #ff4400);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    display: none;
    transition: transform 0.1s, box-shadow 0.2s;
    white-space: nowrap;
}

#btn-attack:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(255, 0, 0, 0.4);
}

#btn-move {
    padding: 12px 32px;
    background: linear-gradient(135deg, #2266cc, #3388ff);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    display: none;
    transition: transform 0.1s, box-shadow 0.2s;
    white-space: nowrap;
}

#btn-move:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(50, 100, 255, 0.4);
}

/* Attack Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #141824;
    border: 1px solid #2a3050;
    border-radius: 12px;
    padding: 32px;
    min-width: 400px;
    max-width: 500px;
}

.modal h2 {
    margin-bottom: 20px;
    color: #ff4444;
    font-size: 1.4em;
}

.modal .attack-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: #0d1020;
    border-radius: 8px;
}

.attack-arrow {
    font-size: 1.8em;
    color: #ff4444;
}

.attack-country {
    text-align: center;
    flex: 1;
}

.attack-country .name {
    font-weight: 700;
    font-size: 1.1em;
}

.attack-country .owner {
    font-size: 0.85em;
    color: #888;
    margin-top: 4px;
}

.attack-country .color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 4px;
}

.modal .strength-info {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #0d1020;
    border-radius: 8px;
    font-size: 0.95em;
}

.strength-info .row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.strength-info .label { color: #888; }

.modal .btn-row {
    display: flex;
    gap: 12px;
}

.modal .btn-row button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}

.modal .btn-row button:hover { transform: translateY(-1px); }

#btn-confirm-attack, .btn-attack-confirm {
    background: linear-gradient(135deg, #cc0000, #ff4400) !important;
    color: #fff;
}

#btn-cancel-attack, #btn-cancel-action {
    background: #2a3050;
    color: #ccc;
}

#btn-confirm-action, .btn-move-confirm {
    background: linear-gradient(135deg, #2266cc, #3388ff);
    color: #fff;
}

.btn-attack-confirm {
    background: linear-gradient(135deg, #cc0000, #ff4400) !important;
}

/* Unit Slider */
.unit-label {
    display: block;
    color: #aaa;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.unit-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.unit-slider-row input[type="range"] {
    flex: 1;
    accent-color: #ff6600;
    height: 6px;
}

.unit-slider-row span {
    font-size: 1.4em;
    font-weight: 900;
    color: #fff;
    min-width: 40px;
    text-align: right;
}

.unit-quick-btns {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.unit-quick-btns button {
    flex: 1;
    padding: 6px;
    background: #1a2040;
    border: 1px solid #2a3050;
    border-radius: 6px;
    color: #ccc;
    font-size: 0.85em;
    cursor: pointer;
    font-weight: 600;
}

.unit-quick-btns button:hover {
    background: #2a3060;
    color: #fff;
}

/* Country Select Phase */
.phase-banner {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 24, 36, 0.95);
    border: 1px solid #ff6600;
    border-radius: 8px;
    padding: 10px 24px;
    z-index: 100;
    font-weight: 700;
    color: #ff8800;
    font-size: 1.05em;
    pointer-events: none;
}

/* Battle Result */
.battle-result {
    text-align: center;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 700;
    font-size: 1.1em;
}

.battle-result.win {
    background: rgba(0, 180, 0, 0.15);
    border: 1px solid #00aa00;
    color: #44ff44;
}

.battle-result.lose {
    background: rgba(180, 0, 0, 0.15);
    border: 1px solid #aa0000;
    color: #ff4444;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 50;
}

.zoom-controls button {
    width: 36px;
    height: 36px;
    background: #1a2040;
    border: 1px solid #2a3050;
    border-radius: 6px;
    color: #ccc;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-controls button:hover {
    background: #2a3060;
}


/* Responsive */
@media (max-width: 768px) {
    .setup-box { min-width: 90vw; padding: 24px; }
    .stats { gap: 12px; font-size: 0.8em; }
    .top-bar { padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
    .bottom-panel { padding: 10px 12px; flex-wrap: wrap; }
    .modal { min-width: 90vw; padding: 20px; }
}
