* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    height: 100%; width: 100%;
    background: #1a1a2e;
    font-family: 'Segoe UI', sans-serif;
    color: #eee;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #16213e;
    border-bottom: 2px solid #0f3460;
    flex-shrink: 0;
    min-height: 52px;
}
#player-dot {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid #fff;
    flex-shrink: 0;
}
#phase-label {
    font-size: 15px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}
#action-hint {
    font-size: 13px;
    color: #aaa;
}
#armies-badge {
    font-size: 22px;
    font-weight: bold;
    color: #f1c40f;
    min-width: 36px;
    text-align: center;
}
#cards-badge {
    font-size: 18px;
    min-width: 32px;
    text-align: center;
}
#player-status {
    font-size: 12px;
    color: #aaa;
    display: flex;
    gap: 8px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
#trade-btn {
    padding: 7px 14px;
    background: #0f3460;
    border: 1px solid #9b59b6;
    color: #eee;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
}
#trade-btn:hover { background: #9b59b6; }
#trade-btn.forced-trade {
    animation: pulse-btn 0.8s ease-in-out infinite;
}
@keyframes pulse-btn {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.4); }
}
#end-btn {
    padding: 7px 18px;
    background: #0f3460;
    border: 1px solid #e94560;
    color: #eee;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    margin-left: auto;
}
#end-btn:hover:not(:disabled) { background: #e94560; }
#end-btn:disabled { opacity: 0.35; cursor: default; }

#map-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 6px;
}
#svgContainer {
    width: 100%;
    height: 100%;
}
#svgContainer svg { width: 100%; height: 100%; }
svg text.reinforced {
    fill: #f1c40f !important;
    font-weight: bold;
    filter: drop-shadow(0 0 4px #f1c40f);
    animation: pulse-label 0.6s ease-out;
}
@keyframes pulse-label {
    0% { font-size: 1.2em; filter: drop-shadow(0 0 8px #f1c40f); }
    100% { font-size: 1em; filter: drop-shadow(0 0 4px #f1c40f); }
}

/* Country path states */
#layer4 path {
    pointer-events: all;
    cursor: pointer;
    transition: fill 0.12s;
}
#layer4 path.sel {
    stroke: #fff !important;
    stroke-width: 3px !important;
    filter: brightness(1.35);
}
#layer4 path.atk-target {
    stroke: #ff4444 !important;
    stroke-width: 2.5px !important;
    animation: pulse 0.75s ease-in-out infinite alternate;
}
#layer4 path.fort-target {
    stroke: #44aaff !important;
    stroke-width: 2.5px !important;
}
@keyframes pulse {
    from { filter: brightness(1); }
    to   { filter: brightness(1.5); }
}

#attack-fx-group {
    pointer-events: none;
}

.attack-arrow-glow {
    fill: none;
    stroke: #ff4444;
    stroke-width: 14;
    stroke-linecap: round;
    opacity: 0.32;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.55));
    animation: attack-arrow-fade 0.7s ease-out forwards;
}

.attack-arrow {
    fill: none;
    stroke: #ff4444;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 24 12;
    stroke-dashoffset: 120;
    filter: drop-shadow(0 0 6px rgba(255,255,255,0.45));
    animation: attack-arrow-dash 0.4s linear forwards, attack-arrow-fade 0.7s ease-out forwards;
}

@keyframes attack-arrow-dash {
    to { stroke-dashoffset: 0; }
}

@keyframes attack-arrow-fade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Setup overlay */
#setup-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.88);
    display: flex; justify-content: center; align-items: center;
    z-index: 100;
}
#setup-box {
    background: #16213e;
    border: 2px solid #0f3460;
    border-radius: 10px;
    padding: 20px 30px;
    text-align: center;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
