/* Sudoku — shared stylesheet. System fonts only; no external resources. */

:root {
  color-scheme: light dark;
  --bg: #f7f6f2;
  --surface: #ffffff;
  --ink: #1c1d21;
  --muted: #5d606b;
  --line: #e2e0d8;
  --line-strong: #c9c6bb;
  --accent: #2f5bb7;
  --accent-ink: #ffffff;
  --accent-soft: #e7edf9;
  --code-bg: #efede6;
  --focus: #2f5bb7;
  --radius: 12px;
  --measure: 42rem;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141519;
    --surface: #1c1e23;
    --ink: #e9e9ec;
    --muted: #a3a6b0;
    --line: #2c2f36;
    --line-strong: #3d414a;
    --accent: #8fb0f2;
    --accent-ink: #10131a;
    --accent-soft: #1f2a40;
    --code-bg: #23262d;
    --focus: #8fb0f2;
  }
}

:lang(zh-Hant) {
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang TC", "Hiragino Sans CNS", "Microsoft JhengHei", "Noto Sans CJK TC", "Noto Sans TC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:lang(en) body, body:lang(en) { line-height: 1.6; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }

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

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 0.875rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.skip-link:focus { top: 0.75rem; }

.wrap {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  font-size: 1.0625rem;
  letter-spacing: 0.02em;
}
.brand:hover { text-decoration: none; }
/* Real app icon (official ictool render). The PNG already carries Apple's squircle mask
   and transparent corners, so no border-radius, clip or background here. */
.mark {
  display: block;
  width: 28px;
  height: 28px;
  flex: none;
  filter: drop-shadow(0 1px 1.5px rgb(16 32 80 / 0.18));
}

.site-nav ul {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
}
.site-nav a:hover { color: var(--ink); background: var(--accent-soft); }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

/* Main */
main { flex: 1; padding: 2.5rem 0 4rem; }

.doc {
  max-width: var(--measure);
  margin: 0 auto;
}

/* Language switcher */
.lang-switch {
  margin: 0 0 2rem;
}
.lang-switch ul {
  display: inline-flex;
  margin: 0;
  padding: 3px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.lang-switch a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 0.95rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1;
}
.lang-switch a:hover { color: var(--ink); }
.lang-switch a[aria-current="page"] {
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
}

/* Typography for documents */
.doc h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 1.3rem + 2vw, 2.375rem);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.doc .meta {
  margin: 0 0 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}
.doc .meta strong { color: var(--ink); font-weight: 600; }
.doc h2 {
  margin: 2.5rem 0 0.75rem;
  font-size: 1.25rem;
  line-height: 1.4;
  font-weight: 650;
  scroll-margin-top: 1rem;
}
.doc p, .doc ul, .doc dl { margin: 0 0 1rem; }
.doc ul { padding-left: 1.35rem; }
.doc li { margin: 0.4rem 0; }
.doc li::marker { color: var(--line-strong); }
.doc li > ul { margin: 0.4rem 0 0; }
.doc strong { font-weight: 650; }
.doc p, .doc li { overflow-wrap: anywhere; }

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.1em 0.35em;
  border-radius: 5px;
  background: var(--code-bg);
  overflow-wrap: anywhere;
}

/* Support */
.lede { color: var(--muted); margin: 0 0 2rem; }
.contact-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin: 0 0 2.75rem;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.contact-card p { margin: 0; }
.contact-card .label { color: var(--muted); font-size: 0.875rem; }
.contact-card .email { font-weight: 600; font-size: 1.125rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1.15rem;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
}
.button:hover { filter: brightness(1.06); }

.faq dt {
  margin: 1.5rem 0 0.35rem;
  font-weight: 650;
}
.faq dt:first-child { margin-top: 0; }
.faq dd {
  margin: 0;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.faq dd:last-child { border-bottom: 0; }

.more { margin-top: 2rem; color: var(--muted); font-size: 0.9375rem; }

/* Landing */
.hero {
  position: relative;
  max-width: 40rem;
  margin: 0 auto;
  padding: 2.5rem 0 1rem;
  text-align: center;
}
.hero-icon {
  display: block;
  width: 128px;
  height: 128px;
  margin: 0 auto 1.75rem;
  filter: drop-shadow(0 6px 14px rgb(30 70 180 / 0.22)) drop-shadow(0 1px 2px rgb(16 32 80 / 0.15));
}
@media (prefers-color-scheme: dark) {
  .hero-icon { filter: drop-shadow(0 6px 16px rgb(0 0 0 / 0.45)); }
  .mark { filter: none; }
}
@media (min-width: 48rem) {
  .hero-icon { width: 144px; height: 144px; }
}
.hero h1 {
  margin: 0;
  font-size: clamp(2.75rem, 2rem + 4vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.06em;
}
.hero .aka {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: 0.04em;
}
.hero .tagline {
  margin: 1.5rem auto 0;
  max-width: 30rem;
  color: var(--ink);
}
.hero .tagline-alt {
  margin: 0.35rem auto 0;
  max-width: 30rem;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
  max-width: 40rem;
  margin: 2.5rem auto 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 40rem) {
  .cards { grid-template-columns: 1fr 1fr; }
}
.card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  height: 100%;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--accent); }
.card .title { font-weight: 650; font-size: 1.125rem; }
.card .title::after { content: " →"; color: var(--accent); }
.card .sub { color: var(--muted); font-size: 0.875rem; }

.other-langs {
  max-width: 40rem;
  margin: 2rem auto 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.5rem;
  color: var(--muted);
  font-size: 0.9375rem;
}
.other-langs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.25rem;
}

/* 404 */
.notfound { text-align: center; max-width: 34rem; margin: 0 auto; padding-top: 2rem; }
.notfound .code {
  margin: 0;
  font-size: clamp(3.5rem, 2.5rem + 5vw, 5rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--line-strong);
  line-height: 1;
}
.notfound h1 { font-size: 1.5rem; margin: 1rem 0 0.25rem; }
.notfound p { margin: 0.25rem 0; color: var(--muted); }
.notfound .links { margin-top: 2rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}
.site-footer .wrap { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.site-footer p { margin: 0; }

@media (min-width: 48rem) {
  main { padding: 3.5rem 0 5rem; }
  .wrap { padding: 0 2rem; }
}

@media (max-width: 21rem) {
  .brand-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .site-nav a { padding: 0 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media print {
  :root {
    --bg: #fff; --surface: #fff; --ink: #000; --muted: #333;
    --line: #bbb; --code-bg: #f2f2f2; --accent: #000;
  }
  body { font-size: 11pt; line-height: 1.5; display: block; }
  .hero-icon, .mark { filter: none; }
  .site-header, .lang-switch, .skip-link, .site-nav { display: none !important; }
  main { padding: 0; }
  .doc { max-width: none; }
  .doc h2 { break-after: avoid; page-break-after: avoid; }
  .doc li, .doc p { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  .site-footer { border-top: 1px solid #bbb; margin-top: 2rem; }
}
