body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#game-container {
    width: 100vw;
    height: 100vh;
    background-color: #2d2d2d;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    background-color: #3d3d3d;
    padding: 10px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #4d4d4d;
}

.header-app-title {
    margin: 0 0 4px 0;
}

.header-app-subtitle {
    margin: 0;
    font-size: 12px;
    color: #888;
    font-weight: normal;
}

.day-indicator {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 160px;
}

.day-indicator__day {
    font-size: 18px;
    font-weight: bold;
    color: #ff9800;
}

.day-indicator__date {
    font-size: 12px;
    color: #aaa;
    font-family: monospace;
    letter-spacing: 1px;
}

@keyframes day-indicator-day-change {
    0%,
    100% {
        filter: brightness(1);
    }
    22% {
        filter: brightness(1.45) drop-shadow(0 0 16px rgba(255, 152, 0, 0.85));
    }
    48% {
        filter: brightness(1.2) drop-shadow(0 0 10px rgba(255, 193, 7, 0.55));
    }
    72% {
        filter: brightness(1.08) drop-shadow(0 0 6px rgba(255, 152, 0, 0.35));
    }
}

.day-indicator.day-indicator--day-changed {
    animation: day-indicator-day-change 0.85s ease-out 1;
}

@media (prefers-reduced-motion: reduce) {
    .day-indicator.day-indicator--day-changed {
        animation-duration: 0.01s;
    }
}

h1 {
    margin: 0;
    font-size: 24px;
    color: #f0f0f0;
}

@media (max-width: 640px) {
    header {
        padding: 6px 12px;
        justify-content: center;
    }

    .header-title-block {
        display: none;
    }

    .day-indicator {
        flex-direction: row;
        align-items: baseline;
        justify-content: center;
        gap: 0.5rem;
        min-width: 0;
        width: 100%;
    }

    .day-indicator__day {
        font-size: 16px;
    }

    .day-indicator__date {
        font-size: 13px;
    }
}

#turn-indicator {
    font-size: 18px;
    font-weight: bold;
    color: #00ff00;
}

main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

#map-container {
    flex: 1;
    background-color: #aad3df;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 0;
}

/* MapLibre positions markers with transforms; extra box model on the root breaks lng/lat sync (esp. with pitch). */
.maplibregl-marker {
    margin: 0 !important;
    padding: 0 !important;
}

/* Side Control Buttons */
#side-controls {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1001;
}

.control-btn {
    background-color: rgba(45, 45, 45, 0.9);
    border: 1px solid #555;
    color: #ff9800;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.control-btn:hover {
    background-color: #ff9800;
    color: #000;
    transform: scale(1.05);
}

.control-btn span {
    font-size: 9px;
    font-weight: bold;
    margin-top: 4px;
}

#help-btn {
    border-color: #ff9800;
    color: #ff9800;
}

#help-btn:hover {
    background-color: #ff9800;
    color: #000;
}

#volume-control-btn {
    border-color: #4caf50;
    color: #4caf50;
}

#volume-control-btn:hover {
    background-color: #4caf50;
    color: #000;
}

#volume-label {
    min-width: 35px;
    text-align: center;
}

.volume-waves, .volume-waves-full {
    transition: opacity 0.2s;
}

