:root {
  color-scheme: light dark;
  --bg: #f7f3eb;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #171613;
  --muted: #625f58;
  --line: #ded5c5;
  --accent: #1b6f65;
  --accent-strong: #15594f;
  --gold: #b5822f;
  --shadow: 0 18px 50px rgba(26, 24, 20, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171613;
    --surface: #201f1b;
    --surface-strong: #26241f;
    --ink: #f5efe4;
    --muted: #c5bcae;
    --line: #3c382f;
    --accent: #57c1b4;
    --accent-strong: #8ad8ce;
    --gold: #e1b865;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  font-weight: 700;
}

:target {
  scroll-margin-top: 20px;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.nav {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav-links a:hover {
  color: var(--accent);
}

.hero {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 62px 0 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  align-items: center;
  gap: 44px;
}

.hero h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2.4rem, 7vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero p {
  max-width: 670px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.12rem;
}

.hero-art {
  justify-self: end;
  width: 190px;
  height: 190px;
  border-radius: 36px;
  box-shadow: var(--shadow);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
  font-weight: 800;
}

.button.secondary {
  background: transparent;
  color: var(--accent);
}

button.button {
  font: inherit;
  cursor: pointer;
}

main {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 64px;
}

.band {
  padding: 34px 0;
  border-top: 1px solid var(--line);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.panel h2,
.panel h3 {
  margin: 0 0 10px;
  line-height: 1.15;
  letter-spacing: 0;
}

.panel p,
.panel li {
  color: var(--muted);
}

.panel p:last-child,
.panel ul:last-child,
.panel ol:last-child {
  margin-bottom: 0;
}

.learn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  text-decoration: none;
}

.learn-link::after {
  content: "→";
  font-size: 1.1em;
}

.wide {
  grid-column: 1 / -1;
}

.page-title {
  padding: 48px 0 18px;
}

.page-title h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.page-title p {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.08rem;
}

.content {
  max-width: 820px;
}

.content section {
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.content h2 {
  margin-top: 0;
  letter-spacing: 0;
}

.content li {
  margin-bottom: 8px;
}

.rules-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.rules-table th,
.rules-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.rules-table th {
  width: 34%;
  color: var(--ink);
  font-weight: 800;
}

.rules-table tr:last-child th,
.rules-table tr:last-child td {
  border-bottom: 0;
}

.card-examples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.variation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.screenshot-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.screenshot-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #f7f3eb;
}

.screenshot-card figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.card-line {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.playing-card {
  min-width: 42px;
  min-height: 58px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.playing-card.red {
  color: #b6332b;
}

.playing-card.wild {
  border-color: var(--gold);
  color: var(--gold);
}

.meta-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.meta-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.meta-item strong {
  display: block;
  margin-bottom: 4px;
}

.checklist {
  list-style: none;
  padding-left: 0;
}

.checklist li {
  position: relative;
  padding-left: 30px;
}

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

.print-sheet {
  max-width: 860px;
}

.print-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 42px 0 22px;
}

.print-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.print-hero p {
  max-width: 600px;
  color: var(--muted);
}

.print-hero .eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.print-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-top: 0 !important;
}

.print-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  break-inside: avoid;
}

.print-card h2 {
  margin: 0 0 8px;
}

.print-card p,
.print-card li {
  color: var(--muted);
}

.print-card ul,
.print-card ol {
  margin-bottom: 0;
  padding-left: 22px;
}

.wild-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.wild-strip span {
  min-width: 34px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.rules-table.compact th,
.rules-table.compact td {
  padding: 8px 10px;
}

.gallery-page {
  max-width: 1040px;
}

.notice {
  border-left: 4px solid var(--gold);
  background: var(--surface);
  padding: 16px 18px;
  border-radius: 0 8px 8px 0;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer-inner {
  width: min(1040px, calc(100% - 32px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-inner a {
  color: var(--muted);
}

@media (max-width: 760px) {
  .nav,
  .hero,
  main,
  .footer-inner {
    width: calc(100vw - 48px);
    max-width: calc(100vw - 48px);
  }

  .nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .nav-links {
    width: 100%;
    gap: 10px 14px;
  }

  .nav-links a {
    font-size: 0.9rem;
  }

  .hero {
    grid-template-columns: 1fr;
    padding-top: 40px;
  }

  .hero h1,
  .page-title h1 {
    font-size: 1.85rem;
    line-height: 1.08;
    overflow-wrap: anywhere;
  }

  .hero p,
  .page-title p,
  .content p,
  .content li,
  .panel p,
  .panel li {
    overflow-wrap: break-word;
  }

  .hero-art {
    justify-self: start;
    width: 120px;
    height: 120px;
    border-radius: 24px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .card-examples,
  .variation-grid,
  .screenshot-grid,
  .meta-list,
  .print-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .notice,
  .screenshot-card,
  .rules-table {
    max-width: 100%;
  }

  .rules-table th,
  .rules-table td {
    display: block;
    width: 100%;
    overflow-wrap: break-word;
  }

  .rules-table th {
    border-bottom: 0;
    padding-bottom: 4px;
  }

  .rules-table td {
    padding-top: 0;
  }

  .print-hero {
    display: block;
  }

  .button {
    width: 100%;
  }
}

@media print {
  .site-header,
  .site-footer,
  .actions,
  .nav-links {
    display: none !important;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 11pt;
  }

  main,
  .content {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .page-title {
    padding: 0 0 12px;
  }

  .print-hero {
    padding: 0 0 10px;
    display: block;
  }

  .print-hero h1 {
    font-size: 28pt;
  }

  .print-hero p {
    margin: 4px 0;
  }

  .content section {
    padding: 10px 0;
    break-inside: avoid;
  }

  .rules-table,
  .panel,
  .notice,
  .print-card {
    border-color: #999999;
    background: #ffffff;
  }

  .print-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .print-card {
    padding: 9px;
  }

  .print-card h2 {
    font-size: 13pt;
  }

  .print-card p,
  .print-card li,
  .rules-table.compact th,
  .rules-table.compact td {
    font-size: 9pt;
  }
}
