:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #141726;
  --muted: #5b6075;
  --border: #e3e5ef;
  --primary: #5b5bd6;
  --primary-soft: #eef0ff;
  --accent: #10a37f;
  --warn-bg: #fff8e6;
  --warn-border: #f0d48a;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1018;
    --surface: #161925;
    --text: #eceef6;
    --muted: #9aa0b8;
    --border: #262a3b;
    --primary: #8b8cf6;
    --primary-soft: #1f2140;
    --accent: #34d3a6;
    --warn-bg: #2a2412;
    --warn-border: #5c4b1c;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
}

a { color: var(--primary); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--primary);
  display: grid;
  place-items: center;
  flex: none;
}
.brand-mark svg { width: 18px; height: 18px; }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  background: var(--surface);
}
.lang-switch button {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 32px;
}
.lang-switch button[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); }

/* Page */
main { padding: 40px 0 64px; }

.back {
  display: inline-block;
  font-size: 15px;
  margin-bottom: 20px;
  text-decoration: none;
  color: var(--muted);
}
.back:hover { color: var(--primary); }

h1 { font-size: clamp(30px, 6vw, 40px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 10px; }
h2 { font-size: 22px; line-height: 1.3; letter-spacing: -0.01em; margin: 40px 0 10px; scroll-margin-top: 80px; }
h3 { font-size: 18px; margin: 24px 0 6px; }
p, ul, ol { margin: 0 0 14px; }
ul, ol { padding-left: 22px; }
li { margin-bottom: 6px; }
strong { font-weight: 650; }

.meta { color: var(--muted); font-size: 15px; margin-bottom: 28px; }

.summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px 8px;
  margin: 0 0 8px;
}
.summary h2 { margin-top: 0; font-size: 18px; }

.note {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  margin: 16px 0;
}

.table-scroll { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--surface); }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { font-weight: 650; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: 0; }

.toc { font-size: 15px; columns: 2; column-gap: 24px; padding-left: 20px; }
@media (max-width: 560px) { .toc { columns: 1; } }

/* Home */
.hero { padding: 24px 0 8px; }
.hero p { color: var(--muted); font-size: 19px; max-width: 34em; }
.cards { display: grid; gap: 14px; margin: 28px 0; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--primary); transform: translateY(-2px); }
.card strong { display: block; font-size: 17px; margin-bottom: 4px; }
.card span { color: var(--muted); font-size: 14px; line-height: 1.5; display: block; }
@media (prefers-reduced-motion: reduce) { .card, .card:hover { transition: none; transform: none; } }

.stores { display: flex; flex-wrap: wrap; gap: 10px; }
.store {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0 40px; color: var(--muted); font-size: 14px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }

/* Language visibility: both languages show without JS; JS keeps only the active one. */
html.js [data-l]:not([data-l~="active"]) { display: none !important; }