@keyframes ticker {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.escalation-bar {
    width: 20px;
    height: 8px;
    background: #333;
    border-radius: 2px;
    transition: background 0.3s;
}

.escalation-bar.active[data-level="1"] { background: #4caf50; }
.escalation-bar.active[data-level="2"] { background: #8bc34a; }
.escalation-bar.active[data-level="3"] { background: #ffeb3b; }
.escalation-bar.active[data-level="4"] { background: #ff9800; }
.escalation-bar.active[data-level="5"] { background: #f44336; }

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes glow-pulse {
    0% { transform: scale(0.8); opacity: 0.3; box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.4); }
    70% { transform: scale(1.2); opacity: 0.8; box-shadow: 0 0 0 15px rgba(255, 152, 0, 0); }
    100% { transform: scale(0.8); opacity: 0.3; box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); }
}

@keyframes arrow-bounce {
    0% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(-20px); opacity: 0.7; }
    100% { transform: translateY(0); opacity: 1; }
}

.tactical-highlight {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 4px solid #ff9800;
    border-radius: 50%;
    background: rgba(255, 152, 0, 0.2);
    pointer-events: none;
    z-index: 9999;
    animation: glow-pulse 1.5s infinite;
}

.tactical-arrow {
    position: absolute;
    pointer-events: none;
    z-index: 10000;
    animation: arrow-bounce 1s infinite ease-in-out;
}

/* Sliding Panels */
.sliding-panel {
    position: absolute;
    left: -400px; /* Hidden by default */
    top: 0;
    width: 350px;
    height: 100%;
    background-color: rgba(45, 45, 45, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1002;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 5px 0 25px rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    border-right: 1px solid #444;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    font-size: 14px;
    padding: 5px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
}

.impact-section h3 {
    font-size: 12px;
    color: #ff9800;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
    margin-top: 15px;
}

.proxy-item {
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #444;
    border-radius: 4px;
}

.proxy-header {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-bottom: 5px;
}

.proxy-bar-bg {
    height: 4px;
    background: #222;
    border-radius: 2px;
    margin: 5px 0;
}

.proxy-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

.proxy-status {
    font-size: 11px;
    color: #aaa;
    font-style: italic;
}

.sliding-panel.active {
    left: 0;
}

.panel-header {
    padding: 20px;
    background-color: #3d3d3d;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #555;
}

.panel-header h3 {
    margin: 0;
    color: #ff9800;
    font-size: 18px;
}

.close-panel {
    color: #aaa;
    font-size: 24px;
    cursor: pointer;
}

.close-panel:hover {
    color: #fff;
}

.panel-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

#info-panel {
    display: none; /* Removed static info panel */
}

.side-stats {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
    background-color: #3d3d3d;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.health-bar-container {
    height: 12px;
    background-color: #444;
    border-radius: 6px;
    margin-bottom: 10px;
    overflow: hidden;
}

.health-bar {
    height: 100%;
    background-color: #4caf50;
    transition: width 0.3s ease;
}

.side-stats h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 18px;
    border-bottom: 1px solid #5d5d5d;
    padding-bottom: 5px;
}

.resource-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column to fit in narrower panel */
    gap: 2px 15px;
}

.resource-grid p {
    margin: 2px 0;
    font-size: 13px;
    color: #bbb;
}

.carrier-icon {
    display: flex;
    justify-content: center;
    align-items: center;
}

.action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

button {
    background-color: #444;
    color: #eee;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

button:hover {
    background-color: #555;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button.produce-btn {
    background-color: #2e7d32;
}

button.produce-btn:hover {
    background-color: #388e3c;
}

/* Map markers: strong side colours (blue vs red) + shape by type / base role */
.marker {
    cursor: pointer;
    position: relative;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.marker:hover {
    transform: scale(1.12);
    z-index: 50;
}

.marker .marker-icon {
    font-size: 11px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
    pointer-events: none;
    user-select: none;
}

.marker.side-us_israel {
    background: linear-gradient(160deg, #4fc3f7 0%, #1565c0 45%, #0d47a1 100%);
    border: 3px solid #01579b;
    box-shadow: 0 2px 10px rgba(1, 87, 155, 0.55);
}

.marker.side-iran {
    background: linear-gradient(160deg, #ff8a80 0%, #e53935 45%, #8b0000 100%);
    border: 3px solid #5d0000;
    box-shadow: 0 2px 10px rgba(93, 0, 0, 0.5);
}

/* Type: aircraft / missile bases — circle */
.marker.marker-type-base {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* Type: carrier strike group — wide deck */
.marker.marker-type-carrier {
    width: 46px;
    height: 26px;
    border-radius: 8px;
}

.marker.marker-type-carrier .marker-icon {
    font-size: 14px;
}

/* Type: surface / Aegis — diamond */
.marker.marker-type-naval {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    transform: rotate(45deg);
}

.marker.marker-type-naval:hover {
    transform: rotate(45deg) scale(1.12);
}

.marker.marker-type-naval .marker-icon {
    transform: rotate(-45deg);
    font-size: 12px;
}

/* Base role: shape variants (only for marker-type-base) */
.marker.marker-type-base.marker-role-offensive {
    border-radius: 4px;
}

.marker.marker-type-base.marker-role-defensive {
    border-radius: 50%;
}

.marker.marker-type-base.marker-role-mixed {
    border-radius: 30%;
}

.marker.marker-type-base.marker-role-logistics {
    width: 40px;
    height: 24px;
    border-radius: 12px;
}

.marker.marker-type-base.marker-role-nuclear {
    border-radius: 0;
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
}

.marker.marker-type-base.marker-role-financial {
    border-radius: 3px;
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.75), 0 2px 10px rgba(1, 87, 155, 0.45);
}

.marker.side-iran.marker-type-base.marker-role-financial {
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.75), 0 2px 10px rgba(93, 0, 0, 0.45);
}

.marker.marker-type-base.marker-role-tech {
    border-radius: 6px;
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.65), 0 2px 10px rgba(1, 87, 155, 0.45);
}

.marker.side-iran.marker-type-base.marker-role-tech {
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.65), 0 2px 10px rgba(93, 0, 0, 0.45);
}

.marker.marker-type-base.marker-role-infrastructure {
    border-radius: 10px;
}

.marker.marker-type-base.marker-role-chokepoint {
    border-radius: 0;
    clip-path: polygon(50% 6%, 100% 94%, 0% 94%);
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
}

.marker.carrier-marker {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

.carrier-icon-container {
    width: 30px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.5));
}

/* MapLibre Popup and Tooltip Styles */
.maplibregl-popup-content {
    background-color: #2d2d2d !important;
    color: #f0f0f0 !important;
    border: 1px solid #4d4d4d;
    border-radius: 4px;
    padding: 10px;
    font-size: 13px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.maplibregl-popup-anchor-top .maplibregl-popup-tip {
    border-bottom-color: #2d2d2d !important;
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip {
    border-top-color: #2d2d2d !important;
}

.maplibregl-popup-close-button {
    color: #888;
}

.maplibregl-popup-close-button:hover {
    background-color: transparent !important;
    color: #fff;
}

.popup-content .popup-header-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.popup-side-flag {
    width: 40px;
    height: auto;
    max-height: 30px;
    object-fit: contain;
    border-radius: 2px;
    flex-shrink: 0;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
}

.popup-content .popup-header-row h3 {
    margin: 0;
    font-size: 15px;
    line-height: 1.3;
    flex: 1;
    color: #fff;
}

.popup-content .popup-meta {
    margin: 0 0 8px 0;
    font-size: 11px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #9e9e9e;
    line-height: 1.35;
}

.popup-content .popup-desc {
    margin: 0 0 10px 0;
    line-height: 1.45;
    color: #e0e0e0;
    font-size: 13px;
}

.popup-content .popup-weapons {
    margin: 0;
    padding-top: 8px;
    border-top: 1px solid #444;
    font-size: 12px;
}

.popup-content .popup-weapons strong {
    display: block;
    margin-bottom: 6px;
    color: #ff9800;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.popup-weapons-list {
    margin: 0;
    padding-left: 1.2em;
    color: #cfd8dc;
    line-height: 1.4;
}

.popup-weapons--empty {
    margin: 0;
    padding-top: 8px;
    border-top: 1px solid #444;
    font-size: 12px;
    color: #78909c;
    font-style: italic;
    line-height: 1.4;
}

/* Hover tooltip (fixed to viewport — works with rotated naval markers) */
.epicfury-marker-tooltip {
    max-width: min(300px, calc(100vw - 24px));
    padding: 12px 14px;
    background: linear-gradient(165deg, rgba(38, 42, 48, 0.98) 0%, rgba(28, 30, 34, 0.99) 100%);
    border: 1px solid rgba(255, 152, 0, 0.35);
    border-radius: 10px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    pointer-events: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #eceff1;
}

.epicfury-marker-tooltip__title {
    font-weight: 700;
    font-size: 14px;
    line-height: 1.25;
    color: #fff;
    margin-bottom: 6px;
}

.epicfury-marker-tooltip__meta {
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #90a4ae;
    line-height: 1.35;
    margin-bottom: 8px;
}

.epicfury-marker-tooltip__desc {
    margin: 0 0 10px 0;
    font-size: 12px;
    line-height: 1.45;
    color: #cfd8dc;
}

.epicfury-marker-tooltip__weapons-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #ff9800;
    margin-bottom: 4px;
}

.epicfury-marker-tooltip__weapons-list {
    margin: 0;
    padding-left: 1.15em;
    font-size: 12px;
    line-height: 1.35;
    color: #b0bec5;
}

.epicfury-marker-tooltip__empty {
    font-size: 11px;
    color: #78909c;
    font-style: italic;
    line-height: 1.4;
}

.popup-content > p {
    margin: 0 0 10px 0;
    line-height: 1.45;
}

button#reset-view-btn {
    background-color: #555;
    margin-bottom: 10px;
}

button#reset-view-btn:hover {
    background-color: #666;
}

