:root {
    --cyan: #00f2ff;
    --pink: #ff007b;
    --purple: #bc13fe;
    --yellow: #ffea00;
    --white: #ffffff;
    --dark: #02040a;
    --glass: rgba(10, 15, 30, 0.7);
    --glass-bright: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: default;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--dark);
    color: var(--white);
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

h1,
h2,
h3,
.hud-value,
.btn {
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(to bottom, #050810, #0a1128);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* --- HUD LUXURY --- */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    padding: 30px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hud-top,
.hud-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.glass-panel {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-bright);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.hud-label {
    display: block;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
}

.hud-value {
    font-size: 20px;
    font-weight: 900;
    color: var(--cyan);
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.4);
}

.hud-center {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

#combo-display {
    text-align: center;
    animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#combo-multiplier {
    display: block;
    font-size: 48px;
    font-weight: 900;
    color: var(--pink);
    text-shadow: 0 0 20px var(--pink);
    font-family: 'Orbitron';
}

.combo-label {
    font-size: 12px;
    letter-spacing: 4px;
}

.resource-panel {
    width: 250px;
}

.resource-row {
    margin-bottom: 15px;
}

.resource-row:last-child {
    margin-bottom: 0;
}

.bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 5px;
}

.bar {
    height: 100%;
    width: 100%;
    transition: width 0.3s ease;
}

.glow-cyan {
    background: var(--cyan);
    box-shadow: 0 0 10px var(--cyan);
}

.glow-pink {
    background: var(--pink);
    box-shadow: 0 0 10px var(--pink);
}

.glow-yellow {
    background: var(--yellow);
    box-shadow: 0 0 10px var(--yellow);
}

/* --- BUTTONS & SCREENS --- */
#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.splash-content {
    text-align: center;
    max-width: 800px;
}

#splash-ship {
    width: 300px;
    margin-bottom: 40px;
    filter: drop-shadow(0 0 30px rgba(0, 242, 255, 0.4));
}

.animated-float {
    animation: float 4s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

.premium-title {
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 900;
    color: var(--white);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2), 0 0 40px var(--cyan);
    margin-bottom: 10px;
}

.premium-subtitle {
    font-size: 14px;
    letter-spacing: 6px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 60px;
}

.action-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

/* Spectacular "Jor Dar" Buttons */
.luxury-btn {
    position: relative;
    padding: 15px 45px;
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--white);
    background: rgba(0, 242, 255, 0.1);
    border: none;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    clip-path: polygon(15% 0%, 100% 0%, 100% 70%, 85% 100%, 0% 100%, 0% 30%);
    border-left: 3px solid var(--cyan);
    backdrop-filter: blur(5px);
}

.luxury-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.luxury-btn:hover:before {
    left: 100%;
}

.luxury-btn:hover {
    background: rgba(0, 242, 255, 0.3);
    transform: translateY(-5px) scale(1.05);
    box-shadow: -10px 10px 30px rgba(0, 242, 255, 0.4);
    letter-spacing: 5px;
}

.luxury-btn.glow-cyan {
    border-left: 4px solid var(--cyan);
    box-shadow: -5px 5px 15px rgba(0, 242, 255, 0.2);
}

.luxury-btn.outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 3px solid var(--pink);
}

.luxury-btn.outline:hover {
    border-color: var(--pink);
    box-shadow: -10px 10px 30px rgba(255, 0, 123, 0.3);
}

/* Luxury Card / Tutorial */
.luxury-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-bright);
    padding: 50px;
    border-radius: 20px;
    max-width: 900px;
    width: 90%;
    text-align: center;
}

.card-title {
    font-size: 28px;
    margin-bottom: 40px;
    color: var(--cyan);
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 50px;
}

.guide-cell {
    padding: 20px;
}

.icon-box {
    font-size: 40px;
    margin-bottom: 20px;
}

.guide-cell h3 {
    font-size: 14px;
    margin-bottom: 15px;
    color: var(--cyan);
}

.guide-cell p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
}

/* Animations */
@keyframes scaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile Controls */
#mobile-ui {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
}

#joystick-container {
    position: absolute;
    bottom: 60px;
    left: 60px;
    width: 140px;
    height: 140px;
    pointer-events: auto;
}

#joystick-base {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

#joystick-handle {
    width: 60px;
    height: 60px;
    background: var(--cyan);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--cyan);
}

