:root {
    --primary: #ff007f;
    --primary-glow: rgba(255, 0, 127, 0.45);
    --secondary: #00f5d4;
    --accent: #ffd166;
    --bg-dark: #0f172a;
    --text-light: #ffffff;

    /* Scalable HUD Design Tokens */
    --hud-user-scale: 1.0;
    --hud-auto-scale: 1.0;
    --hud-scale: calc(var(--hud-user-scale) * var(--hud-auto-scale));
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    font-family: 'Fredoka', 'Outfit', sans-serif;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #240046;
    color: #ffffff;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* UI Layer */
#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    overflow: visible;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Top HUD */
#top-hud {
    font-size: calc(15px * var(--hud-scale));
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(14px * var(--hud-scale)) calc(20px * var(--hud-scale));
    pointer-events: auto;
    position: relative;
    gap: calc(12px * var(--hud-scale));
    width: 100%;
    transform-origin: top center;
    transform: scale(var(--hud-user-scale, 1));
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), font-size 0.2s ease, padding 0.2s ease;
}

.hud-left {
    display: flex;
    gap: 0.6em;
    align-items: center;
    flex-shrink: 0;
}

.hud-right {
    display: flex;
    gap: 0.5em;
    align-items: center;
    flex-shrink: 0;
}

.hud-pill {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(12px);
    border: 0.12em solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 0.45em 1.05em;
    display: flex;
    align-items: center;
    gap: 0.7em;
    box-shadow: 0 0.5em 2em rgba(0, 0, 0, 0.35);
    color: #fff;
    transition: all 0.2s ease;
}

.level-badge-pill {
    cursor: default;
    user-select: none;
    font-weight: 800;
    font-size: 0.95em;
    background: linear-gradient(135deg, rgba(255, 0, 127, 0.25), rgba(157, 78, 221, 0.25));
    border-color: rgba(255, 0, 127, 0.4);
    letter-spacing: 0.5px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.35em;
    font-size: 1.05em;
    font-weight: 700;
}

.stat-icon {
    font-size: 1.25em;
    filter: drop-shadow(0 0.1em 0.25em rgba(0, 0, 0, 0.4));
}

#rings-val {
    color: #ffd166;
}

#gems-val {
    color: #00f5d4;
}

#score-val {
    color: #ff70a6;
    letter-spacing: 0.5px;
}

/* Hearts */
#lives-container {
    display: flex;
    gap: 0.3em;
    font-size: 1.25em;
}

.heart {
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.25s;
    filter: drop-shadow(0 0 0.4em rgba(255, 0, 85, 0.6));
}

.heart.lost {
    filter: grayscale(1) opacity(0.35);
    transform: scale(0.8);
}

/* Level Progress Bar */
#progress-hud {
    flex: 1;
    max-width: 22em;
    min-width: 9em;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(10px);
    border: 0.12em solid rgba(255, 255, 255, 0.2);
    border-radius: 1.3em;
    padding: 0.35em 0.85em;
    display: flex;
    align-items: center;
    gap: 0.6em;
    pointer-events: auto;
}

.progress-track {
    position: relative;
    flex: 1;
    height: 0.65em;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 0.4em;
    overflow: visible;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff007f, #ffd166);
    border-radius: 0.4em;
    transition: width 0.1s linear;
}

.progress-pin {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    font-size: 1.15em;
    transition: left 0.1s linear;
    filter: drop-shadow(0 0.15em 0.3em rgba(0, 0, 0, 0.5));
}

.progress-goal {
    font-size: 1.2em;
}

/* Action Buttons */
.btn-icon {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(10px);
    border: 0.12em solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 2.6em;
    height: 2.6em;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: auto;
}

.btn-icon:hover {
    transform: scale(1.1);
    background: rgba(255, 0, 127, 0.4);
    border-color: #ff007f;
}

/* HUD Scale Dropdown Popup */
.hud-scale-dropdown {
    position: fixed;
    top: clamp(65px, 12vh, 90px);
    right: max(14px, env(safe-area-inset-right));
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid rgba(0, 245, 212, 0.4);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 25px rgba(0, 245, 212, 0.25);
    z-index: 99999;
    pointer-events: auto;
    min-width: 250px;
    max-width: 295px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    color: #fff;
    transition: opacity 0.2s, transform 0.2s;
}

.hud-scale-dropdown.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
}

.hud-menu-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hud-menu-section:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.scale-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.92rem;
    font-weight: 700;
}

#hud-scale-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    cursor: pointer;
    accent-color: #00f5d4;
}

.scale-presets {
    display: flex;
    gap: 6px;
    justify-content: space-between;
}

.scale-presets {
    display: flex;
    gap: 6px;
    justify-content: space-between;
}

.scale-preset-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
    padding: 7px 4px !important;
    color: #ffffff !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    text-align: center !important;
    outline: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    box-shadow: none !important;
}

.scale-preset-btn:hover {
    background: rgba(255, 0, 127, 0.35) !important;
    border-color: #ff007f !important;
    color: #ffffff !important;
}

.scale-preset-btn.active {
    background: linear-gradient(90deg, #ff007f, #9d4edd) !important;
    border-color: #00f5d4 !important;
    color: #ffd166 !important;
    box-shadow: 0 0 10px rgba(0, 245, 212, 0.35) !important;
}

/* Controls Hint Banner (Bottom Center) */
#controls-hint {
    align-self: center;
    margin-bottom: 24px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(12px);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 30px;
    padding: 8px 24px;
    display: flex;
    gap: 20px;
    color: #fff;
    font-size: 0.95rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    transition: opacity 0.5s;
}

.hint-chip {
    display: flex;
    align-items: center;
    gap: 6px;
}

.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    background: rgba(15, 23, 42, 0.9);
    border: 1.5px solid rgba(255, 209, 102, 0.6);
    border-bottom: 3px solid rgba(255, 209, 102, 0.95);
    border-radius: 7px;
    padding: 1px 7px;
    font-size: 0.88rem;
    font-weight: 800;
    color: #ffd166;
    line-height: 1;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 0 8px rgba(255, 209, 102, 0.4);
}

/* Mobile On-Screen Touch Controls */
:root {
    --touch-btn-size: 94px;
    --touch-btn-opacity: 0.35;
    --touch-btn-border-opacity: 0.45;
    --touch-btn-blur: 14px;
}