button#reset-btn {
    background-color: #d32f2f;
    margin-top: auto;
}

button#reset-btn:hover {
    background-color: #e53935;
}

#log-container {
    margin-top: 20px;
    background-color: #1a1a1a;
    border-radius: 8px;
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#map-legend {
    background-color: #1a1a1a;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    font-size: 11px;
    color: #bbb;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    color: #eee;
}

.legend-icon {
    width: 14px;
    height: 14px;
    margin-right: 10px;
    border: 1px solid white;
}

.legend-swatch {
    display: inline-block;
    margin-right: 10px;
    flex-shrink: 0;
    box-sizing: border-box;
    border-width: 2px;
    border-style: solid;
}

.legend-swatch-us {
    background: linear-gradient(160deg, #4fc3f7, #1565c0);
    border-color: #01579b;
}

.legend-swatch-iran {
    background: linear-gradient(160deg, #ff8a80, #e53935);
    border-color: #5d0000;
}

.legend-swatch.circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.legend-swatch.carrier {
    width: 28px;
    height: 14px;
    border-radius: 5px;
}

.legend-swatch.diamond {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    transform: rotate(45deg);
    margin-left: 6px;
    margin-right: 16px;
}

.legend-swatch.square {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.legend-swatch.pill {
    width: 26px;
    height: 12px;
    border-radius: 8px;
}

.legend-swatch.squircle {
    width: 14px;
    height: 14px;
    border-radius: 30%;
}

.legend-swatch.oct {
    width: 16px;
    height: 16px;
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
}

.legend-swatch.tri {
    width: 16px;
    height: 14px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    border: none;
    background: linear-gradient(160deg, #ff8a80, #e53935);
    box-shadow: 0 0 0 2px #5d0000;
}

.legend-swatch.infra {
    width: 16px;
    height: 14px;
    border-radius: 8px;
}

.legend-swatch.ring-gold {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    box-shadow: 0 0 0 2px #ffd700;
}

.legend-swatch.ring-cyan {
    width: 14px;
    height: 14px;
    border-radius: 5px;
    box-shadow: 0 0 0 2px #00e5ff;
}

#logs {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    font-size: 13px;
    font-family: 'Courier New', Courier, monospace;
    color: #00ff00;
}

/* Event Banner Styles */
#event-banner {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 800px;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #ff9800;
    color: #ff9800;
    padding: 10px 20px;
    border-radius: 4px;
    z-index: 10005;
    overflow: hidden;
    transition: all 0.5s ease;
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.3);
}

.event-banner-visible {
    top: 20px !important;
    opacity: 1 !important;
    pointer-events: none;
}

.event-banner-hidden {
    top: -100px !important;
    opacity: 0;
}

.event-banner-content {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 18px;
    white-space: nowrap;
    width: 100%;
    overflow: hidden;
    position: relative;
    height: 40px;
}

#event-banner-flag {
    height: 30px;
    margin-right: 15px;
    border-radius: 2px;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    background: rgba(0,0,0,0.8);
    padding: 2px;
}

