:root {
  color-scheme: light dark;
  --background: #f6f4f0;
  --surface: #fbfaf8;
  --text: #262521;
  --muted: #77716a;
  --line: #dcd7cf;
  --accent: #b9560f;
  --accent-text: #fffaf5;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 16px/1.55 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

.topbar,
main,
footer {
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
}

.topbar {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.035em;
  text-decoration: none;
}

.quiet-link {
  color: var(--muted);
  text-underline-offset: 5px;
}

.site-links { display: flex; align-items: center; gap: 22px; }

/*
 * Explicit over relying on the UA [hidden] rule: several elements this
 * toggles (list items inside a grid, flex children) already carry their own
 * `display` from author CSS, which the cascade lets win over the browser's
 * built-in `[hidden] { display: none }` — same specificity, author beats UA.
 * `!important` here is the deliberate override, not a style to imitate
 * elsewhere in the sheet.
 */
[data-i18n][hidden] { display: none !important; }

.lang-switch {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 45%, transparent);
}

.lang-switch button {
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 5px 11px;
  cursor: pointer;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px #0000000f;
}

.intro {
  min-height: min(700px, calc(100vh - 80px));
  padding: clamp(80px, 14vh, 150px) 0 96px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
p { margin-top: 0; }

h1 {
  max-width: 920px;
  margin-bottom: 28px;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.98;
  letter-spacing: -0.065em;
  font-weight: 620;
}

.lead {
  max-width: 700px;
  margin-bottom: 34px;
  color: var(--muted);
  font-size: clamp(19px, 2.2vw, 25px);
  line-height: 1.45;
}

.primary {
  padding: 11px 17px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
}

.advantages {
  padding: 34px;
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(0, 1.7fr);
  gap: 36px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.advantages h2,
.download h2 {
  margin-bottom: 24px;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.08;
  letter-spacing: -0.045em;
  font-weight: 610;
}

.advantages header > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.advantages ul {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
  list-style: none;
}

.advantages li {
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.advantages li:nth-child(-n + 2) { padding-top: 0; border-top: 0; }
.advantages strong { display: block; margin-bottom: 3px; font-weight: 610; }
.advantages span { display: block; color: var(--muted); font-size: 14px; line-height: 1.45; }

.download {
  padding: 100px 0 120px;
  border-top: 1px solid var(--line);
}

.download-note { max-width: 640px; color: var(--muted); font-size: 18px; }

.downloads {
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.downloads a {
  min-height: 112px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 140ms ease, transform 140ms ease;
}

.downloads a:hover { border-color: var(--accent); transform: translateY(-2px); }
.downloads strong { font-size: 18px; font-weight: 610; }
.downloads span { color: var(--muted); }
.downloads code { font: 12px/1.4 ui-monospace, "SFMono-Regular", Consolas, monospace; }

footer {
  padding: 28px 0 44px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

footer a { color: inherit; text-underline-offset: 4px; }
.footer-links { display: flex; gap: 20px; }

.rules-page {
  width: min(760px, calc(100% - 48px));
  padding: 86px 0 120px;
}

.rules-page h1 { font-size: clamp(46px, 7vw, 76px); }
.rules-page section { padding: 30px 0; border-top: 1px solid var(--line); }
.rules-page h2 { margin-bottom: 14px; font-size: 24px; }
.rules-page li + li { margin-top: 8px; }
.rules-page section p,
.rules-page li { color: var(--muted); }
.rules-date { margin-top: 32px; color: var(--muted); font-size: 13px; }

.guide-layout {
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
  padding: 72px 0 120px;
  display: grid;
  grid-template-columns: 240px minmax(0, 760px);
  justify-content: space-between;
  gap: 72px;
}

.guide-toc {
  position: sticky;
  top: 28px;
  align-self: start;
  display: grid;
  gap: 7px;
}

.guide-toc strong { margin-bottom: 7px; font-size: 13px; }
.guide-toc a { color: var(--muted); font-size: 13px; text-decoration: none; }
.guide-toc a:hover { color: var(--text); }
.guide-article h1 { font-size: clamp(44px, 6vw, 72px); }
.guide-article h2 { margin: 54px 0 16px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 28px; }
.guide-article h3 { margin: 32px 0 12px; font-size: 19px; }
.guide-article p, .guide-article li { color: var(--muted); }
.guide-article li + li { margin-top: 7px; }
.guide-article code { padding: 2px 5px; border-radius: 5px; background: var(--surface); font: .88em ui-monospace, "SFMono-Regular", Consolas, monospace; }

@media (max-width: 760px) {
  .topbar,
  main,
  footer { width: min(100% - 28px, 620px); }
  .intro { min-height: auto; padding: 88px 0 96px; }
  h1 { font-size: clamp(44px, 14vw, 64px); letter-spacing: -0.045em; }
  .advantages,
  .advantages ul,
  .downloads { grid-template-columns: 1fr; }
  .advantages { padding: 24px; gap: 24px; }
  .advantages li:nth-child(2) { padding-top: 13px; border-top: 1px solid var(--line); }
  .download { padding: 80px 0 96px; }
  footer { flex-direction: column; }
  .site-links { gap: 14px; font-size: 13px; }
  .rules-page { width: min(100% - 28px, 620px); padding-top: 64px; }
  .guide-layout { width: min(100% - 28px, 620px); padding-top: 56px; grid-template-columns: 1fr; gap: 36px; }
  .guide-toc { position: static; padding-bottom: 24px; border-bottom: 1px solid var(--line); grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-toc strong { grid-column: 1 / -1; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #1d1c19;
    --surface: #24231f;
    --text: #ebe7df;
    --muted: #aaa39a;
    --line: #45413b;
    --accent: #e49a62;
    --accent-text: #21150d;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .downloads a { transition: none; }
  .downloads a:hover { transform: none; }
}
