@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

@font-face {
    font-family: 'NanumSquareNeo';
    src: url('../fonts/NanumSquareNeo-ExtraBold.woff2') format('woff2');
    font-weight: 900;
}

@font-face {
    font-family: 'NanumSquareNeo';
    src: url('../fonts/NanumSquareNeo-Bold.woff2') format('woff2');
    font-weight: bold;
}

@font-face {
    font-family: 'NanumSquareNeo';
    src: url('../fonts/NanumSquareNeo-Regular.woff2') format('woff2');
    font-weight: normal;
}

:root {
    --neon-blue: #00e5ff;
    --neon-green: #00ffa3;
    --neon-red: #ff3c3c;
    --bg-dark: #050a0f;
    --card-bg: rgba(0, 229, 255, 0.05);
    --border-color: rgba(0, 229, 255, 0.15);
    --text-main: #f0ffff;
    --text-dim: rgba(240, 255, 255, 0.6);
    --accent: var(--neon-blue);
}

@keyframes gridMove {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 60px;
    }
}

@keyframes flashRedAnim {
    0% { opacity: 0; background-color: rgba(255, 60, 60, 0); }
    10% { opacity: 1; background-color: rgba(255, 60, 60, 0.4); }
    100% { opacity: 0; background-color: rgba(255, 60, 60, 0); }
}

@keyframes flashGoldAnim {
    0% { opacity: 0; background-color: rgba(255, 215, 0, 0); }
    10% { opacity: 1; background-color: rgba(255, 215, 0, 0.35); }
    100% { opacity: 0; background-color: rgba(255, 215, 0, 0); }
}

@keyframes screenShake {
    0% { transform: scale(1.01) translate(0, 0); }
    10% { transform: scale(1.01) translate(-3px, -3px); }
    20% { transform: scale(1.01) translate(3px, 3px); }
    30% { transform: scale(1.01) translate(-3px, 3px); }
    40% { transform: scale(1.01) translate(3px, -3px); }
    50% { transform: scale(1.01) translate(-3px, -3px); }
    60% { transform: scale(1.01) translate(3px, 3px); }
    70% { transform: scale(1.01) translate(-3px, 3px); }
    80% { transform: scale(1.01) translate(3px, -3px); }
    90% { transform: scale(1.01) translate(-3px, -3px); }
    100% { transform: scale(1) translate(0, 0); }
}

#game-container.shake-effect {
    animation: screenShake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

#hit-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
}

#hit-flash.flash-red {
    animation: flashRedAnim 0.3s ease-out;
}

#hit-flash.flash-gold {
    animation: flashGoldAnim 0.3s ease-out;
}

@keyframes titleBreathing {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.3));
        opacity: 0.85;
    }
    10% {
        transform: scale(1.08); /* First fast pulse */
        filter: drop-shadow(0 0 40px rgba(0, 229, 255, 0.8));
        opacity: 1;
    }
    20% {
        transform: scale(1.03);
        filter: drop-shadow(0 0 20px rgba(0, 229, 255, 0.5));
    }
    30% {
        transform: scale(1.15); /* Second stronger pulse */
        filter: drop-shadow(0 0 60px rgba(0, 229, 255, 1));
        opacity: 1;
    }
}

html,
body {
    margin: 0;
    overflow: hidden;
    overflow-x: hidden;
    /* Hard lock for horizontal scroll */
    background-color: var(--bg-dark);
    font-family: 'NanumSquareNeo', sans-serif;
    touch-action: none;
    user-select: none;
    color: var(--text-main);
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateZ(0); /* Force GPU layer */
    will-change: transform;
}

/* HUD Styles */
#top-right-hud {
    position: absolute;
    top: calc(20px + env(safe-area-inset-top));
    right: 20px;
    text-align: right;
    color: #58a6ff;
    text-shadow: 0 0 10px rgba(88, 166, 255, 0.5);
    pointer-events: none;
    z-index: 10;
}

.price-val {
    font-size: clamp(30px, 6vw, 50px);
    font-weight: 900;
    color: #24292f;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 5px;
    font-family: 'Orbitron', sans-serif;
}