#touch-controls {
    display: none;
    position: fixed;
    bottom: max(22px, calc(16px + env(safe-area-inset-bottom)));
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    width: auto;
    align-items: flex-end;
    justify-content: space-between;
    pointer-events: none;
    z-index: 100;
}

#touch-controls.force-show {
    display: flex !important;
}

#touch-controls.force-hide {
    display: none !important;
}

.touch-left-zone {
    pointer-events: auto;
    display: flex;
    align-items: flex-end;
}

.touch-cluster {
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.touch-cluster.hidden {
    display: none !important;
}

.touch-cluster-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: auto;
}

.touch-btn-row {
    display: flex;
    gap: 10px;
}

/* Touch Button Base: Glassmorphic, Transparent, Bigger */
.touch-btn {
    position: relative;
    overflow: hidden;
    width: var(--touch-btn-size, 94px);
    height: var(--touch-btn-size, 94px);
    border-radius: 50%;
    background: rgba(15, 23, 42, var(--touch-btn-opacity, 0.35));
    backdrop-filter: blur(var(--touch-btn-blur, 14px));
    -webkit-backdrop-filter: blur(var(--touch-btn-blur, 14px));
    border: 2px solid rgba(255, 255, 255, var(--touch-btn-border-opacity, 0.45));
    color: rgba(255, 255, 255, var(--touch-btn-content-opacity, 0.95));
    font-size: calc(var(--touch-btn-size, 94px) * 0.42);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, calc(var(--touch-btn-opacity, 0.35) * 0.9)), inset 0 1px 2px rgba(255, 255, 255, calc(var(--touch-btn-border-opacity, 0.45) * 0.7));
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, color 0.12s ease, opacity 0.15s ease, filter 0.15s ease;
    cursor: pointer;
}

.touch-btn:active, .touch-btn.touch-pressed {
    transform: scale(0.91);
    background: rgba(255, 0, 127, 0.6) !important;
    border-color: #00f5d4 !important;
    color: #fff !important;
    box-shadow: 0 0 25px rgba(0, 245, 212, 0.6), inset 0 0 12px rgba(255, 0, 127, 0.5) !important;
}

/* Button Tint Accents */
.btn-jump {
    background: rgba(0, 245, 212, calc(var(--touch-btn-opacity, 0.35) * 0.95));
    border-color: rgba(0, 245, 212, var(--touch-btn-border-opacity, 0.45));
    box-shadow: 0 8px 25px rgba(0, 0, 0, calc(var(--touch-btn-opacity, 0.35) * 0.8)), 0 0 16px rgba(0, 245, 212, calc(var(--touch-btn-opacity, 0.35) * 0.7));
}

.btn-stomp {
    background: rgba(255, 0, 127, calc(var(--touch-btn-opacity, 0.35) * 0.95));
    border-color: rgba(255, 0, 127, var(--touch-btn-border-opacity, 0.45));
    box-shadow: 0 8px 25px rgba(0, 0, 0, calc(var(--touch-btn-opacity, 0.35) * 0.8)), 0 0 16px rgba(255, 0, 127, calc(var(--touch-btn-opacity, 0.35) * 0.7));
}

.btn-kick {
    background: rgba(255, 209, 102, calc(var(--touch-btn-opacity, 0.35) * 0.95));
    border-color: rgba(255, 209, 102, var(--touch-btn-border-opacity, 0.45));
    box-shadow: 0 8px 25px rgba(0, 0, 0, calc(var(--touch-btn-opacity, 0.35) * 0.8)), 0 0 16px rgba(255, 209, 102, calc(var(--touch-btn-opacity, 0.35) * 0.7));
}

/* Disabled & Cooldown Freeze State for Mobile Buttons */
.touch-btn.cooldown,
.touch-btn.disabled,
.touch-btn[aria-disabled="true"] {
    opacity: 0.28 !important;
    filter: grayscale(85%) brightness(0.65) !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
    transform: scale(0.92) !important;
    box-shadow: none !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

.cooldown-countdown {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--touch-btn-size, 94px) * 0.30);
    font-weight: 800;
    font-family: 'Fredoka', 'Outfit', sans-serif;
    color: #ffd166;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95), 0 0 10px rgba(255, 209, 102, 0.85);
    background: rgba(15, 23, 42, 0.75);
    border-radius: 50%;
    z-index: 5;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    letter-spacing: -0.5px;
}

/* Virtual Joystick */
.touch-joystick-wrap {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.touch-joystick-wrap.hidden {
    display: none !important;
}

.joystick-base {
    width: calc(var(--touch-btn-size, 94px) * 1.6);
    height: calc(var(--touch-btn-size, 94px) * 1.6);
    min-width: 105px;
    min-height: 105px;
    border-radius: 50%;
    background: rgba(15, 23, 42, var(--touch-btn-opacity, 0.35));
    backdrop-filter: blur(var(--touch-btn-blur, 14px));
    -webkit-backdrop-filter: blur(var(--touch-btn-blur, 14px));
    border: 2px solid rgba(0, 245, 212, var(--touch-btn-border-opacity, 0.45));
    box-shadow: 0 10px 30px rgba(0, 0, 0, calc(var(--touch-btn-opacity, 0.35) * 0.9)), 0 0 20px rgba(0, 245, 212, calc(var(--touch-btn-opacity, 0.35) * 0.7)), inset 0 2px 4px rgba(255, 255, 255, calc(var(--touch-btn-border-opacity, 0.45) * 0.5));
    position: relative;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
}

.joystick-base:active {
    cursor: grabbing;
}

.joystick-track-hint {
    position: absolute;
    width: 76%;
    display: flex;
    justify-content: space-between;
    color: rgba(255, 255, 255, var(--touch-btn-content-opacity, 0.45));
    font-size: 1.1rem;
    font-weight: 800;
    pointer-events: none;
}

.joystick-thumb {
    width: calc(var(--touch-btn-size, 94px) * 0.72);
    height: calc(var(--touch-btn-size, 94px) * 0.72);
    min-width: 46px;
    min-height: 46px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(0, 245, 212, calc(var(--touch-btn-opacity, 0.35) * 1.8 + 0.15)), rgba(121, 40, 202, calc(var(--touch-btn-opacity, 0.35) * 1.8 + 0.15)));
    border: 2px solid rgba(255, 255, 255, var(--touch-btn-border-opacity, 0.7));
    box-shadow: 0 4px 18px rgba(0, 245, 212, calc(var(--touch-btn-opacity, 0.35) * 1.2)), inset 0 2px 4px rgba(255, 255, 255, calc(var(--touch-btn-border-opacity, 0.7) * 0.6));
    position: absolute;
    pointer-events: none;
    transform: translate(0px, 0px);
    transition: transform 0.05s ease-out;
}

