:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    color: #171717;
    background: #f7f7f5;
}

* { box-sizing: border-box; }
body { margin: 0; background: #f7f7f5; }
button, input { font: inherit; }

.page-shell {
    width: min(1100px, calc(100% - 32px));
    margin: 14px auto 48px;
}
.support-strip {
    padding: 8px 0 12px;
    font-size: .88rem;
    color: #626972;
}
.support-strip a, .page-footer a { color: inherit; text-underline-offset: 2px; }
.page-header {
    background: #002145;
    color: #fff;
    padding: 24px;
    text-align: center;
    margin-bottom: 24px;
}
.page-header h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.5rem); }

.inventory-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.inventory-tab, .compute-button, .download-button {
    border: 1px solid #aaa;
    border-radius: 7px;
    background: #fff;
    padding: 9px 14px;
    cursor: pointer;
}
.inventory-tab.active { border-color: #222; background: #222; color: #fff; }
.inventory-panel { display: none; }
.inventory-panel.active { display: block; }
.inventory-scroll, .results-scroll { overflow-x: auto; }

.inventory-table, .results-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
.inventory-table th, .inventory-table td,
.results-table th, .results-table td {
    border: 1px solid #d7d7d2;
    padding: 8px 10px;
    text-align: left;
    white-space: nowrap;
}
.inventory-table thead th { background: #efefec; font-weight: 600; }
.inventory-table tbody th { background: #f8f8f6; font-weight: 500; }
.inventory-table td { text-align: center; min-width: 92px; }

.phoneme {
    min-width: 48px;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-family: "Times New Roman", serif;
    font-size: 1.2rem;
}
.phoneme:hover { background: #f0f0ec; }
.phoneme.selected { background: #222; color: #fff; }
.selection-line { min-height: 24px; margin: 12px 0 16px; }

.parameters {
    margin: 12px 0 16px;
    border-top: 1px solid #d7d7d2;
    border-bottom: 1px solid #d7d7d2;
    background: #fff;
}
.parameters > summary { cursor: pointer; padding: 13px 4px; font-weight: 650; }
.parameter-body { padding: 2px 4px 18px; }
.parameter-section + .parameter-section { margin-top: 24px; }
.parameter-section h2 { margin: 0 0 6px; font-size: 1rem; }
.parameter-help { margin: 0 0 10px; color: #555; }
#freq-log { width: 100%; }
.range-labels { display: flex; justify-content: space-between; color: #777; font-size: .8rem; }
.option-group + .option-group { margin-top: 16px; }
.parent-option { display: block; font-weight: 650; margin-bottom: 6px; }
.child-options { display: flex; flex-wrap: wrap; gap: 7px 18px; padding-left: 22px; }
.child-options label { white-space: nowrap; }

.compute-button {
    border-color: #222;
    background: #222;
    color: #fff;
    font-weight: 700;
    padding: 11px 18px;
}

.results-block { margin-top: 36px; padding-top: 24px; border-top: 1px solid #cfcfca; }
.results-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.results-heading h2 { margin: 0; font-size: 1.25rem; }
.results-heading p { margin: 4px 0 0; color: #555; }
.download-button { white-space: nowrap; }
.results-table thead th { background: #efefec; }
.results-table .segment-header th { text-align: center; font-family: "Times New Roman", serif; font-size: 1.2rem; background: #e7e7e2; }
.error-message { color: #a00000; font-weight: 600; }

.page-footer {
    margin-top: 40px;
    border-top: 1px solid #d7d7d2;
    padding-top: 16px;
    text-align: center;
    color: #626972;
    font-size: .9rem;
}

@media (max-width: 650px) {
    .page-shell { width: min(100% - 20px, 1100px); margin-top: 10px; }
    .results-heading { flex-direction: column; }
    .child-options { display: grid; padding-left: 10px; }
}
