/* play.css — Retro arcade play-first entry point */

/* ─── Full-screen dark base ──────────────────────────────────────── */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

/* ─── Live Background Game ────────────────────────────────────────── */
#background-game-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.25;
    filter: blur(2px);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    pointer-events: none;
}

/* ─── Play overlay (title screen) ────────────────────────────────── */
#play-overlay {
    position: fixed;
    z-index: 600;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.82);
    font-family: 'C64ProRegular', monospace;
    color: #fff;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 22px 16px;
    box-sizing: border-box;
}
#play-overlay.hide { display: none; }

/* CRT scanlines — slowly scrolling */
#play-overlay::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 200%;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255,255,255,0.018) 2px,
            rgba(255,255,255,0.018) 4px
        );
    animation: play-scanroll 10s linear infinite;
    pointer-events: none;
    z-index: 0;
}

/* Purple arcade vignette */
#play-overlay::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(
        ellipse at center,
        rgba(80, 0, 120, 0.25) 0%,
        rgba(0, 0, 0, 0) 60%
    );
    pointer-events: none;
    z-index: 0;
}

@keyframes play-scanroll {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

#play-overlay > * { position: relative; z-index: 1; }

/* ─── Title ──────────────────────────────────────────────────────── */
.play-title {
    font-family: 'WizardOfWor', monospace;
    font-size: clamp(42px, 8vh, 68px);
    color: #DFF60A;
    text-align: center;
    line-height: 1.05;
    letter-spacing: 5px;
    margin: 0 0 8px 0;
    text-shadow:
        0 0 10px rgba(223, 246, 10, 0.5),
        0 0 30px rgba(223, 246, 10, 0.25),
        0 0 60px rgba(223, 246, 10, 0.1);
}

/* INSERT COIN flicker */
.play-insert {
    font-size: 13px;
    color: #777;
    letter-spacing: 6px;
    margin-bottom: 24px;
}
@keyframes play-coin {
    0%, 55% { opacity: 1; }
    56%, 100% { opacity: 0; }
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.play-btn {
    display: block;
    width: min(520px, 88vw);
    margin: 0 auto;
    padding: 0;
    border: 2px solid;
    font-family: 'WizardOfWor', monospace;
    cursor: pointer;
    text-align: center;
    letter-spacing: 3px;
    transition: all 0.15s;
    background: transparent;
    outline: none;
}

/* Primary (PLAY) — big, red, pulsing glow */
.play-btn-primary {
    font-size: clamp(20px, 4vw, 28px);
    padding: 16px 20px;
    color: #fff;
    border-color: #c00;
    background: #c00;
    margin-bottom: 12px;
    animation: play-glow 2s ease-in-out infinite;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}
.play-btn-primary:hover {
    background: #e20;
    border-color: #e20;
    transform: scale(1.04);
    box-shadow: 0 0 24px rgba(220, 0, 0, 0.7);
}
@keyframes play-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(200, 0, 0, 0.4); }
    50%      { box-shadow: 0 0 20px rgba(200, 0, 0, 0.8), 0 0 40px rgba(200, 0, 0, 0.3); }
}

