:root {
    --scorigami-blue: #0A0F1C;
    --scorigami-gold: #ffd700;
    --impossible: #000000;
    --empty: #ffffff;
    --border: #e0e0e0;
    --cell-w: 19px;
    --cell-h: 16px;
    --crosshair: #f2f2f2;
}

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background: #f8f9fa; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding: 20px 10px; 
}

.filter-bar { 
    background: var(--scorigami-blue); 
    color: white; 
    padding: 10px 20px; 
    border-radius: 8px; 
    margin-bottom: 20px; 
    display: flex; 
    gap: 20px; 
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.filter-bar label { cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: bold; }

.matrix-container { 
    position: relative; 
    background: #0F172A; 
    padding: 25px; 
    border: 1px solid #0F172A; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.05); 
    display: inline-block; 
    max-width: 100%;
    overflow-x: auto;
}

.label:last-child {
    width: 35px;
    min-width: 35px;
    background: #f0f0f0;
    box-sizing: border-box; 
}

#grid { 
    display: grid; 
    background-color: var(--border); 
    gap: 1px; 
    border: 1px solid var(--border); 
    position: relative; 
    width: max-content;
    overflow: hidden;
}

.cell {
    width: var(--cell-w); 
    height: var(--cell-h);
    background: var(--empty); 
    font-size: 8px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    position: relative; 
    z-index: 5;
    cursor: default; 
    user-select: none;
    overflow: hidden;
}

.axis-highlight {
    position: absolute; 
    background: var(--scorigami-gold) !important;
    color: black !important; 
    font-weight: bold; 
    z-index: 100;
    display: none; 
    align-items: center; 
    justify-content: center;
    width: var(--cell-w) !important; 
    height: var(--cell-h) !important; 
    font-size: 9px; 
    pointer-events: none;
    box-sizing: border-box;
}

.is-scorigami { 
    background: #0F172A !important; 
    color: white; 
    cursor: pointer; 
    z-index: 10; 
    font-weight: bold;
}

.is-impossible, .is-unused { 
    background: var(--impossible) !important; 
    z-index: 10; 
    color: transparent; 
}

#cross-h, #cross-v {
    position: absolute; 
    background-color: rgba(255, 255, 255, 0.3);
    pointer-events: none; 
    z-index: 15;
    display: none;
    mix-blend-mode: overlay;
}

#cross-h { 
    width: 100%;
    height: var(--cell-h); 
    left: 0; 
}
#cross-v { height: 100%; width: var(--cell-w); top: 0; }

.label { background: #f0f0f0; font-weight: bold; color: #999; z-index: 20; }

#details-popup {
    position: fixed; 
    background: white;
    color: #333333;
    border: 1px solid var(--scorigami-blue);
    display: none; 
    z-index: 2000; 
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
    font-size: 13px; 
    border-radius: 6px; 
    width: 340px; 
    overflow: hidden;
}

.popup-content div {
    color: #333333 !important;
}

