:root {
    --ink: #11152a;
    --violet: #6954df;
    --violet-dark: #5741cf;
    --violet-pale: #f1efff;
    --orange: #f38638;
    --paper: #ffffff;
    --page: #f5f6fa;
    --text: #171829;
    --muted: #70758a;
    --line: #e0e3ec;
    --input: #f5f6fa;
    --danger: #ef3f47;
    --choice-bg: #ffffff;
    --choice-text: #575b6f;
    --progress-bg: #e7e9f0;
    --progress-line: #e3e5ed;
    --placeholder: #9398aa;
    --shadow: rgba(20, 25, 50, 0.08);
    --focus-ring: rgba(105, 84, 223, 0.1);
    --theme-transition: 260ms ease;
}

html[data-theme="dark"] {
    --ink: #f5f3ff;
    --violet: #8a72ff;
    --violet-dark: #a491ff;
    --violet-pale: #2b2750;
    --orange: #ff9b57;
    --paper: #171b31;
    --page: #0d1123;
    --text: #ececf6;
    --muted: #a8adbf;
    --line: #303650;
    --input: #20253c;
    --danger: #ff6971;
    --choice-bg: #1c2138;
    --choice-text: #c9ccda;
    --progress-bg: #292f48;
    --progress-line: #303650;
    --placeholder: #858ba1;
    --shadow: rgba(0, 0, 0, 0.3);
    --focus-ring: rgba(138, 114, 255, 0.18);
}

@font-face {
    font-family: "Material Symbols Rounded";
    src: url("assets/material-symbols-rounded.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: block;
}

.material-symbols-rounded {
    font-family: "Material Symbols Rounded";
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--page); }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--page);
    transition: color var(--theme-transition), background var(--theme-transition);
}

button, input, textarea { font: inherit; }

.page-header,
.form-card,
.field input,
.field textarea,
.input-shell,
.choice span,
.choice--card .material-symbols-rounded,
.button--ghost,
.protocol {
    transition:
        color var(--theme-transition),
        border-color var(--theme-transition),
        background var(--theme-transition),
        box-shadow var(--theme-transition),
        transform 160ms ease;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 20;
    overflow: hidden;
    border-bottom: 1px solid rgba(151, 130, 255, 0.28);
    background: #101532;
    box-shadow: 0 12px 32px rgba(17, 21, 42, 0.18);
}

.navbar__art {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(16, 21, 50, 0.02), rgba(16, 21, 50, 0.2) 35%, rgba(16, 21, 50, 0.2) 65%, rgba(16, 21, 50, 0.02)),
        url("assets/navbar-calculator-art.png") center 48% / cover no-repeat;
    opacity: 0.72;
}

.navbar__inner {
    position: relative;
    width: min(100% - 48px, 1180px);
    height: 92px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.navbar__brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    color: white;
    text-decoration: none;
}

.navbar__logo {
    width: 58px;
    height: 58px;
    display: block;
    flex: 0 0 auto;
    object-fit: contain;
    filter:
        drop-shadow(0 0 8px rgba(176, 154, 255, 0.52))
        drop-shadow(0 10px 13px rgba(3, 5, 22, 0.42));
    transition: transform 220ms ease, filter 220ms ease;
}

.navbar__brand:hover .navbar__logo {
    transform: translateY(-2px) rotate(-2deg) scale(1.08);
    filter:
        drop-shadow(0 0 12px rgba(188, 170, 255, 0.76))
        drop-shadow(0 14px 16px rgba(3, 5, 22, 0.5));
}

.navbar__identity {
    display: grid;
    gap: 3px;
}

.navbar__identity strong {
    font-size: 18px;
    line-height: 1;
    letter-spacing: -0.025em;
}

.navbar__identity small {
    color: rgba(232, 229, 255, 0.72);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.navbar__links {
    display: flex;
    align-items: center;
    gap: 28px;
}

.theme-toggle {
    min-height: 40px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    color: rgba(242, 241, 255, 0.84);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    transition: color 160ms ease, background 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.theme-toggle:hover {
    color: white;
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.14);
    transform: translateY(-2px);
}

.theme-toggle:active { transform: scale(0.96); }
.theme-toggle:focus-visible,
.navbar__links > a:focus-visible {
    outline: 3px solid rgba(190, 179, 255, 0.62);
    outline-offset: 3px;
}
.theme-toggle .material-symbols-rounded { font-size: 18px; transition: transform 300ms ease; }
.theme-toggle:hover .material-symbols-rounded { transform: rotate(16deg); }

.navbar__links > a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: rgba(242, 241, 255, 0.78);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: color 150ms ease, transform 150ms ease, background 150ms ease;
}

