/* ============================================================
   EDHREQ — Global Reset & Base
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-dark:      #0d0d0f;
    --bg-panel:     #13131a;
    --bg-card:      #1a1a25;
    --border:       #2e2e45;
    --gold:         #c8922a;
    --gold-light:   #e8b84b;
    --gold-dim:     #7a5518;
    --red-dark:     #6b1212;
    --red-mid:      #9b1c1c;
    --red-glow:     #cc2222;
    --text-primary: #e8e0d0;
    --text-muted:   #7a7a9a;
    --text-gold:    #c8922a;
    --shadow:       rgba(0, 0, 0, 0.7);

    --font-title:  'Palatino Linotype', 'Book Antiqua', Palatino, serif;
    --font-body:   Georgia, 'Times New Roman', serif;
    --font-ui:     'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
    height: 100%;
    min-height: 100vh;
}

body {
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(107, 18, 18, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(46, 18, 107, 0.08) 0%, transparent 60%);
    color: var(--text-primary);
    font-family: var(--font-body);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================================
   HEADER
   ============================================================ */
header {
    text-align: center;
    padding: 2rem 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(107,18,18,0.15) 0%, transparent 100%);
    position: relative;
}

header::before,
header::after {
    content: '';
    position: absolute;
    bottom: 0;
    height: 1px;
    width: 30%;
    background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}
header::before { left: 0; }
header::after  { right: 0; }

.site-title {
    font-family: var(--font-title);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--gold-light);
    text-shadow:
        0 0 30px rgba(200, 146, 42, 0.5),
        0 0 60px rgba(200, 146, 42, 0.2),
        2px 2px 4px rgba(0,0,0,0.8);
    text-transform: uppercase;
}

.site-subtitle {
    margin-top: 0.5rem;
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
    letter-spacing: 0.05em;
}

.site-subtitle em {
    color: var(--gold);
    font-style: normal;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
main.panels {
    flex: 1;
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.panel-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    height: 100%;
}

.panel-left  { background: linear-gradient(135deg, rgba(107,18,18,0.04) 0%, transparent 100%); }
.panel-right { background: linear-gradient(225deg, rgba(46,18,107,0.04) 0%, transparent 100%); }

/* ============================================================
   DIVIDER
   ============================================================ */
.panel-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
    width: 2px;
    position: relative;
}

.divider-line {
    flex: 1;
    width: 1px;
    background: linear-gradient(180deg, transparent, var(--gold-dim) 30%, var(--gold-dim) 70%, transparent);
}

.divider-icon {
    font-size: 1.5rem;
    color: var(--gold-dim);
    padding: 0.5rem 0;
    transform: rotate(90deg);
}

/* ============================================================
   PANEL HEADINGS
   ============================================================ */
.panel-heading {
    font-family: var(--font-title);
    font-size: 1.4rem;
    font-weight: normal;
    color: var(--gold);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--gold-dim);
    padding-bottom: 0.5rem;
    width: 100%;
    text-align: center;
}

/* ============================================================
   COMMANDER SEARCH SELECT
   ============================================================ */
.search-select {
    width: 100%;
    max-width: 480px;
    position: relative;
}

#commander-search {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#commander-search:focus,
#commander-search:hover:not(:disabled) {
    border-color: var(--gold-dim);
    box-shadow: 0 0 0 2px rgba(200, 146, 42, 0.15);
}

#commander-search::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

#commander-search:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 1000;
    list-style: none;
    padding: 0;
    margin: 0;
    box-shadow: 0 4px 16px var(--shadow);
}

.search-dropdown li {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: background 0.15s;
}

.search-dropdown li:hover {
    background: rgba(200, 146, 42, 0.12);
    color: var(--gold-light);
}

.search-dropdown li.no-results {
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
}

.search-dropdown li.no-results:hover {
    background: none;
    color: var(--text-muted);
}

/* ============================================================
   PARTNER TOGGLE & SECOND SEARCH
   ============================================================ */
.partner-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    width: 100%;
    max-width: 480px;
}

.partner-label input[type="checkbox"] {
    accent-color: var(--gold);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.partner-label:hover {
    color: var(--gold);
}

#partner-section {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#partner-search {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#partner-search:focus,
#partner-search:hover {
    border-color: var(--gold-dim);
    box-shadow: 0 0 0 2px rgba(200, 146, 42, 0.15);
}

#partner-search::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.pair-status {
    font-family: var(--font-ui);
    font-size: 0.82rem;
    padding: 0.4rem 0.75rem;
    border-radius: 3px;
    text-align: center;
}

.pair-checking {
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    font-style: italic;
}

.pair-valid {
    color: #6dbf7e;
    background: rgba(50, 120, 60, 0.15);
    border: 1px solid rgba(80, 160, 80, 0.4);
}

.pair-invalid {
    color: #e07070;
    background: rgba(107, 18, 18, 0.3);
    border: 1px solid var(--red-dark);
}

/* ============================================================
   CARD DISPLAY AREAS
   ============================================================ */
.commander-display,
.required-display {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    min-height: 300px;
}

.card-placeholder {
    border: 2px dashed var(--border);
    border-radius: 8px;
    width: 240px;
    height: 336px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
    text-align: center;
    padding: 1rem;
    background: var(--bg-card);
}

