* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    background: #090d16;
    color: #f8fafc;
    overflow: hidden;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 1;
}

/* Geometry Dash Style Centered Main Menu Overlay */
.main-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 22;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at center, rgba(9, 13, 22, 0.25) 0%, rgba(9, 13, 22, 0.78) 100%);
    pointer-events: none;
}

.gd-menu-container {
    pointer-events: auto;
    width: 100%;
    max-width: 860px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 22px;
    animation: panelSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.gd-title-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    margin: 0;
    background: none;
    border: none;
    box-shadow: none;
}

.gd-title-logo {
    width: 210px;
    height: 210px;
    object-fit: contain;
    image-rendering: pixelated;
    margin-bottom: 8px;
    filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.9));
}

.menu-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.45);
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.gd-title {
    font-size: 4.8rem;
    font-weight: 900;
    letter-spacing: 4px;
    line-height: 1;
    color: #f8fafc;
    text-shadow: 0 6px 28px rgba(0, 0, 0, 0.9);
}

.gd-title span {
    color: #38bdf8;
    text-shadow: 0 0 28px rgba(56, 189, 248, 0.75);
}

.gd-subtitle {
    font-size: 0.98rem;
    color: #f8fafc;
    margin-top: 4px;
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.9);
}

.gd-primary-deck {
    display: grid;
    grid-template-columns: 1fr 1.35fr 1fr;
    gap: 16px;
    width: 100%;
    align-items: stretch;
}

.gd-card-btn {
    background: rgba(15, 23, 42, 0.92);
    border: 2px solid #475569;
    border-radius: 16px;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
}

.gd-card-btn:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: #38bdf8;
    background: rgba(30, 41, 59, 0.96);
}

.gd-center-play-btn {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    border: 2px solid #7dd3fc;
    padding: 28px 22px;
    box-shadow: 0 20px 55px rgba(2, 132, 199, 0.5);
}

.gd-center-play-btn:hover {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    border-color: #ffffff;
}

.gd-story-accent {
    border-color: #f43f5e;
}

.gd-story-accent:hover {
    border-color: #fda4af;
}

.gd-play-title {
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    color: #ffffff;
}

.gd-btn-label {
    font-size: 1.12rem;
    font-weight: 900;
    letter-spacing: 1px;
    color: #f8fafc;
}

.gd-btn-desc {
    font-size: 0.78rem;
    color: #cbd5e1;
    font-weight: 500;
}

.gd-secondary-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.gd-pill-btn {
    padding: 10px 18px;
    font-size: 0.88rem;
    font-weight: 800;
    background: rgba(15, 23, 42, 0.9);
    border: 1.5px solid #475569;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.55);
}

.gd-pill-btn:hover {
    border-color: #38bdf8;
    transform: translateY(-2px);
}

.gd-status-strip {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 10px 24px;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid #334155;
    border-radius: 30px;
    font-size: 0.82rem;
    color: #cbd5e1;
}

.menu-corner-scrap {
    position: fixed;
    bottom: 24px;
    right: 28px;
    z-index: 25;
    pointer-events: auto;
    background: rgba(30, 27, 75, 0.92);
    border: 2px solid #c084fc;
    color: #e9d5ff;
    padding: 10px 20px;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 800;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
}

/* Geometry Dash Style Full-Screen Campaign Level Carousel */
.story-screen-overlay {
    position: fixed;
    inset: 0;
    z-index: 28;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.86) 0%, rgba(5, 8, 17, 0.97) 100%);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 32px;
}

.gd-campaign-screen {
    width: 100%;
    max-width: 1040px;
    height: 100%;
    max-height: 760px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.gd-campaign-topbar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.gd-campaign-title-wrap {
    text-align: center;
}

.gd-campaign-title-wrap h2 {
    font-size: 1.75rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: #f8fafc;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.9);
}

.gd-back-btn {
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 800;
    background: rgba(30, 41, 59, 0.92);
    border: 2px solid #475569;
    border-radius: 12px;
}

.gd-carousel-stage {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    min-height: 0;
    touch-action: pan-y;
    user-select: none;
}

.gd-carousel-arrow {
    width: 64px;
    height: 110px;
    border-radius: 16px;
    font-size: 2.2rem;
    font-weight: 900;
    background: rgba(15, 23, 42, 0.92);
    border: 2.5px solid #38bdf8;
    color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.75);
}

.gd-carousel-arrow:hover {
    background: #0284c7;
    border-color: #ffffff;
    transform: scale(1.06);
}