/* Wide Pad Style Variant */
#touch-controls.controls-style-wide .touch-cluster {
    gap: 16px;
}

#touch-controls.controls-style-wide .touch-btn-row {
    gap: 14px;
}

#touch-controls.controls-style-wide .touch-cluster-right {
    gap: 14px;
    align-items: center;
}

#touch-controls.controls-style-wide .btn-jump {
    transform: translateY(-6px);
}

@media (pointer: coarse), (max-width: 960px) {
    #touch-controls {
        display: flex;
    }
    #controls-hint {
        display: none;
    }
}

/* Overlays / Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 15, 30, 0.85);
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 2.5vh, 24px) 16px;
    box-sizing: border-box;
    overflow-y: auto;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    display: none;
    pointer-events: none;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.modal-overlay:not(.active) * {
    pointer-events: none !important;
}

#victory-modal {
    justify-content: center;
    padding: clamp(12px, 2.5vh, 24px) 16px;
    background: rgba(10, 15, 30, 0.85);
    backdrop-filter: blur(12px);
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 28px;
    padding: clamp(18px, 3vh, 30px) clamp(16px, 4vw, 32px);
    text-align: center;
    color: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px var(--primary-glow);
    max-width: 440px;
    width: min(92%, 440px);
    max-height: calc(100vh - clamp(20px, 4vh, 40px));
    overflow-y: auto;
    box-sizing: border-box;
    margin: auto;
    transform: scale(0.9);
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-title {
    font-size: clamp(1.4rem, 4vw, 1.95rem);
    font-weight: 800;
    margin-bottom: clamp(6px, 1.2vh, 10px);
    line-height: 1.15;
    background: linear-gradient(45deg, #ffd166, #ff70a6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px rgba(255, 0, 127, 0.4));
}

.modal-subtitle {
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    line-height: 1.35;
    color: #cbd5e1;
    margin-bottom: clamp(10px, 1.8vh, 18px);
}

.stars-rating {
    font-size: clamp(1.8rem, 4.5vh, 2.3rem);
    margin-bottom: clamp(10px, 1.8vh, 16px);
    filter: drop-shadow(0 0 10px rgba(255, 209, 102, 0.6));
}

.tally-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(6px, 1.2vh, 10px);
    margin-bottom: clamp(12px, 2vh, 20px);
}

.tally-box {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: clamp(6px, 1.2vh, 10px) 8px;
}

.tally-label {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-bottom: 2px;
}

.tally-value {
    font-size: clamp(1.15rem, 3.2vw, 1.35rem);
    font-weight: 800;
}

.btn-primary {
    background: linear-gradient(90deg, #ff007f, #ff5400);
    border: none;
    border-radius: 999px;
    color: #fff;
    font-size: clamp(1.05rem, 3.2vw, 1.2rem);
    font-weight: 800;
    padding: clamp(11px, 1.6vh, 14px) 24px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(255, 0, 127, 0.5);
    transition: transform 0.15s, box-shadow 0.15s;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 12px 32px rgba(255, 0, 127, 0.7);
}

.btn-primary:active {
    transform: translateY(1px) scale(0.98);
}

/* Level Badge Pill & Dropdown */
/* ========================================================
   START MENU SCREEN
   ======================================================== */
/* Hide HUD and touch controls completely before the game starts */
body.start-screen-active #top-hud,
body.start-screen-active #touch-controls {
    display: none !important;
}

.start-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1b0a33 0%, #080214 100%);
    backdrop-filter: blur(20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s ease;
    padding: 16px;
}

.start-menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.start-menu-backdrop {
    position: absolute;
    inset: 0;
    background-image: url('../assets/gary_menu_adventure.jpg?v=4.1');
    background-size: cover;
    background-position: center 40%;
    opacity: 0.38;
    filter: blur(10px) brightness(0.65) saturate(1.3);
    transform: scale(1.08);
    pointer-events: none;
    z-index: 0;
}

.start-menu-card {
    position: relative;
    z-index: 1;
    background: rgba(15, 23, 42, 0.92);
    border: 2px solid rgba(255, 255, 255, 0.22);
    border-radius: 28px;
    padding: 20px 24px;
    max-width: 490px;
    width: 92%;
    text-align: center;
    color: #ffffff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 50px rgba(255, 0, 127, 0.4);
    animation: startCardFloat 4s ease-in-out infinite alternate;
}

@keyframes startCardFloat {
    0% { transform: translateY(0); }
    100% { transform: translateY(-6px); }
}

.menu-hero-art-container {
    position: relative;
    width: 100%;
    height: 195px;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 0, 127, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.menu-hero-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 36%;
    display: block;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.start-menu-card:hover .menu-hero-art {
    transform: scale(1.05);
}

.menu-hero-art-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(15, 23, 42, 0.6) 100%);
    pointer-events: none;
}

