:root {
    color-scheme: light;
    --ink: #123c34;
    --ink-deep: #0b2f29;
    --muted: #61766f;
    --gold: #b78638;
    --gold-soft: #d6bb88;
    --paper: #f7f3eb;
    --white: #fffdfa;
    --line: #dfcfb5;
    --shadow: 0 24px 70px rgba(18, 60, 52, 0.2);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, #f7f3eb 0%, #ffffff 52%, #123c34 100%);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    line-height: 1.5;
}

button,
input,
select {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

a {
    color: inherit;
}

.site-shell {
    min-height: 100vh;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto auto;
    align-items: center;
    gap: 28px;
    min-height: 96px;
    padding: 18px clamp(18px, 5vw, 58px);
    border-bottom: 1px solid rgba(18, 60, 52, 0.16);
    background: rgba(250, 246, 238, 0.94);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    text-decoration: none;
}

.brand-mark {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 3px solid #e2bd55;
    border-radius: 50%;
    color: #d2a842;
    background: #fffaf0;
    font-family: Georgia, serif;
    font-size: 31px;
    font-weight: 800;
    line-height: 1;
    box-shadow: inset 0 0 0 4px rgba(210, 168, 66, 0.16);
}

.brand-name {
    color: var(--ink);
    font-size: clamp(21px, 3vw, 32px);
    font-weight: 850;
    letter-spacing: 0;
    line-height: 1.12;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: clamp(20px, 4vw, 48px);
    color: #5c706a;
    font-size: clamp(17px, 2vw, 25px);
    font-weight: 700;
    white-space: nowrap;
}

.nav-links a {
    text-decoration: none;
}

.nav-links a:hover,
.nav-links a:focus-visible {
    color: var(--ink);
}

.language-control select {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--white);
    color: var(--ink);
    padding: 0 32px 0 12px;
    font-size: 14px;
    font-weight: 700;
}

.hero {
    position: relative;
    min-height: 382px;
    display: flex;
    align-items: center;
    background-image:
        linear-gradient(90deg, rgba(18, 60, 52, 0.92) 0%, rgba(18, 60, 52, 0.7) 46%, rgba(18, 60, 52, 0.26) 100%),
        url("assets/currency-hero.png");
    background-position: center;
    background-size: cover;
    color: #fffaf0;
}

.hero-content {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    padding: 38px 0 92px;
}

.eyebrow {
    margin: 0 0 14px;
    color: #e7cb8e;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.hero h1 {
    margin: 0;
    max-width: 760px;
    font-size: clamp(42px, 7vw, 76px);
    font-weight: 900;
    line-height: 1.16;
    letter-spacing: 0;
}

main {
    position: relative;
    z-index: 2;
    width: min(1180px, calc(100% - 42px));
    margin: -64px auto 0;
}

.converter-card {
    border: 2px solid #d2b179;
    border-radius: 10px;
    background: linear-gradient(105deg, #fffdf8 0%, #f8f4ec 72%, #fbf8f2 100%);
    box-shadow: var(--shadow);
    padding: clamp(24px, 6vw, 62px);
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 48px;
}

.section-head h2 {
    margin: 0;
    font-size: clamp(30px, 5vw, 44px);
    line-height: 1.1;
}

.section-head span {
    color: var(--gold);
    font-size: clamp(14px, 2vw, 22px);
    font-weight: 700;
    letter-spacing: 0.28em;
}

.converter-grid {
    display: grid;
    gap: 24px;
}

.input-column {
    display: grid;
    gap: 14px;
}

.field-label {
    color: #6b7d75;
    font-size: clamp(20px, 3vw, 27px);
    font-weight: 650;
}

.control-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 194px;
    gap: 18px;
    align-items: center;
}

.amount-input,
.result-box,
.currency-picker {
    min-height: 92px;
    border: 2px solid var(--line);
    border-radius: 5px;
    background: var(--white);
}

.amount-input {
    width: 100%;
    min-width: 0;
    padding: 0 28px;
    color: var(--ink);
    outline: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(36px, 6vw, 50px);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.amount-input:focus,
.currency-picker:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(183, 134, 56, 0.16);
}

.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button {
    margin: 0;
    appearance: none;
}

.currency-picker {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 0 18px;
}

.currency-picker select {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-size: clamp(20px, 3vw, 30px);
    font-weight: 750;
}

.flag {
    width: 42px;
    height: 30px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 3px;
    background: #edf2ef;
    font-size: 27px;
    line-height: 1;
    box-shadow: inset 0 0 0 1px rgba(18, 60, 52, 0.12);
}

.currency-icon {
    width: 32px;
    height: 32px;
    display: block;
    flex: 0 0 auto;
    border-radius: 50%;
    object-fit: contain;
}

.flag .currency-icon {
    width: 28px;
    height: 28px;
}

.swap-button {
    width: 74px;
    height: 74px;
    justify-self: center;
    border: 2px solid #caa869;
    border-radius: 50%;
    background: var(--ink);
    color: #fffdf8;
    font-size: 31px;
    font-weight: 900;
    line-height: 1;
    transition: transform 180ms ease, background 180ms ease;
}

.swap-button:hover,
.swap-button:focus-visible {
    background: var(--ink-deep);
    transform: rotate(180deg);
}

.result-box {
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 0 28px;
    background: var(--ink);
    color: #fffdf8;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(34px, 6vw, 48px);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.result-box small {
    margin-left: 12px;
    color: #e4be65;
    font-family: inherit;
    font-size: 0.55em;
    font-weight: 800;
}

.rate-line {
    margin: 34px 0 0;
    color: #60756d;
    font-size: clamp(17px, 3vw, 23px);
    font-weight: 750;
}

.updated-line {
    margin: 8px 0 0;
    color: #8a9892;
    font-size: clamp(15px, 2vw, 20px);
    font-weight: 650;
}

.rates-section,
.about-section {
    padding: 76px 0 0;
}

.section-heading {
    display: grid;
    gap: 8px;
    margin-bottom: 24px;
}

.section-heading p {
    margin: 0;
    color: var(--gold);
    font-size: 15px;
    font-weight: 850;
    letter-spacing: 0.08em;
}

.section-heading h2 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.2;
}

.rates-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.rate-item {
    display: grid;
    gap: 8px;
    border: 1px solid rgba(18, 60, 52, 0.12);
    border-radius: 8px;
    background: rgba(255, 253, 250, 0.88);
    padding: 18px;
}

.rate-item strong {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
}

.rate-item span {
    color: var(--muted);
    font-weight: 650;
}

.about-section p {
    max-width: 880px;
    margin: 0;
    color: #3f5750;
    font-size: clamp(18px, 2.4vw, 23px);
    line-height: 1.75;
}

.about-section {
    margin-top: 76px;
    padding: 52px clamp(24px, 5vw, 64px);
    border-top: 3px solid var(--gold-soft);
    background: #f5f1e8;
}

.site-footer {
    width: 100%;
    margin: 72px 0 0;
    padding: 38px max(28px, calc((100% - 1180px) / 2));
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    background: var(--ink-deep);
    color: #f7f3eb;
    font-size: 15px;
}

.footer-copy {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 28px;
}

.legal-links {
    display: flex;
    gap: 20px;
    white-space: nowrap;
}

.legal-links button {
    padding: 4px 0;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.45);
    background: transparent;
    color: #f1d28f;
    font-weight: 750;
}

.legal-links button:hover,
.legal-links button:focus-visible {
    color: #ffffff;
    border-color: #ffffff;
}

.policy-dialog {
    width: min(720px, calc(100% - 32px));
    max-height: min(82vh, 820px);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    color: var(--ink-deep);
    box-shadow: 0 28px 90px rgba(6, 28, 24, 0.35);
}

.policy-dialog::backdrop {
    background: rgba(7, 29, 25, 0.7);
    backdrop-filter: blur(3px);
}

.policy-dialog-head {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 26px;
    border-bottom: 1px solid var(--line);
    background: var(--white);
}

.policy-dialog-head h2 {
    margin: 0;
    font-size: 26px;
}

.dialog-close {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #f5f1e8;
    color: var(--ink);
    font-size: 28px;
    line-height: 1;
}

.policy-content {
    padding: 10px 26px 30px;
    overflow-y: auto;
}

.policy-content section {
    padding-top: 20px;
}

.policy-content h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.policy-content p {
    margin: 0;
    color: #465c55;
    line-height: 1.75;
}

.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;
}

@media (max-width: 920px) {
    .site-header {
        grid-template-columns: 1fr auto;
        gap: 16px 12px;
        min-height: 82px;
    }

    .nav-links {
        grid-column: 1;
        justify-content: flex-start;
        gap: 28px;
        font-size: 17px;
    }

    .language-control {
        grid-column: 2;
        grid-row: 2;
    }

    .brand-mark {
        width: 48px;
        height: 48px;
        font-size: 26px;
    }

    .brand-name {
        font-size: 22px;
    }

    .hero {
        min-height: 342px;
    }

    .hero-content {
        padding-bottom: 86px;
    }

    main {
        width: min(720px, calc(100% - 28px));
    }

    .control-row,
    .rates-list {
        grid-template-columns: 1fr;
    }

    .currency-picker {
        min-height: 74px;
    }
}

@media (max-width: 560px) {
    .site-header {
        padding: 14px 16px;
    }

    .brand {
        grid-column: 1 / -1;
        gap: 10px;
    }

    .brand-name {
        font-size: 18px;
    }

    .nav-links {
        gap: 20px;
        font-size: 16px;
    }

    .language-control select {
        max-width: 118px;
    }

    .hero h1 {
        font-size: 42px;
    }

    .section-head {
        align-items: flex-start;
        flex-direction: column;
        margin-bottom: 34px;
    }

    .amount-input,
    .result-box {
        min-height: 82px;
        padding: 0 20px;
    }

    .swap-button {
        width: 62px;
        height: 62px;
        font-size: 26px;
    }

    .site-footer {
        flex-direction: column;
        align-items: flex-start;
        margin-top: 58px;
        padding: 32px 22px;
    }

    .legal-links {
        width: 100%;
        justify-content: flex-start;
    }
}
