/* ═══════════════════════════════════════
   Kaikki tai ei mitään – CSS
   Teema: sininen
   ═══════════════════════════════════════ */

/* ─── Wrap ─── */
.ktm-wrap {
    max-width: 900px; margin: 0 auto; font-family: inherit;
    width: 100%; box-sizing: border-box;
}
.ktm-section {
    background: rgba(128,128,128,0.03); border-radius: 12px;
    padding: 20px; margin-bottom: 24px;
}

/* ─── Hero ─── */
.ktm-hero {
    background: linear-gradient(150deg, #1d4ed8 0%, #1e40af 40%, #1e3a8a 80%, #172554 100%);
    border-radius: 20px; padding: 32px 24px 26px; margin-bottom: 24px;
    text-align: center; position: relative; overflow: hidden;
}
.ktm-hero::before {
    content: ''; position: absolute; top: -50%; right: -15%;
    width: 350px; height: 350px; border-radius: 50%;
    background: rgba(255,255,255,0.05); pointer-events: none;
}
.ktm-hero > * { position: relative; z-index: 1; }
.ktm-hero, .ktm-hero *, .ktm-hero h2, .ktm-hero p, .ktm-hero span, .ktm-hero div, .ktm-hero strong {
    color: #fff !important;
}
.ktm-hero h2 {
    margin: 0 0 6px; font-size: 1.45em;
    font-weight: 900; text-shadow: 0 1px 6px rgba(0,0,0,0.15);
}

/* ─── Live badge ─── */
.ktm-live-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.15); border-radius: 20px;
    padding: 4px 14px; font-size: .82em; margin-bottom: 18px;
}
.ktm-pulse {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; background: #4ade80;
    animation: ktm-pulse 2s infinite;
}
@keyframes ktm-pulse {
    0%,100%{ opacity:1; transform:scale(1); }
    50%{ opacity:.5; transform:scale(1.3); }
}

/* ─── 24-numeron ruudukko ─── */
.ktm-grid {
    display: grid; grid-template-columns: repeat(8, 1fr);
    gap: 6px; max-width: 480px; margin: 16px auto 14px;
}
@media (max-width: 500px) { .ktm-grid { grid-template-columns: repeat(6, 1fr); } }
.ktm-num {
    aspect-ratio: 1; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1em; transition: transform .15s;
}
.ktm-num.drawn {
    background: #fff; color: #1d4ed8 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2); transform: scale(1.05);
}
.ktm-num.not-drawn {
    background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.4) !important;
}

/* ─── Legend ─── */
.ktm-hero-legend { font-size: .8em; opacity: .7; margin-bottom: 12px; }

/* ─── Onnenapila ─── */
.ktm-onnenapila-badge {
    display: inline-block; background: rgba(34,197,94,0.2);
    border: 1px solid rgba(34,197,94,0.4); border-radius: 20px;
    padding: 6px 18px; font-size: .9em; margin: 8px 0;
}
.ktm-hero-footer { font-size: .78em; opacity: .55; margin-top: 12px; }