.scroll-container {
    display: flex;
    overflow: hidden;
    width: 100%;
    min-width: 0;
    position: relative;
    z-index: 1;
    justify-content: center;
    align-items: center;
}

.scroll-container.scroll-container--marquee {
    justify-content: flex-start;
}

#event-banner-text {
    display: flex;
    white-space: nowrap;
    animation: none;
    padding-left: 0;
}

#event-banner-text.event-banner-text--marquee {
    animation: banner-scroll 30s linear infinite;
    padding-left: 20px;
}

.scroll-item {
    padding-right: 100px; /* Space between repeated items */
}

@keyframes banner-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes banner-glow {
    0% { text-shadow: 0 0 5px rgba(255, 152, 0, 0.5); }
    50% { text-shadow: 0 0 20px rgba(255, 152, 0, 0.9); }
    100% { text-shadow: 0 0 5px rgba(255, 152, 0, 0.5); }
}

/* First-visit splash (above modals) */
.epicfury-splash {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(12, 14, 18, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.epicfury-splash__panel {
    max-width: 440px;
    width: 100%;
    padding: 28px 24px 24px;
    background: linear-gradient(165deg, rgba(48, 52, 58, 0.98) 0%, rgba(34, 36, 40, 0.99) 100%);
    border: 1px solid rgba(255, 152, 0, 0.25);
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    animation: epicfurySplashIn 0.35s ease-out;
}

@keyframes epicfurySplashIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.epicfury-splash__title {
    margin: 0 0 16px 0;
    font-size: 22px;
    font-weight: 700;
    color: #ff9800;
    letter-spacing: 0.02em;
}

.epicfury-splash__lead,
.epicfury-splash__body {
    margin: 0 0 14px 0;
    font-size: 14px;
    line-height: 1.55;
    color: #cfd8dc;
}

.epicfury-splash__body:last-of-type {
    margin-bottom: 22px;
}

.epicfury-splash__lead strong,
.epicfury-splash__body strong {
    color: #eceff1;
    font-weight: 600;
}

.epicfury-splash__btn {
    display: block;
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: #1565c0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(21, 101, 192, 0.35);
}

.epicfury-splash__btn:hover {
    background: #1976d2;
}

.epicfury-splash__btn:focus-visible {
    outline: 2px solid #64b5f6;
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .epicfury-splash__panel {
        padding: 22px 18px 20px;
    }

    .epicfury-splash__title {
        font-size: 19px;
    }

    .epicfury-splash__lead,
    .epicfury-splash__body {
        font-size: 13px;
    }
}

/* Modal Styles — above map controls, event banner (10005), and attack overlays */
.modal {
    display: none;
    position: fixed;
    z-index: 12000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: transparent; /* Remove dark background to keep map visible */
    backdrop-filter: none; /* Remove blur to keep map visible */
    pointer-events: none; /* Allow clicking map behind if modal is just an overlay (but usually we want modal to be modal) */
}

/* Day briefing: capture backdrop taps so “outside” closes the panel */
#day-briefing-modal.modal {
    pointer-events: auto;
}

.modal-content {
    background-color: rgba(45, 45, 45, 0.95); /* Semi-transparent content background */
    margin: 10% auto;
    padding: 0;
    border: 1px solid #444;
    width: 450px;
    border-radius: 8px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.8);
    overflow: hidden;
    animation: modalFadeIn 0.3s;
    pointer-events: auto; /* Ensure content is still clickable */
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    background-color: #3d3d3d;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #ff9800;
}