.gd-level-card {
    position: relative;
    width: 100%;
    max-width: 680px;
    height: 440px;
    min-height: 440px;
    max-height: 440px;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.96) 0%, rgba(15, 23, 42, 0.98) 100%);
    border: 3px solid #38bdf8;
    border-radius: 22px;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 35px rgba(56, 189, 248, 0.2);
    overflow: hidden;
    will-change: transform, opacity;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.gd-level-card.swipe-next {
    animation: gdCardSwipeNext 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.gd-level-card.swipe-prev {
    animation: gdCardSwipePrev 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes gdCardSwipeNext {
    0% {
        opacity: 0.25;
        transform: translateX(95px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes gdCardSwipePrev {
    0% {
        opacity: 0.25;
        transform: translateX(-95px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.gd-level-card.cleared {
    border-color: #22c55e;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 35px rgba(34, 197, 94, 0.22);
}

.gd-level-card.locked {
    border-color: #475569;
}

.gd-level-card.locked > *:not(.gd-lock-overlay) {
    filter: brightness(0.32) saturate(0.35) blur(1.5px);
    pointer-events: none;
}

.gd-lock-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(5, 8, 17, 0.72);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    gap: 8px;
    backdrop-filter: blur(3px);
}

.gd-lock-icon {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.95);
    border: 3px solid #f43f5e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.3rem;
    box-shadow: 0 0 28px rgba(244, 63, 94, 0.55);
    margin-bottom: 4px;
}

.gd-lock-title {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: #f8fafc;
    text-shadow: 0 3px 12px rgba(0, 0, 0, 0.95);
}

.gd-lock-sub {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fda4af;
    max-width: 420px;
}

.gd-level-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gd-cleared-pill {
    display: inline-block;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 1px;
    border-radius: 6px;
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid #22c55e;
    color: #4ade80;
    margin-left: 8px;
}

.gd-diff-label {
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 1.2px;
    color: #facc15;
}

.gd-level-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    height: 96px;
    flex-shrink: 0;
}

.briefing-avatar {
    width: 92px;
    height: 92px;
    border-radius: 16px;
    background: #090d16;
    border: 2.5px solid #38bdf8;
    object-fit: contain;
    flex-shrink: 0;
}

.gd-level-hero-text {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.gd-level-hero-text h3 {
    font-size: 1.55rem;
    font-weight: 900;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.briefing-specs {
    font-size: 0.86rem;
    color: #38bdf8;
    font-weight: 800;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.briefing-desc {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #cbd5e1;
    background: #0f172a;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #334155;
    height: 76px;
    display: flex;
    align-items: center;
    overflow: hidden;
    flex-shrink: 0;
}

.briefing-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.briefing-launch-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.12rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    border-radius: 12px;
}

.gd-dots-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 6px 14px;
}

.gd-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #334155;
    border: 1.5px solid #64748b;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease;
}

.gd-dot.cleared {
    background: #22c55e;
    border-color: #86efac;
}

.gd-dot.locked {
    background: #0f172a;
    border-color: #334155;
    opacity: 0.55;
}

.gd-dot.active {
    transform: scale(1.4);
    background: #38bdf8;
    border-color: #ffffff;
    box-shadow: 0 0 10px #38bdf8;
}

.gameover-story-nav {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #334155;
}

.gameover-story-nav button {
    flex: 1;
    padding: 11px 14px;
    font-size: 0.9rem;
    font-weight: 800;
}

/* Top Navigation Hub Bar */
.hub-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 54px;
    z-index: 25;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 2px solid #38bdf8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.hub-left, .hub-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-logo {
    font-weight: 900;
    font-size: 1.1rem;
    color: #38bdf8;
    letter-spacing: 1.5px;
    margin: 0 6px;
}

.hub-btn {
    padding: 6px 11px;
    font-size: 0.8rem;
}

.scrap-pill {
    background: #1e1b4b;
    border: 1px solid #c084fc;
    color: #e9d5ff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1e293b;
    border: 1px solid #38bdf8;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.google-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    color: #0f172a;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
}

.google-btn:hover {
    background: #e2e8f0 !important;
}

.google-btn span {
    background: #4285F4;
    color: #fff;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 900;
}

/* Draggable Character Studio Panel */
.ui-panel {
    position: fixed;
    top: 68px;
    left: 32px;
    z-index: 18;
    width: 395px;
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.94);
    border: 2px solid #38bdf8;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    max-height: calc(100vh - 84px);
    overflow-y: auto;
}

.drag-handle {
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-hint {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 600;
    margin-left: 6px;
}

.studio-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.save-badge {
    font-size: 0.72rem;
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid #22c55e;
    padding: 2px 8px;
    border-radius: 12px;
}

.studio-header h1 {
    font-size: 1.15rem;
    letter-spacing: 1px;
    color: #38bdf8;
}

.studio-header p {
    font-size: 0.82rem;
    color: #cbd5e1;
    margin: 4px 0 10px;
}

.studio-expand-btn {
    padding: 3px 8px;
    font-size: 0.72rem;
    background: #1e293b;
    border: 1px solid #38bdf8;
    color: #38bdf8;
    border-radius: 8px;
}

.studio-expand-btn:hover {
    background: #0284c7;
    color: #ffffff;
}

.ui-panel.studio-fullscreen {
    position: fixed !important;
    top: 60px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: min(94vw, 660px) !important;
    max-width: 660px !important;
    max-height: calc(100dvh - 70px) !important;
    z-index: 30;
    padding: 18px 24px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.92), 0 0 40px rgba(56, 189, 248, 0.25);
}

.ui-panel.studio-fullscreen .canvas-wrapper {
    width: min(54vh, 500px, calc(90vw - 48px));
    height: min(54vh, 500px, calc(90vw - 48px));
}

.toolbar {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
    margin-bottom: 8px;
}

.tool-btn {
    padding: 6px 0;
    font-size: 1rem;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 6px;
}

.tool-btn.active {
    background: #0284c7;
    border-color: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.sub-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #cbd5e1;
    margin-bottom: 10px;
}

.sub-toolbar select {
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid #475569;
    border-radius: 4px;
    padding: 4px 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.canvas-wrapper {
    position: relative;
    width: 240px;
    height: 240px;
    margin: 0 auto 10px;
    background-color: #ffffff;
    background-image:
            linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
            linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
            linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
            linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    border-radius: 8px;
    border: 2px solid #475569;
    overflow: hidden;
    cursor: crosshair;
    touch-action: none;
    transition: width 0.18s ease, height 0.18s ease;
}

#draw-canvas,
#selection-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#selection-canvas {
    pointer-events: none;
    z-index: 2;
}

#pivot-marker {
    position: absolute;
    z-index: 3;
    width: 12px;
    height: 12px;
    background: rgba(239, 68, 68, 0.85);
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.color-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    flex: 1;
}

.swatch {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
}

.swatch:hover {
    transform: scale(1.15);
}

.size-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: #cbd5e1;
    margin-bottom: 8px;
}

.size-row input[type="range"] {
    flex: 1;
}

.studio-controls, .nav-controls, .anim-preview-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.studio-controls button, .nav-controls button {
    flex: 1;
}

.anim-preview-controls {
    border-top: 1px solid #334155;
    padding-top: 8px;
    flex-wrap: wrap;
}

.anim-preview-controls span {
    width: 100%;
    font-size: 0.75rem;
    color: #94a3b8;
}

button {
    padding: 6px 10px;
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid #475569;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.82rem;
    transition: transform 0.12s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.15s ease, border-color 0.15s ease;
}

button:hover:not(:disabled) {
    background: #334155;
}

button:active:not(:disabled) {
    transform: scale(0.96);
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.primary-btn {
    background: #0284c7;
    border-color: #38bdf8;
}

.anim-btn.active {
    background: #38bdf8;
    color: #0f172a;
}

/* Skindex-Style Floating Scene Switcher */
.scene-bar {
    position: fixed;
    top: 70px;
    right: 36px;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(15, 23, 42, 0.92);
    border: 2px solid #38bdf8;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.scene-bar span {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-right: 4px;
}

.bg-btn.active {
    background: #38bdf8;
    color: #0f172a;
    border-color: #38bdf8;
}

.pdn-mini-slots {
    position: relative;
    width: 42px;
    height: 36px;
    cursor: pointer;
}

.color-slot {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 2px solid #f8fafc;
    border-radius: 4px;
}

.primary-slot {
    top: 0;
    left: 0;
    z-index: 2;
}

.secondary-slot {
    bottom: 0;
    right: 0;
    z-index: 1;
}

/* Draggable Paint.NET Floating Color Window */
.pdn-window {
    position: fixed;
    top: 90px;
    left: 445px;
    z-index: 32;
    width: 435px;
    background: #1e293b;
    border: 2px solid #38bdf8;
    border-radius: 10px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    display: none;
}

.pdn-window.open {
    display: block;
}

.pdn-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #0f172a;
    font-size: 0.85rem;
    font-weight: 700;
    color: #38bdf8;
    border-bottom: 1px solid #334155;
}

.pdn-header button {
    padding: 2px 8px;
    background: #ef4444;
    border: none;
    color: #fff;
}

.pdn-body {
    display: flex;
    gap: 14px;
    padding: 12px 14px;
}

.pdn-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 160px;
    flex-shrink: 0;
}