.timer-val {
    font-size: 30px;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
    font-family: 'Orbitron', sans-serif;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    #top-right-hud {
        top: calc(20px + env(safe-area-inset-top)); /* Updated to 20px to match global */
        right: 15px;
    }

    #opponent-hud {
        top: calc(15px + env(safe-area-inset-top));
        left: 15px;
    }

    #realtime-rank-hud {
        top: calc(20px + env(safe-area-inset-top)); /* Updated to 20px to match global */
        left: 15px;
    }

    .price-val {
        font-size: 24px;
        margin-top: 0;
    }

    .timer-val {
        font-size: 30px;
    }

    #dashboard {
        bottom: 125px;
        /* Safely above mobile buttons */
        right: 15px;
        left: 15px;
        width: auto;
        max-height: 110px;
        padding: 12px;
        border-radius: 15px;
    }

    .dash-item {
        font-size: 13px;
        margin-bottom: 3px;
    }

    .btn-start {
        position: relative;
        overflow: hidden;
        transition: transform 0.2s, box-shadow 0.2s;
    }

    .btn-start:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(0, 255, 255, 0.2);
    }

    .btn-start div {
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
        letter-spacing: -0.2px;
    }

    .dash-title {
        font-size: 11px;
        margin-bottom: 5px;
        padding-bottom: 5px;
    }

    .report-container {
        width: 85%;
        padding: 25px;
        margin: 15px 0;
        border-radius: 15px;
    }

    .report-header {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .report-item {
        font-size: 13px;
        padding: 8px 0;
    }

    .report-total {
        font-size: 20px;
        margin-top: 15px;
        padding-top: 15px;
    }
}

/* --- Modern UI Overlays --- */
#start-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, rgba(0, 229, 255, 0.12) 0%, var(--bg-dark) 85%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 1000;
    text-align: center;
    backdrop-filter: blur(15px);
    overflow-y: auto;
    overflow-x: hidden;
}

#start-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: calc(100% - 20px);
    /* No default padding-top here to avoid breaking desktop */
}

@media (max-width: 600px) {
    #start-overlay {
        backdrop-filter: none;
        background: var(--bg-dark); /* Solid background on mobile for speed */
    }
}

#start-overlay::before {
    content: '';
    position: absolute;
    inset: -100px;
    background-image:
        linear-gradient(rgba(0, 229, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 255, 0.08) 1px, transparent 1px);
    background-size: 60px 60px;
    transform: perspective(600px) rotateX(60deg) translateY(-80px);
    animation: gridMove 25s linear infinite;
    z-index: -1;
    opacity: 0.6;
}

h1 {
    font-size: clamp(60px, 15vw, 130px);
    font-weight: 900;
    margin: 0;
    letter-spacing: -6px;
    background: linear-gradient(180deg, #fff 40%, var(--neon-blue) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

.breathing-title {
    animation: titleBreathing 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite;
}

.slogan {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    color: var(--neon-blue);
    letter-spacing: 12px;
    text-transform: uppercase;
    margin: 15px 0 40px 0;
    opacity: 0.9;
    font-weight: 900;
}


.main-message {
    max-width: 550px;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 45px;
}

/* --- Central Stats Dashboard --- */
.central-stats {
    display: flex;
    flex-direction: column;
    /* Stacked vertically for stability */
    align-items: center;
    gap: 30px;
    /* Space between Assets and Battle Record */
    width: 100%;
    max-width: 650px;
    margin-bottom: 45px;
    padding: 35px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, transparent, rgba(0, 255, 255, 0.03), transparent);
}

.central-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.central-val {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(44px, 10vw, 84px);
    /* Slightly tighter default */
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 35px rgba(0, 229, 255, 0.9);
    line-height: 1.1;
    margin: 15px 0;
    font-variant-numeric: tabular-nums;
    /* Critical for stability */
    display: flex;
    /* Allow spans to align perfectly */
    justify-content: center;
}

.central-val span {
    display: inline-block;
    perspective: 1000px;
}

/* Individual Digit Flip */
.digit-flip {
    animation: digitFlip 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes digitFlip {
    0% {
        transform: translateY(0) rotateX(0);
    }

    30% {
        transform: translateY(-3px) rotateX(-45deg);
        opacity: 0.8;
    }

    70% {
        transform: translateY(3px) rotateX(45deg);
        opacity: 0.8;
    }

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

.refill-btn {
    display: none;
    /* Controlled by JS */
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.5);
    color: #ffd700;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: -5px;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.1);
}

.refill-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.2);
}