/* ─── Status / countdown ─── */
.ktm-status-msg {
    background: #fef3c7; color: #92400e; border-radius: 8px;
    padding: 10px 16px; font-size: .88em; margin-bottom: 14px;
    text-align: center;
}
.ktm-countdown {
    background: rgba(29,78,216,0.06); border-radius: 10px;
    padding: 12px 16px; text-align: center; margin-bottom: 20px;
    font-size: .95em;
}
.ktm-countdown strong { color: #1d4ed8; }

/* ─── Dynamic text ─── */
.ktm-dynamic-text { margin-bottom: 20px; line-height: 1.7; }
.ktm-dynamic-text p { margin: 0 0 8px; }

/* ─── Draw time row ─── */
.ktm-draw-time-row {
    padding: 10px 14px; border-radius: 8px;
    background: rgba(128,128,128,0.04); margin-bottom: 8px;
}

/* ─── Table ─── */
.ktm-table-scroll { overflow-x: auto; }
.ktm-table {
    width: 100%; border-collapse: collapse; font-size: .88em; margin-top: 10px;
}
.ktm-table th {
    background: rgba(29,78,216,0.06); padding: 8px 12px;
    text-align: left; font-weight: 700; font-size: .82em;
    text-transform: uppercase; letter-spacing: .3px;
}
.ktm-table td {
    padding: 8px 12px; border-bottom: 1px solid rgba(128,128,128,0.08);
}
.ktm-table tbody tr:hover td { background: rgba(29,78,216,0.04); }
.ktm-highlight-row td { background: rgba(29,78,216,0.06); font-weight: 600; }
.ktm-jackpot-hit td  { background: rgba(34,197,94,0.08); font-weight: 600; }
.ktm-nowin-row td    { opacity: .45; }
.ktm-table-note { font-size: .78em; opacity: .6; margin: 10px 0 0; line-height: 1.5; }

/* ─── Section headings ─── */
.ktm-section h2 { font-size: 1.15em; font-weight: 700; margin: 0 0 14px; }
.ktm-section h3 { font-size: 1em; font-weight: 600; margin: 0 0 14px; }

/* ─── Historia ─── */
.ktm-historia-list { display: flex; flex-direction: column; gap: 8px; }
.ktm-historia-row {
    background: rgba(128,128,128,0.03); border: 1px solid rgba(128,128,128,0.1);
    border-radius: 8px; padding: 10px 14px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.ktm-jackpot-row {
    background: rgba(34,197,94,0.06); border-color: rgba(34,197,94,0.2);
}
.ktm-historia-date { font-size: .88em; min-width: 110px; }
.ktm-historia-numbers { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.ktm-ball-small {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 6px;
    background: rgba(29,78,216,0.1); color: #1d4ed8;
    font-size: .78em; font-weight: 700;
}
.ktm-ball-onnenapila {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 6px; height: 26px; border-radius: 6px;
    background: rgba(34,197,94,0.12); color: #16a34a;
    font-size: .78em; font-weight: 700;
}
.ktm-badge-win {
    display: inline-block; background: rgba(34,197,94,0.15);
    border-radius: 4px; padding: 1px 6px;
    font-size: .72em; font-weight: 700; margin-left: 6px; color: #16a34a;
}
.ktm-historia-prize { font-size: .82em; color: #16a34a; }

/* ─── Pagination ─── */
.ktm-pagination { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.ktm-page-btn {
    background: rgba(29,78,216,0.08); border-radius: 6px;
    padding: 6px 14px; text-decoration: none; font-size: .88em;
    color: #1d4ed8; transition: background .15s;
}
.ktm-page-btn:hover { background: rgba(29,78,216,0.15); }
.ktm-page-info { font-size: .85em; opacity: .65; }

/* ─── Hot/Cold ─── */
.ktm-hot-cold-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media(max-width:520px){ .ktm-hot-cold-grid{ grid-template-columns:1fr; } }
.ktm-hot-cold-col h3 { font-size: .95em; margin: 0 0 12px; }
.ktm-hc-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ktm-ball-med {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 8px;
    font-weight: 700; font-size: .9em; flex-shrink: 0;
}
.ktm-ball-med.hot     { background: rgba(239,68,68,0.12); color: #dc2626; }
.ktm-ball-med.cold    { background: rgba(29,78,216,0.12); color: #1d4ed8; }
.ktm-ball-med.neutral { background: rgba(128,128,128,0.1); color: inherit; }
.ktm-ball-med.overdue { background: rgba(245,158,11,0.12); color: #d97706; }
.ktm-hc-bar-wrap {
    flex: 1; height: 8px; background: rgba(128,128,128,0.12);
    border-radius: 4px; overflow: hidden;
}
.ktm-hc-bar { height: 100%; border-radius: 4px; transition: width .4s ease; }
.ktm-hc-bar.hot     { background: linear-gradient(90deg,#ef4444,#f97316); }
.ktm-hc-bar.cold    { background: linear-gradient(90deg,#3b82f6,#06b6d4); }
.ktm-hc-bar.neutral { background: rgba(128,128,128,0.4); }
.ktm-hc-bar.overdue { background: linear-gradient(90deg,#f59e0b,#fbbf24); }
.ktm-hc-stat { font-size: .78em; opacity: .65; white-space: nowrap; }

/* ─── Freq grid ─── */
.ktm-freq-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 8px; margin: 14px 0;
}
.ktm-freq-item { text-align: center; }
.ktm-freq-pct { font-size: .72em; opacity: .65; margin-top: 3px; }
.ktm-freq-cnt { font-size: .65em; opacity: .5; }

/* ─── Heatmap ─── */
.ktm-heatmap {
    display: grid; grid-template-columns: repeat(8, 1fr);
    gap: 6px; margin: 14px 0;
}
@media(max-width:500px){ .ktm-heatmap{ grid-template-columns:repeat(6,1fr); } }
.ktm-heatmap-cell {
    aspect-ratio: 1; border-radius: 8px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; cursor: default;
}
.ktm-hm-num { font-weight: 700; font-size: .85em; color: #fff !important; }
.ktm-hm-cnt { font-size: .6em; color: rgba(255,255,255,.8) !important; }

/* ─── Even/odd ─── */
.ktm-eo-list { display: flex; flex-direction: column; gap: 8px; }
.ktm-eo-row { display: flex; align-items: center; gap: 8px; }
.ktm-eo-label { font-size: .85em; min-width: 70px; font-weight: 600; }

/* ─── Sum stats ─── */
.ktm-sum-stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0; }

/* ─── Stat grid ─── */
.ktm-stat-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(130px,1fr));
    gap: 12px; margin-bottom: 16px;
}
.ktm-stat-box {
    background: rgba(128,128,128,0.04); border-radius: 10px;
    padding: 14px 12px; text-align: center;
}
.ktm-stat-val { font-size: 1.5em; font-weight: 800; color: #1d4ed8; display: block; }
.ktm-stat-lbl { font-size: .75em; opacity: .6; margin-top: 4px; display: block; line-height: 1.3; }

/* ─── Analyysi box ─── */
.ktm-analyysi-box {
    background: rgba(29,78,216,0.05); border: 1px solid rgba(29,78,216,0.15);
    border-radius: 8px; padding: 14px 16px;
    font-size: .88em; line-height: 1.6; margin: 12px 0;
}
.ktm-analyysi-box ul { margin: 8px 0; padding-left: 20px; }
.ktm-analyysi-box li { margin-bottom: 4px; }

/* ─── Overdue ─── */
.ktm-overdue-list { display: flex; flex-direction: column; gap: 8px; }
.ktm-overdue-row { display: flex; align-items: center; gap: 8px; }

/* ─── Checker ─── */
.ktm-checker-grid {
    display: grid; grid-template-columns: repeat(8, 1fr);
    gap: 6px; margin: 14px 0;
}
@media(max-width:500px){ .ktm-checker-grid{ grid-template-columns:repeat(6,1fr); } }
.ktm-check-num {
    aspect-ratio: 1; border-radius: 8px;
    background: transparent; border: 2px solid rgba(128,128,128,0.15);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .9em; cursor: pointer;
    transition: all .15s; color: inherit; user-select: none;
}
.ktm-check-num:hover { border-color: #1d4ed8; background: rgba(29,78,216,0.08); }
.ktm-check-num.selected {
    background: #1d4ed8; border-color: #1d4ed8;
    color: #fff !important; transform: scale(1.05);
}
.ktm-checker-info { font-size: .88em; opacity: .75; margin: 8px 0 14px; }
.ktm-check-result {
    margin-top: 16px; padding: 16px;
    background: rgba(128,128,128,0.03);
    border-radius: 8px; border: 1px solid rgba(128,128,128,0.1);
}

/* ─── Buttons ─── */
.ktm-btn {
    background: #1d4ed8; color: #fff !important;
    border: none; border-radius: 8px; padding: 10px 20px;
    font-size: .9em; font-weight: 600; cursor: pointer;
    transition: opacity .15s; margin-right: 8px;
}
.ktm-btn:disabled { opacity: .5; cursor: not-allowed; }
.ktm-btn:hover:not(:disabled) { opacity: .85; }
.ktm-btn-secondary {
    background: rgba(128,128,128,0.08);
    border: 1px solid rgba(128,128,128,0.15); color: inherit;
}

/* ─── FAQ ─── */
.ktm-faq-list { display: flex; flex-direction: column; gap: 8px; }
.ktm-faq-item {
    background: rgba(128,128,128,0.03); border: 1px solid rgba(128,128,128,0.1);
    border-radius: 8px; overflow: hidden;
}
.ktm-faq-q {
    width: 100%; text-align: left; background: none; border: none;
    padding: 14px 16px; color: inherit; font-size: .92em; font-weight: 600;
    cursor: pointer; display: flex; justify-content: space-between;
    align-items: center; gap: 10px; line-height: 1.4; font-family: inherit;
}
.ktm-faq-q:hover { background: rgba(128,128,128,0.04); }
.ktm-faq-arrow { font-size: .75em; opacity: .5; flex-shrink: 0; }
.ktm-faq-a {
    padding: 0 16px 14px; font-size: .88em; line-height: 1.65; opacity: .8;
}

/* ─── Responsible + source ─── */
.ktm-responsible {
    background: rgba(239,68,68,0.05); border: 1px solid rgba(239,68,68,0.15);
    border-radius: 8px; padding: 12px 16px; font-size: .8em; opacity: .8;
    margin-top: 16px; line-height: 1.5;
}
.ktm-source-note { font-size: .75em; opacity: .45; text-align: center; margin-top: 12px; }

/* ─── Error ─── */
.ktm-error { color: #dc2626; font-size: .88em; }

/* ─── Kertoimet table ─── */
.ktm-kertoimet-table th:nth-child(n+2),
.ktm-kertoimet-table td:nth-child(n+2) { text-align: right; }
.ktm-kertoimet-table th:first-child,
.ktm-kertoimet-table td:first-child { text-align: left; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .ktm-wrap { max-width: 100%; padding: 0; overflow: hidden; }
    .ktm-hero { padding: 20px 16px 18px; }
    .ktm-hero h2 { font-size: 1.25em; }
    .ktm-section { padding: 14px; }
    .ktm-grid { gap: 4px; }
    .ktm-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .ktm-table th, .ktm-table td { padding: 6px 8px; }
}
@media (max-width: 480px) {
    .ktm-grid { grid-template-columns: repeat(6, 1fr); }
    .ktm-checker-grid { grid-template-columns: repeat(6, 1fr); }
    .ktm-hot-cold-grid { grid-template-columns: 1fr; }
}
