/* Minimalist tech design system for Core Nex (matching 404adicted.com) */
:root {
    --bg-main: #0a0a0a;
    --text-primary: #ffffff;
    --text-muted: #888888;
    --accent: #aa44ff;
    --accent-cyan: #00ffff;
    --border: rgba(255, 255, 255, 0.08);
    --card-bg: rgba(255, 255, 255, 0.03);
    --modal-bg: rgba(15, 15, 20, 0.78);
    --modal-backdrop-bg: rgba(0, 0, 0, 0.78);
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

body.light-mode {
    --bg-main: #f5f5f7;
    --text-primary: #1d1d1f;
    --text-muted: #6e6e73;
    --accent: #7c3aed;
    --accent-cyan: #7c3aed;
    --border: rgba(0, 0, 0, 0.08);
    --card-bg: rgba(0, 0, 0, 0.03);
    --modal-bg: rgba(255, 255, 255, 0.75);
    --modal-backdrop-bg: rgba(245, 245, 247, 0.75);
}

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

body {
    overflow: hidden;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    touch-action: none;
    width: 100vw;
    height: 100vh;
}

/* Minimalist Center Crosshair */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 10px rgba(170, 68, 255, 0.8);
    pointer-events: none;
    z-index: 20;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

body.scoped #crosshair {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4);
}

body.light-mode #crosshair {
    background: #1d1d1f;
    box-shadow: 0 0 6px rgba(124, 58, 237, 0.4);
}

/* ─── DOOM Eternal Precision Bolt Scope Overlay ─── */
#precision-scope {
    position: fixed;
    inset: 0;
    z-index: 19;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: scale(1.12);
    transition: opacity 0.16s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

#precision-scope.active {
    opacity: 1;
    transform: scale(1);
}

.scope-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at center,
        transparent 24%,
        rgba(20, 6, 34, 0.38) 46%,
        rgba(6, 2, 12, 0.88) 76%,
        rgba(3, 1, 6, 0.97) 100%
    );
}

body.light-mode .scope-vignette {
    background: radial-gradient(
        circle at center,
        transparent 26%,
        rgba(124, 58, 237, 0.14) 50%,
        rgba(20, 16, 30, 0.72) 82%,
        rgba(10, 8, 16, 0.9) 100%
    );
}

.scope-svg {
    position: relative;
    width: min(68vmin, 420px);
    height: min(68vmin, 420px);
    filter: drop-shadow(0 0 12px rgba(170, 68, 255, 0.55));
}

#scope-charge-ring {
    transition: stroke 0.15s ease;
}

.scope-status {
    position: relative;
    margin-top: 14px;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 3px;
    color: #dd88ff;
    text-shadow: 0 0 10px rgba(170, 68, 255, 0.65);
    text-transform: uppercase;
}

/* Header & Hints */
#ui {
    position: absolute;
    top: 32px;
    left: 36px;
    z-index: 30;
    pointer-events: none;
}

.brand-tag {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-primary);
}

#weapon-indicator {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 10px;
    font-family: var(--font-heading);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 2px;
    color: #f4f0ff;
    background: rgba(170, 68, 255, 0.14);
    border: 1px solid rgba(221, 136, 255, 0.35);
    border-radius: 6px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    text-transform: uppercase;
}

body.light-mode #weapon-indicator {
    color: #1d1d1f;
    background: rgba(124, 58, 237, 0.1);
    border-color: rgba(124, 58, 237, 0.3);
}

#speedrun-telemetry {
    margin-top: 6px;
    font-family: var(--font-heading);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 2px;
    color: rgba(244, 240, 255, 0.65);
    font-variant-numeric: tabular-nums;
    text-transform: uppercase;
}

#run-timer {
    color: #f4f0ff;
}

#best-timer {
    color: #dd88ff;
}

#best-timer.pb-flash {
    color: #ffffff;
    text-shadow: 0 0 12px rgba(221, 136, 255, 0.95);
}

.telemetry-sep {
    margin: 0 6px;
    opacity: 0.45;
}

body.light-mode #speedrun-telemetry {
    color: #6e6e73;
}

body.light-mode #run-timer {
    color: #1d1d1f;
}

body.light-mode #best-timer {
    color: #7c3aed;
}

.desktop-hint {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 200;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-top: 6px;
}

/* Theme Toggle Button (Identical to Landing Page) */
.theme-toggle {
    position: absolute;
    top: 32px;
    right: 36px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 35;
    pointer-events: auto;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: border-color 0.3s, transform 0.3s;
}

.theme-toggle:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-primary);
    transition: stroke 0.3s;
}

.theme-toggle .sun-icon {
    display: none;
}

