`/* Lock the screen to prevent mobile bounce and dragging */
html, body {
    overscroll-behavior: none; /* Stops the pull-to-refresh bounce */
    overflow-x: hidden; /* Stops any side-to-side wiggling */
    width: 100vw;
    position: relative;
}

/* Modern iOS Dark Theme Palette */
:root {
    --bg-base: #000000;
    --bg-panel: #1c1c1e;
    --bg-card: #2c2c2e;
    --text-main: #ffffff;
    --text-secondary: #8e8e93;
    --gold: #d4af37;
    --ios-red: #ff453a;
    --ios-green: #32d74b;
    --ios-red-dark: #5c1b1b;
    --ios-green-dark: #1b4d25;
    --mode-blue: #0a84ff;
    
    /* Dynamic Button Variables */
    --btn-bg: #2c2c2e;
    --btn-text: #ffffff;
}

/* Base Layout & Typography */
body { 
    margin: 0; padding: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    -webkit-font-smoothing: antialiased;
    background-color: var(--bg-base); color: var(--text-main); 
    display: flex; height: 100vh; flex-direction: column; 
}

/* App Wrapper to hold charts and sidebar under the banner */
#app-container {
    display: flex; flex-direction: row; flex: 1; min-height: 0; width: 100%;
}

/* Sidebar & Chart Responsiveness */
#chart-container { flex: 3; height: 100%; border-right: 1px solid #333; display: flex; flex-direction: column; }
.chart-top { flex: 1; width: 100%; position: relative; min-height: 0; }
.chart-bottom { height: 280px; width: 100%; border-top: 1px solid #333; background-color: var(--bg-base); display: flex; flex-direction: column; }

#side-panel { flex: 1; padding: 24px; display: flex; flex-direction: column; background-color: var(--bg-panel); overflow-y: auto; position: relative; }

@media (max-width: 1024px) {
    #app-container { flex-direction: column; height: auto; }
    #chart-container { height: 85vh; width: 100%; border-right: none; border-bottom: 1px solid #333; }
    #side-panel { width: auto; height: auto; padding: 20px; }
    .chart-bottom { height: 250px; }
}

/* Live Viewers Sidebar Badge */
#live-viewers-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid #333;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 10;
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: var(--ios-green);
    border-radius: 50%;
    animation: pulseDot 2s infinite ease-in-out;
}

/* Branding and Headers */
h2 { margin-top: 15px; color: var(--gold); border-bottom: 1px solid #38383a; padding-bottom: 12px; text-align: center; margin-bottom: 15px; font-weight: 600; }
.panel-description { font-size: 13px; color: var(--text-secondary); text-align: center; margin-bottom: 8px; line-height: 1.5; padding: 0 10px; }
.branding-text { font-size: 14px; color: var(--gold); text-align: center; margin-bottom: 24px; font-style: italic; font-weight: 600; }
.news-header { color: var(--text-main); font-size: 13px; font-weight: 600; padding: 8px 15px; border-bottom: 1px solid #333; background: var(--bg-panel); text-transform: uppercase; letter-spacing: 0.5px; }

/* Interactive Elements (2x2 Grid Fixed) */
.top-buttons { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 12px; 
    margin-bottom: 24px; 
}

.ios-btn { 
    width: 100%; 
    box-sizing: border-box; 
    background-color: var(--btn-bg); 
    border: none; 
    padding: 12px; 
    border-radius: 10px; 
    color: var(--btn-text); 
    cursor: pointer; 
    font-size: 13px; 
    font-weight: 600; 
    transition: all 0.2s; 
}

#info-btn { color: var(--gold); }
#sound-btn.sound-on { color: var(--ios-green); background-color: rgba(50, 215, 75, 0.1); }

/* New Mode Toggle Button Styling */
#mode-btn { border: 1px solid #444; }
#mode-btn.mode-scalp { color: var(--mode-blue); background-color: rgba(10, 132, 255, 0.1); border-color: rgba(10, 132, 255, 0.4); }

/* Tooltip Styling */
.tooltip-container { 
    position: relative; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    width: 100%; 
}
.tooltip-text { visibility: hidden; width: 220px; background-color: rgba(28, 28, 30, 0.95); color: #fff; text-align: center; border-radius: 12px; padding: 12px; position: absolute; z-index: 100; bottom: 130%; left: 50%; transform: translateX(-50%); opacity: 0; transition: opacity 0.3s, visibility 0.3s; font-size: 12px; font-weight: normal; border: 1px solid #444; box-shadow: 0 10px 30px rgba(0,0,0,0.5); pointer-events: none; }
.tooltip-text::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px; border-width: 6px; border-style: solid; border-color: rgba(28, 28, 30, 0.95) transparent transparent transparent; }
.tooltip-container:hover .tooltip-text { visibility: visible; opacity: 1; }

/* Market Sessions Clocks (Upgraded 2x2 Grid with Live Analog Clocks) */
.sessions-container { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 12px; 
    margin-bottom: 24px; 
}

.session { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    background: var(--bg-card); 
    padding: 14px 16px; 
    border-radius: 12px; 
    font-size: 13px; 
    font-weight: 600; 
    color: var(--text-secondary); 
    transition: all 0.3s ease; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border: 1px solid #333;
}

.session.active { 
    color: var(--text-main); 
    border-color: rgba(50, 215, 75, 0.4);
    background: linear-gradient(145deg, var(--bg-card) 0%, rgba(50, 215, 75, 0.08) 100%);
}

/* The Live Analog Clock Faces */
.clock {
    width: 28px;
    height: 28px;
    border: 2px solid #444;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    background: var(--bg-base);
    transition: all 0.3s;
}

.session.active .clock {
    border-color: var(--ios-green);
    box-shadow: 0 0 10px rgba(50, 215, 75, 0.4);
}

.hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    background: #8e8e93;
    border-radius: 4px;
    transition: transform 0.05s linear;
}

.session.active .hand {
    background: var(--text-main);
}

.hour-hand {
    width: 2px;
    height: 30%;
    margin-left: -1px; /* Perfectly centers the width */
}

.min-hand {
    width: 1.5px;
    height: 40%;
    margin-left: -0.75px; /* Perfectly centers the width */
}

/* The Gold center pin of the clock */
.clock::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: var(--gold);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.session-info { 
    display: flex; 
    flex-direction: column; 
    line-height: 1.3; 
}

.session-time { 
    font-size: 11px; 
    font-weight: 500; 
    opacity: 0.8; 
    margin-top: 3px; 
    font-family: 'Courier New', Courier, monospace; 
    letter-spacing: 0.5px;
}

#live-price-display { text-align: center; font-size: 38px; color: var(--gold); font-weight: 700; margin-bottom: 30px; letter-spacing: 1px; }

/* Level Widgets & Granular Bells */
.level-box { 
    background: var(--bg-card); padding: 16px; margin-bottom: 12px; 
    border-radius: 14px; text-align: center; box-shadow: 0 4px 12px rgba(0,0,0,0.2); 
    transition: background-color 0.4s ease; 
}
.res { border-left: 5px solid var(--ios-red); }
.sup { border-left: 5px solid var(--ios-green); }
.level-header { display: flex; justify-content: center; align-items: center; position: relative; margin-bottom: 6px; }
.level-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.bell-btn { position: absolute; right: 0; cursor: pointer; font-size: 16px; opacity: 0.3; transition: all 0.2s; user-select: none; }
.bell-btn.active { opacity: 1; filter: drop-shadow(0 0 4px rgba(212, 175, 55, 0.5)); }
.price-text { font-size: 24px; font-weight: 700; }

/* Beginner Hints */
.beginner-hint { font-size: 11px; margin-top: 6px; font-style: italic; letter-spacing: 0.5px; opacity: 0.8; }
.res .beginner-hint { color: #ff8a84; }
.sup .beginner-hint { color: #7de88e; }

#toggle-extreme-btn { 
    background-color: rgba(212, 175, 55, 0.1); color: var(--gold); border: 1px solid rgba(212, 175, 55, 0.3); 
    padding: 14px; border-radius: 14px; font-weight: 600; cursor: pointer; width: 100%; margin-bottom: 20px; 
}

.section-header { color: var(--text-main); text-align: center; font-size: 14px; margin-top: 24px; border-bottom: 1px solid #333; padding-bottom: 10px; margin-bottom: 15px; }
#last-updated { font-size: 11px; color: var(--text-secondary); text-align: center; margin-top: 24px; padding-bottom: 40px; text-transform: uppercase; }
.error-text { color: var(--ios-red) !important; font-weight: bold; }

/* Animations & Modals */
@keyframes pulseRed { 0% { background-color: var(--bg-card); } 50% { background-color: var(--ios-red-dark); } 100% { background-color: var(--bg-card); } }
@keyframes pulseGreen { 0% { background-color: var(--bg-card); } 50% { background-color: var(--ios-green-dark); } 100% { background-color: var(--bg-card); } }
@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 rgba(50, 215, 75, 0.7); } 70% { box-shadow: 0 0 0 8px rgba(50, 215, 75, 0); } 100% { box-shadow: 0 0 0 0 rgba(50, 215, 75, 0); } }

.alert-red { animation: pulseRed 2s infinite ease-in-out; }
.alert-green { animation: pulseGreen 2s infinite ease-in-out; }

.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.modal-content { background-color: rgba(28, 28, 30, 0.95); margin: 15% auto; padding: 30px; border-radius: 24px; width: 85%; max-width: 400px; color: var(--text-main); border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 20px 40px rgba(0,0,0,0.5); }
.close-btn { color: var(--text-secondary); float: right; font-size: 24px; cursor: pointer; font-weight: bold; }

/* Phase 2: Maintenance Overlay Styling */
.maintenance-overlay {
    display: none; position: fixed; z-index: 99999; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-base); flex-direction: column; align-items: center; justify-content: center;
}
.maintenance-content { text-align: center; padding: 40px; }
.maintenance-icon { font-size: 80px; margin-bottom: 20px; animation: spin 4s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }
.maintenance-content h1 { color: var(--gold); margin-bottom: 10px; font-size: 32px; }
.maintenance-content p { color: var(--text-secondary); font-size: 16px; max-width: 400px; line-height: 1.5; margin: 0 auto; }

/* Phase 3: Contact Form Styles */
.contact-form { display: flex; flex-direction: column; gap: 15px; margin-top: 15px; }
.contact-input { background: var(--bg-base); border: 1px solid #444; color: white; padding: 14px; border-radius: 10px; font-size: 14px; font-family: inherit; transition: border-color 0.3s; }
.contact-input:focus { outline: none; border-color: var(--gold); }
textarea.contact-input { resize: vertical; min-height: 100px; }
.contact-submit { background: var(--gold); color: #000; border: none; padding: 14px; border-radius: 10px; font-weight: 700; font-size: 15px; cursor: pointer; transition: opacity 0.2s; }
.contact-submit:hover { opacity: 0.8; }
.contact-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.contact-status { font-size: 14px; font-weight: 600; text-align: center; display: none; margin-top: 10px; }
.status-success { color: var(--ios-green); display: block; }
.status-error { color: var(--ios-red); display: block; }

/* Phase 5: Center Announcement Modal */
#announcement-modal .modal-content {
    background: linear-gradient(145deg, var(--bg-card) 0%, #1a1a1c 100%);
    border: 1px solid var(--gold);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.15);
    text-align: center;
}
#announcement-title {
    color: var(--gold);
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}
#announcement-text-content {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-main);
    margin-bottom: 25px;
}
.acknowledge-btn {
    background: var(--gold);
    color: #000;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100%;
}

/* =========================================
   MOBILE HAMBURGER MENU (Phones & Tablets)
   ========================================= */

/* Hide mobile elements on Desktop */
#mobile-top-bar, #mobile-close-btn, #menu-overlay {
    display: none;
}

@media (max-width: 768px) {
    /* The Top Navigation Bar */
    #mobile-top-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: #1c1c1e;
        padding: 12px 15px;
        border-bottom: 1px solid #333;
        position: fixed;
        top: 0; left: 0; right: 0;
        z-index: 1000;
    }

    #mobile-top-bar .brand {
        color: var(--gold);
        font-weight: 700;
        font-size: 16px;
        letter-spacing: 0.5px;
    }

    .hamburger-btn {
        background: var(--blue);
        color: white;
        border: none;
        padding: 8px 14px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(10, 132, 255, 0.3);
    }

    /* Push the main app down so it doesn't hide under the top bar */
    #app-container {
        margin-top: 55px; 
        display: flex;
        flex-direction: column;
    }

    /* Force the Charts to look good on mobile */
    .chart-top {
        height: 50vh !important;
    }
    .chart-bottom {
        height: 450px !important;
        margin-top: 15px;
    }

    /* The Side Panel (Now a Slide-Out Drawer) */
    #side-panel {
        position: fixed;
        top: 0;
        right: -100%; 
        width: 85%;
        max-width: 380px;
        height: 100vh;
        z-index: 9999;
        /* FIX 1: Solid dark background so the chart does NOT bleed through */
        background-color: #121212 !important; 
        border-left: 1px solid #333;
        box-shadow: -10px 0 30px rgba(0,0,0,0.9);
        transition: right 0.3s cubic-bezier(0.4, 0.0, 0.2, 1); 
        padding: 20px;
        padding-top: 70px; 
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #side-panel.open {
        right: 0;
    }

    /* FIX 2: Move the Viewer Badge to the Top-Left to avoid the Close button */
    #live-viewers-badge {
        position: absolute !important;
        top: 20px !important;
        left: 20px !important; 
        right: auto !important; 
        margin: 0 !important;
    }

    /* The Close 'X' Button inside the drawer */
    #mobile-close-btn {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        color: #fff;
        font-size: 24px;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        cursor: pointer;
        line-height: 1;
        text-align: center;
        padding: 0;
    }

    /* The Dark Overlay Background */
    #menu-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        /* FIX 3: Darkened from 0.7 to 0.85 opacity with a stronger blur */
        background: rgba(0,0,0,0.85);
        backdrop-filter: blur(4px); 
        z-index: 9998;
        opacity: 0;
        pointer-events: none; 
        transition: opacity 0.3s ease;
    }

    #menu-overlay.open {
        display: block;
        opacity: 1;
        pointer-events: auto; 
    }
}
.acknowledge-btn:hover { opacity: 0.8; }