.page-hero { padding: 20px 0; background: linear-gradient(to bottom, var(--bg-subtle), var(--bg)); border-bottom: 1px solid var(--line); }

.filter-row {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
    margin-bottom: 24px; background: var(--surf); padding: 16px;
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--sh-card);
}
.filter-item { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px; }
.filter-item label { font-size: 11px; color: var(--tx-dim); text-transform: uppercase; font-weight: 600; letter-spacing: .04em; }
.filter-item input,
.filter-item select,
.filter-group input {
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--tx);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    width: 100%;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
    height: 38px;
    box-sizing: border-box;
}
.filter-item input:focus,
.filter-item select:focus,
.filter-group input:focus {
    border-color: var(--ac);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.filter-item input::placeholder,
.filter-group input::placeholder {
    color: var(--tx-dim);
    font-size: 13px;
}

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

.filter-group {
    display: flex; gap: 8px; align-items: center;
    background: var(--bg-subtle); padding: 8px;
    border-radius: 10px; border: 1px solid var(--line-subtle);
    flex: 1; min-width: 240px;
}
.filter-group .fg-label {
    font-size: 11px; color: var(--tx-dim); font-weight: 700;
    text-transform: uppercase; white-space: nowrap;
    padding-right: 6px; letter-spacing: .04em;
}
.filter-group input { min-width: 0; }

.table-custom { width: 100%; border-collapse: collapse; font-size: 13px; text-align: center; }
.table-custom th, .table-custom td { padding: 10px 8px; border-bottom: 1px solid var(--line-subtle); }
.table-custom th { background: var(--bg-subtle); color: var(--tx-muted); font-size: 12px; font-weight: 600; }
.table-custom tr:hover td { background: var(--bg-subtle); }

.col-main, .col-side, .split { min-width: 0 !important; }

.carousel-wrap { position: relative; }
.carousel-track {
    display: flex; gap: 12px; overflow-x: auto;
    scroll-behavior: smooth; scrollbar-width: none;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-item-card {
    flex: 0 0 calc((100% - 36px) / 4);
    min-width: 240px;
    scroll-snap-align: start;
}
@media (max-width: 1200px) { .carousel-item-card { flex: 0 0 calc((100% - 24px) / 3); } }
@media (max-width: 992px)  { .carousel-item-card { flex: 0 0 calc((100% - 12px) / 2); } }
@media (max-width: 576px)  { .carousel-item-card { flex: 0 0 85%; } }

.carousel-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--surf); border: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 5; box-shadow: var(--sh-card);
    color: var(--tx); font-size: 15px; transition: background .15s;
}
.carousel-nav:hover { background: var(--bg-subtle); }
.carousel-nav:disabled { opacity: .35; cursor: default; }
.carousel-nav.prev { left: -10px; }
.carousel-nav.next { right: -10px; }
@media (max-width: 768px) {
    .carousel-nav.prev { left: 2px; }
    .carousel-nav.next { right: 2px; }
}

.pattern-card {
    background: var(--surf); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 12px;
    box-shadow: var(--sh-card);
    display: flex; flex-direction: column; gap: 8px;
    height: 100%;
    transition: border-color .15s, box-shadow .15s;
}
.pattern-card.active { border-color: var(--ac); box-shadow: 0 0 0 2px rgba(59,130,246,.15); }
.pattern-card h3 { font-size: 13px; font-weight: 700; margin: 0; color: var(--tx); line-height: 1.3; }
.pattern-card .pattern-desc { font-size: 11px; color: var(--tx-muted); margin: 0; line-height: 1.35; min-height: 42px; }
.pattern-card .pattern-stats { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11px; align-items: center; }