body.light-mode .theme-toggle .moon-icon {
    display: none;
}

body.light-mode .theme-toggle .sun-icon {
    display: block;
}

/* Minimalist HUD Bars */
#player-hud {
    position: absolute;
    bottom: 36px;
    left: 36px;
    z-index: 15;
    width: 240px;
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
}

.hud-label, #boss-name {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 2.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

#boss-hud {
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    width: 460px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
}

.hud-visible {
    opacity: 1 !important;
}

.health-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

body.light-mode .health-bar-container {
    background: rgba(0, 0, 0, 0.06);
}

.boss-bg {
    width: 100%;
    margin: 0 auto;
}

.health-bar-fill {
    height: 100%;
    width: 100%;
    border-radius: 999px;
    transition: width 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.player-fill {
    background: linear-gradient(90deg, #aa44ff, #e8e8f8);
}

.boss-fill {
    background: linear-gradient(90deg, #7c3aed, #dd88ff);
}

/* ─── Mobile Landscape Prompt (Landing Page Glassmorphism Style) ─── */
#rotate-device-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--modal-backdrop-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.rotate-card {
    position: relative;
    width: 100%;
    max-width: 340px;
    background: var(--modal-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 28px;
    text-align: left;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.rotate-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 22px;
}

.rotate-svg {
    width: 22px;
    height: 22px;
    stroke: var(--text-primary);
    animation: smoothRotate 2.8s infinite cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes smoothRotate {
    0%, 15% { transform: rotate(0deg); }
    45%, 70% { transform: rotate(-90deg); }
    100% { transform: rotate(0deg); }
}

.card-category {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.68rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.rotate-card h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 10px;
    background: linear-gradient(90deg, var(--text-primary), var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.rotate-card p {
    font-family: var(--font-body);
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--text-muted);
    font-weight: 200;
    margin-bottom: 26px;
}

.card-action-btn {
    width: 100%;
    padding: 13px 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.card-action-btn:hover, .card-action-btn:active {
    background: rgba(170, 68, 255, 0.12);
    border-color: rgba(170, 68, 255, 0.4);
}

/* ─── Minimalist Glassmorphism Mobile Controls (Free Fire Ergonomics) ─── */
#mobile-controls {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 25;
    pointer-events: none;
}

#joystick-zone {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 45%;
    height: 75%;
    pointer-events: auto;
    touch-action: none;
}

#joystick-base {
    position: absolute;
    left: 38px;
    bottom: 24px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(18, 14, 24, 0.55) 0%, rgba(8, 6, 12, 0.8) 100%);
    border: 1.5px solid rgba(244, 240, 255, 0.28);
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.65), inset 0 0 18px rgba(244, 240, 255, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
}

#joystick-base::after {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 1px solid rgba(244, 240, 255, 0.12);
    pointer-events: none;
}

#joystick-stick {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(244, 240, 255, 0.95) 0%, rgba(200, 190, 225, 0.75) 100%);
    border: 1.5px solid #ffffff;
    box-shadow: 0 0 16px rgba(244, 240, 255, 0.55);
    transform: translate(0px, 0px);
    pointer-events: none;
}

body.light-mode #joystick-base {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(29, 29, 31, 0.25);
}

body.light-mode #joystick-stick {
    background: #1d1d1f;
    border-color: #1d1d1f;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

#look-zone {
    position: absolute;
    right: 0;
    top: 0;
    width: 55%;
    height: 100%;
    pointer-events: auto;
    touch-action: none;
    z-index: 1;
}

/* 4-Finger Claw Grip Clusters:
   - Top-Left (#left-claw-buttons): Scope/Tether + Jump (Left Index Finger)
   - Top-Right (#action-buttons): Fire + Dash + Swap (Right Index Finger) */
#left-claw-buttons {
    position: absolute;
    left: 18px;
    top: 12px;
    width: 170px;
    height: 110px;
    pointer-events: none;
    z-index: 3;
}

#action-buttons {
    position: absolute;
    right: 18px;
    top: 12px;
    bottom: auto;
    width: 195px;
    height: 145px;
    pointer-events: none;
    z-index: 3;
}

/* Hollow Knight / Silksong Soul Crest Medallion Buttons */
.ff-btn {
    position: absolute;
    border-radius: 50%;
    border: 1.5px solid rgba(244, 240, 255, 0.42);
    background: radial-gradient(circle, rgba(22, 16, 30, 0.72) 0%, rgba(8, 6, 12, 0.9) 100%);
    color: #f4f0ff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    pointer-events: auto;
    touch-action: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7), 0 0 15px rgba(244, 240, 255, 0.08), inset 0 0 14px rgba(244, 240, 255, 0.06);
    transition: transform 0.12s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Inner filigree ring + cardinal diamond notches like Hollow Knight Soul Meter */