.card-image {
    max-width: 300px;
    width: 100%;
    border-radius: 10px;
    box-shadow:
        0 4px 20px var(--shadow),
        0 0 0 1px rgba(200, 146, 42, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-image:hover {
    transform: scale(1.02) translateY(-2px);
    box-shadow:
        0 8px 40px var(--shadow),
        0 0 20px rgba(200, 146, 42, 0.2);
}

#required-link {
    display: block;
    cursor: pointer;
}

/* ============================================================
   CHALLENGE BUTTON
   ============================================================ */
.challenge-btn {
    width: 100%;
    max-width: 360px;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--red-dark) 0%, var(--red-mid) 50%, var(--red-dark) 100%);
    color: var(--gold-light);
    border: 1px solid var(--gold-dim);
    border-radius: 4px;
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.challenge-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.05) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.2s;
}

.challenge-btn:hover:not(:disabled)::before { opacity: 1; }

.challenge-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--red-mid) 0%, var(--red-glow) 50%, var(--red-mid) 100%);
    border-color: var(--gold);
    box-shadow:
        0 0 20px rgba(204, 34, 34, 0.4),
        0 0 40px rgba(204, 34, 34, 0.2),
        inset 0 0 10px rgba(0,0,0,0.3);
    color: #fff;
    transform: translateY(-1px);
}

.challenge-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 0 10px rgba(204, 34, 34, 0.3);
}

.challenge-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================================
   VERDICT TEXT
   ============================================================ */
.verdict {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--red-dark);
    border-left: 4px solid var(--red-glow);
    border-radius: 4px;
    padding: 1.25rem 1.5rem;
    text-align: center;
    box-shadow: 0 0 20px rgba(204, 34, 34, 0.1);
}

#verdict-text {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
}

#verdict-text strong {
    color: var(--gold-light);
    font-weight: bold;
}

#verdict-text .punishment {
    color: var(--red-glow);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-style: italic;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   ERROR
   ============================================================ */
.error {
    width: 100%;
    max-width: 420px;
    background: rgba(107,18,18,0.3);
    border: 1px solid var(--red-dark);
    border-radius: 4px;
    padding: 1rem 1.5rem;
    color: #e07070;
    font-size: 0.9rem;
    text-align: center;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
    text-align: center;
    padding: 1.25rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 0.8rem;
}

footer a {
    color: var(--gold-dim);
    text-decoration: none;
}
footer a:hover { color: var(--gold); }

/* ============================================================
   CHAOS LEVEL CONTROL
   ============================================================ */
.chaos-section {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.chaos-header-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.chaos-title {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

#chaos-label {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--gold);
    font-style: italic;
}

.chaos-reset-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.72rem;
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    line-height: 1.4;
}
.chaos-reset-btn:hover {
    color: var(--gold);
    border-color: var(--gold-dim);
}

.chaos-slider-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.chaos-end-label {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.chaos-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--gold-dim) 0%, var(--red-glow) 100%);
    outline: none;
    cursor: pointer;
}

.chaos-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gold-light);
    border: 2px solid var(--bg-dark);
    box-shadow: 0 0 6px rgba(200, 146, 42, 0.5);
    cursor: pointer;
    transition: box-shadow 0.2s;
}
.chaos-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 0 12px rgba(200, 146, 42, 0.8);
}
.chaos-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gold-light);
    border: 2px solid var(--bg-dark);
    box-shadow: 0 0 6px rgba(200, 146, 42, 0.5);
    cursor: pointer;
}

/* ============================================================
   MULTIPLE CARDS TOGGLE
   ============================================================ */
.multi-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    width: 100%;
    max-width: 360px;
}

.multi-label input[type="checkbox"] {
    accent-color: var(--gold);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.multi-label:hover {
    color: var(--gold);
}

#multi-section {
    width: 100%;
    max-width: 360px;
}

.multi-slider-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
}

.multi-slider-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--gold-dim) 0%, var(--gold) 100%);
    outline: none;
    cursor: pointer;
}

.multi-slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gold-light);
    border: 2px solid var(--bg-dark);
    box-shadow: 0 0 6px rgba(200, 146, 42, 0.5);
    cursor: pointer;
}

.multi-slider-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gold-light);
    border: 2px solid var(--bg-dark);
    box-shadow: 0 0 6px rgba(200, 146, 42, 0.5);
    cursor: pointer;
}

.multi-rate-note {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    margin-top: 0.35rem;
}

#multi-count {
    font-family: var(--font-ui);
    font-size: 0.82rem;
    color: var(--gold);
    white-space: nowrap;
    min-width: 4.5em;
    text-align: right;
}

/* ============================================================
   MULTI-CARD RESULTS LIST
   ============================================================ */
.multi-card-results {
    width: 100%;
    padding: 0.5rem 0;
}

#multi-card-list {
    width: 100%;
}

.multi-card-header {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    text-align: center;
}

.multi-card-header strong {
    color: var(--gold-light);
}

.multi-card-ol {
    list-style: decimal;
    padding-left: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.multi-card-ol li {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--text-primary);
}

.multi-card-link {
    color: var(--gold);
    text-decoration: none;
    transition: color 0.15s;
}

.multi-card-link:hover {
    color: var(--gold-light);
    text-decoration: underline;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden {
    display: none !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    main.panels {
        flex-direction: column;
    }

    .panel-divider {
        flex-direction: row;
        width: 100%;
        height: 2px;
        padding: 0 2rem;
    }

    .divider-line {
        flex: 1;
        height: 1px;
        width: auto;
        background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
    }

    .divider-icon {
        transform: none;
        padding: 0 0.5rem;
    }
}
