/* =========================================
   ARCHIPELAGO - AGE OF KINGDOMS
   PRABEBANG STUDIO - THEOTOWN 2.5D RETRO MOBA
========================================= */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
    box-sizing: border-box;
    user-select: none;
}

body {
    margin: 0;
    padding: 0;
    background: #060e1a;
    color: #f5e6bd;
    font-family: 'Press Start 2P', monospace;
    image-rendering: pixelated;
    overflow: hidden;
}

button {
    font-family: 'Press Start 2P', monospace;
    cursor: pointer;
}

/* =========================================
   INTRO SCREEN
========================================= */
#intro-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle, #1e293b, #020617 80%);
    opacity: 1;
    visibility: visible;
    transition: opacity 1s ease, visibility 1s ease;
}

#intro-screen.intro-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.intro-content { text-align: center; animation: intro-appear 1.2s ease; }
.intro-content img {
    display: block; width: 220px; max-width: 65vw; margin: 0 auto 25px;
    filter: drop-shadow(0 0 20px #eab308);
}
.intro-content p { color: #facc15; font-size: 11px; letter-spacing: 3px; }
.intro-content span { color: #94a3b8; font-size: 8px; letter-spacing: 4px; }

@keyframes intro-appear {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

/* =========================================
   LOBBY KEREN - ROYAL WAR ROOM
========================================= */
#lobby-screen {
    display: none;
    min-height: 100vh;
    flex-direction: column;
    background: radial-gradient(circle at center, #132238 0%, #080f1d 100%);
    color: #f5e6bd;
}

.lobby-topbar {
    min-height: 75px;
    padding: 12px 35px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #040914;
    border-bottom: 4px solid #1e3a5f;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
}

.lobby-brand h1 {
    margin: 0;
    color: #facc15;
    font-size: clamp(16px, 2.3vw, 24px);
    text-shadow: 3px 3px #451a03;
    letter-spacing: 2px;
}

.lobby-brand span {
    display: block;
    margin-top: 6px;
    color: #60a5fa;
    font-size: 7px;
}

.lobby-user-status {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 8px;
    color: #86efac;
}

#logout-button {
    background: #7f1d1d;
    color: #fca5a5;
    border: 2px solid #ef4444;
    padding: 8px 14px;
    font-size: 8px;
    transition: 0.15s;
    box-shadow: 0 3px 0 #450a0a;
}
#logout-button:hover { background: #991b1b; transform: translateY(-1px); }

/* MAIN LAYOUT */
.lobby-main {
    flex: 1;
    min-height: 550px;
    display: grid;
    grid-template-columns: 290px 1fr 310px;
    gap: 18px;
    padding: 22px;
}

.lobby-left, .lobby-right {
    background: rgba(8, 16, 32, 0.94);
    border: 4px solid #1e3a5f;
    box-shadow: 6px 6px 0 #020617;
    border-radius: 4px;
}

.lobby-panel-title {
    padding: 12px;
    background: #172a45;
    color: #fde047;
    font-size: 9px;
    border-bottom: 3px solid #0f1d30;
    text-align: center;
}

/* LEFT PANEL (PROFIL KOMANDAN) */
.kingdom-info {
    padding: 20px 15px;
    text-align: center;
    border-bottom: 3px solid #1e3a5f;
}

.kingdom-emblem {
    width: 75px;
    height: 85px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d97706;
    color: #fff;
    border: 4px solid #facc15;
    clip-path: polygon(10% 0, 90% 0, 90% 75%, 50% 100%, 10% 75%);
    font-size: 28px;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.4);
}

.kingdom-info h2 { font-size: 11px; color: #fef08a; line-height: 1.6; }
.badge-blue { color: #38bdf8; font-size: 7px; margin-top: 5px; }

.commander-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    gap: 10px;
}

.stat-box {
    background: #0b1526;
    border: 2px solid #2563eb;
    padding: 8px 6px;
    flex: 1;
    border-radius: 4px;
}
.stat-box span { display: block; font-size: 6px; color: #94a3b8; }
.stat-box strong { display: block; font-size: 8px; color: #fde047; margin-top: 5px; }

.kingdom-details {
    padding: 15px;
    line-height: 1.8;
    font-size: 7px;
    color: #cbd5e1;
}
.kingdom-details p { color: #facc15; font-size: 8px; font-weight: bold; margin-bottom: 8px; }
.kingdom-details ul { padding-left: 15px; margin: 0; }
.kingdom-details li { margin-bottom: 8px; }

/* SHOWCASE */
.lobby-center {
    position: relative;
    border: 4px solid #1e3a5f;
    background: linear-gradient(180deg, #182e4b 0%, #10243d 50%, #0a1829 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 6px 6px 0 #020617;
}

.showcase-title { padding: 18px; text-align: center; }
.showcase-title span { color: #38bdf8; font-size: 7px; }
.showcase-title h2 { font-size: 13px; line-height: 1.8; margin-top: 6px; color: #facc15; }

.pixel-world {
    position: relative;
    flex: 1;
    background: linear-gradient(to bottom, transparent 55%, #183e52 56%, #0f2b3a 100%);
    overflow: hidden;
}

.pixel-sun {
    position: absolute; top: 15%; left: 48%; width: 48px; height: 48px;
    background: #facc15; box-shadow: 0 0 30px #f59e0b;
}

.pixel-cloud { position: absolute; width: 60px; height: 10px; background: #94a3b8; opacity: 0.8; }
.cloud-one { top: 20%; left: 10%; }
.cloud-two { top: 30%; right: 10%; }

.pixel-island {
    position: absolute; transform: rotate(-30deg);
    border: 5px solid #d97706; background: #15803d; box-shadow: 0 12px 0 #166534;
}
.island-back { width: 170px; height: 85px; top: 40%; left: 18%; z-index: 2; }
.island-front { width: 220px; height: 95px; top: 62%; left: 45%; z-index: 3; }

.pixel-ship { position: absolute; z-index: 5; left: 35%; top: 68%; width: 75px; height: 55px; }
.ship-body {
    position: absolute; bottom: 0; width: 70px; height: 16px;
    background: #78350f; border: 3px solid #271408; clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
}
.ship-sail { position: absolute; left: 30px; top: 0; width: 4px; height: 38px; background: #451a03; }
.ship-sail::after {
    content: ""; position: absolute; top: 3px; left: 4px; width: 22px; height: 26px;
    background: #fef08a; clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.showcase-caption { position: absolute; bottom: 10px; width: 100%; text-align: center; color: #facc15; font-size: 7px; }

/* RIGHT PANEL (MENU OPERASI) */
.lobby-menu-content { padding: 20px 15px; text-align: center; }
.menu-description { color: #94a3b8; font-size: 7px; margin-bottom: 20px; }

.btn-battle-play {
    width: 100%;
    padding: 22px 10px;
    margin-bottom: 16px;
    background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
    color: #fff;
    border: 4px solid #facc15;
    box-shadow: 0 6px 0 #451a03;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: 0.1s;
}
.btn-battle-play:hover { background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%); }
.btn-battle-play:active { transform: translateY(4px); box-shadow: 0 2px 0 #451a03; }
.btn-big-text { font-size: 10px; color: #fef08a; }
.btn-sub-text { font-size: 6px; color: #fff; }

.btn-battle-secondary {
    width: 100%; padding: 14px 10px; margin-bottom: 20px;
    background: #334155; color: #cbd5e1; border: 3px solid #64748b;
    box-shadow: 0 4px 0 #0f172a; font-size: 8px;
}
.btn-battle-secondary:hover { background: #475569; }

.game-status-card {
    background: #040914; border: 2px solid #1e3a5f;
    padding: 10px; font-size: 7px; color: #94a3b8; line-height: 1.8;
}

.lobby-footer {
    min-height: 40px; padding: 10px 25px; display: flex;
    justify-content: space-between; align-items: center;
    background: #040914; border-top: 3px solid #1e3a5f; color: #64748b; font-size: 7px;
}

/* =========================================
   FULLSCREEN GAME CONTAINER & HUD OVERLAY
========================================= */
#game-container {
    display: none;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: #0e2a38;
    overflow: hidden;
}

#game {
    position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;
}

.game-hud-overlay {
    position: absolute; inset: 0; z-index: 10;
    pointer-events: none;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 15px 25px;
}
.game-hud-overlay * { pointer-events: auto; }

.hud-top-bar { display: flex; justify-content: space-between; align-items: center; }

#back-lobby-button {
    background: rgba(30, 20, 15, 0.9); color: #fca5a5;
    border: 3px solid #991b1b; padding: 10px 14px; font-size: 8px;
    box-shadow: 0 4px 0 #000;
}

.hud-resources {
    display: flex; gap: 12px;
    background: rgba(15, 23, 42, 0.9); border: 3px solid #3b82f6;
    padding: 8px 15px; border-radius: 4px; box-shadow: 0 4px 0 #000;
}
.res-item { font-size: 9px; color: #fde047; }

/* MOBA RADAR MINI BASE TRACKER */
.hud-moba-tracker {
    align-self: center; margin-top: 65px;
    display: flex; align-items: center; gap: 15px;
    background: rgba(0, 0, 0, 0.75); border: 2px solid #475569;
    padding: 6px 16px; border-radius: 20px;
}
.team-tracker { display: flex; align-items: center; gap: 6px; font-size: 7px; }
.blue-team span { color: #38bdf8; }
.red-team span { color: #ef4444; }
.vs-text { font-size: 8px; color: #e2e8f0; font-weight: bold; }
.base-dots { display: flex; gap: 4px; }
.base-dots .dot { font-size: 9px; color: #22c55e; }
.base-dots .main-dot { font-size: 12px; color: #eab308; }
.base-dots .destroyed { color: #475569 !important; }

/* REVISI 4: BAR PROGRES CHANNELING MEMBANGUN (10 DETIK) */
.channeling-container {
    align-self: center;
    width: 280px;
    text-align: center;
    margin-bottom: 10px;
    background: rgba(15, 23, 42, 0.9);
    border: 3px solid #facc15;
    padding: 8px;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(250, 204, 21, 0.5);
}
.bar-border {
    width: 100%; height: 12px; background: #000;
    border: 2px solid #64748b; margin-bottom: 6px;
}
.bar-fill { width: 0%; height: 100%; background: #22c55e; transition: width 0.1s linear; }
.bar-text { font-size: 7px; color: #fde047; }

/* ACTION BAR */
.hud-bottom-bar { display: flex; justify-content: center; margin-bottom: 10px; }
.skill-group {
    display: flex; gap: 15px;
    background: rgba(15, 23, 42, 0.9); border: 4px solid #475569;
    padding: 10px 20px; border-radius: 8px; box-shadow: 0 6px 0 #000;
}
.hud-btn {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: #1e293b; color: #f8fafc; border: 3px solid #64748b;
    padding: 10px 14px; font-size: 7px; transition: 0.1s;
}
.btn-hold-repair { border-color: #facc15 !important; }
.btn-hold-repair:active { background: #d97706 !important; }
.hud-btn .btn-icon { font-size: 16px; }
.hud-btn:hover { background: #334155; transform: translateY(-2px); }
.hud-btn:active { transform: translateY(2px); }

@media (max-width: 900px) {
    .lobby-main { grid-template-columns: 1fr; }
    .lobby-center { min-height: 300px; }
}