#setup-box h1 {
    font-size: 42px; letter-spacing: 6px;
    color: #e94560; margin-bottom: 4px;
}
#setup-box p { color: #aaa; margin-bottom: 12px; font-size: 13px; }
#setup-step2 { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
#player-config { display: flex; flex-direction: column; gap: 4px; }
.setup-section {
    padding: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
}
.player-config-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    font-size: 12px;
}
.player-config-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}
.player-config-row > span {
    font-size: 12px;
    min-width: 50px;
}
.ai-toggle {
    display: flex;
    gap: 2px;
    margin-left: auto;
}
.toggle-btn {
    padding: 2px 6px;
    font-size: 11px;
    border: 1px solid #555;
    background: #0f3460;
    color: #aaa;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.15s;
}
.toggle-btn:hover { border-color: #999; }
.toggle-btn.active {
    background: #9b59b6;
    color: #fff;
    border-color: #9b59b6;
    font-weight: bold;
}
.card-option-btn {
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid #555;
    background: #0f3460;
    color: #aaa;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.15s;
}
.card-option-btn:hover { border-color: #999; }
.card-option-btn.active {
    background: #2ecc71;
    color: #1a1a2e;
    border-color: #2ecc71;
    font-weight: bold;
}
#start-btn {
    padding: 6px 16px;
    background: #0f3460;
    border: 1px solid #9b59b6;
    color: #eee;
    cursor: pointer;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    align-self: center;
    margin-top: 4px;
}
#start-btn:hover { background: #9b59b6; }
#player-btns { display: flex; gap: 14px; justify-content: center; }
.pbtn {
    width: 54px; height: 54px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.6);
    font-size: 22px; font-weight: bold;
    cursor: pointer; color: #fff;
    transition: transform 0.1s, border-color 0.1s;
}
.pbtn:hover { transform: scale(1.12); border-color: #fff; }

/* Dice result overlay */
#dice-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65);
    display: none;
    justify-content: center; align-items: center;
    z-index: 50;
}
#dice-box {
    background: #16213e;
    border: 2px solid #e94560;
    border-radius: 10px;
    padding: 22px 30px;
    text-align: center;
    min-width: 300px;
}
#dice-vs { display: flex; gap: 32px; justify-content: center; margin: 14px 0; }
.dice-side h4 { font-size: 13px; margin-bottom: 6px; }
.dice-rolls { font-size: 34px; letter-spacing: 4px; }
#dice-result { font-size: 15px; font-weight: bold; }

/* Capture dialog */
#capture-overlay {
    position: fixed; inset: 0;
    background: transparent;
    display: none;
    justify-content: center; align-items: center;
    z-index: 150;
}
#capture-box {
    background: #16213e;
    border: 2px solid #2ecc71;
    border-radius: 10px;
    padding: 28px 32px;
    text-align: center;
    min-width: 320px;
}
#capture-box h3 {
    font-size: 20px;
    color: #2ecc71;
    margin-bottom: 12px;
    letter-spacing: 1px;
}
#capture-msg {
    color: #aaa;
    margin-bottom: 20px;
    font-size: 14px;
}
#army-slider-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
#army-slider-container label {
    color: #aaa;
    font-size: 14px;
    white-space: nowrap;
}
#army-slider {
    width: 140px;
    cursor: pointer;
}
#army-value {
    color: #2ecc71;
    font-weight: bold;
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}
#capture-confirm-btn {
    padding: 10px 24px;
    background: #2ecc71;
    border: none;
    color: #1a1a2e;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
}
#capture-confirm-btn:hover {
    background: #27ae60;
}

/* Fortify dialog */
#fortify-overlay {
    position: fixed; inset: 0;
    background: transparent;
    display: none;
    justify-content: center; align-items: center;
    z-index: 150;
}
#fortify-box {
    background: #16213e;
    border: 2px solid #3498db;
    border-radius: 10px;
    padding: 28px 32px;
    text-align: center;
    min-width: 320px;
}
#fortify-box h3 {
    font-size: 20px;
    color: #3498db;
    margin-bottom: 12px;
    letter-spacing: 1px;
}
#fortify-msg {
    color: #aaa;
    margin-bottom: 20px;
    font-size: 14px;
}
#fortify-slider-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
#fortify-slider-container label {
    color: #aaa;
    font-size: 14px;
    white-space: nowrap;
}
#fortify-slider {
    width: 140px;
    cursor: pointer;
}
#fortify-value {
    color: #3498db;
    font-weight: bold;
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}
#fortify-confirm-btn {
    padding: 10px 24px;
    background: #3498db;
    border: none;
    color: #1a1a2e;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
}
#fortify-confirm-btn:hover {
    background: #2980b9;
}

/* Win banner */
#win-banner {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.82);
    justify-content: center; align-items: center;
    z-index: 200;
}
#win-box {
    text-align: center;
    padding: 40px 60px;
    border-radius: 12px;
    background: #16213e;
    border: 3px solid #f1c40f;
}
#win-box h2 { font-size: 14px; color: #aaa; letter-spacing: 3px; margin-bottom: 8px; }
#win-box h1 { font-size: 42px; font-weight: bold; }
#win-box p { color: #aaa; margin-top: 10px; font-size: 14px; }

/* Cursor overlay */
#cursor-overlay {
    position: fixed;
    pointer-events: none;
    z-index: 80;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
}
#soldier-svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    flex-shrink: 0;
}
#army-number {
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* Combat log */
#combat-log {
    position: fixed;
    bottom: 16px;
    left: 16px;
    max-width: 640px;
    max-height: 600px;
    overflow-y: auto;
    background: rgba(22, 33, 62, 0.88);
    border: 1px solid #0f3460;
    border-radius: 6px;
    padding: 12px;
    font-size: 16px;
    line-height: 1.6;
    z-index: 70;
}
#combat-log::-webkit-scrollbar {
    width: 6px;
}
#combat-log::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
}
#combat-log::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}
#combat-log::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}
.log-entry {
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.log-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.dice {
    font-size: 48px;
    letter-spacing: 2px;
}