.pattern-card .pattern-footer {
    display: flex; align-items: center; gap: 8px;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: auto;
}
.pattern-card .pattern-footer .pattern-stats { flex: 1 1 auto; margin: 0; }
.pattern-card .pattern-footer .btn-show { flex: 0 0 auto; margin: 0; }
.pattern-card .stat-chip {
    background: var(--bg-subtle); padding: 3px 6px; border-radius: 5px;
    font-family: 'JetBrains Mono', monospace; font-weight: 700;
}
.pattern-card .stat-chip.green  { color: #10b981; }
.pattern-card .stat-chip.amber  { color: #f59e0b; }
.pattern-card .stat-chip.red    { color: #ef4444; }
.pattern-card .btn-show {
    background: var(--ac); color: #fff; border: none;
    padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    display: inline-flex; align-items: center; gap: 6px;
    line-height: 1.2; white-space: nowrap;
    transition: background .15s, transform .1s;
}
.pattern-card .btn-show:hover { background: #1d4ed8; }
.pattern-card .btn-show:active { transform: scale(.97); }

.result-panel {
    background: var(--surf); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px; box-shadow: var(--sh-card);
}
.result-panel h3 { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.result-split {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
}
@media (max-width: 992px) {
    .result-split { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .pattern-card .pattern-footer {
        flex-direction: column; align-items: stretch;
    }
    .pattern-card .pattern-footer .btn-show { align-self: flex-start; }

    .result-split .table-custom {
        min-width: 900px;
    }

    .result-split .tbl-scroll-x {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .result-split .table-custom th,
    .result-split .table-custom td {
        padding: 8px 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    .result-split .table-custom td a {
        white-space: nowrap;
    }
    .heatmap-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -4px;
        padding: 0 4px 8px;
    }
    .heatmap-scroll .heatmap-table {
        min-width: 560px;
    }
    .heatmap-scroll::-webkit-scrollbar {
        height: 6px;
    }
    .heatmap-scroll::-webkit-scrollbar-thumb {
        background: var(--line);
        border-radius: 3px;
    }
    .heatmap-scroll::-webkit-scrollbar-track {
        background: transparent;
    }
}        

.metric-box { display: flex; justify-content: space-between; padding: 8px 0; font-size: 13px; border-bottom: 1px dashed var(--line-subtle); }
.metric-box:last-child { border-bottom: none; }
.metric-box .mlabel { color: var(--tx-muted); }
.metric-box .mvalue { font-family: 'JetBrains Mono', monospace; font-weight: 700; }

.heatmap-table { width: 100%; border-collapse: separate; border-spacing: 4px; font-size: 13px; }
.heatmap-table th { background: transparent; color: var(--tx-muted); font-weight: 600; padding: 6px 4px; font-size: 11px; text-align: center; }
.heatmap-table td.hm-cell {
    text-align: center; padding: 10px 6px; border-radius: 6px;
    font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 13px;
    color: #0f1419;
    transition: transform .12s ease;
}
.heatmap-table td.hm-cell:hover { transform: scale(1.03); }
.heatmap-table td.hm-cell .hm-pct {
    display: inline;
    font-size: 10px; font-weight: 600;
    opacity: .65; margin-left: 4px; color: #0f1419;
}
@media (max-width: 576px) {
    .heatmap-table td.hm-cell .hm-pct {
        display: block; margin-left: 0; margin-top: 1px;
    }
}
.heatmap-table td.hm-label {
    text-align: left; padding: 10px 12px 10px 8px;
    font-weight: 600; font-size: 12px; color: var(--tx-muted);
    white-space: nowrap; min-width: 130px;
}

.hm-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--tx-muted); margin-top: 12px; }
.hm-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: middle; }

.tabs-inline .tab { padding: 6px 12px; font-size: 12px; }

.hm-pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.hm-pagination button {
    background: var(--surf); border: 1px solid var(--line); color: var(--tx);
    border-radius: 5px; padding: 4px 10px; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: background .15s, border-color .15s;
}
.hm-pagination button:hover:not(:disabled) { background: var(--bg-subtle); }
.hm-pagination button.active { background: var(--ac); color: #fff; border-color: var(--ac); }
.hm-pagination button:disabled { opacity: .4; cursor: default; }

.hint-icon { font-size: 11px; color: var(--tx-dim); cursor: help; margin-left: 4px; border-bottom: 1px dashed var(--tx-dim); }

.table-custom a,
.result-panel a,
.rating-list a {
    transition: color .15s ease; 
}
.table-custom a:hover,
.result-panel a:hover,
.rating-list a:hover {
    color: var(--ac) !important;
    text-decoration: none;
}
.result-split a[href*="/team.php"],
.result-split a[href*="/tourney.php"] {
    transition: color .15s ease;
}
.result-split a[href*="/team.php"]:hover,
.result-split a[href*="/tourney.php"]:hover {
    color: var(--ac) !important;
}

.result-split a[href*="/tiraj.php"]:hover {
    color: #1d4ed8;
}

.anomalies-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 28px; }
.anom-card { background: var(--surf); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--sh-card); position: relative; overflow: hidden; }
.anom-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ac); }
.anom-card.cls-amber::before { background: #f59e0b; }
.anom-card.cls-green::before { background: #10b981; }
.anom-card.cls-red::before, .anom-card.cls-danger::before { background: #ef4444; }

.anom-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.anom-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; padding: 3px 8px; border-radius: 20px; background: var(--bg-subtle); color: var(--tx-muted); }
.anom-prob { font-size: 11px; font-weight: 800; font-family: 'JetBrains Mono', monospace; color: #10b981; background: rgba(16, 185, 129, 0.12); padding: 2px 8px; border-radius: 6px; }
.anom-title { font-size: 14px; font-weight: 700; color: var(--tx); line-height: 1.35; margin-bottom: 6px; }
.anom-desc { font-size: 12px; color: var(--tx-muted); line-height: 1.45; margin: 0; }

.slots-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.slots-table th { background: var(--bg-subtle); color: var(--tx-muted); font-size: 11px; text-transform: uppercase; padding: 10px 12px; text-align: center; border-bottom: 1px solid var(--line); }
.slots-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-subtle); text-align: center; vertical-align: middle; }
.slots-table tbody tr:hover { background: rgba(59, 130, 246, 0.04); }

.slot-num-badge { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 7px; background: var(--bg-subtle); border: 1px solid var(--line); font-weight: 800; font-family: 'JetBrains Mono', monospace; color: var(--tx); font-size: 12px; }
.slot-tri-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 170px; }
.slot-tri-nums { display: flex; justify-content: space-between; font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; }
.slot-tri-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--bg-subtle); }