.refill-btn.visible {
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.central-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    letter-spacing: 4px;
    color: var(--neon-blue);
    margin-top: 8px;
    font-weight: 900;
    opacity: 0.8;
}

/* --- Mode Cards --- */
#mode-select {
    display: flex;
    gap: 25px;
    width: 100%;
    max-width: 800px;
    justify-content: center;
}

.mode-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 35px;
    width: 240px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    text-align: center;
}

.mode-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--neon-blue);
    background: rgba(0, 229, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 229, 255, 0.1);
}

.mode-card h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 30px;
    font-weight: 900;
    margin: 0 0 8px 0;
    color: #fff;
}

.mode-card p {
    font-size: 12px;
    color: var(--text-dim);
    margin: 0;
    line-height: 1.4;
}

.action-label {
    margin-top: 25px;
    font-size: 12px;
    font-weight: 900;
    color: var(--neon-blue);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Ad Frame */
#ad-frame {
    width: 100%;
    height: auto;
    min-height: 30px;
    border-radius: 10px;
    margin: 20px 0;
    border: none;
    background: transparent;
}

/* Common Button Styles */
.btn-start {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    border: 1px solid var(--border-color);
    padding: 15px 40px;
    font-size: 20px;
    font-weight: 900;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-start:hover {
    transform: scale(1.05);
    background: rgba(0, 229, 255, 0.2);
    border-color: var(--neon-blue);
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.2);
}

@media (max-width: 1024px) {
    #start-overlay {
        justify-content: flex-start;
        padding-top: env(safe-area-inset-top); 
        overflow-y: auto;
    }

    #start-overlay::before {
        background-size: 40px 40px;
    }

    #start-welcome {
        padding-top: 20vh; /* 20% of screen height */
        margin-top: 0;
        margin-bottom: 50px;
    }

    #start-welcome h1 {
        font-size: 50px;
        letter-spacing: -2px;
        margin-top: 5vh !important; /* Another 5% push */
        margin-bottom: 20px;
    }

    .slogan {
        font-size: 10px;
        letter-spacing: 5px;
        margin-bottom: 30px;
    }

    .central-stats {
        max-width: 100%;
        padding: 15px 0;
        margin-bottom: 30px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .central-val {
        font-size: clamp(24px, 10vw, 36px);
        /* More aggressive shrink for safety */
    }

    .central-label {
        font-size: 8px;
        letter-spacing: 2px;
    }

    #mode-select {
        flex-direction: row; /* Horizontal alignment */
        align-items: stretch;
        gap: 12px;
        padding: 0 15px;
        max-width: 500px;
    }

    .mode-card {
        flex: 1; /* Equal width */
        width: auto;
        max-width: none;
        padding: 20px 10px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .mode-card h2 {
        font-size: 16px;
        margin-bottom: 5px;
    }

    .mode-card p {
        font-size: 11px;
        line-height: 1.3;
        margin-bottom: 10px;
    }

    .mode-card .action-label {
        font-size: 11px;
    }
}

/* Opponent HUD */
#opponent-hud {
    position: absolute;
    top: 40px;
    left: 40px;
    text-align: left;
    color: #d73a49;
    /* Reddish for rivalry */
    pointer-events: none;
    z-index: 10;
    display: none;
}

.opp-title {
    font-size: 16px;
    font-weight: 900;
    margin-bottom: 5px;
    color: var(--text-dim);
}

.opp-val {
    font-size: clamp(30px, 6vw, 60px);
    font-weight: 900;
    color: #ffdd44;
    /* This was not in the diff, keeping original color for opp-val */
    text-shadow: 0 0 15px #ffdd44;
    /* This was not in the diff, keeping original color for opp-val */
    transition: transform 0.1s;
    font-family: 'Orbitron', sans-serif;
}

/* Lobby Styles (Participation Waiting) - Managed by game.js via #lobby-container */
#lobby-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    /* Inside modal-content glass, so we match inner layout */
}

