/* ===== RESET & CSS VARIABLES ===== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-panel: rgba(18, 18, 26, 0.95);
    --neon-green: #00ff88;
    --neon-green-dim: #00cc66;
    --neon-red: #ff3366;
    --neon-red-dim: #cc2952;
    --neon-blue: #00aaff;
    --neon-purple: #aa44ff;
    --neon-yellow: #ffdd00;
    --neon-cyan: #00ffcc;
    --neon-orange: #ff8800;
    --pepe-green: #4CAF50;
    --text-primary: #e0e0e0;
    --text-muted: #666;
    --font-mono: 'Courier New', monospace;
    --glow-green: 0 0 10px rgba(0, 255, 136, 0.4);
    --glow-red: 0 0 10px rgba(255, 51, 102, 0.4);
    --glow-blue: 0 0 10px rgba(0, 170, 255, 0.4);
    --border-radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-mono);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background:
        radial-gradient(circle at 20% 80%, rgba(0, 255, 136, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(170, 68, 255, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(0, 170, 255, 0.04) 0%, transparent 50%);
    animation: bgPulse 15s ease-in-out infinite;
    z-index: -2;
}

@keyframes bgPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* ===== MATRIX RAIN ===== */
.matrix-rain {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.08;
}

/* ===== SCREENS ===== */
#startScreen, #alreadyPlayedScreen {
    text-align: center;
    padding: clamp(20px, 3vw, 30px);
    width: min(95%, 800px);
    max-height: 92vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-secondary);
    border: 2px solid rgba(0, 255, 136, 0.3);
    border-radius: var(--border-radius);
    position: relative;
    backdrop-filter: blur(15px);
    animation: float 4s ease-in-out infinite;
    box-shadow: 0 10px 60px rgba(0, 255, 136, 0.15), 0 0 120px rgba(170, 68, 255, 0.08),
                inset 0 0 60px rgba(0, 255, 136, 0.03);
}

#alreadyPlayedScreen { display: none; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

#startScreen h1, #alreadyPlayedScreen h1 {
    font-size: clamp(1.2rem, 3vw + 0.4rem, 2.2rem);
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--neon-green), var(--neon-purple), var(--neon-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: hueShift 6s linear infinite;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@keyframes hueShift {
    from { filter: hue-rotate(0deg); }
    to { filter: hue-rotate(360deg); }
}

.pepe-logo-img {
    width: clamp(80px, 12vw, 130px);
    height: auto;
    margin: 8px 0;
    display: block;
    margin-left: auto;
    margin-right: auto;
    animation: bounce 2s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(0, 255, 136, 0.6));
}

@keyframes bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-12px) scale(1.05); }
}

.description {
    margin: 15px 0;
    line-height: 1.6;
    font-size: clamp(0.85rem, 2vw, 1.05rem);
    color: var(--text-primary);
    opacity: 0.9;
}

/* Challenge date display */
.challenge-date {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: var(--neon-cyan);
    margin: 10px 0;
    text-shadow: 0 0 8px rgba(0, 255, 204, 0.5);
}

/* Player stats bar */
.player-stats {
    display: none;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 10px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.info-box {
    padding: clamp(14px, 2.5vw, 20px);
    margin: 12px 0;
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
    text-align: left;
}

.info-box.goal {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 100, 0, 0.05));
    border: 1.5px solid rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.1);
}