.pdn-top-controls {
    width: 100%;
}

.pdn-slots-wrap {
    position: relative;
    width: 100%;
    height: 46px;
}

.pdn-box {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 2px solid #94a3b8;
    cursor: pointer;
}

.pdn-box.active {
    border-color: #38bdf8;
    box-shadow: 0 0 6px #38bdf8;
    z-index: 3;
}

#pdn-primary-box {
    top: 0;
    left: 4px;
    background: #111111;
}

#pdn-secondary-box {
    top: 14px;
    left: 20px;
    background: #ffffff;
}

#pdn-swap-btn {
    position: absolute;
    top: 0;
    left: 56px;
    padding: 2px 6px;
    font-size: 0.75rem;
}

#pdn-reset-btn {
    position: absolute;
    top: 24px;
    left: 56px;
    padding: 2px 6px;
    font-size: 0.7rem;
}

.wheel-container {
    position: relative;
    width: 150px;
    height: 150px;
    cursor: crosshair;
    touch-action: none;
}

#wheel-cursor {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid #000;
    box-shadow: 0 0 2px #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    top: 75px;
    left: 75px;
}

.pdn-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    width: 100%;
}

.pdn-grid .swatch {
    width: 18px;
    height: 14px;
    border-radius: 2px;
}

.pdn-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pdn-section-title {
    font-size: 0.75rem;
    color: #94a3b8;
    border-bottom: 1px solid #334155;
    padding-bottom: 2px;
    margin-top: 2px;
}

