:root {
    --bg-dark: #0b0f19;
    --card-bg: #161b26;
    --card-border: #2d3748;
    --accent-gold: #f59e0b;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --accent-violet: #8b5cf6;
    --accent-blue: #3b82f6;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.mobile-app-container {
    width: 100%;
    max-width: 480px;
    background: var(--bg-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 35px rgba(0,0,0,0.85);
    padding-bottom: 85px;
}

/* Header */
.app-header {
    background: #111827;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent-gold);
}

.brand-logo span { color: #fff; }

/* ==================== NOTICE BAR (SCROLLING LEFT) ==================== */
.app-notice-bar {
    background: #111827;
    border-bottom: 1px solid rgba(245, 158, 11, 0.25);
    display: flex;
    align-items: center;
    overflow: hidden;
    height: 38px;
    padding: 0 14px;
    position: relative;
    z-index: 90;
}

.notice-icon {
    font-size: 1rem;
    margin-right: 8px;
    color: var(--accent-gold);
    flex-shrink: 0;
    z-index: 2;
    background: #111827;
    padding-right: 6px;
}

.notice-marquee-wrapper {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    width: 100%;
}

.notice-marquee-text {
    display: inline-block;
    white-space: nowrap;
    color: #f3f4f6;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    animation: marqueeMoveLeft 18s linear infinite;
}

@keyframes marqueeMoveLeft {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* ==================== PROMO DOWNLOAD BANNER (COMPACT & ANIMATED) ==================== */
.app-promo-banner {
    margin: 10px 16px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: 14px;
    padding: 10px 12px;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    animation: bannerGlowPulse 4s ease-in-out infinite alternate;
}

.app-promo-banner-bottom {
    margin: 18px 16px 25px 16px;
}

@keyframes bannerGlowPulse {
    0% {
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15), 0 0 0 1px rgba(245, 158, 11, 0.2);
    }
    100% {
        box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4), 0 0 0 1px rgba(245, 158, 11, 0.55);
    }
}

.promo-banner-left {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.promo-icon-box {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    border-radius: 10px;
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.promo-app-icon {
    width: 44px !important;
    height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.promo-text-details {
    flex: 1;
    min-width: 0;
}

.promo-company-name {
    font-size: 0.88rem;
    font-weight: 800;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.promo-description {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.promo-banner-right {
    flex-shrink: 0;
}

.btn-banner-download {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: #000 !important;
    font-weight: 800;
    font-size: 0.76rem;
    padding: 8px 12px;
    border-radius: 20px;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
    animation: downloadBtnPulse 2.2s infinite ease-in-out;
}

@keyframes downloadBtnPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: 65px;
    background: #111827;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--card-border);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    gap: 4px;
    transition: all 0.2s ease;
}

.nav-item.active, .nav-item:hover { color: var(--accent-gold); }
.nav-icon { font-size: 1.3rem; }

/* Session Cards */
.session-card {
    background: var(--card-bg);
    border-radius: 14px;
    border: 1px solid var(--card-border);
    padding: 16px;
    margin: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
}

.session-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
}

.pulse-dot { width: 10px; height: 10px; border-radius: 50%; }
.pulse-green {
    background: var(--accent-green);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 1.5s infinite;
}
.dot-red { background: var(--accent-red); }

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Prediction Container */
.prediction-main-card {
    margin: 18px;
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--card-border);
    padding: 22px 16px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.period-display-badge {
    display: inline-block;
    background: #0f172a;
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--accent-gold);
    letter-spacing: 0.5px;
    margin-bottom: 18px;
}

/* 3 COLOUR BUTTONS */
.color-buttons-row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    margin: 12px 0 18px 0;
}

.btn-color-box {
    flex: 1 1 0;
    min-width: 0;
    padding: 18px 4px;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 900;
    color: #ffffff;
    text-align: center;
    letter-spacing: 0.5px;
    border: 2px solid transparent;
    opacity: 0.4;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    text-transform: uppercase;
}

.box-red { background: linear-gradient(135deg, #ef4444, #991b1b); }
.box-violet { background: linear-gradient(135deg, #8b5cf6, #5b21b6); }
.box-green { background: linear-gradient(135deg, #10b981, #065f46); }

.btn-color-box.lit-active {
    opacity: 1 !important;
    transform: scale(1.05);
}

.box-red.lit-active {
    border-color: #fca5a5;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.95), inset 0 0 12px rgba(255,255,255,0.6);
}

.box-violet.lit-active {
    border-color: #ddd6fe;
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.95), inset 0 0 12px rgba(255,255,255,0.6);
}

.box-green.lit-active {
    border-color: #a7f3d0;
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.95), inset 0 0 12px rgba(255,255,255,0.6);
}

.btn-color-box.winner-glow {
    opacity: 1 !important;
    transform: scale(1.08);
    animation: winnerPulse 1s infinite alternate;
}

@keyframes winnerPulse {
    0% { transform: scale(1.04); filter: brightness(1.1); }
    100% { transform: scale(1.1); filter: brightness(1.3); }
}

/* NUMBER PREDICTION (0-9) GRID */
.number-buttons-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin: 12px 0 18px 0;
}

.btn-num-box {
    padding: 12px 0;
    border-radius: 12px;
    font-size: 1.25rem;
    font-weight: 900;
    color: #fff;
    text-align: center;
    border: 2px solid transparent;
    opacity: 0.4;
    transition: all 0.25s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.num-c-0 { background: linear-gradient(135deg, #ef4444, #8b5cf6); }
.num-c-1 { background: linear-gradient(135deg, #10b981, #059669); }
.num-c-2 { background: linear-gradient(135deg, #ef4444, #dc2626); }
.num-c-3 { background: linear-gradient(135deg, #10b981, #059669); }
.num-c-4 { background: linear-gradient(135deg, #ef4444, #dc2626); }
.num-c-5 { background: linear-gradient(135deg, #10b981, #8b5cf6); }
.num-c-6 { background: linear-gradient(135deg, #ef4444, #dc2626); }
.num-c-7 { background: linear-gradient(135deg, #10b981, #059669); }
.num-c-8 { background: linear-gradient(135deg, #ef4444, #dc2626); }
.num-c-9 { background: linear-gradient(135deg, #10b981, #059669); }

.btn-num-box.lit-active {
    opacity: 1 !important;
    transform: scale(1.1);
    border-color: #fff;
    box-shadow: 0 0 20px var(--accent-gold), inset 0 0 10px #fff;
}

.btn-num-box.winner-glow {
    opacity: 1 !important;
    transform: scale(1.15);
    border-color: #fff;
    box-shadow: 0 0 25px #3b82f6, inset 0 0 12px #fff;
    animation: winnerPulse 1s infinite alternate;
}

.status-msg-badge {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-top: 5px;
    letter-spacing: 0.5px;
}

.upcoming-hero-box {
    padding: 30px 15px;
    text-align: center;
}

.upcoming-clock-anim {
    font-size: 3rem;
    display: inline-block;
    animation: swingClock 2s infinite ease-in-out;
}

@keyframes swingClock {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    75% { transform: rotate(-15deg); }
}

.upcoming-time-text {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-gold);
    margin: 12px 0 6px 0;
    text-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.btn-primary {
    width: 100%;
    padding: 13px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    color: #000;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-history-trigger {
    background: #1e293b;
    border: 1px solid var(--card-border);
    color: #cbd5e1;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 12px;
    border-radius: 12px;
    width: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.custom-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    padding: 22px;
    position: relative;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--card-border);
}

.modal-close-btn {
    background: #374151;
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
}

.modal-scroll-body {
    overflow-y: auto;
    flex: 1;
}

.history-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #111827;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.header-help-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000 !important;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
    letter-spacing: 0.3px;
    transition: transform 0.15s ease;
}

.header-help-btn:active {
    transform: scale(0.94);
}

/* Game Selection Grid (Home) */
.game-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 15px 20px;
}

.game-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 18px 12px;
    text-align: center;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.game-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-3px);
}

.game-icon-box {
    width: 55px;
    height: 55px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.game-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}