.info-box.goal::before {
    content: '\ud83d\udc38';
    position: absolute;
    font-size: 80px;
    opacity: 0.07;
    right: -10px; top: -15px;
    animation: rotate 12s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.info-box.controls-info {
    background: linear-gradient(135deg, rgba(0, 170, 255, 0.1), rgba(0, 200, 255, 0.05));
    border: 1.5px solid rgba(0, 170, 255, 0.4);
    box-shadow: 0 0 25px rgba(0, 170, 255, 0.1);
}

.info-box h3 {
    margin-bottom: 10px;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    text-align: center;
}

.info-box.goal h3 { color: #ffd700; text-shadow: 0 0 8px rgba(255, 215, 0, 0.5); }
.info-box.controls-info h3 { color: var(--neon-blue); text-shadow: 0 0 8px rgba(0, 170, 255, 0.5); }

.info-box p {
    margin: 4px 0;
    font-size: clamp(0.8rem, 2vw, 0.95rem);
    line-height: 1.5;
    color: rgba(255,255,255,0.85);
}

/* Start button */
.start-button {
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    padding: clamp(12px, 2vh, 16px) clamp(30px, 5vw, 50px);
    background: linear-gradient(135deg, var(--neon-green), var(--neon-green-dim));
    color: #000;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    font-family: var(--font-mono);
    margin-top: 18px;
    transition: all 0.3s;
    box-shadow: 0 5px 25px rgba(0, 255, 136, 0.3);
    text-transform: uppercase;
    letter-spacing: 2px;
    touch-action: manipulation;
}

.start-button:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 0 10px 40px rgba(0, 255, 136, 0.5);
    background: linear-gradient(135deg, #00ffaa, var(--neon-yellow));
}

/* ===== GAME SCREEN ===== */
#gameScreen {
    display: none;
    width: 100%;
    min-height: 100vh;
    padding: clamp(6px, 1.2vw, 12px);
    background: var(--bg-primary);
    overflow-y: auto;
}

/* ===== HEADER STATS BAR ===== */
.header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: clamp(4px, 1vw, 8px);
    padding: clamp(6px, 1.2vw, 10px);
    background: var(--bg-panel);
    border: 1.5px solid rgba(0, 255, 136, 0.25);
    border-radius: var(--border-radius);
    margin-bottom: clamp(6px, 1vw, 10px);
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.08);
}

.stat {
    text-align: center;
    padding: clamp(4px, 1vw, 8px);
    background: rgba(0, 255, 136, 0.03);
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 136, 0.15);
    transition: all 0.3s;
}

.stat:hover { background: rgba(0, 255, 136, 0.07); }

.stat-label {
    font-size: clamp(0.55rem, 1.2vw, 0.75rem);
    color: var(--text-muted);
    display: block;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: clamp(0.8rem, 1.8vw, 1.1rem);
    font-weight: bold;
    color: var(--neon-green);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pepe mood indicator */
.pepe-mood {
    text-align: center;
    line-height: 1;
}

.pepe-mood img {
    width: clamp(32px, 4vw, 48px);
    height: auto;
    transition: transform 0.3s;
}

.pepe-mood img:hover {
    transform: scale(1.2);
}

/* ===== NEWS TICKER ===== */
.news-ticker {
    background: var(--bg-panel);
    border: 1.5px solid rgba(255, 221, 0, 0.3);
    border-radius: var(--border-radius);
    padding: 6px 12px;
    margin-bottom: clamp(6px, 1vw, 10px);
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    height: 28px;
    display: flex;
    align-items: center;
}

.news-ticker .ticker-label {
    color: var(--neon-yellow);
    font-weight: bold;
    font-size: 0.75rem;
    margin-right: 10px;
    flex-shrink: 0;
    text-shadow: 0 0 5px rgba(255, 221, 0, 0.5);
}

.news-ticker .ticker-content {
    display: inline-block;
    animation: tickerScroll 20s linear infinite;
    font-size: 0.8rem;
    color: var(--text-primary);
}

@keyframes tickerScroll {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* ===== MAIN GAME LAYOUT ===== */
.game-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(6px, 1vw, 10px);
}

/* ===== CHART AREA ===== */
.chart-area {
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 0.8vw, 6px);
}

.chart-container {
    height: clamp(200px, 32vh, 420px);
    min-height: 200px;
    background: linear-gradient(180deg, rgba(12, 12, 20, 0.98), rgba(6, 6, 12, 0.98));
    border: 1.5px solid rgba(0, 255, 136, 0.2);
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 40px rgba(0, 255, 136, 0.03);
}

.chart-container canvas { width: 100%; height: 100%; display: block; }

.chart-overlay {
    position: absolute;
    top: 6px; left: 8px;
    font-size: 0.7rem;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 2;
}

