/* Blade War: Booming Settlement & Waterworks - UI Styles */
:root {
    --bg-dark: #0f172a;
    --gold: #f59e0b;
    --gold-light: #fde047;
    --blue-water: #38bdf8;
    --green-lush: #10b981;
    --wood: #854d0e;
    --stone: #64748b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

body {
    background: radial-gradient(circle at center, #1e293b, #090d16);
    color: #f8fafc;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    padding: 10px;
}

/* Device Wrapper (Portrait 9:16 Diorama View) */
.game-container {
    position: relative;
    width: 100%;
    max-width: 440px;
    height: 92vh;
    max-height: 840px;
    background: #000;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 0 4px rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

/* Canvas Area */
.canvas-wrapper {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
}

/* Floating Top Bar */
.top-bar {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
    pointer-events: none;
}

.top-bar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
}

.game-logo {
    height: 52px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}

.top-controls {
    display: flex;
    gap: 6px;
}

.ctrl-btn {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 6px 12px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.ctrl-btn:active {
    transform: scale(0.94);
    background: rgba(245, 158, 11, 0.8);
}

/* Resources Header Bar */
.resources-panel {
    display: flex;
    justify-content: space-around;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 6px 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
}

.res-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 800;
}

.res-stone { color: #cbd5e1; }
.res-wood { color: #f59e0b; }
.res-water { color: #38bdf8; }
.res-food { color: #4ade80; }

/* Stage Indicator & Overall Progress */
.stage-banner {
    position: absolute;
    top: 112px;
    left: 12px;
    right: 12px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    padding: 8px 12px;
    border: 1px solid rgba(245, 158, 11, 0.3);
    z-index: 10;
    pointer-events: auto;
}

.stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.stage-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--gold-light);
    letter-spacing: 0.5px;
}

.stage-subtext {
    font-size: 10px;
    color: #94a3b8;
    margin-bottom: 6px;
}

.overall-progress-bar {
    width: 100%;
    height: 7px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.overall-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #f59e0b, #10b981);
    width: 0%;
    transition: width 0.3s ease;
}

/* Floating Bottom Bar: Video Authentic Badges & Controls */
.bottom-bar {
    position: absolute;
    bottom: 10px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    pointer-events: none;
}

.badge-video {
    height: 48px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
    pointer-events: auto;
    animation: gentleGlow 2.5s infinite alternate ease-in-out;
}

@keyframes gentleGlow {
    0% { filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)) brightness(1); }
    100% { filter: drop-shadow(0 4px 12px rgba(245, 158, 11, 0.6)) brightness(1.15); }
}

/* Big Dispatch Workers Button */
.dispatch-btn {
    pointer-events: auto;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: 2px solid #fef08a;
    color: #fff;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dispatch-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

/* Quick Goals Drawer / Selector */
.goals-overlay {
    position: absolute;
    bottom: 66px;
    left: 10px;
    right: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    z-index: 10;
    pointer-events: auto;
}

.goal-card {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.goal-card:active {
    transform: scale(0.96);
    border-color: var(--gold);
}

.goal-card.done {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(6, 78, 59, 0.65);
}

.goal-info {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 700;
    margin-bottom: 4px;
}

.goal-title {
    color: #e2e8f0;
}

.goal-pct {
    color: var(--gold-light);
}

.goal-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.goal-fill {
    height: 100%;
    background: var(--blue-water);
    width: 0%;
    transition: width 0.25s ease;
}

.goal-card.done .goal-fill {
    background: var(--green-lush);
}

/* Navigation Stage Tabs */
.stage-tabs {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    max-width: 440px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.stage-tab {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stage-tab.active {
    background: linear-gradient(135deg, #f59e0b, #b45309);
    color: #fff;
    border-color: #fde047;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.35);
}

/* Modal Victory Celebration */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    background: linear-gradient(180deg, #1e293b, #0f172a);
    border: 2px solid var(--gold);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    max-width: 320px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(245, 158, 11, 0.4);
    animation: popUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popUp {
    0% { transform: scale(0.8) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-card h2 {
    font-size: 16px;
    color: var(--gold-light);
    margin-bottom: 10px;
}

.modal-card p {
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.5;
    margin-bottom: 20px;
}

.modal-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    border: 1px solid #a7f3d0;
    color: #fff;
    padding: 10px 20px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transition: all 0.2s ease;
}

.modal-btn:hover {
    transform: scale(1.04);
}
