/**
 * Neon Claim - Territory Capture Arcade Styles
 *
 * @file        styles.css
 * @author      Mike Fairbrother <mike@fairbrother.me>
 * @copyright   2024-2026 Mike Fairbrother. All rights reserved.
 * @license     PROPRIETARY - No rights to copy, modify, distribute, or reuse
 *              any part of this code without explicit written permission from the author.
 */

:root {
    --bg-dark: #0a0818;
    --bg-mid: #12102a;
    --text-primary: #fff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --accent: #00e5ff;
    --accent-glow: rgba(0, 229, 255, 0.4);
    --accent-dim: rgba(0, 229, 255, 0.15);
    --danger: #ff4757;
    --danger-glow: rgba(255, 71, 87, 0.5);
    --success: #2ed573;
    --neon-cyan: #00e5ff;
    --neon-green: #39ff14;
    --neon-pink: #ff2d95;
    --neon-orange: #ff9f43;
    --neon-purple: #a855f7;
    --player-color: #00e5ff;
    --fire-a: #ff6b6b;
    --fire-b: #ff9f43;
    --transition-fast: 150ms;
    --transition-normal: 300ms;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

/* ---- App container ---- */
#app {
    position: relative;
    width: 100%;
    max-width: 420px;
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    overflow: hidden;
    background: linear-gradient(170deg, #12102a 0%, #0a0818 40%, #140f30 100%);
}

/* ---- Screen system ---- */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1;
}
.screen.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
}

/* ---- Menu Screen ---- */
.screen-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
}

.back-to-games-inline {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
    padding: 8px 14px;
    border-radius: 10px;
    transition: color var(--transition-fast), background var(--transition-fast);
}
.back-to-games-inline:active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.game-logo {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.logo-emoji {
    font-size: 40px;
    animation: logo-float 3s ease-in-out infinite;
}
.logo-emoji:nth-child(2) { animation-delay: -1s; }
.logo-emoji:nth-child(3) { animation-delay: -2s; }
.logo-pulse {
    animation: logo-pulse 2s ease-in-out infinite !important;
}
@keyframes logo-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@keyframes logo-pulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 6px var(--accent-glow)); }
    50% { transform: scale(1.15); filter: drop-shadow(0 0 14px var(--accent)); }
}

.game-title {
    font-size: 48px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #00e5ff, #39ff14);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 12px var(--accent-glow));
}

.game-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 16px;
    font-weight: 500;
}

.menu-best {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-weight: 600;
}
.menu-best span {
    color: var(--accent);
    font-weight: 800;
}

/* ---- Buttons ---- */
.btn {
    display: block;
    width: 220px;
    padding: 16px 32px;
    border: none;
    border-radius: 16px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    letter-spacing: 0.5px;
    font-family: inherit;
    text-decoration: none;
    text-align: center;
    color: inherit;
}
.btn:active { transform: scale(0.95); }

.btn-primary {
    background: linear-gradient(135deg, #00e5ff, #39ff14);
    color: #0a0818;
    box-shadow: 0 4px 24px rgba(0, 229, 255, 0.3);
}
.btn-primary:active { box-shadow: 0 2px 12px rgba(0, 229, 255, 0.2); }

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    margin-top: 12px;
    font-size: 16px;
    padding: 12px 32px;
}

.btn-small {
    width: 160px;
    font-size: 14px;
    padding: 10px 20px;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
    flex-shrink: 0;
}
.icon-btn:active { background: rgba(255, 255, 255, 0.15); }

.settings-row {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* ---- Game Header / HUD ---- */
#game-header {
    display: flex;
    align-items: center;
    padding: 10px 12px 6px;
    gap: 8px;
    min-height: 52px;
    z-index: 20;
    position: relative;
}

.stat {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.stat-right { align-items: flex-end; }
.stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}
.stat-value {
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.header-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#territory-bar-wrap {
    position: relative;
    width: 100%;
    max-width: 140px;
    height: 18px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 9px;
    overflow: hidden;
}
#territory-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00e5ff, #39ff14);
    border-radius: 9px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}
#territory-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* ---- Game Canvas ---- */
#game-canvas {
    display: block;
    flex: 1;
    width: 100%;
    image-rendering: pixelated;
}

/* ---- Touch Zone (invisible overlay for swipe detection) ---- */
#touch-zone {
    position: absolute;
    inset: 52px 0 0 0;
    z-index: 15;
}

/* ---- Overlays ---- */
.overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: rgba(6, 4, 18, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px;
}
.overlay-title {
    font-size: 32px;
    font-weight: 900;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #00e5ff, #39ff14);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.overlay-stat-row {
    display: flex;
    gap: 32px;
    margin-bottom: 12px;
}
.overlay-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.overlay-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}
.overlay-stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
}

.level-bonus {
    font-size: 14px;
    color: var(--neon-green);
    font-weight: 700;
    margin-bottom: 8px;
    min-height: 20px;
}

.best-badge {
    background: linear-gradient(135deg, #ffd93d, #ff9f43);
    color: #1a1640;
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 8px;
    animation: badge-pop 0.4s ease-out;
}
.hidden { display: none !important; }

@keyframes badge-pop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.go-best-row {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 600;
}
.go-best-row span {
    color: var(--accent);
    font-weight: 800;
}

/* ---- Help Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 20px;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    background: linear-gradient(170deg, #1a1545, #0e0b24);
    border: 1px solid rgba(0, 229, 255, 0.12);
    border-radius: 20px;
    padding: 28px 24px;
    max-width: 360px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.25s ease;
}
.modal-overlay.active .modal-content {
    transform: scale(1);
}
.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--accent);
}

.help-items {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
}
.help-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-align: left;
}
.help-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}
.help-item div {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}
.help-item strong {
    color: var(--text-primary);
}
.help-controls {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* ---- Footer ---- */
.game-footer {
    margin-top: 24px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.25);
    letter-spacing: 0.5px;
    font-weight: 500;
}
.game-footer a {
    color: inherit;
    text-decoration: none;
}

/* ---- Desktop frame ---- */
@media (min-width: 421px) {
    body {
        display: flex;
        align-items: center;
        justify-content: center;
        background: #050410;
    }
    #app {
        border-radius: 24px;
        box-shadow: 0 0 80px rgba(0, 229, 255, 0.08);
        border: 1px solid rgba(0, 229, 255, 0.06);
        max-height: 900px;
    }
}

/* ---- Safe area ---- */
@supports (padding-top: env(safe-area-inset-top)) {
    #game-header {
        padding-top: calc(10px + env(safe-area-inset-top));
    }
}