/* Secondary (MULTIPLAYER) — outlined, blue accent */
.play-secondary-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 0;
}
.play-btn-sm {
    width: min(440px, 82vw);
    padding: 12px 18px;
    font-family: 'WizardOfWor', monospace;
    font-size: 14px;
    color: #fff;
    background: #c00;
    border: 2px solid #c00;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.15s;
    outline: none;
}
.play-btn-sm:hover {
    transform: scale(1.04);
}
.play-btn-sm.green { background: #070; border-color: #070; }
.play-btn-sm.green:hover { background: #090; border-color: #090; box-shadow: 0 0 12px rgba(0,153,0,0.5); }
.play-btn-sm.blue { background: #15c; border-color: #15c; }
.play-btn-sm.blue:hover { background: #27e; border-color: #27e; box-shadow: 0 0 12px rgba(34,119,238,0.5); }

/* ─── Hint text ──────────────────────────────────────────────────── */
.play-hint {
    font-size: 11px;
    color: #444;
    letter-spacing: 4px;
    font-family: 'C64ProRegular', monospace;
    animation: play-coin 2s step-start infinite;
}

/* ─── Footer ─────────────────────────────────────────────────────── */
.play-footer {
    position: absolute;
    bottom: 20px;
    font-size: 11px;
}
.play-footer a {
    color: #333;
    text-decoration: none;
    letter-spacing: 2px;
    transition: color 0.2s;
}
.play-footer a:hover { color: #888; }

/* ─── Challenge banner ───────────────────────────────────────────── */
.play-challenge {
    background: linear-gradient(90deg, #f80 0%, #f00 100%);
    color: #fff;
    padding: 10px 24px;
    margin-bottom: 20px;
    font-size: 13px;
    letter-spacing: 1px;
    text-align: center;
}
.play-challenge strong { color: #ff0; font-size: 1.1em; }

/* Loading indicator */
.play-loading {
    font-family: 'C64ProRegular', monospace;
    font-size: 1rem;
    color: #0ff;
    text-align: center;
    letter-spacing: 0.1em;
    margin-top: 20px;
    animation: go-blink 1s infinite alternate;
}

/* ─── Game root ──────────────────────────────────────────────────── */
#game-root {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Screen shake on death */
@keyframes swow-shake {
    0%, 100% { transform: translate(0, 0); }
    15%      { transform: translate(-3px, 2px); }
    30%      { transform: translate(3px, -2px); }
    45%      { transform: translate(-2px, -3px); }
    60%      { transform: translate(2px, 3px); }
    75%      { transform: translate(-1px, 1px); }
}
#game-root.shake { animation: swow-shake 0.2s ease-out; }

/* ─── Game-Over overlay (dynamically injected into #game-root) ──── */
#play-gameover {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    z-index: 500;
    pointer-events: none;
    animation: go-fadein 0.8s ease-out;
}
@keyframes go-fadein {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

.go-content {
    text-align: center;
    color: #fff;
    font-family: 'C64ProRegular', monospace;
}
.go-newhigh {
    font-size: 1.1rem;
    color: #ff0;
    letter-spacing: 0.15em;
    animation: go-blink 0.6s infinite alternate;
    margin-bottom: 6px;
}
@keyframes go-blink {
    from { opacity: 0.5; }
    to   { opacity: 1; }
}
.go-score {
    font-family: 'WizardOfWor', monospace;
    font-size: 3.5rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    text-shadow: 0 0 12px #ff0, 0 0 30px #f80;
}
.go-wave {
    font-size: 0.9rem;
    color: #aaa;
    margin-top: 2px;
    letter-spacing: 0.15em;
}
.go-detail {
    font-size: 0.85rem;
    color: #777;
    margin-top: 4px;
}

/* Share buttons */
.go-share {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 12px;
    pointer-events: auto;
}
.go-share-btn {
    display: inline-block;
    padding: 6px 14px;
    font-family: 'C64ProRegular', monospace;
    font-size: 0.7rem;
    color: #fff;
    border: 1px solid #555;
    background: #222;
    cursor: pointer;
    text-decoration: none;
    letter-spacing: 0.1em;
    transition: background 0.15s, border-color 0.15s;
}
.go-share-btn:hover { background: #444; border-color: #aaa; }
.go-share-twitter { border-color: #1da1f2; }
.go-share-twitter:hover { background: #1da1f2; }

/* Play Again button */
.go-actions {
    margin-top: 16px;
    pointer-events: auto;
}
.go-replay-btn {
    display: inline-block;
    padding: 10px 28px;
    font-family: 'WizardOfWor', monospace;
    font-size: 18px;
    color: #fff;
    background: #c00;
    border: 2px solid #c00;
    cursor: pointer;
    letter-spacing: 3px;
    animation: play-glow 2s ease-in-out infinite;
    transition: all 0.15s;
    outline: none;
}
.go-replay-btn:hover {
    background: #e20;
    border-color: #e20;
    transform: scale(1.05);
    box-shadow: 0 0 24px rgba(220, 0, 0, 0.7);
}

.go-hint {
    font-size: 0.75rem;
    color: #444;
    margin-top: 10px;
    animation: go-blink 1.5s infinite alternate;
    letter-spacing: 0.1em;
}

/* ─── MP post-match result text ──────────────────────────────────── */
.go-result {
    font-family: 'WizardOfWor', monospace;
    font-size: 2rem;
    letter-spacing: 0.15em;
    margin-bottom: 8px;
}
.go-win {
    color: #0f0;
    text-shadow: 0 0 12px rgba(0,255,0,0.5), 0 0 30px rgba(0,255,0,0.2);
}
.go-lose {
    color: #f44;
    text-shadow: 0 0 12px rgba(255,68,68,0.5), 0 0 30px rgba(255,68,68,0.2);
}
.go-draw {
    color: #ff0;
    text-shadow: 0 0 12px rgba(255,255,0,0.5);
}

/* ─── Kill score popups ──────────────────────────────────────────── */
.kill-popup {
    position: fixed;
    z-index: 550;
    pointer-events: none;
    font-family: 'C64ProRegular', monospace;
    font-size: 1rem;
    font-weight: bold;
    color: #ff0;
    text-shadow: 0 0 6px #f80;
    animation: kill-float 0.8s ease-out forwards;
}
@keyframes kill-float {
    0%   { opacity: 1; transform: translateY(0) scale(1.2); }
    60%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-30px) scale(0.8); }
}

/* ─── Mode Sections (Battle Royale Layout) ──────────────────────────── */
.play-mode-section {
    width: min(560px, 92vw);
    margin: 0 auto 22px;
    text-align: center;
}

.classic-section {
    margin-bottom: 34px;
}

.network-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: stretch;
}

.network-section .play-mode-label,
.network-section .mode-desc {
    grid-column: 1 / -1;
}

.play-mode-label {
    font-family: 'C64ProRegular', monospace;
    font-size: 10px;
    color: #666;
    letter-spacing: 3px;
    text-align: center;
    margin-bottom: 8px;
}

/* Mode descriptions */
.mode-desc {
    font-family: 'C64ProRegular', monospace;
    font-size: 10px;
    color: #777;
    text-align: center;
    margin: 6px auto 12px;
    max-width: 400px;
    line-height: 1.4;
    letter-spacing: 0.5px;
}

/* Battle Royale primary button */
.play-btn-br {
    width: 100%;
    min-height: 82px;
    padding: 14px 22px;
    font-family: 'WizardOfWor', monospace;
    font-size: 18px;
    color: #fff;
    background: linear-gradient(135deg, #c00 0%, #800 100%);
    border: 2px solid #c00;
    cursor: pointer;
    letter-spacing: 3px;
    transition: all 0.15s;
    outline: none;
    margin: 0;
    box-shadow: 0 0 8px rgba(200, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.play-btn-br:hover {
    background: linear-gradient(135deg, #e20 0%, #a00 100%);
    border-color: #e20;
    transform: scale(1.05);
    box-shadow: 0 0 24px rgba(220, 0, 0, 0.7);
}

/* Button internal structure */
.btn-icon {
    font-size: 22px;
    line-height: 1;
}
.btn-label {
    font-family: 'WizardOfWor', monospace;
    font-size: inherit;
    letter-spacing: inherit;
    line-height: 1;
}
.btn-hint {
    font-family: 'C64ProRegular', monospace;
    font-size: 9px;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
    line-height: 1;
    margin-top: 2px;
}

/* Battle Royale secondary row */
.play-br-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 8px;
}

/* Team BR row (separate styling) */
.play-br-team-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 12px;
}

.play-btn-br-sm {
    padding: 10px 20px;
    font-family: 'WizardOfWor', monospace;
    font-size: 12px;
    color: #fff;
    background: #640;
    border: 2px solid #840;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.15s;
    outline: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.play-btn-br-sm:hover {
    background: #850;
    border-color: #a60;
    transform: scale(1.04);
    box-shadow: 0 0 12px rgba(170, 85, 0, 0.5);
}
.play-btn-br-sm .btn-icon {
    font-size: 16px;
}
.play-btn-br-sm .btn-hint {
    font-size: 8px;
    margin-top: 1px;
}

/* Purple variant for Team Endless */
.play-btn-br-sm.purple {
    background: #606;
    border-color: #808;
}
.play-btn-br-sm.purple:hover {
    background: #808;
    border-color: #a0a;
    box-shadow: 0 0 12px rgba(136, 0, 136, 0.6);
}

/* Blue variant for Team Sit-n-Go */
.play-btn-br-sm.blue {
    background: #15c;
    border-color: #27e;
}
.play-btn-br-sm.blue:hover {
    background: #27e;
    border-color: #3af;
    box-shadow: 0 0 12px rgba(34, 119, 238, 0.6);
}

/* Private room button */
.play-btn-private {
    width: 100%;
    min-height: 82px;
    padding: 14px 22px;
    font-family: 'WizardOfWor', monospace;
    font-size: 16px;
    color: #fff;
    background: #15c;
    border: 2px solid #15c;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.15s;
    outline: none;
    box-shadow: 0 0 6px rgba(17, 85, 204, 0.4);
}
.play-btn-private:hover {
    background: #27e;
    border-color: #27e;
    transform: scale(1.04);
    box-shadow: 0 0 16px rgba(34, 119, 238, 0.6);
}

@media (max-width: 720px), (max-height: 760px) {
    #play-overlay {
        justify-content: flex-start;
        padding-top: 18px;
    }

    .play-title {
        font-size: clamp(34px, 10vw, 52px);
    }

    .play-insert {
        margin-bottom: 14px;
    }

    .classic-section {
        margin-bottom: 20px;
    }

    .network-section {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .play-btn-private,
    .play-btn-br {
        min-height: 68px;
    }

    .play-hint {
        margin-top: 4px;
    }
}

/* ─── Active Games Panel ──────────────────────────────────────────── */
.active-games-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 320px;
    max-height: calc(100vh - 160px);
    background: rgba(0, 0, 0, 0.92);
    border: 2px solid #333;
    padding: 16px;
    overflow-y: auto;
    font-family: 'C64ProRegular', monospace;
    z-index: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.active-games-header {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #444;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.active-games-title {
    font-size: 14px;
    color: #0ff;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.minimap-link {
    font-size: 18px;
    text-decoration: none;
    opacity: 0.7;
    transition: all 0.2s;
    cursor: pointer;
}

.minimap-link:hover {
    opacity: 1;
    transform: scale(1.1);
}

.active-games-count {
    font-size: 11px;
    color: #888;
    letter-spacing: 1px;
}

.active-games-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Game Card */
.game-card {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #444;
    padding: 12px;
    transition: all 0.2s;
}

.game-card:hover {
    border-color: #666;
    background: rgba(30, 30, 30, 0.9);
}

.game-mode {
    font-size: 13px;
    color: #ff0;
    letter-spacing: 1px;
    margin-bottom: 6px;
    font-weight: bold;
}

.game-stats {
    font-size: 11px;
    color: #aaa;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.stat-sep {
    margin: 0 6px;
    color: #555;
}

.game-actions {
    display: flex;
    gap: 8px;
}

.game-btn {
    flex: 1;
    padding: 6px 12px;
    font-family: 'WizardOfWor', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.15s;
    outline: none;
}

.join-btn {
    background: #070;
    border-color: #090;
    color: #fff;
}

.join-btn:hover {
    background: #0a0;
    border-color: #0c0;
    box-shadow: 0 0 8px rgba(0, 170, 0, 0.5);
}

.spectate-btn {
    background: #224;
    border-color: #446;
    color: #aaf;
}

.spectate-btn:hover {
    background: #336;
    border-color: #66a;
    box-shadow: 0 0 8px rgba(102, 170, 255, 0.4);
}

/* Loading State */
.loading-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.3; }
}

.loading-card {
    opacity: 0.7;
    pointer-events: none;
}

/* Empty State */
.active-games-empty {
    text-align: center;
    padding: 32px 16px;
    color: #666;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.empty-text {
    font-size: 13px;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

/* ============================================================================
   MINI-MAP VIEW
   ============================================================================ */

.minimap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #1a1a1a;
    border-bottom: 2px solid #333;
}

.minimap-title {
    font-size: 14px;
    font-weight: bold;
    color: #8af;
    letter-spacing: 1px;
}

.minimap-count {
    font-size: 11px;
    color: #666;
}

.minimap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 16px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.minimap-dungeon {
    position: relative;
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.minimap-dungeon:hover {
    border-color: #66a;
    box-shadow: 0 0 12px rgba(102, 170, 255, 0.3);
    transform: translateY(-2px);
}

.minimap-dungeon.state-active {
    border-color: #0a0;
}

.minimap-dungeon.state-collapsing {
    border-color: #f60;
    animation: pulse-collapse 1.5s infinite;
}

.minimap-dungeon.state-empty {
    border-color: #444;
    opacity: 0.6;
}

@keyframes pulse-collapse {
    0%, 100% { border-color: #f60; }
    50% { border-color: #fa0; }
}

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

.dungeon-id {
    font-size: 16px;
    font-weight: bold;
    color: #8af;
}

.dungeon-state {
    font-size: 9px;
    padding: 2px 6px;
    background: #333;
    border-radius: 3px;
    letter-spacing: 0.5px;
    color: #888;
}

.state-active .dungeon-state {
    background: #050;
    color: #0f0;
}

.state-collapsing .dungeon-state {
    background: #520;
    color: #fa0;
}

.dungeon-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #aaa;
}

.stat-icon {
    font-size: 12px;
}

.stat-value {
    color: #fff;
}

.dungeon-players {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    padding: 6px 0;
    border-top: 1px solid #333;
}

.player-mini {
    font-size: 10px;
    padding: 2px 6px;
    background: #222;
    border: 1px solid #444;
    border-radius: 3px;
    color: #8af;
}

.dungeon-connections {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #333;
    font-size: 14px;
}

.conn-left, .conn-right {
    color: #66a;
    opacity: 0.7;
}

.minimap-spectate-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: #224;
    border: 1px solid #446;
    border-radius: 50%;
    color: #aaf;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    z-index: 10;
}

.minimap-spectate-btn:hover {
    background: #336;
    border-color: #66a;
    box-shadow: 0 0 8px rgba(102, 170, 255, 0.5);
}

.minimap-empty {
    text-align: center;
    padding: 48px 16px;
    color: #666;
}

.minimap-empty .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.minimap-empty .empty-text {
    font-size: 14px;
    letter-spacing: 1px;
}

.empty-hint {
    font-size: 10px;
    color: #555;
    letter-spacing: 0.5px;
}

/* Scrollbar styling */
.active-games-panel::-webkit-scrollbar {
    width: 6px;
}

.active-games-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.active-games-panel::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.active-games-panel::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Mobile: hide active games panel */
@media (max-width: 768px) {
    .active-games-panel {
        display: none;
    }
}
