:root {
    color-scheme: light dark;
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-muted: #f1f5f9;
    --text: #0f172a;
    --muted: #475569;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --accent: #22c55e;
    --border: rgba(15, 23, 42, 0.12);
    --shadow-soft: 0 12px 32px rgba(15, 23, 42, 0.08);
    --radius-lg: 18px;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--background);
    color: var(--text);
}
[data-theme="dark"] {
    --background: #0f172a;
    --surface: #111c33;
    --surface-muted: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.18);
    --shadow-soft: 0 20px 40px rgba(15, 23, 42, 0.32);
}
.high-contrast {
    --background: #ffffff;
    --surface: #ffffff;
    --surface-muted: #f0f0f0;
    --text: #000000;
    --muted: #1f2937;
    --border: rgba(0, 0, 0, 0.22);
    --primary: #111827;
    --primary-dark: #000000;
}
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--background);
    color: var(--text);
}
.container {
    width: min(1120px, 92vw);
    margin: 0 auto;
}
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.site-header__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.4rem;
    padding: 1rem 0;
}
.brand { display: flex; flex-direction: column; gap: 0.2rem; }
.brand__name { font-weight: 700; letter-spacing: 0.05em; }
.brand__tagline { color: var(--muted); font-size: 0.9rem; }
.site-nav { display: flex; align-items: center; gap: 0.9rem; color: var(--muted); font-size: 0.95rem; }
.site-nav__link { color: inherit; text-decoration: none; }
.site-nav__link--active { color: var(--primary); font-weight: 600; }
.site-nav__link:hover, .site-nav__link:focus-visible { color: var(--primary); }
.theme-toggle {
    border: none;
    background: var(--surface-muted);
    color: var(--text);
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    font-size: 1rem;
    cursor: pointer;
}
.site-main {
    padding: 3rem 0 4rem;
    background: radial-gradient(120% 120% at 60% 0%, rgba(37,99,235,0.08) 0%, rgba(15,23,42,0) 55%), var(--background);
}
.hero {
    display: flex;
    justify-content: space-between;
    gap: 2.6rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 3rem;
}
.hero__label { text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-size: 0.85rem; margin-bottom: 0.4rem; }
.hero__title { margin: 0 0 0.8rem; font-size: clamp(2.3rem, 4vw, 3rem); line-height: 1.1; }
.hero__subtitle { margin: 0 0 1.3rem; font-size: 1.05rem; color: var(--muted); max-width: 38rem; }
.hero__version { font-size: 0.85rem; color: var(--muted); }
.hero__actions { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.btn {
    border-radius: 999px;
    padding: 0.68rem 1.5rem;
    border: 1px solid transparent;
    font: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn--primary { background: var(--primary); color: #fff; box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22); }
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 16px 32px rgba(37, 99, 235, 0.28); }
.btn--ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text); }

.express {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    padding: 1.6rem;
}
.express__form {
    display: grid;
    gap: 1.4rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.express__form label { display: flex; flex-direction: column; gap: 0.6rem; }
.express__form span { font-weight: 600; color: var(--muted); }
select, input[type="number"], input[type="search"] {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.6rem 0.8rem;
    background: var(--surface-muted);
    color: inherit;
    font: inherit;
}
.combo { display: flex; flex-direction: column; gap: 0.4rem; }
.combo__search { padding: 0.5rem 0.7rem; }
.express__result { grid-column: 1 / -1; background: var(--surface-muted); padding: 1rem 1.2rem; border-radius: 14px; }
.express__result-output { margin: 0 0 0.4rem; font-size: 1.2rem; font-weight: 600; }
.express__result-formula { margin: 0; color: var(--muted); font-size: 0.92rem; }

.popular {
    margin-top: 2.8rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    padding: 1.6rem;
}
.popular__header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.2rem; }
.popular__grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.popular__link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    background: var(--surface-muted);
    border-radius: 12px;
    border: 1px solid transparent;
    color: inherit;
}
.popular__link:hover, .popular__link:focus-visible { border-color: var(--primary); }

.categories {
    margin-top: 2.8rem;
}
.categories__grid {
    display: grid;
    gap: 1.4rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.category-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.3rem;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.category-card__title { margin: 0; font-weight: 600; }
.category-card__desc { margin: 0; color: var(--muted); font-size: 0.93rem; }
.category-card__cta { margin-top: auto; display: inline-flex; align-items: center; gap: 0.4rem; color: var(--primary); font-weight: 600; }

.history {
    margin-top: 2.8rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    padding: 1.6rem;
}
.history__header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.1rem; }
.history__list { display: grid; gap: 0.9rem; }
.history__item { border: 1px solid var(--border); border-radius: 12px; padding: 0.9rem 1rem; background: var(--surface-muted); }
.history__item-header { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; }
.history__item-type { font-weight: 600; color: var(--primary); font-size: 0.85rem; }
.history__item-value { margin: 0; font-size: 0.95rem; }
.history__bookmark { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; }
.history__bookmark[aria-pressed="true"] { color: var(--accent); }

.learning { margin-top: 3rem; }
.learning__grid { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.learning__grid article { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 1.3rem; box-shadow: var(--shadow-soft); }
.learning__grid h3 { margin-top: 0; }
.learning__grid a { color: var(--primary); font-weight: 600; }

.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 2.4rem 0; margin-top: 3rem; }
.site-footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; color: var(--muted); }
.site-footer__contact { color: var(--primary); }

@media (max-width: 768px) {
    .hero { flex-direction: column; align-items: flex-start; }
    .express__form { grid-template-columns: 1fr; }
}
