:root {
    --font-primary: 'Roboto', sans-serif;
    --font-heading: 'Playfair Display', serif;
    --accent-primary: #007bff;
    --accent-action: #28a745;
    --danger-color: #dc3545;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --bg-body: #f2f6f9;
    --bg-card: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
    --shadow-md: 0 3px 6px rgba(0, 0, 0, .1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font: 400 16px/1.5 var(--font-primary); color: var(--text-primary); background: var(--bg-body); }
header { background: linear-gradient(135deg, #0069ff 0%, #005fd1 100%); color: #fff; text-align: center; padding: 1.5rem .5rem 2rem; }
header h1 { font: 700 clamp(1.3rem, 3vw, 2rem) var(--font-heading); }
header p { opacity: .9; font-size: .95rem; }
main { max-width: 100rem; margin: 0 auto; padding: 1.5rem; }
.settings-panel, .matchup-configuration, .results-panel { background: var(--bg-card); border-radius: .75rem; box-shadow: var(--shadow-sm); padding: 1.4rem 1.8rem 2rem; margin-bottom: 2rem; }
h2 { font: 700 1.35rem/1.2 var(--font-heading); margin-bottom: 1rem; }
h3 { font-weight: 600; font-size: 1.1rem; margin-bottom: .75rem; }
h4 { margin-bottom: 1rem; }
h5 { margin-top: 1rem; margin-bottom: 0.5rem; font-size: 1rem; }
.player-columns-container { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 992px) { .player-columns-container { grid-template-columns: 1fr; } }
.player-column { background: var(--bg-card); border-radius: .5rem; box-shadow: var(--shadow-sm); padding: 1rem 1.25rem 1.5rem; }
.results-column { background: none; box-shadow: none; padding: 0; }
.set-selection-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.set-selection-header h3 { margin-bottom: 0; }
.set-selection-controls { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem; }
.set-quick-action-btn { font-size: 0.8rem; padding: 0.3rem 0.55rem; background: #fff; color: var(--accent-primary); border-color: #b9d3ff; box-shadow: none; }
.set-quick-action-btn:hover { background: #edf4ff; }
.set-quick-action-btn:disabled { color: var(--text-secondary); border-color: #d3d9e3; background: #f8f9fa; cursor: not-allowed; }
.set-selection.collapsed #set-checkboxes, .set-selection.collapsed .set-actions { display: none; }
.set-selection.collapsed { padding-bottom: 0; margin-bottom: 1rem; }
.set-checkboxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: .9rem 1.2rem; }
.set-switch { display: flex; align-items: center; column-gap: .65rem; font-size: .92rem; user-select: none; cursor: pointer; }
.set-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.set-switch .slider { position: relative; flex: 0 0 54px; height: 28px; background: #d1d7e0; border-radius: 28px; overflow: hidden; transition: background .35s ease; }
.set-switch .slider::before { content: ''; position: absolute; width: 24px; height: 24px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: 0 2px 4px rgba(0, 0, 0, .25); transition: transform .35s cubic-bezier(.4, 0, .2, 1); }
.set-switch input:checked+.slider { background: linear-gradient(90deg, #00c6ff 0%, #0072ff 100%); }
.set-switch input:checked+.slider::before { transform: translateX(26px); }
.playstyle-selector { margin-bottom: .25rem; }
.playstyle-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem 1rem; margin-top: .6rem; }
.playstyle-options.collapsed { display: none; }
.toggle-playstyle-btn { background: none !important; border: none !important; box-shadow: none !important; color: var(--accent-primary); font-size: 1rem; cursor: pointer; padding: .25rem; transition: none; }
.toggle-playstyle-btn:hover, .toggle-playstyle-btn:active { text-decoration: underline; }
.toggle-playstyle-btn[aria-expanded="true"]::after { content: ' ▴'; }
.toggle-playstyle-btn[aria-expanded="false"]::after { content: ' ▾'; }
.preferences-row { display: grid; gap: 1.25rem; align-items: start; margin-top: .75rem; }
.range-selector label { display: block; margin-bottom: .25rem; }
.range-selector select { width: 100%; }
button, input[type="button"], input[type="submit"], select { font: 400 1rem var(--font-primary); border-radius: 6px; border: 1px solid #ced4da; padding: .6rem 1.2rem; cursor: pointer; transition: background .15s, box-shadow .15s, transform .05s; }
button { background: var(--accent-primary); color: #fff; box-shadow: var(--shadow-sm); }
button:hover { background: #0069d9; box-shadow: var(--shadow-md); }
button:active { transform: translateY(1px); }
button:focus-visible, select:focus-visible { outline: 3px solid var(--accent-primary); outline-offset: 2px; }
.primary-action-button { display: block; margin: 1.2rem auto; max-width: 18rem; width: 100%; font-weight: 600; background: var(--accent-action); border-color: var(--accent-action); }
.primary-action-button:hover { background: #218838; }
#toggle-set-selection-btn { background: none; border: none; color: var(--accent-primary); padding: .25rem .5rem; box-shadow: none; }
select { background: #fff; width: 100%; }
.set-actions button { margin-right: .6rem; margin-top: .5rem; }
label { font-size: .9rem; }
.error-message { background: var(--danger-color); color: #fff; border-radius: .25rem; padding: .5rem .75rem; margin-bottom: 1rem; }
.top-control-wrapper { min-height: 5.25rem; }
.hidden { display: none; }
.fighter-card { background-color: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; padding: 1rem; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); }
.main-suggestion { margin-bottom: 1.5rem; }
.fighter-stats { display: flex; justify-content: space-between; align-items: center; padding-bottom: 0.75rem; margin-bottom: 0.75rem; border-bottom: 1px solid #e9ecef; font-size: 0.9rem; }
.win-percentage { font-weight: 500; color: var(--accent-action); }
.relevance-score { background-color: #e9ecef; color: var(--text-secondary); padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.8rem; }
.fighter-card-body { display: flex; gap: 1rem; align-items: flex-start; }
.fighter-card .fighter-image { flex-shrink: 0; width: 100px; border-radius: 6px; }
.fighter-card .fighter-details h3 { margin-bottom: 0.5rem; }
.fighter-card .fighter-details p { font-size: 0.9rem; line-height: 1.4; margin-bottom: 0.25rem; }
.fighter-card-footer { margin-top: 1rem; text-align: center; }
.lock-button, .select-alternative-btn { width: 100%; padding: 0.5rem; font-weight: 600; color: white; }
.select-alternative-btn { background-color: #6c757d; }
.select-alternative-btn:hover { background-color: #5a6268; }
.alternatives-grid { display: grid; gap: 1rem; }
.alternative-suggestion .fighter-stats { padding-bottom: 0.5rem; margin-bottom: 0.5rem; font-size: 0.8rem; }
.alternative-suggestion .win-percentage { font-weight: 400; }
.alternative-suggestion .relevance-score { padding: 0.1rem 0.5rem; font-size: 0.7rem; }
.lock-button.btn-lock { background-color: var(--accent-primary); }
.lock-button.btn-lock:hover { background-color: #0069d9; }
.lock-button.btn-unlock { background-color: var(--accent-action); border-color: var(--accent-action); }
.lock-button.btn-unlock:hover { background-color: #218838; }

/* ===== HEADER WITH HELP BUTTON ===== */
.header-with-help { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.header-with-help h2 { margin-bottom: 0; }

/* ===== MATCHUP MODE SELECTOR ===== */
.mode-selection { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid #e9ecef; }
.mode-selection h3 { margin-bottom: 1rem; display: flex; align-items: center; justify-content: space-between; }
.header-buttons { display: flex; align-items: center; gap: 0.5rem; }
.mode-toggle-heading-btn { background: none !important; border: none !important; box-shadow: none !important; color: var(--accent-primary); font-size: 0.9rem; cursor: pointer; padding: 0.25rem 0; transition: none; text-align: right; }
.mode-toggle-heading-btn:hover { text-decoration: underline; }
.help-icon-btn { background: none !important; border: none !important; box-shadow: none !important; color: var(--accent-primary); font-size: 1rem; cursor: pointer; padding: 0.2rem 0.4rem; transition: none; }
.help-icon-btn:hover { transform: scale(1.15); }
.advanced-button-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.mode-selection.collapsed { padding-bottom: 0; margin-bottom: 1rem; }
.mode-selection.collapsed > p, .mode-selection.collapsed .mode-options, .mode-selection.collapsed .custom-mode { display: none; }
.mode-options { display: flex; flex-direction: column; gap: 0.75rem; }
.mode-options label { display: flex; align-items: center; font-size: 0.95rem; cursor: pointer; user-select: none; }
.mode-options input[type="radio"] { margin-right: 0.5rem; cursor: pointer; }
.advanced-toggle { background: none !important; border: none !important; box-shadow: none !important; color: var(--accent-primary); font-size: 0.9rem; cursor: pointer; padding: 0.25rem 0; transition: none; text-align: left; margin-top: 0.5rem; }
.advanced-toggle:hover { text-decoration: underline; }
.custom-mode { margin-top: 1rem; padding: 1rem; background-color: #f8f9fa; border-radius: 6px; border-left: 3px solid var(--accent-primary); }
.custom-mode.collapsed { display: none; }
.custom-mode label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.custom-mode input[type="number"] { width: 100%; max-width: 200px; padding: 0.5rem; border: 1px solid #ced4da; border-radius: 4px; font-size: 0.9rem; }
.custom-mode input[type="number"]:focus { outline: 2px solid var(--accent-primary); outline-offset: 1px; }
.custom-mode .helper-text { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.5rem; font-style: italic; }

/* ===== MODAL STYLES ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal-content {
    background: #fff;
    color: #222;
    padding: 1.5rem;
    max-width: 480px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Stronger hidden rule for modals */
.hidden { display: none !important; }

/* ===== COOKIE CONSENT ===== */
.cookie-consent {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(960px, calc(100% - 2rem));
    background: #0b1526;
    color: #f8fafc;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(0,0,0,0.25);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem 1rem;
    align-items: center;
    z-index: 1200;
}

.cookie-consent .cookie-text {
    font-size: 0.95rem;
    line-height: 1.4;
}

.cookie-consent .cookie-actions { display: flex; gap: 0.5rem; }

.cookie-consent button { margin: 0; padding: 0.55rem 1rem; }

.cookie-consent .secondary {
    background: #25324a;
    color: #e2e8f0;
    border-color: transparent;
}

.cookie-consent .secondary:hover { background: #2f405c; }

@media (max-width: 640px) {
    .cookie-consent { grid-template-columns: 1fr; }
    .cookie-consent .cookie-actions { justify-content: flex-start; }
}


/* ===== PLAYSTYLE TAGS (Major/Minor) ===== */
.playstyle-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    margin: 0.1rem 0.2rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.playstyle-tag.major {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: #fff;
    box-shadow: 0 2px 4px rgba(238, 90, 111, 0.2);
}

.playstyle-tag.minor {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a0a0 100%);
    color: #fff;
    box-shadow: 0 2px 4px rgba(78, 205, 196, 0.2);
}

/* Uniform tag colour inside the glossary (no major/minor distinction) */
.playstyle-glossary-list .playstyle-tag {
    background: linear-gradient(135deg, #7c6fcd 0%, #5a4fa8 100%);
    color: #fff;
    box-shadow: 0 2px 4px rgba(90, 79, 168, 0.2);
}

/* ===== PLAYSTYLE GLOSSARY MODAL ===== */
.modal-content-scrollable {
    max-height: 80vh;
    overflow-y: auto;
    width: min(560px, calc(100% - 2rem));
}

.playstyle-glossary-heading {
    margin-top: 1.25rem;
    margin-bottom: 0.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.playstyle-glossary-heading:first-of-type {
    margin-top: 0.75rem;
}

.playstyle-glossary-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    align-items: center;
    justify-items: center;
    margin: 0.5rem auto 0.75rem;
    width: 100%;
}

.playstyle-glossary-list dt {
    text-align: center;
}

.playstyle-glossary-list dd {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    text-align: center;
}

#playstyle-help-modal .modal-content {
    text-align: center;
}
/* ===== THEME FILTER ===== */
.theme-filter-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.theme-filter-section h3 {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-filter-section .optional-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 0.4rem;
}

.theme-filter-section.collapsed { padding-bottom: 0; margin-bottom: 1rem; }
.theme-filter-section.collapsed > p, .theme-filter-section.collapsed .theme-options { display: none; }

.theme-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.6rem;
}

.theme-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.9rem;
    border: 2px solid #ced4da;
    border-radius: 24px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    background: #fff;
    color: var(--text-primary);
    transition: border-color .15s, background .15s, color .15s;
    user-select: none;
}

.theme-chip input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-chip:hover {
    border-color: var(--accent-primary);
    background: #e8f0fe;
}

.theme-chip.active,
.theme-chip:has(input:checked) {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    color: #fff;
}