.menu-hero-art-badge {
    position: absolute;
    bottom: 10px;
    right: 12px;
    background: rgba(10, 14, 26, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 209, 102, 0.7);
    color: #ffd166;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 2px;
    padding: 4px 12px;
    border-radius: 999px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.sparkle-1 {
    position: absolute;
    top: -6px;
    right: -12px;
    font-size: 1.6rem;
    animation: spinSparkle 3s linear infinite;
}

.sparkle-2 {
    position: absolute;
    bottom: -2px;
    left: -12px;
    font-size: 1.4rem;
    animation: spinSparkle 2.4s linear infinite reverse;
}

@keyframes spinSparkle {
    0% { transform: rotate(0deg) scale(0.9); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(0.9); }
}

.game-logo-title {
    font-size: clamp(2rem, 5vw, 2.7rem);
    font-weight: 900;
    letter-spacing: -0.5px;
    margin: 0;
    line-height: 1.05;
    background: linear-gradient(45deg, #ffd166 0%, #ff007f 50%, #00f5d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 16px rgba(255, 0, 127, 0.5));
}

.game-logo-tag {
    display: inline-block;
    margin-top: 4px;
    background: linear-gradient(90deg, #ff007f, #7209b7);
    color: #ffd166;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 4px;
    padding: 3px 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 209, 102, 0.5);
    box-shadow: 0 0 16px rgba(255, 0, 127, 0.4);
}

.start-menu-tagline {
    color: #cbd5e1;
    font-size: 1.05rem;
    margin-top: 10px;
    font-weight: 600;
}

.start-action-container {
    margin: 18px 0 16px 0;
}

.btn-start-hero {
    background: linear-gradient(90deg, #ff007f, #ff5400, #ffd166);
    background-size: 200% auto;
    border: none;
    border-radius: 999px;
    color: #fff;
    font-family: inherit;
    font-size: clamp(1.2rem, 3.5vw, 1.45rem);
    font-weight: 900;
    padding: 16px 48px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(255, 0, 127, 0.6), 0 0 25px rgba(255, 84, 0, 0.4);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    letter-spacing: 1px;
    animation: pulseStartBtn 2.2s infinite;
}

@keyframes pulseStartBtn {
    0% { transform: scale(1); box-shadow: 0 8px 25px rgba(255, 0, 127, 0.5); }
    50% { transform: scale(1.04); box-shadow: 0 14px 40px rgba(255, 0, 127, 0.8), 0 0 35px rgba(0, 245, 212, 0.5); }
    100% { transform: scale(1); box-shadow: 0 8px 25px rgba(255, 0, 127, 0.5); }
}

.btn-start-hero:hover {
    transform: translateY(-3px) scale(1.06);
    background-position: right center;
    box-shadow: 0 16px 45px rgba(255, 0, 127, 0.85);
}

.btn-start-hero:active {
    transform: translateY(1px) scale(0.98);
}

.btn-icon-play {
    font-size: 1.2rem;
}

.how-to-play-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 14px 0 6px 0;
}

/* Start Menu Controls Display Modes */
.controls-desktop {
    display: grid;
}

.controls-mobile {
    display: none;
}

@media (pointer: coarse), (max-width: 920px) {
    .controls-desktop {
        display: none;
    }
    .controls-mobile {
        display: grid;
    }
}

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

body.is-touch-device .controls-mobile {
    display: grid;
}

/* Touch Icon Chips for Mobile Controls Card */
.touch-icon-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 30px;
    padding: 1px 8px;
    border-radius: 9px;
    background: rgba(15, 23, 42, 0.9);
    border: 1.5px solid rgba(0, 245, 212, 0.65);
    border-bottom: 3px solid rgba(0, 245, 212, 0.95);
    color: #00f5d4;
    font-size: 1.05rem;
    font-weight: 800;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 245, 212, 0.35);
    vertical-align: middle;
}

.touch-icon-chip.touch-jump {
    border-color: rgba(0, 245, 212, 0.65);
    border-bottom-color: rgba(0, 245, 212, 0.95);
    color: #00f5d4;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 245, 212, 0.45);
}

.touch-icon-chip.touch-stomp {
    border-color: rgba(255, 0, 127, 0.65);
    border-bottom-color: rgba(255, 0, 127, 0.95);
    color: #ff007f;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5), 0 0 12px rgba(255, 0, 127, 0.45);
}

.touch-icon-chip.touch-kick {
    border-color: rgba(255, 209, 102, 0.65);
    border-bottom-color: rgba(255, 209, 102, 0.95);
    color: #ffd166;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5), 0 0 12px rgba(255, 209, 102, 0.45);
}

.card-hint {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    padding: 10px 14px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #ffffff;
}

.hint-icons {
    font-size: 0.95rem;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.hint-sep {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0 1px;
}

.hint-badge-air {
    background: rgba(255, 0, 127, 0.25);
    border: 1px solid rgba(255, 0, 127, 0.6);
    color: #ff70a6;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.6px;
    padding: 1px 7px;
    border-radius: 999px;
    text-transform: uppercase;
    margin-left: 2px;
}

.hint-desc {
    font-size: 0.88rem;
    font-weight: 700;
    color: #00f5d4;
    letter-spacing: 0.2px;
}

/* ========================================================
   ANIMATED LEVEL TRANSITION OVERLAY
   ======================================================== */
.transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    pointer-events: none;
    overflow: hidden;
    visibility: hidden;
}

.transition-overlay.active {
    visibility: visible;
    pointer-events: auto;
}

/* Diagonal Neon Shutter Curtains */
.transition-curtain {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 55%;
    background: linear-gradient(135deg, #0f051d 0%, #240046 50%, #3a0ca3 100%);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    transition: transform 1.35s cubic-bezier(0.77, 0, 0.175, 1);
    z-index: 1;
}

.curtain-left {
    left: 0;
    transform: translateX(-102%);
    border-right: 3px solid #00f5d4;
    box-shadow: 10px 0 35px rgba(0, 245, 212, 0.4);
}

.curtain-right {
    right: 0;
    transform: translateX(102%);
    border-left: 3px solid #ff007f;
    box-shadow: -10px 0 35px rgba(255, 0, 127, 0.4);
}

.transition-overlay.active .curtain-left {
    transform: translateX(0%);
}

.transition-overlay.active .curtain-right {
    transform: translateX(0%);
}

/* Transition Outward Sweep */
.transition-overlay.closing .curtain-left {
    transform: translateX(-102%);
    transition: transform 1.45s cubic-bezier(0.25, 1, 0.5, 1);
}

.transition-overlay.closing .curtain-right {
    transform: translateX(102%);
    transition: transform 1.45s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Center Portal Ring */
.transition-portal-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 140px;
    height: 140px;
    margin: -70px 0 0 -70px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #00f5d4;
    border-bottom-color: #ff007f;
    opacity: 0;
    transform: scale(0.3) rotate(0deg);
    transition: all 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
}

.transition-overlay.active .transition-portal-ring {
    opacity: 0.85;
    transform: scale(1.6) rotate(360deg);
}

.transition-overlay.closing .transition-portal-ring {
    opacity: 0;
    transform: scale(2.8) rotate(720deg);
}

/* Stage Title Card (Pops in at Midpoint) */
.transition-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 209, 102, 0.5);
    border-radius: 28px;
    padding: 28px 48px;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9), 0 0 40px rgba(0, 245, 212, 0.35);
    z-index: 3;
    opacity: 0;
    min-width: 320px;
    max-width: 90vw;
    transition: transform 1.05s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.75s ease;
}

.transition-overlay.active .transition-card {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    transition-delay: 0.45s;
}

.transition-overlay.closing .transition-card {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.15);
    transition: opacity 0.6s, transform 0.75s ease;
}