#mobile-fire-btn {
    position: absolute;
    bottom: 60px;
    right: 60px;
    width: 90px;
    height: 90px;
    background: rgba(255, 0, 123, 0.2);
    border: 2px solid var(--pink);
    border-radius: 50%;
    pointer-events: auto;
    box-shadow: 0 0 20px var(--pink);
}

#mobile-fire-btn:active {
    background: var(--pink);
}

/* Transitions */
.loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    margin: 20px auto;
    position: relative;
    overflow: hidden;
}

.loading-bar::after {
    content: '';
    position: absolute;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--cyan);
    animation: loading 2s linear infinite;
}

@keyframes loading {
    to {
        left: 100%;
    }
}

.hidden {
    display: none !important;
}

/* Briefing Grid */
.briefing-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
    text-align: left;
    width: 100%;
}

.brief-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.brief-icon {
    font-size: 24px;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brief-icon.cyan {
    color: var(--cyan);
    text-shadow: 0 0 10px var(--cyan);
}

.brief-icon.pink {
    color: var(--pink);
    text-shadow: 0 0 10px var(--pink);
}

.brief-icon.yellow {
    color: var(--yellow);
    text-shadow: 0 0 10px var(--yellow);
}

.brief-text h3 {
    font-size: 14px;
    letter-spacing: 2px;
    margin: 0 0 5px 0;
    color: rgba(255, 255, 255, 0.9);
}

.brief-text p {
    font-size: 13px;
    margin: 0;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
}

/* Sector Progress */
.sector-progress-container {
    width: 250px;
    padding: 10px 15px;
}

.progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
}

#sector-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--pink));
    box-shadow: 0 0 10px var(--cyan);
    transition: width 0.3s ease;
}

/* Briefing Boxes */
.briefing-grid {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.brief-box {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left;
}

.brief-icon {
    font-size: 24px;
    min-width: 40px;
    text-align: center;
}

.brief-info h3 {
    font-size: 14px;
    margin: 0;
    color: var(--cyan);
    letter-spacing: 1px;
}

.brief-info p {
    font-size: 12px;
    margin: 5px 0 0 0;
    color: rgba(255, 255, 255, 0.6);
}

/* Combo UI */
#combo-ui {
    z-index: 10;
    pointer-events: none;
    text-align: center;
}

#combo-val {
    font-size: 48px;
    font-weight: 900;
    color: var(--yellow);
    text-shadow: 0 0 20px var(--yellow);
    font-style: italic;
}

.combo-pulse {
    animation: comboPulse 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes comboPulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Landscape Mobile Fix */
@media (max-height: 500px) {
    #splash-ship {
        display: none;
    }

    .premium-title {
        font-size: 2rem;
        margin-top: 20px;
    }

    .action-stack {
        flex-direction: row;
    }

    .luxury-card {
        padding: 20px;
    }

    .gui-grid {
        gap: 10px;
    }
}

/* Universal Mobile Layout (Forces Vertical Stack on Portrait Phones) */
@media screen and (orientation: portrait),
screen and (max-width: 1024px) {
    #app-container #hud {
        padding: 5px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important;
    }

    #app-container #hud .hud-top {
        position: absolute;
        top: 10px;
        left: 0;
        width: 100%;
        padding: 0 10px;
    }

    #app-container #hud .hud-bottom {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        /* Tuck to the right */
        gap: 6px !important;
        position: absolute !important;
        bottom: 110px !important;
        right: 15px !important;
        width: auto !important;
    }

    #app-container .resource-panel,
    #app-container .status-panel,
    #app-container .sector-progress-container {
        width: 160px !important;
        /* Compact width */
        padding: 5px 10px !important;
        margin: 0 !important;
        border-radius: 4px !important;
        background: rgba(10, 15, 30, 0.85) !important;
        border: 1px solid rgba(0, 242, 255, 0.2) !important;
    }

    #app-container .hud-value {
        font-size: 11px !important;
    }

    #app-container .hud-label {
        font-size: 6px !important;
        margin-bottom: 1px !important;
    }

    #app-container .progress-bar-container {
        height: 4px !important;
    }
}





    /* Layout Utilities Fix */
    .abs-full {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    .center-flex {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .flex-between {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .no-pointer {
        pointer-events: none;
    }

    .abs-center {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }