/* Mate-Selection Widget — Two-Column Tufte Layout */

/* Widget accent colors (dark/light adaptive) */
:root {
    --msw-marriage: #3a7ca5;
    --msw-dating: #c95a4b;
}

html[data-theme="dark"],
html:not([data-theme]) {
    --msw-marriage: #7eb0d5;
    --msw-dating: #fd7f6f;
}

@media (prefers-color-scheme: light) {
    html:not([data-theme]) {
        --msw-marriage: #3a7ca5;
        --msw-dating: #c95a4b;
    }
}

/* Grid: form (55%) | gap (5%) | results (0.75fr) */
.msw-widget {
    display: grid;
    grid-template-columns: 55% 0.75fr;
    column-gap: 5%;
    align-items: start;
    width: 100%;
    font-size: 1.4rem;
    line-height: 2.2rem;
}

.msw-form-column {
    min-width: 0;
}

/* Sticky results panel */
.msw-results-panel {
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

/* Language toggle */
.msw-lang-toggle {
    display: flex;
    justify-content: flex-end;
    gap: 0.4em;
    margin-bottom: 1em;
}

.msw-lang-btn {
    background: transparent;
    border: 1px solid var(--theme-table-border);
    border-radius: var(--radius-sm);
    padding: 0.2em 0.6em;
    font-family: inherit;
    font-size: 1.1rem;
    color: var(--theme-text);
    cursor: pointer;
    transition: background-color 120ms ease;
}

.msw-lang-btn:hover {
    background: var(--highlight-weak);
}

.msw-lang-btn.msw-active {
    background: var(--highlight-weak);
    font-weight: bold;
}

/* Headings */
.msw-heading {
    font-size: 2rem;
    font-weight: bold;
    color: var(--theme-heading);
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}

.msw-results-heading {
    font-size: 2rem;
    font-weight: bold;
    color: var(--theme-heading);
    margin-top: 3.4rem;
    margin-bottom: 0.5em;
}

/* Required note */
.msw-required-note {
    font-size: 1.2rem;
    color: var(--theme-secondary-text);
    margin-bottom: 1em;
}

/* Form fields */
.msw-field {
    margin-bottom: 1.2em;
}

.msw-label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.3em;
    color: var(--theme-text);
}

.msw-select {
    width: 100%;
    padding: 0.4em 0.6em;
    font-family: inherit;
    font-size: 1.3rem;
    line-height: 1.6;
    color: var(--theme-text);
    background-color: var(--theme-bg);
    border: 1px solid var(--theme-table-border);
    border-radius: var(--radius-sm);
    appearance: auto;
}

.msw-select:focus {
    outline: 2px solid var(--highlight-strong);
    outline-offset: 1px;
}

/* Radio buttons */
.msw-radio-group {
    display: flex;
    gap: 1.2em;
    margin-top: 0.3em;
}

.msw-radio-label {
    display: flex;
    align-items: center;
    gap: 0.3em;
    cursor: pointer;
    color: var(--theme-text);
}

.msw-radio-label input[type="radio"] {
    margin: 0;
    accent-color: var(--theme-text);
}

/* Buttons */
.msw-buttons {
    display: flex;
    gap: 0.8em;
    margin-top: 1.5em;
    margin-bottom: 1.5em;
}

.msw-btn-predict {
    flex: 1;
    padding: 0.5em 1em;
    font-family: inherit;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--theme-bg);
    background-color: var(--theme-text);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity 120ms ease;
}

.msw-btn-predict:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.msw-btn-predict:not(:disabled):hover {
    opacity: 0.85;
}

.msw-btn-reset {
    padding: 0.5em 1em;
    font-family: inherit;
    font-size: 1.3rem;
    color: var(--theme-text);
    background-color: transparent;
    border: 1px solid var(--theme-table-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 120ms ease;
}

.msw-btn-reset:hover {
    background: var(--highlight-weak);
}

/* Results panel text */
.msw-results-panel p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0.4em 0;
}

.msw-results-panel[data-state="initial"] p {
    opacity: 0.7;
}

/* Score cards */
.msw-score-boxes {
    display: flex;
    flex-direction: column;
    gap: 1em;
    margin: 1em 0;
}

.msw-score-box {
    background-color: var(--theme-code-bg);
    border: 1px solid var(--theme-table-border);
    border-radius: var(--radius-sm);
    padding: 1em;
    text-align: center;
}

.msw-score-box.msw-marriage-card {
    border-left: 3px solid var(--msw-marriage);
}

.msw-score-box.msw-dating-card {
    border-left: 3px solid var(--msw-dating);
}

.msw-score-title {
    margin: 0 0 0.3em;
    font-size: 1.3rem;
    font-weight: bold;
}

.msw-score-title.msw-marriage {
    color: var(--msw-marriage);
}

.msw-score-title.msw-dating {
    color: var(--msw-dating);
}

.msw-score-line {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.3em;
}

.msw-big-number {
    font-size: 2.4rem;
    font-weight: bold;
    line-height: 1.2;
}

.msw-big-number.msw-marriage {
    color: var(--msw-marriage);
}

.msw-big-number.msw-dating {
    color: var(--msw-dating);
}

.msw-out-of {
    font-size: 1.0rem;
    color: var(--theme-secondary-text);
}

.msw-score-box hr {
    border: none;
    border-top: 1px solid var(--theme-table-border);
    margin: 0.6em 0;
}

.msw-percentile {
    font-size: 1.0rem;
    margin: 0.4em 0 0;
}

/* Disclaimer */
.msw-disclaimer {
    margin-top: 1.2em;
    padding-top: 1em;
    border-top: 1px solid var(--theme-table-border);
}

.msw-disclaimer-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.3em;
}

.msw-disclaimer p {
    font-size: 1.0rem;
    line-height: 1.5;
    color: var(--theme-secondary-text);
    margin: 0.3em 0;
}

/* Mobile: single column */
@media (max-width: 760px) {
    .msw-widget {
        display: block;
    }

    .msw-results-panel {
        position: static;
        max-height: none;
        overflow-y: visible;
        margin-top: 1.5em;
    }

    .msw-results-panel p {
        font-size: 1.4rem;
        line-height: 2.2rem;
    }

    .msw-results-heading {
        margin-top: 0;
    }

    .msw-score-title {
        font-size: 1.6rem;
    }

    .msw-big-number {
        font-size: 3rem;
    }

    .msw-out-of {
        font-size: 1.2rem;
    }

    .msw-percentile {
        font-size: 1.2rem;
    }

    .msw-buttons {
        flex-direction: column;
    }

    .msw-btn-predict,
    .msw-btn-reset {
        width: 100%;
    }
}