:root {
    color-scheme: light;
    --bg: #f4f8f6;
    --surface: #ffffff;
    --surface-2: #eef7f3;
    --ink: #17211c;
    --muted: #607069;
    --line: #d8e5df;
    --accent: #0f766e;
    --accent-strong: #0b5f59;
    --accent-soft: #dff4ef;
    --gold: #b7791f;
    --rose: #b91c1c;
    --shadow: 0 18px 45px rgba(20, 41, 35, 0.12);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

img {
    display: block;
    max-width: 100%;
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
}

.skip-link {
    left: 1rem;
    padding: 0.65rem 0.9rem;
    position: fixed;
    top: -4rem;
    z-index: 20;
    background: var(--ink);
    color: #fff;
    border-radius: var(--radius);
}

.skip-link:focus {
    top: 1rem;
}

.site-header {
    background: rgba(244, 248, 246, 0.92);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(16px);
}

.topbar,
.app-shell,
.seo-content,
.site-footer {
    width: min(1180px, calc(100% - 32px));
    margin-inline: auto;
}

.topbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
    font-weight: 760;
    letter-spacing: 0;
}

.brand img {
    width: 42px;
    height: 42px;
}

.locale-switcher {
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.25rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
}

.locale-switcher a {
    min-width: 44px;
    padding: 0.45rem 0.65rem;
    text-align: center;
    text-decoration: none;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.locale-switcher a[aria-current="page"] {
    background: var(--accent);
    color: #fff;
}

.app-shell {
    padding-block: 28px 44px;
}

.intro-band {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: end;
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 0.35rem;
    color: var(--accent-strong);
    font-size: 0.88rem;
    font-weight: 760;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 3.5vw, 3.8rem);
    line-height: 1.04;
    letter-spacing: 0;
}

.intro-band p:last-child {
    max-width: 760px;
    margin: 0.75rem 0 0;
    color: var(--muted);
}

.trust-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.trust-strip span {
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 999px;
    padding: 0.45rem 0.7rem;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
}

.ad-row,
.side-ad {
    min-height: 92px;
    margin-bottom: 18px;
    border: 1px dashed #b9cac3;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.65);
    display: grid;
    place-items: center;
}

.ad-row[hidden],
.side-ad[hidden] {
    display: none;
}

.ad-slot {
    display: block;
    width: 100%;
    min-height: 90px;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(320px, 0.94fr) minmax(320px, 1.06fr);
    gap: 18px;
    align-items: start;
}

.calculator-panel,
.tools-panel,
.history-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.calculator-panel {
    padding: 18px;
}

.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 14px;
}

.panel-title h2,
.tools-panel h2,
.history-panel h2,
.seo-content h2 {
    margin: 0;
    font-size: 1.12rem;
    letter-spacing: 0;
}

.display-stack {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.85rem;
    background: #f8fbfa;
}

.expression {
    min-height: 1.2rem;
    color: var(--muted);
    text-align: right;
    font-size: 0.92rem;
}

.calculator-display {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    text-align: right;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 760;
    letter-spacing: 0;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.55rem;
    margin-top: 14px;
}

.key {
    min-width: 0;
    min-height: 54px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f7faf8;
    color: var(--ink);
    cursor: pointer;
    font-size: clamp(1rem, 2.6vw, 1.18rem);
    font-weight: 760;
    letter-spacing: 0;
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.key:hover {
    background: var(--accent-soft);
    border-color: #9dd4ca;
}

.key:active {
    transform: translateY(1px);
}

.key.operator {
    background: #fff8e8;
    border-color: #ecd8a7;
    color: #7b4c08;
}

.key.utility {
    color: var(--accent-strong);
}

.key.equals {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.key.danger {
    color: var(--rose);
}

.history-panel {
    margin-top: 18px;
    padding: 16px;
}

.history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.ghost-button {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    padding: 0.42rem 0.65rem;
    font-size: 0.88rem;
    font-weight: 700;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0.8rem 0 0;
    display: grid;
    gap: 0.45rem;
}

.history-list li {
    display: grid;
    gap: 0.1rem;
    padding: 0.55rem 0;
    border-top: 1px solid var(--line);
}

.history-list small {
    color: var(--muted);
}

.tools-panel {
    padding: 18px;
}

.tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.45rem;
    margin: 0.85rem 0 1rem;
}

.tab-button {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.55rem 0.45rem;
    background: #f8fbfa;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 760;
}

.tab-button[aria-selected="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.tool-section {
    display: none;
}

.tool-section.active {
    display: block;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.field {
    display: grid;
    gap: 0.32rem;
}

.field label {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 740;
}

.field input,
.field select {
    min-width: 0;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fbfdfc;
    color: var(--ink);
    padding: 0.68rem 0.72rem;
    outline: 0;
}

.field input:focus,
.field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

.results {
    margin-top: 1rem;
    border-top: 1px solid var(--line);
}

.result-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: baseline;
    padding: 0.72rem 0;
    border-bottom: 1px solid var(--line);
}

.result-row span:first-child {
    color: var(--muted);
}

.result-row strong {
    text-align: right;
    font-size: 1.08rem;
}

.two-thirds {
    grid-column: span 2;
}

.seo-content {
    padding-block: 18px 44px;
}

.content-block,
.faq-block {
    border-top: 1px solid var(--line);
    padding-top: 24px;
    margin-top: 20px;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-top: 16px;
}

.content-grid article {
    border-left: 3px solid var(--accent);
    padding-left: 0.9rem;
}

.content-grid h3 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
}

.content-grid p,
.seo-content > p,
.faq-block p {
    color: var(--muted);
}

.faq-block details {
    border-top: 1px solid var(--line);
    padding: 0.85rem 0;
}

.faq-block summary {
    cursor: pointer;
    font-weight: 760;
}

.site-footer {
    border-top: 1px solid var(--line);
    padding-block: 24px 34px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-links a {
    text-decoration: none;
    font-weight: 700;
}

@media (max-width: 920px) {
    .intro-band,
    .workspace {
        grid-template-columns: 1fr;
    }

    .trust-strip {
        justify-content: flex-start;
    }

    .content-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .topbar,
    .app-shell,
    .seo-content,
    .site-footer {
        width: min(100% - 24px, 1180px);
    }

    .topbar,
    .site-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .locale-switcher {
        width: 100%;
    }

    .locale-switcher a {
        flex: 1;
    }

    .calculator-panel,
    .tools-panel,
    .history-panel {
        box-shadow: none;
    }

    .keypad {
        gap: 0.42rem;
    }

    .key {
        min-height: 48px;
    }

    .tabs,
    .input-grid,
    .content-grid {
        grid-template-columns: 1fr;
    }

    .two-thirds {
        grid-column: auto;
    }
}