.pdn-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

.pdn-row label {
    width: 24px;
    color: #cbd5e1;
}

.pdn-row input[type="range"] {
    flex: 1;
    min-width: 0;
    height: 6px;
}

.pdn-row input[type="number"], .pdn-row input[type="text"] {
    width: 52px;
    padding: 2px 4px;
    background: #0f172a;
    border: 1px solid #475569;
    color: #f8fafc;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
}

.hex-row {
    margin: 4px 0;
}

.hex-row input[type="text"] {
    width: 75px;
    text-transform: uppercase;
}

/* Organized Runner & Story HUD (Boxless Bare Fonts, Icons & Outlined Bottom-Right Bars) */
.hud-container {
    position: absolute;
    inset: 0;
    z-index: 15;
    pointer-events: none;
    padding: 20px 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

.hud-stat-box {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    min-width: 210px;
    pointer-events: auto;
    backdrop-filter: none;
    box-shadow: none;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95), 0 0 3px rgba(0, 0, 0, 0.95);
}

.telemetry-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.peak-sub-label {
    font-size: 0.76rem;
    font-weight: 900;
    color: #38bdf8;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95), 0 0 3px rgba(0, 0, 0, 0.95);
}

.telemetry-badges {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 2px;
}

.hud-stat-box.right {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.hud-action-btns {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-bottom: 6px;
}

.hud-label {
    font-size: 0.75rem;
    font-weight: 900;
    color: #e2e8f0;
    letter-spacing: 1.2px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95), 0 0 3px rgba(0, 0, 0, 0.95);
}

.hud-value {
    font-size: 2.15rem;
    font-weight: 900;
    color: #ffffff;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.95);
}

.tier-badge {
    display: inline-block;
    padding: 3px 9px;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.8px;
    border-radius: 5px;
    background: #0284c7;
    color: #fff;
}

/* Bare Font Styling for In-Game HUD Speed Tier Badge */
#hud-tier-badge {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0;
    font-size: 0.92rem;
    font-weight: 900;
    letter-spacing: 1.4px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.95);
}

#hud-tier-badge.supersonic-fire {
    color: #fffbeb !important;
    text-shadow: 0 0 6px #ffffff, 0 -2px 8px #facc15, 0 -4px 14px #f97316, 0 0 20px #ef4444, 0 2px 6px rgba(0, 0, 0, 0.95);
    animation: supersonicTextFlame 0.35s infinite alternate;
}

#hud-tier-badge.hypersonic-fire {
    color: #f0f9ff !important;
    text-shadow: 0 0 6px #ffffff, 0 -2px 8px #67e8f9, 0 -4px 14px #38bdf8, 0 0 22px #2563eb, 0 2px 6px rgba(0, 0, 0, 0.95);
    animation: hypersonicTextFlame 0.3s infinite alternate;
}

