:root {
  --paper: #f5f2ec;
  --ink: #17191d;
  --muted: #64676e;
  --line: #d7d2c9;
  --panel: #fcfaf6;
  --accent: #9e3d49;
  --focus: #285b78;
  --green: #2f7b55;
  --soft-accent: rgba(158, 61, 73, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 85% 6%, rgba(40, 91, 120, 0.08), transparent 28rem),
    radial-gradient(circle at 5% 29%, rgba(158, 61, 73, 0.07), transparent 30rem),
    var(--paper);
  font-family: "Avenir Next", Avenir, "SF Pro Display", system-ui, sans-serif;
}

a {
  color: inherit;
  text-underline-offset: 0.18em;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.content-header,
.content-footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.content-header {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.content-brand {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.content-header nav,
.content-footer nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.content-header nav a,
.content-footer nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.content-article {
  width: min(900px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 100px;
}

.breadcrumbs {
  padding: 24px 0;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.72rem;
  list-style: none;
}

.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 7px;
  color: var(--line);
}

.article-hero {
  padding: clamp(50px, 8vw, 96px) 0 clamp(58px, 8vw, 88px);
}

.section-label,
.result-kicker {
  margin: 0 0 13px;
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 850;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.article-hero h1 {
  max-width: 850px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.25rem, 8vw, 6.5rem);
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 0.94;
}

.article-hero > p:last-child {
  max-width: 720px;
  margin: 30px 0 0;
  color: var(--muted);
  font-size: clamp(1.08rem, 2vw, 1.34rem);
  line-height: 1.6;
}

.answer-box,
.rule-callout,
.tool-rule-note,
.source-note,
.worked-example {
  margin: 0 0 64px;
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 25px;
  background: var(--panel);
  box-shadow: 0 20px 58px rgba(28, 28, 25, 0.07);
}

.answer-box {
  border-top: 5px solid var(--accent);
}

.answer-box strong,
.rule-callout strong,
.tool-rule-note strong {
  font: 400 clamp(1.45rem, 3vw, 2rem)/1.15 Georgia, serif;
}

.answer-box p,
.rule-callout p,
.tool-rule-note p,
.worked-example p,
.source-note p {
  margin: 13px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.quick-table,
.article-section,
.faq-section {
  margin: 72px 0;
}

.quick-table h2,
.article-section h2,
.faq-section h2,
.source-note h2,
.play-cta h2,
.tool-cta h2 {
  margin: 0 0 23px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.05rem, 5vw, 3.45rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.article-section h3,
.worked-example h3,
.example-grid h3 {
  margin: 0 0 11px;
  font: 400 1.55rem/1.12 Georgia, serif;
}

.article-section > p,
.article-section > ul,
.article-section > ol,
.faq-section > p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
}

.article-section > p strong {
  color: var(--ink);
}

.article-section > .evidence,
.evidence {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.evidence strong {
  color: var(--ink);
}

.quick-table dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--line);
}

.quick-table dl div {
  display: grid;
  grid-template-columns: minmax(88px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.quick-table dl div:nth-child(odd) {
  padding-right: 24px;
}

.quick-table dl div:nth-child(even) {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.quick-table dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.quick-table dd {
  margin: 0;
  font-weight: 700;
}

.steps,
.questions-list {
  padding-left: 1.4rem;
}

.steps li,
.questions-list li {
  margin: 12px 0;
  padding-left: 7px;
}

.steps strong {
  color: var(--ink);
}

.definition-grid,
.intro-grid,
.resource-grid,
.example-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.definition-grid > div,
.intro-grid > div,
.example-grid article {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--panel) 84%, transparent);
}

.definition-grid strong,
.intro-grid strong {
  display: block;
  margin-bottom: 8px;
  font: 400 1.35rem Georgia, serif;
}

.definition-grid p,
.intro-grid span,
.example-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.intro-grid {
  margin: 12px 0 72px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.intro-grid > div {
  padding-top: 18px;
  border-width: 2px 0 0;
  border-radius: 0;
  background: transparent;
}

.text-link {
  display: inline-flex;
  gap: 14px;
  margin-top: 12px;
  color: var(--ink);
  font-weight: 800;
}

table {
  width: 100%;
  margin: 25px 0;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

th,
td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}

th {
  color: var(--muted);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  font-size: 0.74rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

td:first-child {
  font-weight: 800;
}

tr:last-child td {
  border-bottom: 0;
}

.value-table {
  max-width: 540px;
}

.example-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.example-grid article > span,
.resource-card > span {
  display: block;
  margin-bottom: 11px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.resource-grid {
  margin-top: 30px;
}

.resource-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 16px 44px rgba(28, 28, 25, 0.06);
  text-decoration: none;
  transition:
    border-color 160ms ease,
    transform 160ms ease;
}

.resource-card:hover,
.resource-card:focus-visible {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.resource-card strong {
  font: 400 1.65rem/1.12 Georgia, serif;
}

.resource-card p {
  margin: auto 0 0;
  padding-top: 22px;
  color: var(--muted);
  line-height: 1.5;
}

.faq-section details {
  border-top: 1px solid var(--line);
}

.faq-section details:last-child {
  border-bottom: 1px solid var(--line);
}

.faq-section summary {
  padding: 20px 36px 20px 0;
  font-weight: 800;
  cursor: pointer;
}

.faq-section details p {
  margin: -6px 0 22px;
  color: var(--muted);
  line-height: 1.65;
}

.source-note {
  margin-top: 80px;
  border-style: dashed;
  box-shadow: none;
}

.source-note .review-date,
.review-date {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.play-cta,
.tool-cta {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 35px;
  margin-top: 76px;
  padding: clamp(28px, 5vw, 48px);
  border-radius: 28px;
  color: white;
  background: #17191d;
}

.play-cta h2,
.tool-cta h2 {
  max-width: 560px;
  margin-bottom: 12px;
  color: white;
}

.play-cta p:last-child,
.tool-cta p:last-child {
  max-width: 600px;
  margin: 0;
  color: rgba(255, 255, 255, 0.69);
  line-height: 1.55;
}

.play-cta a,
.tool-cta a {
  min-height: 52px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 0 19px;
  border-radius: 15px;
  color: var(--ink);
  background: white;
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
}

.scorekeeper {
  display: grid;
  gap: 22px;
}

.scorekeeper fieldset {
  min-width: 0;
  margin: 0;
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
}

.scorekeeper legend {
  padding: 0 10px;
  font: 400 1.45rem Georgia, serif;
}

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

.form-grid label,
.game-count-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.scorekeeper input,
.scorekeeper select {
  width: 100%;
  min-height: 50px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: var(--paper);
}

.fieldset-help {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.55;
}

.rules-lock-note {
  margin: 20px 0 0;
  font-size: 0.78rem;
}

.scorekeeper input:disabled,
.scorekeeper select:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

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

.game-count-grid section {
  display: grid;
  gap: 10px;
}

.game-count-grid h2 {
  margin: 0 0 4px;
  font: 400 1.4rem Georgia, serif;
}

.game-count-grid label {
  grid-template-columns: minmax(0, 1fr) 86px;
  align-items: center;
}

.game-count-grid label > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.game-count-grid small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.check-list {
  display: grid;
  gap: 0;
  margin-top: 22px;
  border-top: 1px solid var(--line);
}

.check-list label {
  min-height: 68px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.check-list input {
  min-height: auto;
  accent-color: var(--accent);
}

.check-list span {
  display: grid;
  gap: 3px;
}

.check-list strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.check-list small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.form-actions,
.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-actions button,
.session-actions button {
  min-height: 50px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--panel);
  font-size: 0.8rem;
  font-weight: 850;
}

.form-actions .calculate-button {
  border-color: var(--ink);
  color: white;
  background: var(--ink);
}

.form-actions button:disabled,
.session-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.form-error {
  margin: 0;
  padding: 15px 17px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  color: var(--accent);
  background: var(--soft-accent);
  font-weight: 750;
}

.score-result {
  margin-top: 36px;
  padding: clamp(26px, 5vw, 44px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: 0 22px 60px rgba(28, 28, 25, 0.08);
}

.score-result h2 {
  margin: 0 0 13px;
  font: 400 clamp(2rem, 5vw, 3.25rem)/1.05 Georgia, serif;
  letter-spacing: -0.04em;
}

.score-result > p {
  color: var(--muted);
  line-height: 1.55;
}

.point-result-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 25px 0;
  padding: 0;
  list-style: none;
}

.point-result-list li {
  display: grid;
  gap: 6px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.point-result-list span,
.score-result-grid span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.score-result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
}

.score-result-grid > div {
  display: grid;
  gap: 5px;
  padding: 15px;
  border-right: 1px solid var(--line);
}

.score-result-grid > div:last-child {
  border-right: 0;
}

.score-result-grid strong {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.score-result .match-result {
  margin-bottom: 0;
  color: var(--ink);
  font-weight: 850;
}

.session-actions {
  margin-top: 12px;
}

.content-footer {
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
}

.content-footer > div {
  display: grid;
  gap: 5px;
}

.content-footer strong {
  color: var(--ink);
  font-size: 0.85rem;
}

@media (max-width: 760px) {
  .content-header,
  .content-footer,
  .content-article {
    width: min(100% - 32px, 900px);
  }

  .content-header nav a:first-child {
    display: none;
  }

  .article-hero h1 {
    font-size: clamp(3rem, 15vw, 5rem);
  }

  .quick-table dl,
  .definition-grid,
  .resource-grid,
  .example-grid,
  .intro-grid,
  .form-grid,
  .game-count-grid {
    grid-template-columns: 1fr;
  }

  .quick-table dl div:nth-child(odd),
  .quick-table dl div:nth-child(even) {
    padding-right: 0;
    padding-left: 0;
    border-left: 0;
  }

  .example-grid {
    gap: 12px;
  }

  .play-cta,
  .tool-cta {
    align-items: stretch;
    flex-direction: column;
  }

  .play-cta a,
  .tool-cta a {
    width: 100%;
  }

  table {
    display: block;
    overflow-x: auto;
  }

  .point-result-list,
  .score-result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .score-result-grid > div:nth-child(2) {
    border-right: 0;
  }

  .score-result-grid > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .content-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 28px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

html[data-theme="dark"] {
  --paper: #0d1014;
  --ink: #f2f0eb;
  --muted: #a6abb3;
  --line: #303740;
  --panel: #151a20;
  --accent: #ef8992;
  --focus: #79b8de;
  --green: #69bf90;
  --soft-accent: rgba(239, 137, 146, 0.1);
  color-scheme: dark;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 85% 6%, rgba(75, 141, 180, 0.1), transparent 28rem),
    radial-gradient(circle at 5% 29%, rgba(190, 75, 88, 0.08), transparent 30rem),
    var(--paper);
}

html[data-theme="dark"] .play-cta,
html[data-theme="dark"] .tool-cta {
  color: #17191d;
  background: #eeeae2;
}

html[data-theme="dark"] .play-cta h2,
html[data-theme="dark"] .tool-cta h2 {
  color: #17191d;
}

html[data-theme="dark"] .play-cta p:last-child,
html[data-theme="dark"] .tool-cta p:last-child {
  color: #5e6268;
}

html[data-theme="dark"] .play-cta a,
html[data-theme="dark"] .tool-cta a {
  color: white;
  background: #17191d;
}
