:root {
    color-scheme: light;
    --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --bg: #FBF7EE;
    --surface: #FFFFFF;
    --surface-muted: #F5EDDC;
    --surface-sunken: #FAF5EA;
    --input-bg: #FFFDF8;
    --text: #3B2B30;
    --text-soft: #5C484E;
    --text-muted: #7B666F;
    --border: #E8DFD0;
    --border-strong: #D5C7B3;
    --control-border: #8C7A66;
    --primary: #930031;
    --primary-solid: #930031;
    --primary-hover: #780027;
    --primary-text: #930031;
    --primary-soft: #FFF2A7;
    --on-primary: #FFF8E7;
    --accent: #FFA500;
    --on-accent: #3A0B1A;
    --success: #930031;
    --success-text: #930031;
    --success-soft: #FDEFF3;
    --success-border: #E7B6C3;
    --danger: #930031;
    --danger-solid: #930031;
    --danger-solid-hover: #780027;
    --danger-text: #930031;
    --danger-soft: #FDEFF3;
    --danger-border: #930031;
    --on-danger: #FFF8E7;
    --warning-text: #7A4700;
    --warning-soft: #FFF2A7;
    --warning-border: #FFA500;
    --focus: #930031;
    --focus-ring: rgba(147, 0, 49, 0.15);
    --shadow-sm: 0 1px 2px rgba(59, 43, 48, 0.06);
    --shadow-md: 0 16px 36px rgba(59, 43, 48, 0.12);
    --radius-sm: 6px;
    --radius-md: 9px;
    --radius-lg: 14px;
    --header-height: 64px;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #1C1216;
    --surface: #26191E;
    --surface-muted: #332329;
    --surface-sunken: #211519;
    --input-bg: #22161B;
    --text: #F6EDDF;
    --text-soft: #D9C9BC;
    --text-muted: #A9948B;
    --border: #3D2B31;
    --border-strong: #574048;
    --control-border: #B29A86;
    --primary: #FFA500;
    --primary-solid: #FFA500;
    --primary-hover: #FFB733;
    --primary-text: #FFC266;
    --primary-soft: #4A3212;
    --on-primary: #3A0B1A;
    --accent: #FFF2A7;
    --on-accent: #930031;
    --success: #FFA500;
    --success-text: #FFC266;
    --success-soft: #3B2A12;
    --success-border: #8A5A12;
    --danger: #FFA500;
    --danger-solid: #FFA500;
    --danger-solid-hover: #FFB733;
    --danger-text: #FFC266;
    --danger-soft: #3D1A24;
    --danger-border: #FFA500;
    --on-danger: #3A0B1A;
    --warning-text: #FFD27A;
    --warning-soft: #3B2A12;
    --warning-border: #B87900;
    --focus: #FFF2A7;
    --focus-ring: rgba(255, 242, 167, 0.22);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.32);
    --shadow-md: 0 18px 44px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: clip;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body,
button,
input,
textarea {
    font-family: var(--font-sans);
}

h1,
h2,
h3,
h4,
p,
dl,
dd,
figure {
    margin: 0;
}

h1,
h2,
h3 {
    color: var(--text);
    font-weight: 650;
    letter-spacing: -0.025em;
    line-height: 1.12;
}

ul,
ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

svg {
    display: block;
}

::selection {
    background: var(--accent);
    color: var(--on-accent);
}

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon {
    width: 18px;
    height: 18px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--text);
    color: var(--bg);
    font-size: 14px;
    font-weight: 600;
    transform: translateY(-160%);
    transition: transform 140ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.container {
    width: 100%;
    max-width: 1160px;
    margin-inline: auto;
    padding-inline: 24px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    height: var(--header-height);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 28px;
    height: 100%;
}

.brand {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    color: var(--text);
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.brand-word__accent {
    margin-left: 1px;
    padding: 1px 4px;
    border-radius: 4px;
    background: var(--accent);
    color: var(--on-accent);
}

.header-inner--brand {
    justify-content: center;
}

.section {
    padding: 66px 0;
    scroll-margin-top: calc(var(--header-height) + 18px);
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 26px;
}

.section-heading h2 {
    font-size: clamp(26px, 3vw, 32px);
    letter-spacing: -0.035em;
}

.section-heading p {
    max-width: 62ch;
    margin-top: 7px;
    color: var(--text-soft);
    font-size: 14.5px;
    line-height: 1.6;
}

.section-heading--split {
    align-items: flex-start;
}

.results-title-line {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.results-title-line h2:focus {
    outline: none;
}

.results-title-line h2:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
}

.results-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}

.history-section {
    padding-bottom: 84px;
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 28px 0;
}

.data-management {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.data-management h2 {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.data-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: none;
}

.footer-inner {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.footer-brand {
    color: var(--text);
    font-size: 14px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.footer-brand span {
    margin-left: 4px;
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.footer-inner p {
    color: var(--text-muted);
    font-size: 12.5px;
}

.footer-inner div > p:last-child {
    margin-top: 3px;
}

.footer-note {
    text-align: right;
}

.noscript-message {
    margin: 24px;
    padding: 16px;
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-md);
    background: var(--warning-soft);
    color: var(--warning-text);
    font-size: 14px;
}

@media print {
    @page {
        margin: 18mm 16mm;
    }

    html,
    body {
        background: #FFFFFF !important;
        color: #000000 !important;
    }

    body > *:not(#printView) {
        display: none !important;
    }

    #printView {
        display: block !important;
    }
}
