:root {
  --bg: #ffffff;
  --surface: #f6f8fa;
  --surface-2: #eef2f5;
  --border: #dde3e9;
  --text: #0f1b24;
  --muted: #56636f;
  --accent: #0f8f86;
  --accent-strong: #0b726b;
  --accent-soft: #e3f4f2;
  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(15, 27, 36, .05), 0 6px 24px rgba(15, 27, 36, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1419; --surface: #141d24; --surface-2: #1b2630; --border: #26343f;
    --text: #e6edf2; --muted: #98a6b2; --accent: #3cc7b9; --accent-strong: #62d8cc;
    --accent-soft: #123a38; --on-accent: #06201e; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1419; --surface: #141d24; --surface-2: #1b2630; --border: #26343f;
  --text: #e6edf2; --muted: #98a6b2; --accent: #3cc7b9; --accent-strong: #62d8cc;
  --accent-soft: #123a38; --on-accent: #06201e; --shadow: none; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent-strong); }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 4.5vw, 2.5rem); margin: 0 0 .5rem; }
h2 { font-size: 1.4rem; margin: 2.5rem 0 .75rem; }
h3 { font-size: 1.05rem; margin: 1.25rem 0 .25rem; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Header / footer */
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.logo svg { flex: none; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; white-space: nowrap; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.theme-toggle { flex: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center; }
@media (max-width: 720px) {
  .site-header .wrap { flex-wrap: wrap; padding-top: 8px; padding-bottom: 4px; gap: 4px 12px; }
  .theme-toggle { margin-left: auto; }
  .nav { order: 3; width: 100%; margin: 0 -10px; }
}
.site-footer { margin-top: 4rem; border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .92rem; }
.site-footer .wrap { padding-top: 2rem; padding-bottom: 2rem; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1.5rem; }
.footer-cols h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text); margin: 0 0 .5rem; }
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { margin: .3rem 0; }
.footer-cols a { color: var(--muted); text-decoration: none; }
.footer-cols a:hover { color: var(--accent-strong); text-decoration: underline; }
.copyright { margin-top: 2rem; }

/* Layout */
main { padding: 1.75rem 0 0; }
.breadcrumbs { font-size: .85rem; color: var(--muted); margin-bottom: .75rem; }
.breadcrumbs a { color: var(--muted); }
.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 1.5rem; max-width: 60ch; }
.content { max-width: 860px; }
.layout.with-aside .content { max-width: none; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
.layout.with-aside { grid-template-columns: minmax(0, 1fr) 300px; }
@media (max-width: 960px) { .layout.with-aside { grid-template-columns: minmax(0, 1fr); } .layout aside { display: none; } }
.prose p, .prose li { max-width: 68ch; }
.prose ul { padding-left: 1.2rem; }

/* Hero */
.hero { background: linear-gradient(180deg, var(--accent-soft), transparent); border-bottom: 1px solid var(--border); margin-top: -1.75rem; padding: 2.5rem 0 2.5rem; }
.hero h1 { font-size: clamp(2rem, 5.5vw, 3rem); }

/* Calculator */
.calc { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.field label, .field .label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; font: inherit; font-size: 1.15rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; min-height: 52px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.opts { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { font: inherit; font-size: .88rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent-strong); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; min-height: 52px; width: 100%; }
.seg button { flex: 1; font: inherit; border: 0; background: var(--surface); color: var(--muted); cursor: pointer; padding: 0 12px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.result { display: block; margin-top: 18px; padding: 18px 20px; border-radius: 12px; background: var(--accent-soft); min-height: 104px; }
.result .r-label { font-size: .88rem; color: var(--muted); }
.result .r-main { font-size: clamp(1.35rem, 4vw, 1.9rem); font-weight: 700; color: var(--text); margin: 2px 0; line-height: 1.25; }
.result .r-sub { font-size: .95rem; color: var(--muted); }
.result .r-error { color: #c0392b; font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 12px; }
.stat { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.stat b { display: block; font-size: 1.2rem; }
.stat span { font-size: .82rem; color: var(--muted); }
.swap { font: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; min-height: 52px; padding: 0 14px; cursor: pointer; align-self: end; }

/* Cards / grids */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { display: block; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; background: var(--bg); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); color: var(--text); }
.card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; }
.card .when { color: var(--accent-strong); font-weight: 600; font-size: .92rem; }
.pop-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
th { background: var(--surface); font-weight: 600; font-size: .85rem; color: var(--muted); }
tr:last-child td { border-bottom: 0; }

/* FAQ */
.faq details { border: 1px solid var(--border); border-radius: 12px; padding: 0 16px; margin: 8px 0; background: var(--bg); }
.faq summary { cursor: pointer; font-weight: 600; padding: 14px 0; list-style-position: outside; }
.faq details[open] summary { border-bottom: 1px solid var(--border); }
.faq details p { margin: 12px 0 14px; color: var(--muted); }

/* World clock */
.clock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.clock { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.clock .c-city { font-size: .85rem; color: var(--muted); }
.clock .c-time { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.clock .c-date { font-size: .8rem; color: var(--muted); }

/* Ads: space reserved to avoid layout shift */
.ad { margin: 24px 0; min-height: 100px; text-align: center; }
.ad::before { content: "Advertisement"; display: block; font-size: .7rem; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 4px; }
.ad-sidebar { position: sticky; top: 84px; min-height: 600px; margin-top: 0; }