.transition-badge {
    display: inline-block;
    background: linear-gradient(90deg, #ff007f, #7209b7);
    color: #ffd166;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 3px;
    padding: 4px 18px;
    border-radius: 999px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 209, 102, 0.4);
    box-shadow: 0 0 15px rgba(255, 0, 127, 0.5);
}

.transition-stage-title {
    font-size: clamp(1.8rem, 4.5vw, 2.6rem);
    font-weight: 900;
    margin: 0 0 20px 0;
    background: linear-gradient(45deg, #ffffff, #00f5d4, #ffd166);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 10px rgba(0, 245, 212, 0.5));
}

.transition-stage-subtitle {
    color: #cbd5e1;
    font-size: 1.05rem;
    font-style: italic;
    margin-top: 6px;
    margin-bottom: 16px;
}

.transition-loader-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    overflow: hidden;
}

.transition-loader-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #00f5d4, #ffd166, #ff007f);
    border-radius: 3px;
    animation: loaderFill 2.4s ease-in-out forwards;
}

@keyframes loaderFill {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* ========================================================
   UPGRADED GAME OVER SCREEN
   ======================================================== */
.gameover-card {
    border-color: rgba(255, 0, 85, 0.5);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 45px rgba(255, 0, 85, 0.4);
}

.gameover-header-icon {
    font-size: clamp(2.4rem, 5.5vh, 3.2rem);
    margin-bottom: clamp(4px, 1vh, 8px);
    animation: pulseIcon 1.2s infinite alternate;
}

@keyframes pulseIcon {
    0% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(255, 0, 85, 0.6)); }
    100% { transform: scale(1.1); filter: drop-shadow(0 0 20px rgba(255, 0, 85, 0.9)); }
}

.gameover-title {
    background: linear-gradient(45deg, #ff4d6d, #ff758f, #ffd166);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    color: #fff;
    font-size: clamp(0.96rem, 2.8vw, 1.08rem);
    font-weight: 700;
    padding: clamp(10px, 1.5vh, 13px) 20px;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-2px);
}

@media (max-width: 820px) {
    :root {
        --hud-auto-scale: clamp(0.72, 0.45 + 0.9vw, 0.92);
    }
    #top-hud {
        padding: calc(6px * var(--hud-scale)) calc(8px * var(--hud-scale));
        flex-wrap: wrap;
        gap: calc(5px * var(--hud-scale));
        width: 100%;
        max-width: 100%;
        overflow: visible;
    }
    .hud-left {
        order: 1;
        gap: 0.35em;
    }
    .hud-right {
        order: 2;
        gap: 0.35em;
    }
    #progress-hud {
        order: 3;
        flex-basis: 100%;
        width: 100%;
        max-width: 100%;
        margin-top: 2px;
        padding: 0.3em 0.7em;
    }
    .level-menu-dropdown {
        left: 8px;
        top: 45px;
    }
    .touch-cluster {
        gap: 6px !important;
    }
    #touch-controls {
        bottom: max(24px, calc(16px + env(safe-area-inset-bottom))) !important;
        left: max(14px, env(safe-area-inset-left)) !important;
        right: max(14px, env(safe-area-inset-right)) !important;
        width: auto !important;
        max-width: none !important;
        align-items: flex-end !important;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    :root {
        --hud-auto-scale: 0.72;
    }
    #top-hud {
        padding: 4px 10px;
    }
}

/* ==========================================================================
   Leaderboard & Stage Timer Design System
   ========================================================================== */

/* Stage Timer Pill in Top HUD */
.timer-badge-pill {
    background: linear-gradient(135deg, rgba(255, 209, 102, 0.22), rgba(255, 112, 166, 0.18));
    border-color: rgba(255, 209, 102, 0.45);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

#level-timer-val {
    color: #ffd166;
    font-weight: 800;
    min-width: 4.8em;
    display: inline-block;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Start Menu Hall of Fame Button */
.btn-menu-leaderboard {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(255, 209, 102, 0.18), rgba(255, 0, 127, 0.18));
    border: 1.5px solid rgba(255, 209, 102, 0.5);
    border-radius: 999px;
    color: #ffd166;
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    font-weight: 800;
    padding: clamp(10px, 1.6vh, 13px) 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 209, 102, 0.2);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: 10px;
    width: auto;
    letter-spacing: 0.5px;
}

.btn-menu-leaderboard:hover, .btn-menu-leaderboard:active {
    background: linear-gradient(135deg, rgba(255, 209, 102, 0.32), rgba(255, 0, 127, 0.32));
    border-color: #ffd166;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 209, 102, 0.4);
}

/* End-of-Game Player Name Save Card (Victory & Game Over) */
.leaderboard-save-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.95));
    border: 1.5px solid rgba(255, 209, 102, 0.4);
    border-radius: 16px;
    padding: clamp(10px, 1.8vh, 14px) clamp(12px, 2.5vw, 16px);
    margin-bottom: clamp(12px, 2vh, 16px);
    text-align: left;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 0 15px rgba(255, 209, 102, 0.08);
}

.save-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: clamp(0.85rem, 2.2vw, 0.95rem);
    font-weight: 800;
    color: #ffd166;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.save-icon {
    font-size: 1.15em;
}

.save-badge-record {
    margin-left: auto;
    background: linear-gradient(90deg, #ff007f, #ffbe0b);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    animation: pulseBadge 1.2s infinite alternate;
}

@keyframes pulseBadge {
    0% { transform: scale(0.95); box-shadow: 0 0 8px rgba(255, 0, 127, 0.5); }
    100% { transform: scale(1.05); box-shadow: 0 0 16px rgba(255, 190, 11, 0.8); }
}

.save-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.player-name-input {
    flex: 1;
    min-width: 0;
    background: rgba(10, 15, 30, 0.75);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    color: #ffffff;
    font-family: inherit;
    font-size: clamp(0.92rem, 2.6vw, 1.05rem);
    font-weight: 700;
    padding: 10px 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    user-select: text;
    -webkit-user-select: text;
}

.player-name-input:focus {
    border-color: #00f5d4;
    box-shadow: 0 0 14px rgba(0, 245, 212, 0.4);
    background: rgba(10, 15, 30, 0.95);
}

.btn-save-leaderboard {
    background: linear-gradient(135deg, #00f5d4, #0582ca);
    border: none;
    border-radius: 10px;
    color: #051923;
    font-family: inherit;
    font-size: clamp(0.85rem, 2.2vw, 0.95rem);
    font-weight: 800;
    padding: 10px 16px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s, filter 0.15s;
    flex-shrink: 0;
}

.btn-save-leaderboard:hover, .btn-save-leaderboard:active {
    transform: scale(1.03);
    filter: brightness(1.15);
}

.save-status-msg {
    font-size: 0.76rem;
    color: #94a3b8;
    margin-top: 6px;
    min-height: 1.2em;
    transition: color 0.2s;
}

.save-status-msg.success {
    color: #00f5d4;
    font-weight: 700;
}

/* Full Leaderboard Modal Overlay */
#leaderboard-modal {
    z-index: 10000;
    background: rgba(8, 12, 24, 0.88);
    backdrop-filter: blur(16px);
}

.lb-modal-card {
    position: relative;
    max-width: 520px;
    width: min(94vw, 520px);
    max-height: calc(100vh - clamp(24px, 4vh, 48px));
    display: flex;
    flex-direction: column;
    padding: clamp(16px, 2.5vh, 26px) clamp(14px, 3.5vw, 24px);
    border: 2px solid rgba(255, 209, 102, 0.4);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 50px rgba(255, 209, 102, 0.25);
}

.lb-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.18s ease;
    z-index: 5;
}