.link-box {
    background: #fff;
    color: var(--text-dim);
    padding: 12px;
    margin: 10px 0;
    font-family: inherit;
    font-size: 14px;
    user-select: all;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    word-break: break-all;
    max-width: 400px;
}

#mode-select {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}




#upcoming-stock-hud {
    position: fixed;
    top: 35%; /* Moved up between top and center */
    left: 50%;
    transform: translate(-50%, -50%); /* Centered precisely */
    font-size: clamp(60px, 15vw, 120px); /* Slightly smaller for better focus */
    font-weight: 900;
    color: rgba(255, 255, 255, 0.25);
    text-shadow: 0 0 40px rgba(0, 255, 255, 0.4);
    z-index: 1000;
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
    display: none; /* Controlled by JS opacity/display */
    transition: opacity 0.3s;
    will-change: transform, opacity;
}

#buy-count-hud {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 40px;
    font-weight: 900;
    color: var(--accent);
    z-index: 100;
    pointer-events: none;
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
    font-family: 'Orbitron', sans-serif;
    transform: translate3d(-50%, 0, 0); /* Use 3D transform for positioning */
    will-change: transform;
}

/* Dashboard */
#dashboard {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 280px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    pointer-events: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    z-index: 5;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

@media (max-width: 600px) {
    #dashboard {
        backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }
}

.dash-title {
    font-size: 14px;
    color: var(--text-dim);
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    text-transform: uppercase;
}

#dashboard-items {
    flex-grow: 1;
    overflow: hidden;
    color: #3fb950;
    font-size: 18px;
    display: flex;
    flex-direction: column-reverse;
    gap: 5px;
}

.dash-item {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
    animation: slide-up 0.2s;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Controls */
#mobile-controls {
    position: fixed;
    bottom: calc(30px + env(safe-area-inset-bottom)); /* Lowered for better comfort */
    width: 100%;
    display: none; /* Hidden by default, shown via JS during race */
    justify-content: space-between;
    padding: 0 10px; /* Reduced padding to spread buttons to edges */
    box-sizing: border-box;
    z-index: 10000;
    pointer-events: none;
}

#mobile-controls .control-btn {
    pointer-events: auto;
}

@media (pointer: coarse) {
    /* No automatic display: flex here, let JS handle it */
}

.control-btn {
    width: 90px;
    height: 90px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    backdrop-filter: blur(10px);
    -webkit-tap-highlight-color: transparent;
    transition: all 0.1s;
}

.control-btn:active {
    transform: scale(0.92);
    background: rgba(0, 255, 255, 0.2);
    border-color: var(--accent);
}

.control-btn.active {
    background: rgba(0, 255, 255, 0.4);
    transform: scale(0.95);
    box-shadow: 0 0 30px var(--accent);
}

/* UI Overlays */

.overlay-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 64, 64, 0.9);
    backdrop-filter: blur(15px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 200;
    text-align: center;
    color: var(--text-main);
    overflow-y: auto;
    padding: 60px 0;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .overlay-screen {
        backdrop-filter: none;
        background: rgba(0, 48, 48, 1.0);
    }
}



.instructions {
    margin-top: 20px;
    color: #8b949e;
    font-size: 16px;
    line-height: 1.8;
    max-width: 500px;
}

.report-container {
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    background: rgba(0, 64, 64, 0.85);
    border-radius: 15px;
    padding: 30px;
    box-sizing: border-box;
    box-shadow: 0 20px 60px rgba(0, 255, 255, 0.2);
    border: 1px solid var(--border-color);
    margin: 20px 0;
    text-align: left;
}

.report-header {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 20px;
    color: var(--accent);
    border-bottom: 3px solid var(--accent);
    display: inline-block;
    padding-bottom: 5px;
}

/* Base list style */
.report-list {
    flex-grow: 1;
    min-height: 100px;
    margin: 10px 0;
    text-align: left;
    border-top: 1px solid rgba(64, 224, 208, 0.2);
    border-bottom: 1px solid rgba(64, 224, 208, 0.2);
    padding: 10px 0;
    overflow-y: auto;
}