.close-modal {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover {
    color: #fff;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    background-color: #333;
    border-top: 1px solid #444;
    text-align: right;
}

/* ?epicfury_map_debug=1 — live marker/location counts (see console for detail) */
#epicfury-map-debug-hud {
    position: fixed;
    left: 8px;
    bottom: max(36px, calc(28px + env(safe-area-inset-bottom, 0px)));
    max-width: min(440px, calc(100vw - 16px));
    z-index: 15000;
    padding: 8px 10px;
    font-family: ui-monospace, Consolas, "Cascadia Mono", monospace;
    font-size: 11px;
    line-height: 1.35;
    color: #eceff1;
    background: rgba(18, 20, 24, 0.94);
    border: 1px solid #546e7a;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Above modals (12000) and typical map overlays; fixed to viewport, not #map-container */
.continuous-play-stop-bar {
    position: fixed;
    left: 50%;
    bottom: max(14px, calc(10px + env(safe-area-inset-bottom, 0px)));
    transform: translateX(-50%);
    z-index: 25000;
    display: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 14px;
    padding: 10px 16px;
    max-width: calc(100vw - 20px);
    box-sizing: border-box;
    background: rgba(22, 24, 28, 0.97);
    border: 1px solid #455a64;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    pointer-events: auto;
}

.continuous-play-stop-bar__label {
    font-size: 13px;
    color: #b0bec5;
    text-align: center;
    line-height: 1.3;
}

.continuous-play-stop-bar__stop {
    padding: 8px 18px;
    background: #c62828;
    color: #fff;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Day briefing: scroll headlines/strikes only; keep action buttons on screen */
#day-briefing-modal .modal-content--day-briefing {
    box-sizing: border-box;
    width: 520px;
    max-width: min(92vw, calc(100vw - 16px));
    max-height: min(85vh, calc(100vh - 48px));
    max-height: min(85vh, calc(100dvh - 48px));
    margin: 6vh auto 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#day-briefing-modal .day-briefing-modal__header {
    flex-shrink: 0;
}

#day-briefing-modal .day-briefing-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px 22px;
    box-sizing: border-box;
}

#day-briefing-modal .day-briefing-modal__footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 18px 18px;
    box-sizing: border-box;
}

.day-briefing-modal__lead {
    margin: 0 0 14px 0;
    font-size: 12px;
    color: #888;
    line-height: 1.45;
}

.day-briefing-modal__section-title {
    margin: 0 0 8px 0;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.06em;
    color: #888;
    text-transform: uppercase;
}

.day-briefing-headlines {
    margin: 0 0 18px 0;
    padding: 0 0 0 1.15em;
    color: #e0e0e0;
    line-height: 1.45;
    font-size: 13px;
    list-style-position: outside;
}

.day-briefing-modal__btn-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.day-briefing-btn {
    box-sizing: border-box;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.2;
}

.day-briefing-btn--play {
    flex: 1 1 0;
    min-width: 0;
    background: #1565c0;
    color: #fff;
}

.day-briefing-btn--next {
    flex: 1 1 0;
    min-width: 0;
    background: #2e7d32;
    color: #fff;
}

.day-briefing-btn--onwards {
    width: 100%;
    padding: 11px 14px;
    background: #37474f;
    color: #fff;
    border: 1px solid #546e7a;
}

@media (max-width: 640px) {
    #day-briefing-modal .modal-content--day-briefing {
        width: calc(100vw - 12px);
        max-width: calc(100vw - 12px);
        max-height: calc(100vh - 72px);
        max-height: calc(100dvh - 72px);
        margin: 6px auto 10px;
    }

    #day-briefing-modal .modal-header {
        padding: 10px 14px;
    }

    #day-briefing-modal .modal-header h2 {
        font-size: 15px;
        line-height: 1.25;
        word-break: break-word;
    }

    #day-briefing-modal .day-briefing-modal__body {
        padding: 10px 12px;
    }

    #day-briefing-modal .day-briefing-modal__footer {
        padding: 10px 12px 12px;
        gap: 8px;
    }

    .day-briefing-modal__lead {
        font-size: 11px;
        margin-bottom: 10px;
    }

    .day-briefing-modal__section-title {
        font-size: 10px;
        letter-spacing: 0.05em;
        margin-bottom: 6px;
    }

    .day-briefing-headlines {
        font-size: 11.5px;
        line-height: 1.4;
        margin-bottom: 12px;
        padding-left: 1em;
    }

    #day-briefing-headlines a {
        word-break: break-word;
        overflow-wrap: anywhere;
        hyphens: auto;
    }

    .day-briefing-strikes-list {
        font-size: 11px;
        font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
        line-height: 1.4;
    }

    .day-briefing-strikes-list .day-briefing-strike {
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 6px;
    }

    .day-briefing-strikes-list .day-briefing-strike__flag {
        width: 24px;
        max-height: 16px;
        margin-top: 2px;
    }

    .day-briefing-strikes-list .day-briefing-strike__text {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .day-briefing-modal__btn-row {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .day-briefing-btn--play,
    .day-briefing-btn--next {
        flex: none;
        width: 100%;
        min-width: 0;
        padding: 10px 12px;
        font-size: 13px;
    }

    .day-briefing-btn--onwards {
        font-size: 13px;
        padding: 10px 12px;
    }

    .continuous-play-stop-bar {
        padding: 8px 12px;
        gap: 8px;
    }

    .continuous-play-stop-bar__label {
        white-space: normal;
        max-width: 100%;
        font-size: 12px;
    }

    .continuous-play-stop-bar__stop {
        padding: 7px 14px;
        font-size: 13px;
    }

    /* Side controls: vertical stack overflows short viewports — volume/music get clipped */
    #side-controls {
        left: max(8px, env(safe-area-inset-left, 0px));
        right: auto;
        top: auto;
        bottom: max(10px, env(safe-area-inset-bottom, 0px));
        transform: none;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
        gap: 8px;
        max-width: calc(100% - 16px);
        z-index: 10050;
    }

    .control-btn {
        width: 52px;
        height: 52px;
        min-width: 52px;
        min-height: 52px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .control-btn span {
        font-size: 8px;
        margin-top: 2px;
    }

    #music-control-btn {
        border-color: #7e57c2;
        color: #b39ddb;
    }

    #music-control-btn:hover {
        background-color: #7e57c2;
        color: #000;
    }

    /* During strike replay, hide day/map only — keep volume controls reachable */
    body.epicfury-attack-animation-active #day-calendar-toggle-btn,
    body.epicfury-attack-animation-active #map-events-toggle-btn {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }
}