.ff-btn .hk-ring {
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    border: 1px solid rgba(244, 240, 255, 0.18);
    pointer-events: none;
}

.ff-btn .hk-ring::before,
.ff-btn .hk-ring::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(244, 240, 255, 0.55);
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}

.ff-btn .hk-ring::before { top: -2.5px; }
.ff-btn .hk-ring::after  { bottom: -2.5px; }

.ff-btn .hk-glyph {
    width: 60%;
    height: 60%;
    color: #f4f0ff;
    filter: drop-shadow(0 0 6px rgba(244, 240, 255, 0.45));
    transition: transform 0.12s ease, filter 0.12s ease;
}

.ff-btn:active, .ff-btn.pressed {
    transform: scale(0.9);
    border-color: #ffffff;
    box-shadow: 0 0 26px rgba(244, 240, 255, 0.45), inset 0 0 18px rgba(244, 240, 255, 0.22);
}

.ff-btn:active .hk-glyph, .ff-btn.pressed .hk-glyph {
    transform: scale(1.08);
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.9));
}

body.light-mode .ff-btn {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.85) 0%, rgba(235, 235, 242, 0.95) 100%);
    border-color: rgba(29, 29, 31, 0.4);
    color: #1d1d1f;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

body.light-mode .ff-btn .hk-ring {
    border-color: rgba(29, 29, 31, 0.18);
}

body.light-mode .ff-btn .hk-glyph {
    color: #1d1d1f;
    filter: none;
}

/* ─── TOP-LEFT CLAW (Left Index Finger): Secondary Mod + Jump ─── */
.ff-btn-scope {
    width: 68px;
    height: 68px;
    left: 4px;
    top: 4px;
    border-width: 2px;
    border-color: rgba(244, 240, 255, 0.6);
}

.ff-btn-scope.scope-active {
    border-color: #dd88ff;
    box-shadow: 0 0 24px rgba(221, 136, 255, 0.65), inset 0 0 16px rgba(170, 68, 255, 0.35);
}

.ff-btn-jump {
    width: 58px;
    height: 58px;
    left: 88px;
    top: 18px;
}

/* ─── TOP-RIGHT CLAW (Right Index Finger): Primary Fire + Dash + Swap ─── */
.ff-btn-attack {
    width: 78px;
    height: 78px;
    right: 4px;
    top: 4px;
    border-width: 2px;
    border-color: rgba(244, 240, 255, 0.65);
}

.ff-btn-attack .hk-glyph {
    width: 64%;
    height: 64%;
}

.ff-btn-dash {
    width: 58px;
    height: 58px;
    right: 98px;
    top: 8px;
}

.ff-btn-switch {
    width: 48px;
    height: 48px;
    right: 84px;
    top: 78px;
}

body.is-touch #mobile-controls {
    display: block;
}

body.is-touch .desktop-hint {
    display: none;
}

body.is-touch #ui {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: max-content;
}

body.is-touch #player-hud {
    top: auto;
    left: auto;
    bottom: 22px;
    right: 24px;
    transform: none;
    width: 155px;
    text-align: right;
}

body.is-touch #boss-hud {
    top: 56px;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
}

body.is-touch .theme-toggle {
    top: 10px;
    left: calc(50% + 120px);
    right: auto;
    width: 32px;
    height: 32px;
}

@media (max-width: 950px) and (orientation: portrait) {
    #rotate-device-overlay {
        display: flex;
    }
}

@media (max-width: 950px) {
    #mobile-controls {
        display: block;
    }
    .desktop-hint {
        display: none;
    }
    #ui {
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        text-align: center;
        width: max-content;
    }
    .brand-tag {
        font-size: 0.88rem;
    }
    #weapon-indicator {
        font-size: 0.6rem;
        padding: 3px 8px;
        margin-top: 4px;
    }
    #speedrun-telemetry {
        font-size: 0.56rem;
        margin-top: 3px;
        letter-spacing: 1.5px;
    }
    .theme-toggle {
        top: 10px;
        left: calc(50% + 120px);
        right: auto;
        width: 32px;
        height: 32px;
    }
    #player-hud {
        top: auto;
        left: auto;
        bottom: 22px;
        right: 24px;
        transform: none;
        width: 155px;
        text-align: right;
    }
    .hud-label {
        font-size: 0.54rem;
        margin-bottom: 4px;
    }
    #boss-hud {
        top: 68px;
        bottom: auto;
        left: 50%;
        transform: translateX(-50%);
        width: 220px;
    }
    #boss-name {
        font-size: 0.56rem;
        margin-bottom: 4px;
    }
}