.chart-overlay .price-display {
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    font-weight: bold;
    color: var(--neon-green);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.chart-overlay .price-change {
    font-size: clamp(0.7rem, 1.5vw, 0.85rem);
    margin-left: 8px;
}

.sub-chart {
    height: clamp(50px, 8vh, 80px);
    background: rgba(12, 12, 20, 0.95);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.sub-chart canvas { width: 100%; height: 100%; display: block; }

.sub-chart-label {
    position: absolute;
    top: 3px; left: 6px;
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 2;
    pointer-events: none;
}

/* ===== SIDEBAR PANELS ===== */
.sidebar-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(4px, 0.8vw, 8px);
}

.panel {
    background: var(--bg-panel);
    border: 1.5px solid rgba(0, 255, 136, 0.15);
    border-radius: var(--border-radius);
    overflow: hidden;
    max-height: clamp(180px, 25vh, 280px);
}

.panel-header {
    padding: 6px 10px;
    background: rgba(0, 255, 136, 0.05);
    border-bottom: 1px solid rgba(0, 255, 136, 0.15);
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--neon-green);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.panel-body {
    overflow-y: auto;
    max-height: calc(100% - 30px);
    font-size: 0.7rem;
}

.panel-body::-webkit-scrollbar { width: 3px; }
.panel-body::-webkit-scrollbar-thumb { background: rgba(0, 255, 136, 0.3); border-radius: 3px; }

/* Order Book */
.orderbook-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 2px 6px;
    font-size: 0.65rem;
    position: relative;
}

.orderbook-row.ask { color: var(--neon-red); }
.orderbook-row.bid { color: var(--neon-green); }
.orderbook-row.spread {
    color: var(--text-muted);
    text-align: center;
    padding: 3px 6px;
    background: rgba(255, 255, 255, 0.03);
    font-weight: bold;
}

.orderbook-row .depth-bar {
    position: absolute;
    top: 0; height: 100%;
    opacity: 0.08;
    z-index: 0;
}

.orderbook-row.ask .depth-bar { right: 0; background: var(--neon-red); }
.orderbook-row.bid .depth-bar { left: 0; background: var(--neon-green); }
.orderbook-row span { position: relative; z-index: 1; }

/* Trade History */
.trade-log-entry {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 6px;
    padding: 4px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.65rem;
    align-items: center;
}

.trade-log-entry .trade-type {
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.6rem;
}

.trade-log-entry .trade-type.long { background: rgba(0, 255, 136, 0.2); color: var(--neon-green); }
.trade-log-entry .trade-type.short { background: rgba(255, 51, 102, 0.2); color: var(--neon-red); }

/* ===== CONTROLS PANEL ===== */
.controls-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: clamp(6px, 1vw, 10px);
    padding: clamp(8px, 1.5vw, 12px);
    background: var(--bg-panel);
    border: 1.5px solid rgba(0, 255, 136, 0.2);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.05);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: clamp(8px, 1.5vw, 12px);
    background: rgba(0, 255, 136, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 136, 0.12);
}

.control-group label, .control-group .group-label {
    font-size: clamp(0.75rem, 1.5vw, 0.85rem);
    color: var(--neon-green);
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.3);
    text-align: center;
}

/* Slider */
.position-slider {
    width: 100%;
    height: 6px;
    background: #222;
    outline: none;
    border-radius: 3px;
    cursor: pointer;
    -webkit-appearance: none;
}

.position-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    background: var(--neon-green);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px var(--neon-green);
}

.position-slider::-moz-range-thumb {
    width: 18px; height: 18px;
    background: var(--neon-green);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px var(--neon-green);
}

.size-display {
    font-size: clamp(0.9rem, 2vw, 1.15rem);
    color: var(--neon-yellow);
    text-align: center;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255, 221, 0, 0.4);
}

/* Button grids */
.btn-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.lev-btn, .speed-btn {
    padding: clamp(5px, 1vw, 8px);
    background: rgba(30, 30, 40, 0.9);
    color: var(--neon-green);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
    font-size: clamp(0.65rem, 1.3vw, 0.8rem);
    font-family: var(--font-mono);
    text-align: center;
    touch-action: manipulation;
    min-height: 28px;
}

.lev-btn:hover, .speed-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.4);
}

.lev-btn.active {
    background: linear-gradient(135deg, var(--neon-green), var(--neon-green-dim));
    color: #000;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

.speed-btn.active {
    background: linear-gradient(135deg, var(--neon-blue), #0088cc);
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.5);
    border-color: var(--neon-blue);
}

/* Risk Management */
.risk-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
}

.risk-row input[type="checkbox"] {
    width: 16px; height: 16px;
    cursor: pointer;
    accent-color: var(--neon-green);
}

.risk-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    background: #333;
    border-radius: 2px;
    cursor: pointer;
}