.report-list-content {
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Specialized Scrolling effect for SINGLE PLAYER ONLY */
.scrolling-list {
    min-height: 250px;
    max-height: 350px;
    overflow: hidden !important;
    position: relative;
    perspective: 800px;
    border: none !important;
}

.scrolling-list-content {
    position: absolute;
    width: 100%;
    left: 0;
    top: 50px;
    /* Start a bit lower for better perspective */
    transform-origin: 50% 0%;
}

@keyframes starWarsScroll {
    0% {
        transform: rotateX(25deg) translateY(0);
        opacity: 1;
    }

    100% {
        transform: rotateX(35deg) translateY(-100%) scale(0.8);
        opacity: 0;
    }
}

/* Multi-player specific ranking styles (Isolation) */
.multi-rank-item {
    height: 54px;
    margin: 8px 0;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0;
    /* Removed border-radius */
    background: rgba(255, 255, 255, 0.05);
    font-size: 18px;
    font-weight: 700;
}

.report-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(64, 224, 208, 0.15);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    /* Keeping original margin-bottom for item */
}

.report-item span:last-child {
    font-family: 'Orbitron', sans-serif;
}

.report-total {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--accent);
    display: flex;
    justify-content: space-between;
    font-size: 28px;
    font-weight: 900;
}

#countdown-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle, rgba(13, 17, 23, 0.2) 0%, rgba(13, 17, 23, 0.5) 100%);
    backdrop-filter: blur(4px); /* Toned down blur */
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000; /* Ensure it's above everything */
    padding: 0;
    margin: 0;
}

#countdown-text {
    font-size: clamp(60px, 15vw, 120px); /* Matched to upcoming-stock-hud */
    font-weight: 900;
    color: rgba(255, 255, 255, 0.25); /* Matched transparency */
    text-shadow: 0 0 40px rgba(0, 255, 255, 0.4); /* Matched shadow */
    font-family: 'Orbitron', sans-serif;
    letter-spacing: -2px;
    opacity: 1;
    transform: scale(0.5);
    animation: countdownPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes countdownPop {
    from {
        transform: scale(0.5);
        opacity: 0;
        filter: blur(10px);
    }
    to {
        transform: scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

.countdown-pop {
    animation: none;
    animation: countdownPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
}

/* Premium In-game HUD */
#realtime-rank-hud {
    position: fixed;
    top: calc(20px + env(safe-area-inset-top)); /* Synced with top-right-hud */
    left: 20px;
    z-index: 90;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(35px, 10vw, 80px);
    /* Exact match with .timer-val */
    font-weight: 900;
    line-height: 1;
    margin: 0;
    padding: 0;
    color: var(--accent);
    opacity: 0.7;
    /* Exact match with .timer-val */
    text-shadow: 0 0 10px rgba(88, 166, 255, 0.5);
    /* Exact match with #top-right-hud */
    text-align: left;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    pointer-events: none;
}

#rank-list-content>div {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
}

/* Stylish Start Screen Stats Info */
#start-assets-val,
#start-winrate-val {
    display: block;
    margin-top: 5px;
    font-size: 24px;
    font-weight: 900;
    color: #ffcc00;
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.4);
}

#start-winrate-val {
    font-size: 20px;
    color: #00ffff;
}

/* --- Natural Induction: Info Hub --- */
#info-hub {
    position: relative;
    margin-top: 40px;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 10px;
    gap: 6px;
    transition: all 0.3s ease;
    z-index: 1100;
    width: calc(100% - 40px);
}

#info-hub:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--neon-blue);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 229, 255, 0.1);
}

.user-id-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 700;
    width: calc(100% - 20px);
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--neon-green);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--neon-green);
}

.hub-divider {
    width: 1px;
    height: 15px;
    background: var(--border-color);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: var(--neon-blue);
    text-shadow: 0 0 8px var(--neon-blue);
    transform: rotate(15deg);
}

.gold-btn {
    color: #ffd700 !important;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    font-size: 48px !important;
    position: relative;
    transform: translateY(-18px); /* Precisely aligned to text baseline */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1200;
    padding: 0;
    margin: 0 0 -20px 0;
    animation: trophyWobble 3s ease-in-out infinite;
    display: inline-block;
}