@keyframes supersonicTextFlame {
    from { transform: scale(1) translateY(0); }
    to { transform: scale(1.06) translateY(-1px); }
}

@keyframes hypersonicTextFlame {
    from { transform: scale(1) translateY(0); }
    to { transform: scale(1.07) translateY(-1px); }
}

.draft-badge {
    padding: 0;
    font-size: 0.85rem;
    font-weight: 900;
    letter-spacing: 1px;
    background: none;
    border: none;
    color: #22d3ee;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95), 0 0 8px rgba(6, 182, 212, 0.8);
    animation: blink 0.35s infinite alternate;
}

.scrap-value {
    font-size: 1.65rem;
    color: #a855f7;
    font-weight: 900;
    margin-bottom: 6px;
    white-space: nowrap;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.95), 0 0 12px rgba(168, 85, 247, 0.65);
}

.scrap-gain-popup {
    display: inline-block;
    margin-left: 10px;
    font-size: 1.35rem;
    font-weight: 900;
    color: #c084fc;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95), 0 0 10px rgba(192, 132, 252, 0.8);
    opacity: 0;
    pointer-events: none;
}

.scrap-gain-popup.pop-active {
    animation: scrapGainPopFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes scrapGainPopFade {
    0% {
        opacity: 1;
        transform: translateY(4px) scale(0.85);
    }
    22% {
        opacity: 1;
        transform: translateY(-2px) scale(1.12);
    }
    100% {
        opacity: 0;
        transform: translateY(-7px) scale(0.95);
    }
}

#hud-pause-btn {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    font-size: 1.65rem;
    line-height: 1;
    color: #ffffff;
    cursor: pointer;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.95);
}

#hud-pause-btn:hover {
    background: none;
    color: #38bdf8;
    transform: scale(1.1);
}

.hud-abort-btn {
    padding: 4px 10px;
    font-size: 0.74rem;
    background: #334155;
}

/* Bottom-Right Stamina & Boost Bars (No Outer Box, Thicker with Crisp Outlines) */
.hud-fuel-wrap {
    position: absolute;
    bottom: 24px;
    right: 28px;
    width: 320px;
    background: none;
    border: none;
    padding: 0;
    backdrop-filter: none;
    box-shadow: none;
    pointer-events: none;
}

.hud-fuel-header, .hud-dash-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 1px;
    color: #facc15;
    margin-bottom: 4px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.95);
}

.hud-dash-header {
    margin-top: 10px;
    color: #38bdf8;
}

.stall-text {
    color: #ef4444;
    display: none;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.95);
    animation: blink 0.4s infinite alternate;
}

/* Boxless Launch Sequence Countdown */
.countdown-banner {
    position: absolute;
    top: 22%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: none;
    border: none;
    padding: 0;
    text-align: center;
    box-shadow: none;
    backdrop-filter: none;
}

.countdown-label {
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 4px;
    color: #38bdf8;
    margin-bottom: 2px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.95);
}

.countdown-number {
    font-size: 5.2rem;
    font-weight: 900;
    line-height: 1;
    color: #facc15;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.95), 0 0 25px rgba(250, 204, 21, 0.85);
    animation: countPop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes countPop {
    from { transform: scale(1.45); opacity: 0.35; }
    to { transform: scale(1); opacity: 1; }
}

/* Boxless Flashing Lower-Center Screen Alert Text */
.screen-alert-banner {
    position: absolute;
    bottom: 68px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
    animation: alertPulse 0.32s infinite alternate;
}

.screen-alert-banner.warn-amber,
.screen-alert-banner.info-cyan {
    background: none;
    border: none;
    box-shadow: none;
}

.alert-title {
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    color: #ffffff;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.95), 0 0 12px rgba(239, 68, 68, 0.9);
}

.screen-alert-banner.warn-amber .alert-title {
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.95), 0 0 12px rgba(250, 204, 21, 0.9);
}

.screen-alert-banner.info-cyan .alert-title {
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.95), 0 0 12px rgba(56, 189, 248, 0.9);
}

.alert-sub {
    font-size: 1.55rem;
    font-weight: 900;
    color: #facc15;
    margin-top: 2px;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.95), 0 0 6px rgba(0, 0, 0, 0.95);
}

@keyframes alertPulse {
    from { transform: translateX(-50%) scale(0.98); opacity: 0.72; }
    to { transform: translateX(-50%) scale(1.03); opacity: 1; }
}