.lb-close-btn:hover, .lb-close-btn:active {
    background: rgba(255, 0, 127, 0.7);
    border-color: #ff007f;
    transform: scale(1.1);
}

.lb-title {
    margin-top: 4px;
    background: linear-gradient(45deg, #ffd166, #ff70a6, #00f5d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Persistent Player Bar inside Modal */
.lb-player-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 6px 12px;
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.lb-player-bar-label {
    color: #cbd5e1;
    font-weight: 700;
    white-space: nowrap;
}

.lb-tag-input {
    flex: 1;
    padding: 6px 10px;
    font-size: 0.92rem;
    background: rgba(10, 15, 30, 0.6);
}

.lb-tag-hint {
    font-size: 0.72rem;
    color: #94a3b8;
    white-space: nowrap;
}

/* Tabs: Points vs Times */
.lb-tab-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: rgba(10, 15, 30, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 10px;
}

.lb-tab-btn {
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #94a3b8;
    font-family: inherit;
    font-size: clamp(0.9rem, 2.4vw, 1.05rem);
    font-weight: 800;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.lb-tab-btn.active {
    background: linear-gradient(135deg, #ff007f, #7209b7);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(255, 0, 127, 0.4);
}

/* Level Stage Selector Chips */
.lb-level-selector-wrap {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.lb-level-chips {
    display: flex;
    gap: 6px;
    width: 100%;
    justify-content: center;
}

.lb-stage-chip {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    color: #cbd5e1;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 4px 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.lb-stage-chip.active {
    background: linear-gradient(135deg, #00f5d4, #0582ca);
    border-color: #00f5d4;
    color: #051923;
    font-weight: 800;
    box-shadow: 0 2px 10px rgba(0, 245, 212, 0.4);
}

/* Top 10 Table Scroll Area */
.lb-table-wrap {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
    background: rgba(10, 15, 30, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px;
    max-height: 48vh;
}

.lb-table-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Individual Leaderboard Row */
.lb-row {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: clamp(6px, 1.2vh, 9px) clamp(10px, 2vw, 14px);
    transition: all 0.18s ease;
}

.lb-row:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.18);
}

.lb-row-current-user {
    background: rgba(0, 245, 212, 0.1) !important;
    border-color: rgba(0, 245, 212, 0.5) !important;
    box-shadow: 0 0 14px rgba(0, 245, 212, 0.2);
}

.lb-col-rank {
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}

.lb-rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 800;
    color: #94a3b8;
}

/* Medals */
.gold-rank .lb-rank-badge {
    font-size: 1.25rem;
    filter: drop-shadow(0 0 6px rgba(255, 209, 102, 0.8));
}
.silver-rank .lb-rank-badge {
    font-size: 1.2rem;
    filter: drop-shadow(0 0 5px rgba(203, 213, 225, 0.8));
}
.bronze-rank .lb-rank-badge {
    font-size: 1.15rem;
    filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.8));
}

.lb-col-player {
    flex: 1;
    min-width: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
}

.lb-player-name {
    font-size: clamp(0.92rem, 2.4vw, 1.05rem);
    font-weight: 800;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-you-tag {
    display: inline-block;
    background: #00f5d4;
    color: #051923;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 1px 6px;
    border-radius: 999px;
    margin-left: 6px;
    vertical-align: middle;
}

.lb-row-subtext {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 1px;
}

.lb-col-score {
    flex-shrink: 0;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.lb-score-val {
    font-size: clamp(0.98rem, 2.6vw, 1.15rem);
    font-weight: 800;
    color: #ff70a6;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

.lb-score-pts {
    font-size: 0.68rem;
    color: #ffd166;
    font-weight: 800;
    letter-spacing: 1px;
}

.lb-col-time {
    flex-direction: row;
    align-items: center;
    gap: 4px;
}

.lb-time-icon {
    font-size: 0.9rem;
}

.lb-time-val {
    font-size: clamp(0.95rem, 2.5vw, 1.12rem);
    font-weight: 800;
    color: #ffd166;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

.lb-empty {
    padding: 24px 16px;
    color: #94a3b8;
    font-size: 0.9rem;
    text-align: center;
}

/* Modal Footer */
.lb-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    color: #94a3b8;
}

.lb-reset-btn {
    background: transparent;
    border: none;
    color: #f87171;
    font-family: inherit;
    font-size: 0.74rem;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.75;
    transition: opacity 0.15s;
}

.lb-reset-btn:hover {
    opacity: 1;
}

/* Mobile Fine-Tuning for Leaderboard */
@media (max-width: 600px) {
    .lb-modal-card {
        padding: 14px 12px;
        width: 95vw;
    }
    .lb-player-bar {
        flex-wrap: wrap;
        gap: 4px;
        padding: 6px 8px;
    }
    .lb-tag-hint {
        width: 100%;
        text-align: right;
    }
    .lb-row {
        padding: 6px 8px;
        gap: 8px;
    }
    .lb-col-rank {
        width: 26px;
    }
    .save-input-row {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-save-leaderboard {
        width: 100%;
        text-align: center;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .lb-modal-card {
        max-height: 94vh;
        padding: 10px 14px;
    }
    .lb-title {
        font-size: 1.3rem;
        margin-bottom: 2px;
    }
    .lb-table-wrap {
        max-height: 38vh;
    }
    .lb-player-bar {
        margin-bottom: 6px;
        padding: 4px 8px;
    }
    .lb-tab-switcher {
        margin-bottom: 6px;
    }
}

/* ==========================================================================
   Photo Mode & Camera Studio System
   ========================================================================== */

/* Shutter Flash Animation */
.photo-flash-overlay {
    position: fixed;
    inset: 0;
    background: #ffffff;
    opacity: 0;
    pointer-events: none;
    z-index: 15000;
}

.photo-flash-overlay.animate-flash {
    animation: cameraShutterFlash 0.35s ease-out;
}

@keyframes cameraShutterFlash {
    0% { opacity: 0.95; }
    50% { opacity: 0.5; }
    100% { opacity: 0; }
}

/* Photo Mode Fullscreen Studio Overlay */
.photo-mode-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    display: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.photo-mode-overlay:not(.active) * {
    pointer-events: none !important;
}

.photo-mode-overlay.active {
    display: flex;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.photo-mode-active #ui-container {
    opacity: 0;
    pointer-events: none;
}

/* 360 Orbit Drag Area */
.pm-orbit-touch-zone {
    position: absolute;
    inset: 0;
    z-index: 1;
    cursor: grab;
    touch-action: none;
}

.pm-orbit-touch-zone:active {
    cursor: grabbing;
}

/* Top Studio Navigation Header */
.pm-top-bar {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(10px, 2vh, 18px) clamp(12px, 3vw, 24px);
    pointer-events: none;
    width: 100%;
}

.pm-badge {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(14px);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.pm-icon {
    font-size: 1.25rem;
}

.pm-title {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #ffffff;
}

.pm-paused-tag {
    background: linear-gradient(90deg, #ff007f, #ff5400);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: 1px;
    animation: pulseBadge 1.4s infinite alternate;
}

.pm-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-pm-snap {
    background: linear-gradient(135deg, #00f5d4, #0582ca);
    border: none;
    border-radius: 999px;
    color: #051923;
    font-family: inherit;
    font-size: clamp(0.95rem, 2.6vw, 1.15rem);
    font-weight: 900;
    padding: 10px 22px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 245, 212, 0.5), 0 0 15px rgba(0, 245, 212, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.15s, filter 0.15s;
}

.btn-pm-snap:hover, .btn-pm-snap:active {
    transform: scale(1.05);
    filter: brightness(1.15);
}

.btn-pm-exit {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(14px);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    color: #ffd166;
    font-family: inherit;
    font-size: clamp(0.85rem, 2.2vw, 0.95rem);
    font-weight: 800;
    padding: 10px 18px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.15s, background 0.15s;
}

.btn-pm-exit:hover, .btn-pm-exit:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.03);
}

/* Bottom Controls Dock */
.pm-bottom-dock {
    position: relative;
    z-index: 10;
    margin: 0 auto clamp(10px, 2vh, 18px) auto;
    width: min(94vw, 560px);
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(18px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 12px 16px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.75), 0 0 35px rgba(255, 0, 127, 0.25);
    pointer-events: none;
}

.photo-mode-overlay.active .pm-top-bar,
.photo-mode-overlay.active .pm-bottom-dock {
    pointer-events: auto;
}

/* Live Depth-of-Field Blur Overlay */
.pm-dof-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.15s ease;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    -webkit-mask-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 1) 0%,
        rgba(0, 0, 0, 0.9) 18%,
        rgba(0, 0, 0, 0) 36%,
        rgba(0, 0, 0, 0) 64%,
        rgba(0, 0, 0, 0.9) 82%,
        rgba(0, 0, 0, 1) 100%
    );
    mask-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 1) 0%,
        rgba(0, 0, 0, 0.9) 18%,
        rgba(0, 0, 0, 0) 36%,
        rgba(0, 0, 0, 0) 64%,
        rgba(0, 0, 0, 0.9) 82%,
        rgba(0, 0, 0, 1) 100%
    );
}

.pm-vignette-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.2s ease;
    opacity: 0;
    background: radial-gradient(circle at center, transparent 35%, rgba(0, 0, 0, 0.9) 100%);
}

/* Live Aspect Ratio Framing Matte (Top, Bottom, Left, Right) */
.pm-frame-matte {
    position: absolute;
    background: #000000;
    z-index: 3;
    pointer-events: none;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.pm-frame-matte-top {
    top: 0;
    left: 0;
    right: 0;
    height: 0;
    border-bottom: 1.5px solid rgba(255, 209, 102, 0.4);
}

.pm-frame-matte-bot {
    bottom: 0;
    left: 0;
    right: 0;
    height: 0;
    border-top: 1.5px solid rgba(255, 209, 102, 0.4);
}

.pm-frame-matte-left {
    top: 0;
    bottom: 0;
    left: 0;
    width: 0;
    border-right: 1.5px solid rgba(255, 209, 102, 0.4);
}

.pm-frame-matte-right {
    top: 0;
    bottom: 0;
    right: 0;
    width: 0;
    border-left: 1.5px solid rgba(255, 209, 102, 0.4);
}

.pm-frame-guide {
    position: absolute;
    pointer-events: none;
    z-index: 4;
    border: 1.5px dashed rgba(255, 209, 102, 0.65);
    box-shadow: 0 0 20px rgba(255, 209, 102, 0.25), inset 0 0 25px rgba(255, 209, 102, 0.1);
    display: none;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
}

.pm-frame-guide.active {
    display: block;
}

.pm-frame-guide-tag {
    position: absolute;
    top: 8px;
    left: 10px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 209, 102, 0.5);
    color: #ffd166;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 999px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.pm-nav-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    background: rgba(10, 15, 30, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 10px;
}

.pm-nav-tab {
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #94a3b8;
    font-family: inherit;
    font-size: clamp(0.68rem, 1.8vw, 0.82rem);
    font-weight: 800;
    padding: 6px 2px;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-nav-tab.active {
    background: linear-gradient(135deg, #ff007f, #7209b7);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(255, 0, 127, 0.4);
}

.pm-panel-section {
    display: none;
}

.pm-panel-section.active {
    display: block;
    animation: fadeInPanel 0.2s ease-out;
}

@keyframes fadeInPanel {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Slider Controls */
.pm-slider-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
}

.pm-slider-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pm-slider-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #cbd5e1;
}

.pm-slider-item input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    outline: none;
}

.pm-slider-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00f5d4;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 245, 212, 0.8);
    transition: transform 0.1s;
}