.risk-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    background: var(--neon-red);
    border-radius: 50%;
    cursor: pointer;
}

.risk-row .risk-val {
    color: var(--neon-yellow);
    font-weight: bold;
    min-width: 30px;
    text-align: right;
}

/* Trade Buttons */
.trade-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(6px, 1.5vw, 10px);
}

.trade-btn {
    padding: clamp(10px, 2vw, 14px);
    font-size: clamp(0.85rem, 1.8vw, 1rem);
    font-weight: bold;
    font-family: var(--font-mono);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    min-height: 42px;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.trade-btn .shortcut {
    font-size: 0.6rem;
    opacity: 0.6;
    font-weight: normal;
}

.long-btn {
    background: linear-gradient(135deg, var(--neon-green), var(--neon-green-dim));
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
}

.short-btn {
    background: linear-gradient(135deg, var(--neon-red), var(--neon-red-dim));
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 51, 102, 0.3);
}

.close-btn {
    background: linear-gradient(135deg, var(--neon-yellow), var(--neon-orange));
    color: #000;
    box-shadow: 0 4px 15px rgba(255, 221, 0, 0.3);
    grid-column: 1 / -1;
}

.trade-btn:hover {
    transform: scale(1.03) translateY(-2px);
    filter: brightness(1.1);
}

.trade-btn:active { transform: scale(0.98); }

/* ===== END GAME BUTTON ===== */
.end-game-btn {
    padding: clamp(10px, 2vw, 14px);
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-weight: bold;
    font-family: var(--font-mono);
    background: linear-gradient(135deg, var(--neon-purple), #7722cc);
    color: #fff;
    border: 2px solid var(--neon-purple);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    touch-action: manipulation;
    width: 100%;
    margin-top: 8px;
    box-shadow: 0 4px 20px rgba(170, 68, 255, 0.3);
    animation: endGamePulse 2s ease-in-out infinite;
}

@keyframes endGamePulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(170, 68, 255, 0.3); }
    50% { box-shadow: 0 4px 30px rgba(170, 68, 255, 0.6); }
}

.end-game-btn:hover {
    transform: scale(1.03) translateY(-2px);
    box-shadow: 0 8px 35px rgba(170, 68, 255, 0.5);
}

.end-game-btn.confirm-pulse {
    background: linear-gradient(135deg, var(--neon-red), #cc2222);
    border-color: var(--neon-red);
    animation: confirmPulse 0.5s ease-in-out infinite alternate;
}

@keyframes confirmPulse {
    from { box-shadow: 0 0 10px rgba(255, 51, 102, 0.4); }
    to { box-shadow: 0 0 25px rgba(255, 51, 102, 0.8); }
}

/* ===== MIDNIGHT COUNTDOWN BAR ===== */
.midnight-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 12px;
    background: rgba(170, 68, 255, 0.1);
    border: 1px solid rgba(170, 68, 255, 0.3);
    border-radius: 6px;
    font-size: 0.7rem;
    color: var(--neon-purple);
    margin-bottom: clamp(6px, 1vw, 10px);
}

.midnight-bar .countdown {
    font-weight: bold;
    color: var(--neon-cyan);
}

/* ===== POSITION INFO ===== */
.position-info {
    padding: clamp(10px, 2vw, 16px);
    background: var(--bg-panel);
    border: 1.5px solid var(--neon-purple);
    border-radius: var(--border-radius);
    margin-top: clamp(6px, 1vw, 10px);
    box-shadow: 0 4px 20px rgba(170, 68, 255, 0.1);
}

.position-info h3 {
    text-align: center;
    color: var(--neon-purple);
    font-size: 0.9rem;
    margin-bottom: 8px;
    text-shadow: 0 0 8px rgba(170, 68, 255, 0.5);
}

.position-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.position-stat {
    padding: 6px 8px;
    background: rgba(170, 68, 255, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(170, 68, 255, 0.2);
    text-align: center;
}

.profit { color: var(--neon-green) !important; text-shadow: 0 0 8px rgba(0, 255, 136, 0.5); }
.loss { color: var(--neon-red) !important; text-shadow: 0 0 8px rgba(255, 51, 102, 0.5); }

/* ===== SENTIMENT GAUGE ===== */
.sentiment-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-panel);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-radius: var(--border-radius);
}

