/* ═══════════════════════════════════════════
   Rahapeli Milli-tulokset v2 — Styles
   ═══════════════════════════════════════════ */

.milli-wrap {
    max-width: 900px;
    margin: 0 auto 30px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1a1a2e;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

/* ─── Dynamic text blocks ─── */
.milli-dynamic-text {
    margin-bottom: 20px;
    line-height: 1.7;
    font-size: 1.02em;
}

.milli-dynamic-text p {
    margin: 0 0 10px;
}

/* ─── Dark mode: html.dark-theme (RahapeliSuomi custom theme) ─── */
.dark-theme .milli-dynamic-text p,
.dark-theme .milli-section h3,
.dark-theme .milli-section h4,
.dark-theme .milli-table td,
.dark-theme .milli-table td strong,
.dark-theme .milli-draw-meta,
.dark-theme .milli-draw-meta span,
.dark-theme .milli-draw-meta strong,
.dark-theme .milli-source-note,
.dark-theme .milli-source-note p,
.dark-theme .milli-counter-label {
    color: #d4d4d8 !important;
}

.dark-theme .milli-counter-number {
    color: #fff !important;
}

.dark-theme .milli-section {
    background: var(--surface, #1e1e2e) !important;
    border-color: var(--border-color, rgba(255,255,255,0.1)) !important;
}

.dark-theme .milli-table th {
    background: rgba(255,255,255,0.08) !important;
}

.dark-theme .milli-table td {
    border-bottom-color: rgba(255,255,255,0.06) !important;
}

.dark-theme .milli-table tbody tr:hover {
    background: rgba(255,255,255,0.04) !important;
}

.dark-theme .milli-highlight-row {
    background: rgba(240, 192, 64, 0.08) !important;
}

.dark-theme .milli-total-row {
    background: rgba(63, 81, 181, 0.1) !important;
}

.dark-theme .milli-total-row td {
    border-top-color: rgba(255,255,255,0.15) !important;
}

/* ─── Latest result balls ─── */
.milli-latest {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%) !important;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    margin-bottom: 24px;
}

.milli-latest,
.milli-latest * {
    color: #fff !important;
}

.milli-pulse {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4caf50 !important;
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    animation: milli-pulse-anim 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes milli-pulse-anim {
    0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
    50% { box-shadow: 0 0 0 10px rgba(76, 175, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}
.milli-latest-header h2 {
    font-size: 1.4em;
    margin: 0 0 8px;
    color: #fff !important;
}

.milli-live-date {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ccd6f6 !important;
    font-size: 1.05em;
    font-weight: 500;
}

.milli-balls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.milli-ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(145deg, #f0c040 0%, #e8a820 100%) !important;
    color: #1a1a2e !important;
    font-size: 1.4em;
    font-weight: 800;
    box-shadow: 0 3px 12px rgba(240, 192, 64, 0.4);
    transition: transform 0.2s;
}

.milli-ball:hover {
    transform: scale(1.1);
}

.milli-ball-extra {
    background: linear-gradient(145deg, #4fc3f7 0%, #0288d1 100%) !important;
    color: #fff !important;
    box-shadow: 0 3px 12px rgba(2, 136, 209, 0.4);
}

.milli-ball-separator {
    color: #8892b0 !important;
    font-size: 1.5em;
    font-weight: 300;
}

/* ─── Jackpot counter ─── */
.milli-jackpot-counter {
    background: linear-gradient(135deg, #b71c1c 0%, #d32f2f 100%) !important;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin-bottom: 24px;
}

.milli-counter-number {
    font-size: 3.5em;
    font-weight: 900;
    color: #fff !important;
    line-height: 1;
}

.milli-counter-label {
    color: rgba(255,255,255,0.85) !important;
    font-size: 1em;
    margin-top: 6px;
}

/* ─── Section wrapper ─── */
.milli-section {
    background: var(--milli-section-bg, #fff);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid rgba(128,128,128,0.15);
}

.milli-section h3 {
    margin: 0 0 16px;
    font-size: 1.15em;
    color: inherit !important;
}

.milli-section h4 {
    margin: 0 0 10px;
    font-size: 0.95em;
    color: inherit !important;
    opacity: 0.7;
    font-weight: 500;
}

/* ─── Tables ─── */
.milli-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.milli-table th {
    background: #1a1a2e;
    color: #f0c040;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.milli-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(128,128,128,0.15);
    color: inherit !important;
}

.milli-table tbody tr:hover {
    background: rgba(128,128,128,0.08);
}

.milli-highlight-row {
    background: rgba(240, 192, 64, 0.1) !important;
}

.milli-highlight-row:hover {
    background: rgba(240, 192, 64, 0.18) !important;
}

.milli-total-row {
    background: rgba(63, 81, 181, 0.1) !important;
}

.milli-total-row td {
    border-top: 2px solid rgba(128,128,128,0.3);
}

.milli-draw-meta {
    display: flex;
    justify-content: space-between;
    padding: 14px 0 0;
    font-size: 0.95em;
    color: inherit !important;
    opacity: 0.8;
    flex-wrap: wrap;
    gap: 10px;
}

/* ─── Jackpot hit row in history ─── */
.milli-jackpot-hit {
    background: rgba(76, 175, 80, 0.12) !important;
}

.milli-jackpot-cell {
    color: #4caf50 !important;
    font-weight: 800;
}

/* ─── Charts ─── */
.milli-chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.milli-chart-box {
    min-width: 0;
}

.milli-chart-container {
    height: 280px;
    max-height: 280px;
    position: relative;
}

/* ─── History mini balls ─── */
.milli-hist-numbers {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}

.milli-mini-ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f0c040;
    color: #1a1a2e;
    font-size: 0.8em;
    font-weight: 700;
    flex-shrink: 0;
}

.milli-mini-extra {
    background: #4fc3f7;
    color: #fff;
}

.milli-history-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ─── Updated badge ─── */
.milli-updated-badge {
    display: inline-block;
    background: #4caf50;
    color: #fff !important;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.88em;
    font-weight: 600;
    margin-top: 4px;
}

/* ─── Source note ─── */
.milli-source-note {
    text-align: center;
    color: inherit !important;
    opacity: 0.6;
    font-size: 0.82em;
    font-style: italic;
}

/* ─── Probability highlight ─── */
.milli-prob-highlight {
    text-align: center;
    padding: 16px;
    margin-bottom: 20px;
    background: rgba(240, 192, 64, 0.08);
    border-radius: 10px;
}

.milli-prob-big {
    font-size: 2.2em;
    font-weight: 900;
    color: #f0c040;
}

.milli-prob-label {
    font-size: 0.88rem;
    opacity: 0.7;
    margin-top: 4px;
}

.milli-prob-green { color: #10b981 !important; font-weight: 600; }
.milli-prob-red { color: #ef4444 !important; font-weight: 600; }

/* ─── Jackpot summary stats ─── */
.milli-jackpot-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.milli-jackpot-stat {
    text-align: center;
    padding: 14px 8px;
    border-radius: 10px;
    background: rgba(128,128,128,0.05);
}

.milli-stat-number {
    display: block;
    font-size: 1.8em;
    font-weight: 900;
    color: #f0c040;
}

.milli-stat-label {
    font-size: 0.78rem;
    opacity: 0.65;
    display: block;
    margin-top: 4px;
}

/* ─── Palautusvelka box ─── */
.milli-velka-box {
    background: var(--surface, #fff);
    border: 2px solid rgba(239, 68, 68, 0.25);
    border-radius: 16px;
    padding: 25px;
    margin: 24px auto;
    max-width: 640px;
    box-sizing: border-box !important;
}

.milli-velka-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.milli-velka-icon { font-size: 1.6rem; }

.milli-velka-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: inherit;
}

.milli-velka-desc {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 18px;
    opacity: 0.85;
}

.milli-velka-visual {
    margin-bottom: 20px;
}

.milli-velka-bar-wrap {
    margin-bottom: 10px;
}

.milli-velka-bar-label {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.65;
}

.milli-velka-bar {
    height: 32px;
    background: rgba(128,128,128,0.08);
    border-radius: 8px;
    overflow: hidden;
}

.milli-velka-bar-fill {
    height: 100%;
    display: flex;
    align-items: center;
    padding-left: 12px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
    border-radius: 8px;
    white-space: nowrap;
}

.milli-velka-actual { background: linear-gradient(90deg, #f59e0b, #d97706); }
.milli-velka-target { background: linear-gradient(90deg, #10b981, #059669); }

.milli-velka-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.milli-velka-stat-item {
    text-align: center;
    padding: 14px;
    border-radius: 10px;
    background: rgba(128,128,128,0.05);
}

.milli-velka-deficit {
    background: rgba(239, 68, 68, 0.08) !important;
}

.milli-velka-big {
    display: block;
    font-size: 1.5em;
    font-weight: 900;
    color: #ef4444;
}

.milli-velka-label {
    display: block;
    font-size: 0.78rem;
    opacity: 0.65;
    margin-top: 4px;
}

.milli-velka-footer {
    background: rgba(128,128,128,0.06);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.6;
    border-left: 4px solid #ef4444;
}

.milli-velka-footer p { margin: 0; }

/* ─── Dark theme: päävoittohistoria stat labelit ─── */
.dark-theme .milli-stat-label {
    color: #a1a1aa !important;
    opacity: 1 !important;
}
.dark-theme .milli-jackpot-stat {
    background: rgba(255,255,255,0.06) !important;
}

/* ─── Dark theme: voittotodennäköisyydet label ─── */
.dark-theme .milli-prob-label {
    color: #a1a1aa !important;
    opacity: 1 !important;
}

/* ─── Dark theme: UKK kysymystekstit ─── */
.dark-theme .faq-main-title {
    color: #f1f5f9 !important;
}
.dark-theme .faq-question {
    color: #e4e4e7 !important;
}
.dark-theme .faq-item {
    border-bottom-color: rgba(255,255,255,0.1) !important;
}
.dark-theme .faq-answer {
    color: #a1a1aa !important;
}
.dark-theme .faq-question span {
    color: #64748b !important;
}

.dark-theme .milli-velka-box {
    border-color: rgba(239, 68, 68, 0.15);
}
.dark-theme .milli-velka-desc,
.dark-theme .milli-velka-bar-label,
.dark-theme .milli-velka-label,
.dark-theme .milli-velka-footer p,
.dark-theme .milli-velka-header h3 {
    color: #d4d4d8 !important;
}
.dark-theme .milli-velka-stat-item {
    background: rgba(255,255,255,0.05) !important;
}
.dark-theme .milli-velka-footer {
    background: rgba(255,255,255,0.04) !important;
}

/* ─── Number heatmap grid ─── */
.milli-hotcold {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 16px;
    margin-bottom: 20px;
}

.milli-hotcold-title {
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.milli-hot-title { color: #ef4444; }
.milli-cold-title { color: #3b82f6; }

.milli-hotcold-balls {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px;
    flex-wrap: wrap;
}

.milli-freq-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px;
}

.milli-freq-count {
    font-size: 0.72rem;
    font-weight: 700;
    opacity: 0.7;
}

.milli-numgrid {
    display: grid !important;
    grid-template-columns: repeat(8, 1fr) !important;
    gap: 4px !important;
    margin-bottom: 10px;
    list-style: none !important;
    padding: 0 !important;
}

.milli-numcell {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 4px;
    border-radius: 8px;
    cursor: default;
    transition: transform 0.15s;
    min-height: 50px;
}

.milli-numcell:hover { transform: scale(1.1); z-index: 1; }

.milli-numcell-num {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
}

.milli-numcell-count {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
}

.milli-numgrid-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.75rem;
    opacity: 0.6;
    margin-bottom: 8px;
}

.milli-legend-bar {
    width: 100px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgb(40,80,220), rgb(180,100,100), rgb(240,140,40));
}

/* ─── Weekday bars ─── */
.milli-weekday-bars {
    margin-bottom: 16px;
}

.milli-wd-row {
    display: grid !important;
    grid-template-columns: 30px 1fr 70px 55px !important;
    gap: 8px !important;
    align-items: center !important;
    margin-bottom: 6px;
}

.milli-wd-label {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.milli-wd-bar-track {
    height: 22px;
    background: rgba(128,128,128,0.08);
    border-radius: 6px;
    overflow: hidden;
    width: 100% !important;
    display: block !important;
}

.milli-wd-bar-fill {
    height: 100% !important;
    display: block !important;
    background: linear-gradient(90deg, #f0c040, #e8a820);
    border-radius: 6px;
    transition: width 0.6s ease;
    min-height: 22px;
}

.milli-wd-value {
    font-size: 0.78rem;
    font-weight: 700;
    text-align: right;
}

.milli-wd-return {
    font-size: 0.75rem;
    opacity: 0.6;
    text-align: right;
}

/* ─── RTP Explainer Box ─── */
.milli-rtp-box {
    background: var(--surface, #fff);
    border: 2px solid rgba(128,128,128,0.15);
    border-radius: 16px;
    padding: 25px;
    max-width: 640px;
    margin: 24px auto;
    box-sizing: border-box !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}

.milli-rtp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.milli-rtp-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.milli-rtp-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: inherit;
}

.milli-rtp-desc {
    line-height: 1.65;
    margin-bottom: 20px;
    font-size: 0.95rem;
    opacity: 0.85;
}

.milli-rtp-section {
    margin-bottom: 18px;
}

.milli-rtp-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
    color: #10b981;
}

.milli-rtp-actual-title {
    color: #f59e0b;
}

.milli-rtp-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 0.65;
    margin-bottom: 6px;
}

.milli-rtp-bar {
    display: flex;
    height: 42px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(128,128,128,0.1);
}

.milli-rtp-player {
    background: linear-gradient(90deg, #10b981, #059669);
    display: flex;
    align-items: center;
    padding-left: 14px;
    transition: filter 0.3s;
}

.milli-rtp-player-actual {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.milli-rtp-house {
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
}

.milli-rtp-amount {
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    white-space: nowrap;
}

.milli-rtp-footer {
    background: rgba(128,128,128,0.06);
    padding: 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    line-height: 1.6;
    border-left: 4px solid rgba(128,128,128,0.2);
    margin-top: 4px;
}

.milli-rtp-footer p {
    margin: 0;
}

.milli-rtp-box:hover .milli-rtp-player {
    filter: brightness(1.08);
}

/* Dark mode RTP */
.dark-theme .milli-rtp-box {
    border-color: rgba(255,255,255,0.08);
}

.dark-theme .milli-rtp-footer {
    background: rgba(255,255,255,0.04);
    border-left-color: rgba(255,255,255,0.12);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .milli-wrap {
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    .milli-section,
    .milli-latest,
    .milli-jackpot-counter,
    .milli-rtp-box,
    .milli-velka-box {
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .milli-section {
        padding: 16px !important;
        border-radius: 8px;
    }

    .milli-latest {
        padding: 20px !important;
    }

    .milli-rtp-box,
    .milli-velka-box {
        max-width: 100% !important;
        padding: 16px !important;
    }

    .milli-chart-grid {
        grid-template-columns: 1fr !important;
    }

    .milli-balls {
        gap: 6px;
    }

    .milli-ball {
        width: 44px;
        height: 44px;
        font-size: 1.15em;
    }

    .milli-counter-number {
        font-size: 2.5em;
    }

    .milli-mini-ball {
        width: 24px;
        height: 24px;
        font-size: 0.65em;
        flex-shrink: 0;
    }

    .milli-hist-numbers {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 2px !important;
    }

    .milli-history-scroll {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: 100% !important;
        margin: 0 -16px;
        padding: 0 16px;
    }

    .milli-history-table,
    .milli-jackpot-table {
        min-width: 580px !important;
        table-layout: auto !important;
    }

    .milli-table {
        font-size: 0.82em;
        width: 100% !important;
        table-layout: fixed !important;
    }

    .milli-table th,
    .milli-table td {
        padding: 8px 5px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .milli-jackpot-summary {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }

    .milli-hotcold {
        grid-template-columns: 1fr !important;
    }

    .milli-numgrid {
        grid-template-columns: repeat(5, 1fr) !important;
    }

    .milli-velka-stats {
        grid-template-columns: 1fr !important;
    }

    .milli-wd-row {
        grid-template-columns: 28px 1fr 55px 45px !important;
        gap: 4px !important;
    }

    .milli-wd-value { font-size: 0.72rem; }
    .milli-wd-return { font-size: 0.68rem; }

    .milli-draw-meta {
        flex-direction: column;
        gap: 4px;
    }

    .milli-rtp-bar {
        height: 36px;
    }

    .milli-velka-bar {
        height: 28px !important;
    }

    .milli-velka-bar-fill {
        font-size: 0.72rem !important;
        padding-left: 8px !important;
    }

    .milli-prob-big {
        font-size: 1.8em;
    }

    .milli-history-scroll {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .milli-balls {
        gap: 5px;
    }

    .milli-ball {
        width: 38px;
        height: 38px;
        font-size: 1em;
    }

    .milli-mini-ball {
        width: 22px;
        height: 22px;
        font-size: 0.6em;
    }

    .milli-numgrid {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 3px !important;
    }

    .milli-numcell {
        padding: 6px 2px !important;
        min-height: 42px !important;
    }

    .milli-numcell-num { font-size: 0.82rem; }
    .milli-numcell-count { font-size: 0.58rem; }

    .milli-table th,
    .milli-table td {
        padding: 6px 4px;
        font-size: 0.78em;
    }

    .milli-history-table th:nth-child(n+6),
    .milli-history-table td:nth-child(n+6) {
        display: none;
    }
}