.pm-slider-item input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.pm-slider-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pm-slider-val {
    font-size: 0.75rem;
    font-weight: 800;
    color: #00f5d4;
}

.pm-ratio-section {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pm-ratio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.pm-toggle-crop-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 209, 102, 0.4);
    border-radius: 999px;
    color: #ffd166;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pm-toggle-crop-btn:hover {
    background: rgba(255, 209, 102, 0.2);
    border-color: #ffd166;
}

.pm-ratio-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.pm-ratio-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    color: #cbd5e1;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 6px 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-ratio-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.35);
}

.pm-ratio-btn.active {
    background: linear-gradient(135deg, #ffd166, #ff7b00);
    border-color: #ffd166;
    color: #051923;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(255, 209, 102, 0.4);
}

.pm-quick-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pm-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    color: #fff;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.pm-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.22);
}

.pm-drag-hint {
    font-size: 0.74rem;
    color: #94a3b8;
}

/* Filter & Pose Buttons Grid */
.pm-filters-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.pm-filter-btn, .pm-pose-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    color: #cbd5e1;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 8px 6px;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: center;
}

.pm-filter-btn:hover, .pm-pose-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.35);
}

.pm-filter-btn.active, .pm-pose-btn.active {
    background: linear-gradient(135deg, #00f5d4, #0582ca);
    border-color: #00f5d4;
    color: #051923;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0, 245, 212, 0.4);
}

/* Comic Stickers Palette */
.pm-stickers-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    max-height: 95px;
    overflow-y: auto;
}