.sentiment-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    white-space: nowrap;
}

.sentiment-bar {
    flex: 1;
    height: 8px;
    background: linear-gradient(to right, var(--neon-red), var(--neon-yellow), var(--neon-green));
    border-radius: 4px;
    position: relative;
    min-width: 60px;
}

.sentiment-needle {
    position: absolute;
    top: -3px;
    width: 4px;
    height: 14px;
    background: #fff;
    border-radius: 2px;
    transition: left 0.5s ease;
    box-shadow: 0 0 6px #fff;
}

.sentiment-text {
    font-size: 0.65rem;
    font-weight: bold;
    min-width: 50px;
    text-align: right;
}

/* ===== NOTIFICATION ===== */
#notification {
    position: fixed;
    top: 15px; left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--bg-panel);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    border: 1.5px solid var(--neon-orange);
    box-shadow: 0 5px 30px rgba(255, 136, 0, 0.3);
    z-index: 1000;
    font-size: 0.9rem;
    font-weight: bold;
    text-align: center;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 90%;
}

#notification.show { transform: translateX(-50%) translateY(0); }

/* Achievement Toast */
.achievement-toast {
    position: fixed;
    bottom: 20px; right: 20px;
    background: var(--bg-panel);
    border: 2px solid var(--neon-yellow);
    border-radius: var(--border-radius);
    padding: 12px 20px;
    z-index: 999;
    animation: achievementIn 0.5s ease, achievementOut 0.5s ease 3s forwards;
    box-shadow: 0 5px 30px rgba(255, 221, 0, 0.3);
    max-width: 280px;
}

.achievement-toast .ach-title {
    color: var(--neon-yellow);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.achievement-toast .ach-name {
    font-size: 1.1rem;
    margin-top: 4px;
}

@keyframes achievementIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes achievementOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* ===== END SCREEN ===== */
#endScreen {
    display: none;
    text-align: center;
    padding: clamp(20px, 4vw, 35px);
    width: min(95%, 650px);
    max-height: 92vh;
    overflow-y: auto;
    background: var(--bg-panel);
    border: 2px solid var(--neon-yellow);
    border-radius: var(--border-radius);
    backdrop-filter: blur(15px);
    box-shadow: 0 10px 60px rgba(255, 221, 0, 0.2);
    animation: endScreenGlow 2s ease-in-out infinite;
}

@keyframes endScreenGlow {
    0%, 100% { box-shadow: 0 10px 50px rgba(255, 221, 0, 0.2); }
    50% { box-shadow: 0 20px 80px rgba(255, 221, 0, 0.35); }
}

#endScreen h2 {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--neon-yellow), var(--neon-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.final-stats {
    margin: 20px 0;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    line-height: 1.8;
    color: var(--text-primary);
}

.final-stats strong { color: var(--neon-yellow); }

.achievement-badge {
    display: inline-block;
    margin: 5px;
    padding: 6px 14px;
    background: rgba(255, 221, 0, 0.1);
    border: 1.5px solid rgba(255, 221, 0, 0.4);
    border-radius: 20px;
    font-size: clamp(0.85rem, 1.8vw, 1rem);
}

/* Share buttons */
.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

.share-btn {
    padding: 10px 20px;
    border: 2px solid var(--neon-cyan);
    border-radius: 20px;
    background: rgba(0, 255, 204, 0.1);
    color: var(--neon-cyan);
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
}

.share-btn:hover {
    background: var(--neon-cyan);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.4);
}

/* Sparkline */
.sparkline-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.sparkline-canvas {
    width: 100%;
    height: 20px;
    display: block;
}

/* Confetti */
#confettiCanvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 998;
}

/* Analytics */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin: 15px 0;
    text-align: center;
}

.analytics-card {
    padding: 10px;
    background: rgba(0, 170, 255, 0.08);
    border: 1px solid rgba(0, 170, 255, 0.25);
    border-radius: 8px;
}

.analytics-card .a-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.analytics-card .a-value {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-weight: bold;
    color: var(--neon-cyan);
    margin-top: 3px;
}

.pnl-distribution {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    height: 50px;
    margin: 10px auto;
    max-width: 400px;
}

.pnl-bar {
    flex: 1;
    max-width: 20px;
    border-radius: 2px 2px 0 0;
    min-height: 2px;
    transition: height 0.3s;
}