.navbar__links > a .material-symbols-rounded { font-size: 17px; }
.navbar__links > a:hover { color: white; }

.navbar__links .navbar__button {
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    color: white;
    background: rgba(111, 84, 231, 0.9);
    box-shadow: 0 10px 24px rgba(5, 8, 28, 0.28), inset 0 1px rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(8px);
}

.navbar__links .navbar__button:hover {
    color: white;
    background: #7a61ee;
    transform: translateY(-2px);
}

.navbar__button-label--short { display: none; }

.page {
    width: min(100% - 90px, 880px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 52px 0 72px;
    scroll-margin-top: 92px;
}

.page-header { margin-bottom: 30px; }

.page-header {
    animation: pageRise 520ms cubic-bezier(.2, .8, .2, 1) both;
}

.page-header h1 {
    margin: 0 0 6px;
    color: var(--ink);
    font-size: clamp(28px, 3vw, 38px);
    line-height: 1.2;
    letter-spacing: -0.035em;
}

.page-header p {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
}

.form-card {
    padding: 50px 50px 44px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--paper);
    box-shadow: 0 7px 28px var(--shadow);
    animation: cardRise 620ms 80ms cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes pageRise {
    from { opacity: 0.72; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes cardRise {
    from { opacity: 0.72; transform: translateY(20px) scale(.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.form-header { margin: 0; }

.progress {
    width: min(100%, 640px);
    margin: 0 auto 10px;
    padding: 0;
    display: flex;
    align-items: center;
    list-style: none;
}

.progress__item {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    color: #6f7488;
}

.progress__item > span {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #70768a;
    font-size: 13px;
    font-weight: 700;
    background: var(--progress-bg);
    transition: color var(--theme-transition), background var(--theme-transition), box-shadow 220ms ease, transform 220ms ease;
}

.progress__item small { font-size: 15px; font-weight: 600; white-space: nowrap; }

.progress__item.is-active { color: var(--ink); }
.progress__item.is-active small { font-weight: 800; }
.progress__item.is-active > span,
.progress__item.is-done > span { color: white; background: var(--violet); }
.progress__item.is-active > span { box-shadow: 0 0 0 6px rgba(105, 84, 223, 0.12), 0 8px 18px rgba(105, 84, 223, 0.2); transform: scale(1.04); }

.progress__line {
    width: 70px;
    height: 3px;
    margin: 0 12px;
    border-radius: 2px;
    background: var(--progress-line);
    transition: background var(--theme-transition);
}

.step-heading { margin-top: 42px; }

.step-heading h2 {
    margin: 0 0 5px;
    color: var(--ink);
    font-size: 22px;
    letter-spacing: -0.025em;
}

.step-heading p { margin: 0; color: var(--muted); font-size: 15px; }

#rightsForm { padding-top: 34px; }

.form-step { display: none; animation: stepIn 220ms ease both; }
.form-step.is-active { display: block; }

@keyframes stepIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 20px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.field--wide { grid-column: 1 / -1; }
.field b, .choice-group b, .required-note b { color: var(--danger); }

.field input, .field textarea {
    width: 100%;
    color: var(--ink);
    border: 1.5px solid var(--line);
    border-radius: 14px;
    outline: none;
    background: var(--input);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input-shell {
    height: 58px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    color: #858b9f;
    background: var(--input);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.input-shell:hover { border-color: color-mix(in srgb, var(--violet) 40%, var(--line)); }
.input-shell:focus-within { border-color: var(--violet); background: var(--paper); box-shadow: 0 0 0 4px var(--focus-ring); transform: translateY(-1px); }
.input-shell:has(input.is-invalid) { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239, 63, 71, 0.08); }
.input-shell input,
.input-shell input:focus,
.input-shell input.is-invalid {
    height: 100%;
    padding: 0;
    flex: 1;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
}

.field input { height: 58px; padding: 0 18px; }
.field textarea { min-height: 112px; padding: 15px 18px; line-height: 1.55; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--placeholder); }

.field input:focus, .field textarea:focus {
    border-color: var(--violet);
    background: var(--paper);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.field input.is-invalid, .field textarea.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 63, 71, 0.08);
}
.input-error { display: none; color: var(--danger); font-size: 12px; font-weight: 500; }
.input-error.is-visible { display: block; }

.choice-group { min-width: 0; margin: 34px 0 0; padding: 0; border: 0; }
.choice-group--first { margin-top: 0; }
.choice-group legend { margin-bottom: 14px; font-size: 14px; font-weight: 700; }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.choice-grid--purposes { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.choice-grid--inline { display: flex; flex-wrap: wrap; }
.choice-grid--inline .choice { flex: 0 1 auto; }
.choice-grid--inline .choice span { width: auto; min-width: 110px; padding-right: 18px; }
.choice { position: relative; min-height: 54px; display: flex; align-items: center; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }

.choice span {
    width: 100%;
    min-height: 54px;
    padding: 14px 14px 14px 45px;
    display: flex;
    align-items: center;
    border: 1.5px solid var(--line);
    border-radius: 13px;
    color: var(--choice-text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    background: var(--choice-bg);
    transition: 160ms ease;
}

.choice span::before {
    content: "";
    position: absolute;
    left: 16px;
    width: 17px;
    height: 17px;
    border: 1.5px solid #b7bbc9;
    border-radius: 5px;
}

.choice input[type="radio"] + span::before { border-radius: 50%; }
.choice:hover span { border-color: color-mix(in srgb, var(--violet) 48%, var(--line)); transform: translateY(-2px); box-shadow: 0 8px 20px var(--shadow); }
.choice input:checked + span { color: var(--violet-dark); border-color: var(--violet); background: var(--violet-pale); }
.choice input:checked + span::before { border-color: var(--violet); background: var(--violet); box-shadow: inset 0 0 0 4px var(--choice-bg); }
.choice input:focus-visible + span { outline: 3px solid rgba(105, 84, 223, 0.2); outline-offset: 2px; }

.choice--card { min-height: 94px; }
.choice--card span {
    min-height: 94px;
    padding: 50px 8px 10px;
    justify-content: center;
    text-align: center;
    font-size: 11px;
}
.choice--card span::before {
    display: none;
}
.choice--card .material-symbols-rounded {
    position: absolute;
    top: 13px;
    left: 50%;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: #70758a;
    background: #e3e5ed;
    transform: translateX(-50%);
}
.choice--card input:checked + span .material-symbols-rounded {
    color: var(--violet);
    background: rgba(105, 84, 223, 0.15);
}

.info-box {
    margin-bottom: 24px;
    padding: 13px 16px;
    border: 1.5px solid rgba(105, 84, 223, 0.18);
    border-radius: 12px;
    color: var(--violet);
    font-size: 13px;
    line-height: 1.5;
    background: rgba(105, 84, 223, 0.07);
}

.field-error { display: none; margin: 10px 0 0; color: var(--danger); font-size: 12px; font-weight: 700; }
.field-error.is-visible { display: block; }

.credits-field { margin-top: 28px; }
.agreements { margin-top: 28px; padding: 4px 0; display: grid; gap: 13px; }
.agreements__title { margin: 0 0 2px; font-size: 14px; font-weight: 700; }
.agreement {
    padding: 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border: 0;
    border-radius: 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.55;
    background: transparent;
}
.agreement input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--violet); }

.form-actions {
    margin-top: 42px;
    padding-top: 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-top: 1px solid var(--line);
}

.required-note { margin: 0 auto; color: var(--muted); font-size: 11px; }
.submit-error { display: none; width: 100%; margin: 0 0 10px; color: var(--danger); font-size: 12px; font-weight: 600; text-align: right; }
.submit-error.is-visible { display: block; }

.button {
    min-width: 128px;
    height: 48px;
    padding: 0 21px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: scale(0.97); }
.button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.button--primary { color: white; background: var(--violet); box-shadow: 0 7px 18px rgba(105, 84, 223, 0.26); }
.button--primary:hover { background: var(--violet-dark); }
.button--ghost { color: var(--text); border: 1px solid var(--line); background: var(--input); }
#backButton, #submitButton { display: none; }
#submitButton { background: var(--orange); box-shadow: 0 7px 18px rgba(243, 134, 56, 0.28); }

.success { min-height: 480px; display: none; place-items: center; align-content: center; text-align: center; }
.success.is-visible { display: grid; }
.success__icon { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; color: white; background: #22a06b; box-shadow: 0 18px 35px rgba(34, 160, 107, 0.2); }
.success__icon svg { width: 34px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.success h2 { margin: 28px 0 10px; color: var(--ink); font-size: 30px; letter-spacing: -0.04em; }
.success p { max-width: 520px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.success a { margin-top: 24px; color: var(--violet); font-size: 13px; font-weight: 800; text-underline-offset: 4px; }
.protocol { margin: 22px 0; padding: 12px 24px; display: grid; gap: 4px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--page); }
.protocol small { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.protocol strong { color: var(--violet); font-size: 18px; }
.success .success__warning { margin-bottom: 22px; padding: 12px 16px; border: 1.5px solid rgba(243, 134, 56, .25); border-radius: 12px; color: var(--orange); background: rgba(243, 134, 56, .08); }

html[data-theme="dark"] .navbar {
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
}

html[data-theme="dark"] .navbar__art { opacity: 0.55; }
html[data-theme="dark"] .form-card { box-shadow: 0 18px 54px rgba(0, 0, 0, 0.28); }
html[data-theme="dark"] .choice--card .material-symbols-rounded { color: #aeb3c7; background: #292f48; }
html[data-theme="dark"] .choice--card input:checked + span .material-symbols-rounded { color: #b7a9ff; background: rgba(138, 114, 255, 0.18); }
html[data-theme="dark"] .info-box { color: #b9adff; background: rgba(138, 114, 255, 0.1); }
html[data-theme="dark"] input,
html[data-theme="dark"] textarea { color-scheme: dark; }

@media (max-width: 760px) {
    .navbar__art { background-position: 32% center; opacity: 0.58; }
    .navbar__inner { width: min(100% - 28px, 1100px); height: 76px; gap: 14px; }
    .navbar__links { gap: 10px; }
    .navbar__links > a:not(.navbar__button) { display: none; }
    .theme-toggle { width: 42px; min-height: 42px; padding: 0; justify-content: center; }
    .theme-toggle__label { display: none; }
    .navbar__button { min-height: 42px !important; padding: 0 13px !important; font-size: 12px !important; }
    .navbar__button .material-symbols-rounded { display: none; }
    .navbar__button-label--full { display: none; }
    .navbar__button-label--short { display: inline; }
    .navbar__logo { width: 46px; height: 46px; }
    .navbar__identity strong { font-size: 16px; }
    .navbar__identity small { display: none; }
    .page { width: min(100% - 28px, 880px); padding: 30px 0 48px; }
    .page-header { margin-bottom: 22px; }
    .page-header h1 { font-size: 27px; }
    .page-header p { font-size: 14px; line-height: 1.6; }
    .form-card { padding: 30px 22px; border-radius: 17px; }
    .progress { width: 100%; }
    .progress__item { gap: 7px; }
    .progress__item > span { width: 32px; height: 32px; }
    .progress__item small { font-size: 12px; }
    .progress__line { width: auto; flex: 1; margin: 0 7px; }
    .step-heading { margin-top: 34px; }
    .field-grid, .choice-grid { grid-template-columns: 1fr; }
    .choice-grid--purposes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .choice-grid--inline { display: grid; }
    .choice-grid--inline .choice span { width: 100%; }
    .form-actions { flex-wrap: wrap; }
    .required-note { order: -1; width: 100%; margin-bottom: 4px; }
    .submit-error { order: -1; text-align: left; }
    .button { flex: 1; }
}

@media (max-width: 460px) {
    .navbar__inner { width: min(100% - 20px, 1100px); }
    .navbar__button { min-width: 76px; padding: 0 11px !important; justify-content: center; }
    .progress__item { gap: 0; }
    .progress__item small { display: none; }
    .progress__line { margin: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