@keyframes trophyWobble {
    0%, 100% { transform: translateY(-18px) rotate(0deg); }
    25% { transform: translateY(-18px) rotate(-8deg); }
    75% { transform: translateY(-18px) rotate(8deg); }
}

.gold-btn:hover {
    color: #fff !important;
    text-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
    transform: translateY(-28px) scale(1.1) rotate(10deg);
}

/* --- UI Modals & Glassmorphism --- */
.ui-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5000;
    /* Extremely High */
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(15px);
    display: none;
    /* Flex when active */
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.glass {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.modal-content {
    width: 100%;
    max-width: 400px;
    border-radius: 24px;
    padding: 24px;
    text-align: center;
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from {
        transform: scale(0.85);
        opacity: 0;
    }

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

.modal-header h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    margin: 0;
    letter-spacing: 2px;
}

.modal-header p {
    font-size: 13px;
    color: var(--text-dim);
    margin: 10px 0 30px 0;
}

/* Leverage Options */
.leverage-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 35px;
}

.lev-option {
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    min-width: 64px;
}

.lev-option.active {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--neon-blue);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.1);
}

.lev-option.active .lev-val {
    color: #fff;
    text-shadow: 0 0 15px var(--neon-blue);
}

.lev-option.locked {
    opacity: 0.5;
    background: rgba(0, 0, 0, 0.2);
}

.lev-val {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    font-weight: 900;
    color: var(--text-dim);
}

.lev-label {
    font-size: 10px;
    letter-spacing: 1px;
    margin-top: 5px;
    font-weight: 700;
    color: var(--text-dim);
}

.lock-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 16px;
}

/* Settings List */
.settings-list {
    margin: 30px 0;
    text-align: left;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.setting-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.setting-text {
    display: flex;
    flex-direction: column;
}

.setting-text span:first-child {
    font-weight: 700;
    font-size: 15px;
}

.item-desc {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 3px;
}

/* Localization Prep: Hide subtitles in English mode */
.lang-en .item-desc {
    display: none;
}

.setting-item i {
    font-size: 12px;
    color: var(--text-dim);
}

/* Buttons */
.btn-primary {
    width: 100%;
    background: var(--neon-blue);
    color: #000;
    border: none;
    padding: 18px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 30px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 229, 255, 0.3);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-dim);
    margin-top: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.btn-text:hover {
    color: var(--text-main);
}

/* Market Insights (PRO) */
.market-insights {
    margin-top: 15px;
    margin-bottom: 80px; /* 안내문 위치를 고려한 충분한 하단 여백 */
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
}

.market-insights-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 900;
    color: #ffd700;
}

.insight-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.insight-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.insight-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.insight-name-container {
    width: 75px;
    overflow: hidden;
    white-space: nowrap;
    margin-right: 10px;
    position: relative;
    flex-shrink: 0;
}

.insight-name-scroll {
    display: inline-block;
    font-weight: 700;
    min-width: 100%;
}

/* Optional: Only animate if we want it constant, or we can trigger via JS if long */
/* For now, let's just allow it to be wider and handle overflow gracefully */

.insight-val {
    font-family: 'Kanit', sans-serif;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
}

@keyframes marqueeInsight {
    0% {
        transform: translateX(0);
    }

    30% {
        transform: translateX(0);
    }

    70% {
        transform: translateX(calc(-100% + 75px));
    }

    100% {
        transform: translateX(0);
    }
}


.val-up {
    color: #ff4d4d;
}

.val-down {
    color: #4d94ff;
}

@media (max-width: 360px) {
    .insight-grid {
        grid-template-columns: 1fr;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Leverage Sub-info Styles */
.lev-info-sub {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.8;
    margin-top: 5px;
    font-family: 'NanumSquareNeo-Regular', sans-serif;
}

.lev-info-tag {
    font-weight: 900;
    font-family: 'Kanit', sans-serif;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 5px;
    font-size: 12px;
}

.tag-red {
    background: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
    border: 1px solid rgba(255, 59, 48, 0.3);
}

.tag-blue {
    background: rgba(0, 122, 255, 0.2);
    color: #007aff;
    border: 1px solid rgba(0, 122, 255, 0.3);
}