/* Audio toggle */
.audio-toggle {
    position: fixed;
    top: 8px; right: 8px;
    background: rgba(30, 30, 40, 0.9);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: var(--neon-green);
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.audio-toggle:hover { box-shadow: 0 0 10px rgba(0, 255, 136, 0.4); }

/* ===== NICKNAME MODAL ===== */
.nickname-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.nickname-modal-content {
    background: var(--bg-panel);
    border: 2px solid var(--neon-green);
    border-radius: var(--border-radius);
    padding: 30px;
    text-align: center;
    width: min(90%, 400px);
    box-shadow: 0 10px 60px rgba(0, 255, 136, 0.2);
}

.nickname-modal-content h2 {
    color: var(--neon-green);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.nickname-modal-content input {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 255, 136, 0.3);
    border-radius: 8px;
    color: var(--neon-green);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    text-align: center;
    outline: none;
    transition: border-color 0.3s;
}

.nickname-modal-content input:focus {
    border-color: var(--neon-green);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

.nickname-modal-content button {
    margin-top: 15px;
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--neon-green), var(--neon-green-dim));
    color: #000;
    border: none;
    border-radius: 20px;
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.nickname-modal-content button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 255, 136, 0.4);
}

/* ===== ALREADY PLAYED SCREEN ===== */
.already-played-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.already-played-stats .stat-card {
    padding: 15px;
    background: rgba(0, 255, 136, 0.05);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: var(--border-radius);
}

/* ===== STREAK DISPLAY ===== */
.streak-display {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    font-size: 0.85rem;
}

.streak-display.visible { display: flex; }

.streak-fire {
    font-size: 1.2rem;
    animation: fireWiggle 0.6s ease-in-out infinite alternate;
}

@keyframes fireWiggle {
    from { transform: rotate(-5deg) scale(1); }
    to { transform: rotate(5deg) scale(1.1); }
}

.streak-count {
    color: var(--neon-orange);
    font-weight: bold;
    font-size: 1.1rem;
}

.streak-best {
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* ===== YESTERDAY TOP 3 ===== */
.yesterday-top3 {
    margin: 12px 0;
    padding: 10px;
    background: rgba(255, 221, 0, 0.05);
    border: 1px solid rgba(255, 221, 0, 0.15);
    border-radius: var(--border-radius);
}

.yt3-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--neon-yellow);
    margin-bottom: 8px;
}

.yt3-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.yt3-entry {
    display: grid;
    grid-template-columns: 30px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
}

.yt3-gold { background: rgba(255, 215, 0, 0.1); }
.yt3-silver { background: rgba(192, 192, 192, 0.08); }
.yt3-bronze { background: rgba(205, 127, 50, 0.08); }