@keyframes blink {
    from { opacity: 1; }
    to { opacity: 0.25; }
}

.fuel-bar-bg, .dash-bar-bg {
    width: 100%;
    height: 22px;
    background: rgba(9, 13, 22, 0.65);
    border-radius: 10px;
    overflow: hidden;
    border: 2.5px solid #f8fafc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.85);
}

/* Stamina bar now uses the warm orange-gold gradient */
.fuel-bar-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f97316, #facc15, #fef08a);
    transition: width 0.06s linear;
}

/* Boost bar dynamically uses the character's trail color */
.dash-bar-fill {
    position: relative;
    width: 100%;
    height: 100%;
    background: #38bdf8;
    transition: width 0.05s linear;
}

/* Surge, Strobe & Glow Effects When Boost is Actively Used */
.dash-bar-bg.boosting {
    border-color: #ffffff;
    box-shadow: 0 0 16px var(--boost-glow-color, #38bdf8), 0 0 30px var(--boost-glow-color, #38bdf8), inset 0 0 10px rgba(255, 255, 255, 0.75);
    animation: boostBarContainerPulse 0.14s infinite alternate;
}

.dash-bar-fill.boosting {
    animation: boostFillStrobe 0.11s infinite alternate;
}

.dash-bar-fill.boosting::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
            90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.85) 50%,
            rgba(255, 255, 255, 0) 100%
    );
    background-size: 55% 100%;
    background-repeat: no-repeat;
    animation: boostEnergySurge 0.26s linear infinite;
}

.hud-dash-header.boosting {
    color: #ffffff !important;
    text-shadow: 0 0 10px #ffffff, 0 0 20px var(--boost-glow-color, #38bdf8), 0 2px 6px rgba(0, 0, 0, 0.95);
    animation: boostTextStrobe 0.14s infinite alternate;
}

@keyframes boostBarContainerPulse {
    from { transform: scaleY(1); }
    to { transform: scaleY(1.12); }
}

@keyframes boostFillStrobe {
    from { filter: brightness(1.05) saturate(1.1); }
    to { filter: brightness(1.65) contrast(1.15); }
}

@keyframes boostEnergySurge {
    0% { background-position: -60% 0; }
    100% { background-position: 160% 0; }
}

@keyframes boostTextStrobe {
    from { opacity: 0.85; transform: translateY(0); }
    to { opacity: 1; transform: translateY(-1px); }
}

.race-progress-wrap {
    flex: 1;
    max-width: 420px;
    margin-top: 4px;
    padding: 0;
    border: none;
}

.race-track-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.74rem;
    color: #f8fafc;
    margin-bottom: 5px;
    font-weight: 800;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95), 0 0 3px rgba(0, 0, 0, 0.95);
}

.race-track-bar {
    position: relative;
    height: 14px;
    background: rgba(9, 13, 22, 0.65);
    border-radius: 8px;
    border: 2px solid #f8fafc;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.85);
}

.race-dot {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 1rem;
    transition: left 0.05s linear;
}

.hud-controls-hint {
    align-self: center;
    background: none;
    border: none;
    padding: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: #e2e8f0;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.95);
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(9, 13, 22, 0.78);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.18s ease-out;
}

.modal-card {
    background: #0f172a;
    border: 2px solid #38bdf8;
    border-radius: 14px;
    padding: 24px 28px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
    max-height: 88vh;
    overflow-y: auto;
    animation: panelSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.wide-card {
    max-width: 780px;
}

/* Story Mode Cutscene Card */
.cutscene-card {
    background: #0f172a;
    border: 2px solid #38bdf8;
    border-radius: 16px;
    padding: 20px 24px;
    width: 100%;
    max-width: 820px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9);
}

.cutscene-stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cutscene-viewport {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #334155;
    background: #090d16;
    margin-bottom: 14px;
}

#cutscene-canvas {
    width: 100%;
    height: auto;
    display: block;
}

.cutscene-dialogue-box {
    background: #1e293b;
    border: 1px solid #38bdf8;
    border-radius: 12px;
    padding: 16px 20px;
}

.cutscene-speaker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.cutscene-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #090d16;
    border: 1.5px solid #38bdf8;
    object-fit: contain;
}

.cutscene-speaker {
    display: inline-block;
    background: #0284c7;
    color: #fff;
    font-weight: 900;
    font-size: 0.78rem;
    letter-spacing: 1px;
    padding: 4px 10px;
    border-radius: 6px;
}

.cutscene-text {
    font-size: 1rem;
    line-height: 1.5;
    color: #f8fafc;
    min-height: 48px;
}

.cutscene-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.cutscene-progress {
    font-size: 0.78rem;
    color: #94a3b8;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.modal-header h2 {
    color: #38bdf8;
    font-size: 1.35rem;
}

.close-modal-btn {
    background: #ef4444;
    border: none;
    color: #fff;
    font-size: 0.9rem;
    padding: 5px 12px;
}

.modal-subtitle {
    color: #94a3b8;
    font-size: 0.84rem;
    margin-bottom: 16px;
}

.workshop-bank-banner {
    background: #1e1b4b;
    border: 1px solid #c084fc;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.workshop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.workshop-card {
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
}

.workshop-card h3 {
    color: #f8fafc;
    font-size: 0.95rem;
}

.workshop-card p {
    font-size: 0.78rem;
    color: #cbd5e1;
}

.level-pips {
    display: flex;
    gap: 3px;
}

.pip {
    flex: 1;
    height: 6px;
    background: #0f172a;
    border-radius: 2px;
}

.pip.filled {
    background: #38bdf8;
}

.story-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.story-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 10px;
    padding: 12px 16px;
}

/* Profile & UGC Showcase */
.profile-hero-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #1e293b;
    border: 1px solid #38bdf8;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 14px;
}

.showcase-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 18px 0 6px;
    padding-top: 14px;
    border-top: 1px solid #334155;
}

.showcase-section-header h3 {
    font-size: 1.05rem;
    color: #38bdf8;
}

.ugc-showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 12px;
}

.ugc-card {
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ugc-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ugc-preview-box {
    width: 54px;
    height: 54px;
    border-radius: 8px;
    background: #090d16;
    border: 1px solid #38bdf8;
    object-fit: contain;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.leaderboard-table th, .leaderboard-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #1e293b;
}

.leaderboard-table tbody tr {
    cursor: pointer;
    transition: background 0.12s ease;
}

.leaderboard-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.1);
}

.leaderboard-table th {
    color: #38bdf8;
    border-bottom: 2px solid #334155;
}

.lb-husser-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: #f8fafc;
}

.lb-pfp {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #38bdf8;
    background: #1e293b;
    flex-shrink: 0;
}

.hub-pfp {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #38bdf8;
    background: #0f172a;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 14px 0;
}

.stat-tile {
    background: #1e293b;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #334155;
}

.stat-tile span {
    display: block;
    font-size: 0.68rem;
    color: #94a3b8;
    letter-spacing: 0.5px;
}

.stat-tile strong {
    font-size: 1.05rem;
    color: #38bdf8;
}

.gameover-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.auth-form, .settings-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e293b;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #334155;
    font-size: 0.86rem;
    cursor: pointer;
}

.auth-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.82rem;
    color: #cbd5e1;
}

.auth-form input, .vault-actions-row input[type="text"] {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #475569;
    background: #1e293b;
    color: #f8fafc;
}

.vault-actions-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.vault-actions-row input[type="text"] {
    flex: 1;
    min-width: 180px;
}

.file-import-btn {
    padding: 6px 10px;
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid #475569;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.82rem;
}

.file-import-btn:hover {
    background: #334155;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes panelSlideUp {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.nickname-edit-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.nickname-edit-row input {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #475569;
    background: #1e293b;
    color: #f8fafc;
    font-size: 0.85rem;
}

.cloud-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.cloud-actions-grid button {
    padding: 10px 12px;
}

/* Hill Climb Racing Style Dual Mobile Touch Pedals */
.mobile-pedals {
    display: none;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    pointer-events: none;
    margin-top: auto;
    padding-bottom: 4px;
}

.pedal-btn {
    pointer-events: auto;
    width: 148px;
    height: 92px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(15, 23, 42, 0.82);
    border: 2px solid #475569;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.55);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.pedal-left { border-color: #38bdf8; }
.pedal-right { border-color: #facc15; }

.pedal-btn.pressed, .pedal-btn:active {
    transform: scale(0.93) translateY(3px);
    background: rgba(2, 132, 199, 0.45);
}

.pedal-right.pressed, .pedal-right:active {
    background: rgba(234, 179, 8, 0.42);
}

.pedal-title {
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    color: #f8fafc;
}

.pedal-sub {
    font-size: 0.65rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.5px;
}

@media (pointer: coarse), (max-width: 960px) {
    .hud-container {
        height: 100dvh;
        padding: 14px 16px max(14px, env(safe-area-inset-bottom));
    }
    .mobile-pedals {
        display: flex;
        gap: 14px;
        z-index: 18;
    }
    .hud-controls-hint {
        display: none;
    }
    /* Stack Stamina & Boost bars cleanly above the touch pedals with equal left/right margins */
    .hud-fuel-wrap {
        bottom: 104px;
        left: 16px;
        right: 16px;
        width: auto;
        min-width: 0;
        padding: 0;
    }
    /* Lift Alert Banner above the Stamina & Boost bars so they never collide */
    .screen-alert-banner {
        bottom: 198px;
        width: calc(100vw - 28px);
        white-space: normal;
    }
}

@media (max-width: 900px) {
    .gd-title { font-size: 3rem; }
    .gd-title-logo { width: 145px; height: 145px; margin-top: 0; }
    .gd-primary-deck { grid-template-columns: 1fr; gap: 10px; }
    .gd-card-btn { padding: 14px 16px; }
    .gd-center-play-btn { padding: 18px 16px; }
    .menu-corner-scrap { bottom: 12px; right: 14px; padding: 7px 14px; font-size: 0.82rem; }
    .story-campaign-layout { grid-template-columns: 1fr; overflow-y: auto; }
    .story-screen-container { height: 94dvh; padding: 16px; }
    .hub-bar { height: auto; min-height: 48px; padding: 6px 12px; flex-wrap: wrap; gap: 6px; }
    .hub-left, .hub-right { flex-wrap: wrap; gap: 6px; }
    .ui-panel { left: 12px; top: 62px; width: calc(100vw - 24px); max-width: 390px; padding: 14px; }
    .scene-bar { top: auto; bottom: 12px; right: 12px; left: 12px; justify-content: center; }
    .pdn-window { left: 12px; top: 80px; width: calc(100vw - 24px); max-width: 380px; }

    .hud-top { gap: 8px; flex-wrap: nowrap; }
    .hud-stat-box { min-width: 0; padding: 0; }
    .scrap-value { font-size: 1.35rem; margin-bottom: 2px; }
    .hud-value { font-size: 1.65rem; }
    .telemetry-header { gap: 8px; flex-wrap: wrap; }
    .peak-sub-label { font-size: 0.68rem; }

    /* Story Mode progress bar sits cleanly below the top telemetry row in portrait */
    .race-progress-wrap {
        position: absolute;
        top: 108px;
        left: 16px;
        right: 16px;
        max-width: none;
    }

    /* Full-width Stamina & Boost bars perched above the pedals */
    .hud-fuel-wrap {
        bottom: 102px;
        left: 16px;
        right: 16px;
        width: auto;
        min-width: 0;
        padding: 0;
    }
    .fuel-bar-bg, .dash-bar-bg {
        height: 18px;
        border-width: 2px;
    }
    .hud-dash-header {
        margin-top: 6px;
    }

    /* Alert text sits in the open space above the Stamina bar */
    .screen-alert-banner {
        bottom: 188px;
    }
    .alert-title { font-size: 1.02rem; }
    .alert-sub { font-size: 1.35rem; }

    /* Ergonomic thumb-zone pedals on bottom-left and bottom-right */
    .pedal-btn {
        flex: 1;
        max-width: 156px;
        height: 74px;
        border-radius: 14px;
        background: rgba(15, 23, 42, 0.68);
        backdrop-filter: blur(4px);
    }
    .pedal-title { font-size: 1.15rem; }
    .workshop-grid { grid-template-columns: 1fr; }
}

@media (max-height: 540px) and (orientation: landscape) {
    .gd-title { font-size: 2.3rem; }
    .gd-title-logo { width: 110px; height: 110px; margin-top: 0; }
    .gd-primary-deck { grid-template-columns: 1fr 1.2fr 1fr; gap: 10px; }
    .gd-card-btn { padding: 12px; }
    .hud-container { padding: 10px 18px max(10px, env(safe-area-inset-bottom)); }
    .hud-top { flex-wrap: nowrap; }
    .race-progress-wrap { position: static; max-width: 280px; }

    /* In landscape, place Stamina & Boost bars centered between the left and right pedals */
    .hud-fuel-wrap {
        bottom: 12px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: calc(100vw - 320px);
        max-width: 340px;
        min-width: 180px;
        padding: 0;
    }
    .fuel-bar-bg, .dash-bar-bg { height: 16px; }
    .pedal-btn { width: 132px; max-width: 132px; height: 68px; }
    .screen-alert-banner { bottom: 92px; padding: 0; }
}