        :root {
            color-scheme: dark;
            font-family: Inter, "Segoe UI", Arial, sans-serif;
            background: #0f172a;
            color: #e2e8f0;
            font-synthesis: none;
        }

        * { box-sizing: border-box; }
        body { margin: 0; min-width: 320px; min-height: 100vh; }
        button, input, select { font: inherit; }
        button, select, input[type="checkbox"] { cursor: pointer; }
        button:focus-visible, input:focus-visible, select:focus-visible {
            outline: 2px solid #fbbf24;
            outline-offset: 2px;
        }

        .page { min-height: 100vh; display: flex; flex-direction: column; }
        header, footer { background: #1e293b; border-color: #334155; }
        header { border-bottom: 1px solid #334155; }
        .header-inner, footer { width: 100%; max-width: 1480px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
        .header-inner { min-height: 76px; display: flex; align-items: center; gap: 14px; }
        .brand-copy { min-width: 0; }
        .header-nav { display: flex; align-items: center; gap: 5px; margin-left: auto; }
        .header-nav span { padding: 9px 12px; border: 1px solid transparent; border-radius: 9px; color: #cbd5e1; font-size: 13px; font-weight: 600; white-space: nowrap; }
        .header-nav span[aria-current="page"] { border-color: #f59e0b66; background: #78350f29; color: #fbbf24; }
        .language-switch { display: flex; gap: 2px; padding: 4px; border: 1px solid #475569; border-radius: 10px; background: #0f172a; }
        .language-switch { margin-left: 0; }
        .language-switch button { min-width: 34px; padding: 6px 7px; border: 0; border-radius: 7px; background: transparent; color: #94a3b8; font-size: 11px; font-weight: 700; }
        .language-switch button[aria-current="true"] { background: #334155; color: #fff; }
        .header-help, .close-help { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid #475569; border-radius: 50%; background: #0f172a; color: #cbd5e1; font-size: 14px; font-weight: 700; cursor: pointer; }
        .brand-mark { font-size: 15px; letter-spacing: -.04em; }
        .header-help:hover, .close-help:hover { border-color: #fbbf24; color: #fbbf24; }
        .brand-mark {
            width: 42px; height: 42px; display: grid; place-items: center;
            border-radius: 13px; background: linear-gradient(135deg, #f59e0b, #ea580c);
            color: #111827; font-size: 21px; font-weight: 800;
        }
        h1, h2, p { margin: 0; }
        h1 { color: #fff; font-size: 19px; letter-spacing: -.02em; }
        .tagline { margin-top: 4px; color: #94a3b8; font-size: 13px; }
        main {
            width: 100%; max-width: 1480px; margin: 0 auto; padding: 30px 24px 34px;
            display: grid; grid-template-columns: minmax(0, 1fr) 350px; align-items: start; gap: 24px; flex: 1;
        }
        .panel {
            background: #1e293b; border: 1px solid #334155; border-radius: 18px;
            box-shadow: 0 18px 44px #02061733;
        }
        .calculator { padding: 24px; }
        .panel-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
        h2 { color: #fff; font-size: 18px; }
        .heading-icon { color: #fbbf24; font-size: 20px; }
        .intro { margin-bottom: 22px; color: #94a3b8; font-size: 13px; line-height: 1.55; }
        .goal-control { min-width: 0; padding: 13px 15px; border: 1px solid #f59e0b66; border-radius: 13px; background: #78350f29; }
        label, .field-label { display: block; color: #cbd5e1; font-size: 13px; font-weight: 600; }
        .goal-label { color: #fbbf24; }
        select, input[type="number"] {
            width: 100%; min-height: 42px; padding: 9px 11px; color: #f8fafc;
            border: 1px solid #475569; border-radius: 9px; background: #0f172a;
        }
        select { margin-top: 7px; }
        .unit-control { display: grid; align-content: center; justify-items: center; gap: 7px; padding: 10px 12px; border: 1px solid #475569; border-radius: 13px; background: #1e293b; }
        .unit-caption { color: #cbd5e1; font-size: 11px; font-weight: 600; }
        .unit-switch { display: flex; gap: 5px; padding: 4px; border: 1px solid #475569; border-radius: 10px; background: #0f172a; }
        .unit-switch button {
            min-width: 39px; border: 0; border-radius: 7px; padding: 7px 8px;
            background: transparent; color: #94a3b8; font-weight: 700;
        }
        .unit-switch button[aria-pressed="true"] { background: #f59e0b; color: #111827; }
        .fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
        .field {
            min-width: 0; padding: 13px; border: 1px solid #334155; border-radius: 12px;
            background: #0f172a80; transition: border-color .15s, background .15s, opacity .15s;
        }
        .field.is-goal { border: 2px solid #f59e0b; padding: 12px; background: #78350f29; }
        .field.is-input { border-color: #38bdf8; background: #0c4a6e2b; }
        .field:not(.is-goal):not(.is-input) { opacity: .58; }
        .field:not(.is-goal):not(.is-input):hover,
        .field:not(.is-goal):not(.is-input):focus-within { opacity: .82; }
        .field-top { min-height: 29px; display: grid; grid-template-columns: minmax(0, 1fr) 30px 22px; align-items: center; gap: 7px; margin-bottom: 8px; }
        .field-title { display: flex; min-width: 0; align-items: center; gap: 9px; }
        .field-title .field-label { min-width: 0; }
        .field-label { line-height: 1.3; }
        .field-variable { position: relative; flex: 0 0 auto; padding: 0; border: 0; background: transparent; color: #cbd5e1; font-family: Georgia, "Times New Roman", serif; font-size: 15px; font-style: italic; font-weight: 700; cursor: pointer; }
        .field-variable::after { position: absolute; z-index: 6; left: 50%; bottom: calc(100% + 8px); width: max-content; max-width: 210px; padding: 7px 9px; border: 1px solid #475569; border-radius: 7px; background: #020617; color: #e2e8f0; content: attr(data-tooltip); font: 11px/1.4 "Segoe UI", Arial, sans-serif; font-style: normal; font-weight: 500; opacity: 0; pointer-events: none; transform: translate(-50%, 3px); transition: opacity .15s, transform .15s; visibility: hidden; }
        .field-variable:hover::after, .field-variable:focus-visible::after { opacity: 1; transform: translate(-50%, 0); visibility: visible; }
        .field-variable:focus-visible { outline: 2px solid #fbbf24; outline-offset: 3px; border-radius: 2px; }
        .is-goal .field-label { color: #fbbf24; }
        .is-input .field-label { color: #7dd3fc; }
        .info-tip { position: relative; display: inline-grid; width: 20px; height: 20px; flex: 0 0 20px; place-items: center; justify-self: center; border: 1px solid #64748b; border-radius: 50%; color: #94a3b8; font-size: 11px; font-weight: 800; cursor: help; }
        .formula-info { grid-column: 3; grid-row: 1; }
        .info-tip::after { position: absolute; z-index: 5; right: -8px; bottom: calc(100% + 9px); width: 230px; padding: 9px 10px; border: 1px solid #475569; border-radius: 8px; background: #020617; color: #e2e8f0; content: attr(data-tooltip); font-size: 11px; font-weight: 500; line-height: 1.45; opacity: 0; pointer-events: none; transform: translateY(3px); transition: opacity .15s, transform .15s; visibility: hidden; white-space: normal; }
        .info-tip:hover::after, .info-tip:focus::after { opacity: 1; transform: translateY(0); visibility: visible; }
        .lock-button { display: grid; width: 29px; height: 29px; flex: 0 0 29px; place-items: center; justify-self: center; padding: 0; border: 0; border-radius: 0; background: transparent; color: #94a3b8; cursor: pointer; }
        .field-top > .lock-button { grid-column: 2; grid-row: 1; }
        .lock-button:hover, .lock-button[aria-pressed="true"] { background: transparent; color: #fbbf24; }
        .input-wrap { position: relative; }
        .input-wrap input { min-height: 40px; padding-right: 54px; }
        .input-wrap.has-pitch-toggle input { padding-right: 88px; }
        .input-suffix { position: absolute; top: 50%; right: 12px; color: #94a3b8; font-size: 12px; pointer-events: none; transform: translateY(-50%); }
        .field.is-goal input { border-color: #d97706; background: #1c1917; }
        .field.is-input input { border-color: #0284c7; }
        .field input:disabled { cursor: not-allowed; opacity: .58; }
        .pitch-toggle { position: absolute; top: 50%; right: 6px; display: flex; overflow: hidden; border: 1px solid #475569; border-radius: 7px; background: #0f172a; transform: translateY(-50%); }
        .pitch-toggle button { border: 0; padding: 5px 7px; background: transparent; color: #94a3b8; font-size: 11px; font-weight: 700; }
        .pitch-toggle button[aria-pressed="true"] { background: #0ea5e9; color: #082f49; }
        .warning {
            display: none; margin-top: 17px; padding: 12px 14px; border: 1px solid #ef444477;
            border-radius: 10px; background: #7f1d1d40; color: #fecaca; font-size: 13px; line-height: 1.5;
        }
        .warning.is-visible { display: block; }
        .result-line {
            display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px;
            margin-top: 18px; padding: 15px; border: 1px solid #475569; border-radius: 11px;
            background: #0f172a80; color: #cbd5e1; font-size: 13px;
        }
        .result-line strong { color: #fff; text-align: right; font-size: 16px; }
        .main-column { min-width: 0; display: grid; gap: 20px; }
        .result-actions { display: flex; align-items: center; gap: 8px; }
        .report-button { border-color: #f59e0b88; background: #78350f66; color: #fef3c7; }
        .report-button:hover { background: #92400e; }
        .icon-button { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; padding: 0; border: 1px solid #475569; border-radius: 9px; background: #334155; color: #e2e8f0; }
        .icon-button:hover:not(:disabled) { border-color: #7dd3fc; background: #1e3a5f; color: #fff; }
        .icon-button:disabled { cursor: not-allowed; opacity: .42; }
        .icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
        .icon-button.report-button { border-color: #f59e0b88; background: #78350f66; color: #fef3c7; }
        .icon-button.report-button:hover:not(:disabled) { background: #92400e; }
        .report-dialog { width: min(680px, calc(100% - 28px)); max-height: min(85vh, 820px); padding: 0; border: 1px solid #475569; border-radius: 16px; background: #1e293b; color: #e2e8f0; box-shadow: 0 24px 80px #020617b3; }
        .report-dialog::backdrop { background: #020617bb; backdrop-filter: blur(3px); }
        .report-content { display: grid; gap: 18px; padding: 22px; }
        .report-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
        .report-heading h2 { margin-bottom: 5px; }
        .report-meta { color: #94a3b8; font-size: 12px; line-height: 1.5; }
        .report-close { width: 34px; height: 34px; flex: 0 0 34px; border: 1px solid #475569; border-radius: 9px; background: #0f172a; color: #cbd5e1; cursor: pointer; }
        .report-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
        .report-close:hover { border-color: #f87171; color: #fca5a5; }
        .report-summary { padding: 15px; border: 1px solid #f59e0b66; border-radius: 12px; background: #78350f29; }
        .report-summary-label { color: #fbbf24; font-size: 12px; font-weight: 700; }
        .report-summary-value { display: block; margin-top: 5px; color: #fff; font-size: 24px; font-weight: 800; }
        .report-section h3 { margin-bottom: 9px; color: #f8fafc; font-size: 14px; }
        .report-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
        .report-list li { display: flex; justify-content: space-between; gap: 14px; padding: 8px 10px; border: 1px solid #334155; border-radius: 8px; background: #0f172a80; font-size: 12px; line-height: 1.45; }
        .report-list li span:first-child { color: #cbd5e1; }
        .report-list li span:last-child { color: #e2e8f0; text-align: right; overflow-wrap: anywhere; }
        .report-section p { color: #cbd5e1; font-size: 13px; line-height: 1.55; }
        .report-explanation { padding: 11px 12px; border-left: 3px solid #38bdf8; border-radius: 0 8px 8px 0; background: #0c4a6e2b; }
        .history { min-width: 0; padding: 20px; }
        .history-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
        .history-heading h3 { color: #fff; font-size: 15px; }
        .history-actions { display: flex; flex-wrap: wrap; gap: 8px; }
        .history-selection-actions[hidden] { display: none; }
        .action-button { border: 1px solid #475569; border-radius: 8px; padding: 7px 10px; background: #334155; color: #e2e8f0; font-size: 11px; font-weight: 700; }
        .action-button:hover:not(:disabled) { background: #475569; }
        .action-button:disabled { cursor: not-allowed; opacity: .45; }
        .history-list { display: grid; gap: 8px; }
        .history-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 11px; border: 1px solid #334155; border-radius: 10px; background: #0f172a80; }
        .history-item input { margin: 3px 0 0; accent-color: #f59e0b; }
        .history-detail { min-width: 0; color: #cbd5e1; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
        .history-detail strong { color: #fbbf24; }
        .history-date { display: block; margin-bottom: 3px; color: #94a3b8; font-size: 10px; }
        .history-delete { border: 0; padding: 4px 6px; background: transparent; color: #94a3b8; font-size: 15px; }
        .history-delete:hover { color: #f87171; }
        .export-dialog { width: min(420px, calc(100% - 28px)); padding: 22px; border: 1px solid #475569; border-radius: 16px; background: #1e293b; color: #e2e8f0; box-shadow: 0 24px 80px #020617b3; }
        .export-dialog::backdrop { background: #020617bb; backdrop-filter: blur(3px); }
        .export-dialog h2 { margin-bottom: 8px; }
        .export-dialog p { margin-bottom: 17px; color: #94a3b8; font-size: 13px; line-height: 1.5; }
        .export-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
        .export-option { min-height: 78px; display: grid; justify-items: center; align-content: center; gap: 7px; border: 1px solid #475569; border-radius: 10px; background: #0f172a; color: #e2e8f0; font-size: 12px; font-weight: 700; }
        .export-option:hover { border-color: #38bdf8; background: #0c4a6e55; }
        .export-option svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
        .export-dialog-close { margin-top: 16px; }
        #print-root { display: none; }
        @media print {
            @page { margin: 18mm; }
            body { min-width: 0; background: #fff; color: #111827; }
            body > *:not(#print-root) { display: none !important; }
            #print-root { display: block !important; color: #111827; font-family: Arial, sans-serif; }
            .print-report { break-after: page; }
            .print-report:last-child { break-after: auto; }
            .print-report h1 { margin: 0 0 6px; color: #111827; font-size: 23px; }
            .print-report h2 { margin: 20px 0 8px; color: #1f2937; font-size: 15px; }
            .print-report p { margin: 0 0 8px; color: #374151; font-size: 11px; line-height: 1.5; }
            .print-report .print-meta { color: #6b7280; font-size: 10px; }
            .print-report .print-result { margin: 16px 0; padding: 14px; border: 1px solid #d97706; border-radius: 8px; background: #fffbeb; }
            .print-report .print-result strong { display: block; margin-top: 5px; color: #111827; font-size: 24px; }
            .print-report table { width: 100%; border-collapse: collapse; font-size: 10px; }
            .print-report th, .print-report td { padding: 6px 8px; border: 1px solid #d1d5db; text-align: left; vertical-align: top; }
            .print-report th { width: 38%; background: #f3f4f6; }
        }
        .empty-history, .storage-note { color: #94a3b8; font-size: 12px; line-height: 1.5; }
        .storage-note { margin-top: 9px; }
        aside { padding: 0; }
        .sidebar { display: grid; gap: 16px; }
        .sidebar-panel { min-width: 0; padding: 18px; }
        .sidebar-panel h2 { margin-bottom: 14px; font-size: 16px; }
        .sidebar-settings { display: grid; gap: 10px; margin-bottom: 16px; }
        .sidebar-settings .goal-control { padding: 11px 12px; border-color: #f59e0b66; }
        .sidebar-settings .unit-control { grid-template-columns: 1fr auto; justify-items: start; gap: 8px; padding: 10px 12px; }
        .sidebar-settings .unit-switch { justify-self: end; }
        .legend { display: grid; gap: 11px; margin-bottom: 19px; }
        .legend-item { display: flex; align-items: center; gap: 9px; color: #cbd5e1; font-size: 12px; line-height: 1.4; }
        .swatch { width: 14px; height: 14px; flex: 0 0 14px; border-radius: 4px; }
        .swatch.goal { border: 2px solid #f59e0b; background: #78350f55; }
        .swatch.input { border: 1px solid #38bdf8; background: #0c4a6e66; }
        .swatch.locked { border: 1px solid #64748b; background: #334155; }
        .formula-box { padding: 13px; border: 1px solid #334155; border-radius: 11px; background: #0f172a80; }
        .formula-title { margin-bottom: 8px; color: #fbbf24; font-size: 12px; font-weight: 700; }
        .formula-list { display: grid; gap: 7px; }
        .formula-item { width: 100%; padding: 9px 10px; border: 1px solid #334155; border-radius: 9px; background: #0f172a80; color: inherit; font: inherit; text-align: left; }
        .formula-item:disabled { cursor: not-allowed; opacity: .65; }
        .formula-item.is-available { cursor: pointer; }
        .formula-item.is-available:hover { border-color: #7dd3fc; }
        .formula-item.is-current { border-color: #f59e0b; background: #78350f29; }
        .formula-item.is-available:not(.is-current) { border-color: #38bdf866; }
        .formula-name { display: block; margin-bottom: 4px; color: #94a3b8; font-size: 11px; }
        .formula-item.is-current .formula-name { color: #fbbf24; }
        .formula-expression { color: #e2e8f0; font-family: "Segoe UI", Arial, sans-serif; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
        .formula-status { display: block; margin-top: 5px; color: #94a3b8; font-size: 10px; line-height: 1.4; }
        .formula-item.is-available .formula-status { color: #7dd3fc; }
        .formula-item.is-current .formula-status { color: #fbbf24; }
        .aside-note { margin-top: 14px; color: #94a3b8; font-size: 12px; line-height: 1.55; }
        .sidebar-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
        .sidebar-panel-heading h2 { margin: 0; }
        .sidebar-panel-heading .close-help { width: 26px; height: 26px; border-radius: 7px; padding: 0; }
        .close-help svg { width: 14px; height: 14px; }
        [hidden] { display: none !important; }
        footer { border-top: 1px solid #334155; padding-top: 15px; padding-bottom: 15px; color: #94a3b8; text-align: center; font-size: 12px; }

        @media (max-width: 1100px) {
            main { grid-template-columns: 1fr; }
            aside { order: -1; }
            .sidebar { grid-template-columns: 1fr; align-items: start; }
        }
        @media (max-width: 760px) {
            .header-inner { flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; gap: 10px; }
            .header-nav { order: 3; width: auto; margin-left: 0; flex: 1; }
            .header-nav span { flex: 1; text-align: center; }
            .header-help { order: 2; }
            .language-switch { order: 4; margin-left: 0; }
        }
        @media (max-width: 520px) {
            .header-inner { min-height: 68px; }
            h1 { font-size: 16px; }
            .tagline { font-size: 11px; }
            main { padding-top: 18px; }
            .calculator { padding: 17px; }
            .goal-control { padding: 11px; }
            .unit-control { padding: 8px; }
            .unit-switch button { min-width: 36px; }
            .unit-switch { justify-self: start; }
            .fields { grid-template-columns: 1fr; }
            .sidebar { grid-template-columns: 1fr; }
        }
