:root {
  color-scheme: light dark;
  --bg: #f6f7f5;
  --surface: #ffffff;
  --ink: #16201b;
  --muted: #5d6a63;
  --line: #dfe4e0;
  --accent: #14663f;
  --accent-soft: #e4f2ea;
  --gain: #14663f;
  --gain-soft: #e4f2ea;
  --loss: #b3322b;
  --loss-soft: #fbeae8;
  --warn: #8a5a00;
  --warn-soft: #fbf1dc;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101512;
    --surface: #18201c;
    --ink: #edf2ee;
    --muted: #9aa8a0;
    --line: #2b3630;
    --accent: #6fd19e;
    --accent-soft: #1c3227;
    --gain: #6fd19e;
    --gain-soft: #1c3227;
    --loss: #f28f87;
    --loss-soft: #3a211f;
    --warn: #e8bd6a;
    --warn-soft: #362a14;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans Thai", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.65;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar-inner,
main {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
}

nav { display: flex; gap: 4px; }

nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

nav a:hover { color: var(--ink); }

nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

main { padding-top: 40px; padding-bottom: 64px; }

h1 {
  margin: 0 0 8px;
  font-size: 34px;
  line-height: 1.25;
}

.lead { margin: 0 0 32px; color: var(--muted); }

.rules {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rule {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.step {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.rule-body { min-width: 0; }

h2 {
  margin: 4px 0 12px;
  font-size: 22px;
  line-height: 1.3;
}

.checks {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checks li {
  position: relative;
  padding-left: 26px;
}

.checks li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.callout {
  margin: 0;
  font-size: 19px;
  font-weight: 500;
}

.num { color: var(--loss); font-weight: 700; }

.targets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.target {
  padding: 12px;
  border-radius: 8px;
  text-align: center;
}

.target span { display: block; font-size: 14px; }
.target strong { display: block; font-size: 26px; line-height: 1.3; }
.target.gain { background: var(--gain-soft); color: var(--gain); }
.target.loss { background: var(--loss-soft); color: var(--loss); }
.target.todo { background: var(--warn-soft); color: var(--warn); }
.target.todo strong { font-size: 18px; line-height: 1.85; }

.empty {
  padding: 48px 24px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.empty a { color: var(--accent); }

@media (max-width: 520px) {
  body { font-size: 16px; }
  h1 { font-size: 28px; }
  main { padding-top: 28px; }
  .rule { grid-template-columns: 1fr; gap: 8px; padding: 20px; }
  .targets { gap: 6px; }
  .target { padding: 12px 4px; }
  .target strong { font-size: 22px; }
  .target.todo strong { font-size: 15px; line-height: 2.2; }
}