.popup-header { 
    background: var(--scorigami-blue); 
    color: white; 
    padding: 12px 15px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.popup-content { padding: 0; }
.popup-section { padding: 15px; }
.close-btn { cursor: pointer; font-size: 22px; line-height: 1; }

.history-list { max-height: 220px; overflow-y: auto; background: #f9f9f9; border-top: 1px solid #eee; }
.history-item { padding: 10px 15px; border-bottom: 1px solid #eee; font-size: 12px; }
.history-item:last-child { border-bottom: none; }
.history-item strong { display: block; color: #333; margin-bottom: 2px; }
.history-item span { color: #777; font-size: 11px; }

.first-badge { 
    background: #fff9c4; 
    border: 1px solid #fbc02d; 
    padding: 12px; 
    border-radius: 4px; 
    margin-bottom: 10px; 
    position: relative;
}
.first-label { font-size: 10px; color: #f57f17; font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px; }

/* Container */
.scorigami-controls {
    background: #e5e5e5;
    color: #333;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    margin-bottom: 12px;
}

/* Toggle Switch Design */
.switch-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 18px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider { background-color: #2e7d32; }
input:checked + .slider:before { transform: translateX(16px); }

/* Select & Slider */
.control-select { padding: 5px; border-radius: 4px; border: 1px solid #999; }

.slider-row { display: flex; align-items: center; gap: 15px; }
.main-range {
    flex-grow: 1; height: 8px; border-radius: 5px; background: #ccc;
    outline: none; -webkit-appearance: none;
}
.main-range::-webkit-slider-thumb {
    -webkit-appearance: none; width: 24px; height: 24px;
    background: #d32f2f; cursor: pointer; border-radius: 50%; cursor: pointer; accent-color: #d32f2f;
}

#year-display {
    font-weight: 800;
    font-size: 16px;
    color: #d32f2f;
    min-width: 40px;
}

/* In deinen <style> Block */
.divider { width: 1px; height: 20px; background: #bbb; margin: 0 5px; }

.league-filter {
    background: rgba(56, 189, 248, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.search-group {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-group input {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #999;
    width: 100px;
    font-size: 13px;
    outline: none;
}

.search-group input:focus {
    border-color: #d32f2f;
    box-shadow: 0 0 3px rgba(211, 47, 47, 0.3);
}

/* Base style for the text inside cells */
.cell-year {
    display: none; 
    font-size: 9px;
    font-family: 'Arial Narrow', Arial, sans-serif;
    font-weight: 700;
    line-height: var(--cell-h);
    text-align: center;
    pointer-events: none;
    user-select: none;
    text-shadow: none !important;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.5px;
}

/* Show text only if the hide-class is NOT present on the grid */
#grid:not(.hide-box-years) .cell-year {
    display: block;
}

/* Standard styling for scorigami cells (Fallback if JS-Gradient is off) */
.is-scorigami {
    cursor: pointer;
    position: relative;
    z-index: 10;
    transition: transform 0.1s ease-in-out;
}

/* Hover effect for cells */
.is-scorigami:hover {
    transform: scale(1.1);
    z-index: 100;
    outline: 1px solid var(--scorigami-gold);
}

/* Ensure empty/unused cells don't have pointer events */
.is-unused, .is-impossible {
    pointer-events: none;
}


.scorigami-help-section {
    margin-top: 40px;
    padding: 30px;
    background: #1e293b;
    border-radius: 12px;
    color: #e2e8f0;
    line-height: 1.6;
    max-width: 1400px;
    border: 1px solid #334155;
    box-sizing: border-box;
}

.scorigami-help-section h2 { 
    color: #38bdf8; 
    margin-top: 0; 
    border-bottom: 1px solid #334155; 
    padding-bottom: 10px; 
}

.scorigami-help-section h3 { 
    color: #f1f5f9; 
    font-size: 1.1rem; 
    margin-bottom: 10px; 
}

.help-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 30px; 
    margin-bottom: 30px; 
}

.help-box ul { padding-left: 20px; }
.help-box li { margin-bottom: 8px; font-size: 0.9rem; }

.legend-container { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 40px; 
    margin-top: 15px; 
}

.legend-bar { 
    display: flex; 
    border-radius: 4px; 
    overflow: hidden; 
    margin-top: 10px; 
}

.legend-bar span { 
    padding: 5px 15px; 
    font-size: 11px; 
    font-weight: bold; 
    text-align: center;
    min-width: 45px;
}

.special-cells { 
    display: flex; 
    gap: 20px; 
    margin-top: 25px; 
    font-size: 0.9rem; 
}

.s-cell { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

.s-cell span { 
    width: 16px; 
    height: 16px; 
    border-radius: 3px; 
}

@media (max-width: 800px) { 
    .help-grid { grid-template-columns: 1fr; } 
}

.scorigami-intro {
    max-width: 900px;
    margin-bottom: 25px;
    line-height: 1.5;
}

.scorigami-intro p {
    margin: 0;
    font-size: 0.95rem;
    color: #cbd5e1;
}

.scorigami-intro strong {
    color: #38bdf8; 
}

.scorigami-intro em {
    color: var(--scorigami-gold);
    font-style: normal;
    font-weight: 600;
}