.pm-sticker-chip {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-sticker-chip:hover {
    background: rgba(255, 209, 102, 0.25);
    border-color: #ffd166;
    transform: scale(1.04);
}

/* Stickers Placed on Viewport */
.pm-stickers-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 2;
}

.pm-sticker-item {
    position: absolute;
    pointer-events: auto;
    cursor: grab;
    user-select: none;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.8));
    touch-action: none;
    padding: 8px 10px;
    border-radius: 14px;
    transition: outline 0.15s ease, background 0.15s ease;
}

.pm-sticker-item.selected {
    outline: 2px dashed #00f5d4;
    outline-offset: 4px;
    background: rgba(0, 245, 212, 0.12);
}

.pm-sticker-item:active {
    cursor: grabbing;
}

.sticker-content {
    font-size: clamp(2.4rem, 6vw, 3.4rem);
    line-height: 1;
    pointer-events: none;
}

.sticker-label {
    background: #ffd166;
    color: #0f172a;
    font-size: 0.72rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 999px;
    margin-top: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.12s ease;
}

.sticker-label:hover {
    transform: scale(1.08);
}

/* Corner Control Handles on Active Sticker */
.sticker-handle-btn {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.7);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.12s ease;
    z-index: 10;
}

.pm-sticker-item.selected .sticker-handle-btn,
.pm-sticker-item:hover .sticker-handle-btn {
    opacity: 1;
    pointer-events: auto;
}

.sticker-handle-btn:hover {
    transform: scale(1.25);
}

/* Top-Left: Delete Handle */
.sticker-del-btn {
    top: -8px;
    left: -8px;
    background: #ff007f;
    color: #ffffff;
}

/* Top-Right: Rotate Handle */
.sticker-rot-btn {
    top: -8px;
    right: -8px;
    background: #00f5d4;
    color: #051923;
    cursor: grab;
}

/* Bottom-Right: Scale Handle */
.sticker-scale-btn {
    bottom: -8px;
    right: -8px;
    background: #ffd166;
    color: #051923;
    cursor: nwse-resize;
}

/* Bottom-Left: Text Visibility Toggle Handle */
.sticker-text-btn {
    bottom: -8px;
    left: -8px;
    background: #7209b7;
    color: #ffffff;
}

/* Selected Sticker Dock Controls */
.pm-sticker-edit-bar {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pm-sticker-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pm-sticker-active-name {
    font-size: 0.78rem;
    font-weight: 800;
    color: #ffd166;
}

.pm-sticker-header-actions {
    display: flex;
    gap: 4px;
}

/* Photo Preview Modal */
#photo-preview-modal {
    z-index: 20000;
}

.pm-preview-card {
    max-width: 600px;
    width: min(94vw, 600px);
}

.pm-preview-img-container {
    width: 100%;
    max-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
    margin-top: 8px;
}

.pm-preview-img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    display: block;
}

/* Canvas Viewport Filter Classes */
#canvas-container.filter-golden {
    filter: sepia(0.35) saturate(1.4) contrast(1.1) hue-rotate(-10deg);
}

#canvas-container.filter-cyberpunk {
    filter: saturate(1.7) contrast(1.25) hue-rotate(185deg);
}

#canvas-container.filter-retro {
    filter: contrast(1.2) saturate(0.85) sepia(0.25);
}

#canvas-container.filter-noir {
    filter: grayscale(1) contrast(1.35) brightness(0.95);
}

#canvas-container.filter-pastel {
    filter: brightness(1.12) saturate(1.2) contrast(0.95);
}

/* Start Menu Subrow (Leaderboard, Photo Mode, Install App) */
.start-action-subrow {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
}

.btn-menu-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    color: #ffffff;
    font-size: clamp(0.85rem, 2.2vw, 0.95rem);
    font-weight: 800;
    padding: clamp(9px, 1.4vh, 12px) 18px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-menu-action:hover, .btn-menu-action:active {
    background: rgba(0, 245, 212, 0.25);
    border-color: #00f5d4;
    color: #00f5d4;
    transform: translateY(-2px);
}

/* Mobile Responsiveness for Photo Mode */
@media (max-width: 600px) {
    .pm-bottom-dock {
        padding: 10px 12px;
        width: 95vw;
        border-radius: 18px;
    }
    .pm-slider-group {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .pm-filters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .pm-stickers-palette {
        grid-template-columns: repeat(3, 1fr);
    }
    .btn-pm-snap {
        padding: 8px 16px;
        font-size: 0.92rem;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .pm-top-bar {
        padding: 4px 12px;
    }
    .pm-bottom-dock {
        padding: 6px 12px;
        margin-bottom: 6px;
        max-height: 52vh;
        overflow-y: auto;
    }
    .pm-nav-tabs {
        margin-bottom: 6px;
        padding: 2px;
    }
    .pm-slider-group {
        grid-template-columns: 1fr 1fr;
        gap: 4px 10px;
    }
}