.slot-ribbon { display: inline-flex; gap: 4px; align-items: center; justify-content: center; }
.slot-dot { width: 22px; height: 22px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; font-family: 'JetBrains Mono', monospace; text-decoration: none; }
.slot-dot.o-1 { background: rgba(16, 185, 129, 0.16); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.35); }
.slot-dot.o-X { background: rgba(245, 158, 11, 0.16); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.35); }
.slot-dot.o-2 { background: rgba(239, 68, 68, 0.16); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.35); }

.streak-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; font-family: 'JetBrains Mono', monospace; }
.streak-pill.warn { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.streak-pill.danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }
.streak-pill.calm { color: var(--tx-dim); font-weight: 500; }

@media (max-width: 1100px) { .anomalies-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
    .anomalies-grid { grid-template-columns: 1fr; gap: 10px; }
    .slots-table, .slots-table tbody, .slots-table tr, .slots-table td { display: block !important; width: 100% !important; box-sizing: border-box !important; }
    .slots-table thead { display: none !important; }
    .slots-table tr { background: var(--surf) !important; border: 1px solid var(--line) !important; border-radius: 10px !important; margin-bottom: 12px !important; padding: 12px 14px !important; box-shadow: var(--sh-card) !important; }
    .slots-table td { display: flex !important; justify-content: space-between !important; align-items: center !important; padding: 7px 0 !important; border-bottom: 1px dashed var(--line-subtle) !important; text-align: right !important; }
    .slots-table td:last-child { border-bottom: none !important; }
    .slots-table td::before { content: attr(data-label); font-size: 12px; font-weight: 600; color: var(--tx-muted); text-align: left; margin-right: auto; padding-right: 10px; }
    .slot-tri-wrap { min-width: 145px; }
}