#day-briefing-headlines a {
    color: #6ec6ff;
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

#day-briefing-headlines a:hover {
    color: #90caf9;
}

.day-briefing-strikes-list {
    list-style: none;
    margin: 0 0 8px 0;
    padding: 0;
    color: #bdbdbd;
    line-height: 1.45;
    font-size: 13px;
    font-family: monospace, ui-monospace, monospace;
}

.day-briefing-strikes-list .day-briefing-strike {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.day-briefing-strikes-list .day-briefing-strike__flag {
    width: 28px;
    height: auto;
    max-height: 19px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.day-briefing-strikes-list .day-briefing-strike__text {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Inline Flatpickr (Jump to day) — full month grid, no native date textbox */
.modal-content--timeline {
    width: min(420px, 92vw);
}

.timeline-flatpickr-host {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 300px;
}

.timeline-flatpickr-host .flatpickr-calendar.inline {
    margin: 0 auto;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
    border: 1px solid #555;
    background: #2d2d2d;
}

.timeline-flatpickr-host .flatpickr-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#confirm-weapon-btn {
    background-color: #2e7d32;
    padding: 10px 20px;
    font-weight: bold;
}

#confirm-weapon-btn:disabled {
    background-color: #444;
    color: #777;
    cursor: not-allowed;
    transform: none;
}

.weapon-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.weapon-option {
    background-color: #444; /* Darker but distinct from background */
    border: 2px solid #555;
    padding: 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    color: #fff;
}

.weapon-option:hover {
    border-color: #ff9800;
    background-color: #555;
}

.weapon-option.selected {
    border-color: #ff9800;
    background-color: #ff9800;
    color: #000;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.4);
}

.weapon-option h4 {
    margin: 0 0 5px 0;
    font-size: 15px;
    font-weight: bold;
    text-transform: uppercase;
}

.weapon-option p {
    margin: 0;
    font-size: 12px;
    color: #bbb;
}

.weapon-option.selected p {
    color: #333;
}

.weapon-option.unavailable {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #333;
    border-color: #444;
}

.marker.selected-attacker {
    border: 3px solid #ffeb3b !important;
    box-shadow: 0 0 20px #ffeb3b !important;
    z-index: 1000;
}

.marker.selected-target {
    border: 3px solid #f44336 !important;
    box-shadow: 0 0 20px #f44336 !important;
    z-index: 1000;
}

.marker.waiting-for-target {
    animation: pulse-yellow 1.5s infinite;
}

@keyframes pulse-yellow {
    0% { box-shadow: 0 0 0 0 rgba(255, 235, 59, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(255, 235, 59, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 235, 59, 0); }
}

.weapon-btn {
    background-color: #444;
    color: #eee;
    border: 1px solid #666;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.weapon-btn:hover {
    background-color: #555;
    border-color: #888;
}

.weapon-btn.active-weapon {
    background-color: #ff9800;
    color: #000;
    font-weight: bold;
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}

/* Attack Animations — large on-screen so missile / boat / drone reads clearly */
.attack-unit {
    position: absolute;
    width: 72px;
    height: 72px;
    pointer-events: none;
    z-index: 3000;
    transform: translate(-50%, -50%);
    transition: all 4s linear; /* Slower transition matching JS duration */
    object-fit: contain;
    filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.85));
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.attack-unit.attack-unit--naval {
    width: 104px;
    height: 88px;
}

.attack-unit.attack-unit--drone {
    width: 80px;
    height: 80px;
}

.attack-unit.attack-unit--fighter {
    width: 96px;
    height: 72px;
}

.attack-unit.attack-unit--heavy {
    width: 112px;
    height: 72px;
}

.attack-unit.attack-unit--missile {
    width: 72px;
    height: 72px;
}

.explosion-gif {
    z-index: 3001;
    pointer-events: none;
}

.unit-missile {
    width: 30px;
    height: 30px;
    background-image: var(--epicfury-img-missile);
}

.unit-drone {
    width: 20px;
    height: 20px;
    background-image: var(--epicfury-img-drone, var(--epicfury-img-missile));
}

.unit-aircraft {
    width: 35px;
    height: 35px;
    background-image: var(--epicfury-img-fighter, var(--epicfury-img-missile));
}

.unit-naval {
    width: 40px;
    height: 40px;
    background-image: var(--epicfury-img-swarm);
}

.impact-effect {
    position: absolute;
    pointer-events: none;
    z-index: 3001;
    animation: impact-boom 0.5s ease-out forwards;
}

@keyframes impact-boom {
    0% { transform: scale(0.5); opacity: 1; background: radial-gradient(circle, #fff 0%, #ff9800 50%, transparent 100%); }
    100% { transform: scale(3); opacity: 0; }
}

/* Impact flash when projectile reaches target (fixed position = map pixel at hit) */
.strike-impact-explosion {
    position: fixed;
    width: 140px;
    height: 140px;
    margin-left: -70px;
    margin-top: -70px;
    pointer-events: none;
    z-index: 3005;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(255, 180, 50, 0.85) 35%, rgba(255, 80, 0, 0.5) 55%, transparent 72%);
    box-shadow:
        0 0 20px 10px rgba(255, 200, 100, 0.9),
        0 0 50px 25px rgba(255, 100, 0, 0.45),
        inset 0 0 30px rgba(255, 255, 255, 0.6);
    animation: strike-explosion-flash 0.65s ease-out forwards;
}

@keyframes strike-explosion-flash {
    0% {
        opacity: 1;
        transform: scale(0.35);
        filter: brightness(1.4);
    }
    35% {
        opacity: 1;
        transform: scale(1.05);
        filter: brightness(1.2);
    }
    100% {
        opacity: 0;
        transform: scale(2.2);
        filter: brightness(0.9);
    }
}

.damage-indicator {
    position: absolute;
    color: #f44336;
    font-weight: bold;
    font-size: 20px;
    pointer-events: none;
    z-index: 3002;
    text-shadow: 0 0 5px #000;
    animation: float-up 1.5s ease-out forwards;
}

@keyframes float-up {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-50px); opacity: 0; }
}

.intercept-indicator {
    position: absolute;
    color: #2196f3;
    font-weight: bold;
    font-size: 14px;
    pointer-events: none;
    z-index: 3002;
    text-shadow: 0 0 5px #000;
    animation: fade-out 1s ease-out forwards;
}

@keyframes fade-out {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

#logs p {
    margin: 5px 0;
    border-bottom: 1px solid #333;
    padding-bottom: 3px;
    transition: background-color 0.3s ease;
}