.yt3-rank { text-align: center; }
.yt3-name { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yt3-score { color: var(--neon-green); font-weight: bold; text-align: right; }

/* ===== CHALLENGE BANNER ===== */
.challenge-banner {
    background: linear-gradient(135deg, rgba(255, 136, 0, 0.15), rgba(255, 51, 102, 0.15));
    border: 1px solid var(--neon-orange);
    border-radius: var(--border-radius);
    padding: 12px;
    margin-bottom: 12px;
    text-align: center;
}

.challenge-banner .challenger-name {
    color: var(--neon-orange);
    font-weight: bold;
    font-size: 1rem;
}

.challenge-banner .challenger-score {
    color: var(--neon-green);
    font-weight: bold;
    font-size: 1.3rem;
}

/* ===== FRIEND CHALLENGE ===== */
.challenge-link-section {
    margin: 15px 0;
    padding: 12px;
    background: rgba(0, 170, 255, 0.05);
    border: 1px solid rgba(0, 170, 255, 0.2);
    border-radius: var(--border-radius);
    text-align: center;
}

.challenge-link-section h4 {
    color: var(--neon-cyan);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.challenge-link-url {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.challenge-link-url input {
    flex: 1;
    max-width: 280px;
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid rgba(0, 170, 255, 0.3);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

.challenge-link-url button {
    padding: 6px 12px;
    background: var(--neon-cyan);
    color: var(--bg-primary);
    border: none;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 0.75rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.challenge-link-url button:hover { opacity: 0.8; }

/* ===== LEADERBOARD ===== */
.leaderboard-container {
    width: 100%;
    max-width: 560px;
    margin: 20px auto 0;
}

.leaderboard {
    background: var(--bg-panel);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.lb-title {
    text-align: center;
    font-size: 1rem;
    color: var(--neon-yellow);
    padding: 12px 15px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.lb-trophy-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.lb-crown-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.lb-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lb-tab {
    flex: 1;
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.lb-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.lb-tab.active {
    color: var(--neon-green);
    border-bottom-color: var(--neon-green);
}

.lb-content {
    max-height: 360px;
    overflow-y: auto;
}

.lb-loading, .lb-empty {
    padding: 30px 15px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.lb-player-rank {
    text-align: center;
    padding: 8px 15px;
    font-size: 0.8rem;
    color: var(--neon-cyan);
    background: rgba(0, 255, 204, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.lb-table {
    width: 100%;
}

.lb-header-row {
    display: grid;
    grid-template-columns: 40px 1fr 80px 55px 50px;
    padding: 6px 12px;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.lb-row {
    display: grid;
    grid-template-columns: 40px 1fr 80px 55px 50px;
    padding: 7px 12px;
    font-size: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.15s;
}

.lb-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.lb-row-me {
    background: rgba(0, 255, 136, 0.08) !important;
    border-left: 3px solid var(--neon-green);
}

.lb-row-top1 .lb-col-name { color: var(--neon-yellow); font-weight: bold; }
.lb-row-top2 .lb-col-name { color: #c0c0c0; }
.lb-row-top3 .lb-col-name { color: #cd7f32; }

.lb-col-rank { text-align: center; }
.lb-col-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-col-score { text-align: right; color: var(--neon-green); font-weight: bold; }
.lb-col-trades { text-align: center; color: var(--text-muted); }
.lb-col-wr { text-align: center; color: var(--text-muted); }

.lb-you {
    color: var(--neon-cyan);
    font-size: 0.65rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .sidebar-panels { grid-template-columns: 1fr; }
    .panel { max-height: 150px; }
    .controls-panel { grid-template-columns: 1fr; }
    .header { grid-template-columns: repeat(3, 1fr); }
    .btn-grid { grid-template-columns: repeat(4, 1fr); }
    .chart-container { height: clamp(180px, 28vh, 260px); }
    .already-played-stats { grid-template-columns: 1fr; }
    .lb-header-row, .lb-row { grid-template-columns: 32px 1fr 70px 45px 45px; font-size: 0.7rem; }
    .lb-col-trades, .lb-col-wr { font-size: 0.65rem; }
}

@media (min-width: 601px) and (max-width: 1024px) {
    .controls-panel { grid-template-columns: repeat(2, 1fr); }
    .header { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1025px) {
    .game-layout {
        grid-template-columns: 1fr 340px;
    }
    .header { grid-template-columns: repeat(8, 1fr); }
}

/* ── Oddsynapse promo links ─────────────────────────────────────── */
.oddsynapse-promo {
    margin-top: 28px;
}
.oddsynapse-promo a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: clamp(10px, 1.8vh, 14px) clamp(28px, 4.5vw, 44px);
    background: rgba(0, 255, 136, 0.04);
    border: 1px solid rgba(0, 255, 136, 0.12);
    border-radius: 30px;
    color: rgba(0, 255, 136, 0.3);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: clamp(0.6rem, 1.5vw, 0.75rem);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 5px 25px rgba(0, 255, 136, 0.04);
    transition: all 0.3s;
}
.oddsynapse-promo a:hover {
    background: rgba(0, 255, 136, 0.08);
    border-color: rgba(0, 255, 136, 0.25);
    color: rgba(0, 255, 136, 0.55);
    box-shadow: 0 8px 32px rgba(0, 255, 136, 0.1);
}
.oddsynapse-promo a strong {
    color: inherit;
}
.oddsynapse-promo--end {
    margin-top: 24px;
}
.promo-arrow {
    font-size: 0.9rem;
}

/* ── Leaderboard oddsynapse footer link ─────────────────────────────────── */
.lb-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 255, 136, 0.08);
    text-align: center;
}
.lb-oddsynapse-link {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: rgba(0, 255, 136, 0.35);
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}
.lb-oddsynapse-link:hover {
    color: rgba(0, 255, 136, 0.7);
}
.lb-oddsynapse-link strong {
    color: inherit;
}
