@font-face {
  font-family: "Bodoni Moda";
  src: url("/assets/fonts/bodoni-moda-latin.woff2") format("woff2");
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("/assets/fonts/dm-sans-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #F4F6F8;
  --white: #FFFFFF;
  --ink: #12151C;
  --teal: #1F7A8C;
  --mist: #CFE6EA;
  --suit: #D62839;
  --rule: #D5DBE0;
  --quiet: #4A5260;
  --serif: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --sans: "DM Sans", system-ui, "Segoe UI", Arial, sans-serif;
  --gutter: 1rem;
  --cell: 1.5rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

a {
  touch-action: manipulation;
  color: var(--teal);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

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

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  line-height: 1.1;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 1.5rem + 3.4vw, 3.9rem);
  font-weight: 800;
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.65rem, 1.3rem + 1.4vw, 2.4rem);
  font-weight: 600;
}

h3 {
  font-size: 1.4rem;
  font-weight: 600;
}

p {
  margin: 0 0 1rem;
}

.skip {
  position: absolute;
  inset-inline-start: 1rem;
  inset-block-start: -4rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--white);
}

.skip:focus {
  inset-block-start: 1rem;
}

.wrap {
  width: min(100% - 2 * var(--gutter), 70rem);
  margin-inline: auto;
}

.masthead {
  background: var(--white);
  border-bottom: 1px solid var(--rule);
}

.masthead .wrap {
  padding-top: 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
}

.brand-note {
  margin: 0.4rem 0 0;
  color: var(--quiet);
  font-size: 0.9375rem;
}

.tabs ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.tabs a {
  display: block;
  padding-block: 0.7rem 0.4rem;
  min-height: 2.75rem;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.tabs a::after {
  content: "";
  display: block;
  height: 3px;
  margin-top: 0.3rem;
  background: var(--teal);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease-out;
}

.tabs a:hover::after {
  transform: scaleX(1);
}

.tabs a[aria-current="page"]::after {
  background: var(--suit);
  transform: scaleX(1);
}

.files {
  display: flex;
  width: calc(8 * var(--cell));
  margin-top: 0.5rem;
  margin-bottom: -1px;
  border: 1px solid var(--ink);
}

.files span {
  width: var(--cell);
  height: var(--cell);
  background: var(--white);
}

.files span:nth-child(even) {
  background: var(--ink);
}

.files span.here {
  background: var(--suit);
}

.part {
  padding-block: clamp(2.25rem, 5vw, 3.75rem);
  border-top: 1px solid var(--rule);
}

.part h2 {
  margin-bottom: 1.25rem;
}

.prose p,
p.prose {
  max-width: 62ch;
}

.lede {
  max-width: 58ch;
  margin-top: 1.25rem;
  font-size: 1.1875rem;
}

.intro {
  padding-block: clamp(2rem, 5vw, 3.5rem);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.fineprint {
  color: var(--quiet);
  font-size: 0.9375rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.6rem 1.4rem;
  border: 2px solid var(--teal);
  background: var(--teal);
  color: var(--white);
  font-weight: 600;
  text-decoration: none;
}

.btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.btn-quiet {
  border-color: var(--ink);
  background: transparent;
  color: var(--ink);
}

.btn-quiet:hover {
  background: var(--mist);
  border-color: var(--ink);
  color: var(--ink);
}

.opening {
  display: grid;
  gap: 2.5rem;
  padding-block: clamp(2rem, 5vw, 3.5rem);
}

.board-wrap {
  position: relative;
  width: min(100%, 32rem);
  margin-bottom: 1.5rem;
}

.board {
  display: grid;
  grid-template: repeat(8, 1fr) / repeat(8, 1fr);
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  background: repeating-conic-gradient(var(--teal) 0 25%, var(--mist) 0 50%) 0 0 / 25% 25%;
}

.pc {
  width: 100%;
  height: 100%;
  padding: 9%;
}

.pc.w {
  fill: var(--white);
  stroke: var(--ink);
  stroke-width: 1.5;
}

.pc.b {
  fill: var(--ink);
}

.laid {
  position: absolute;
  right: 0;
  bottom: -6%;
  width: 38%;
  margin: 0;
  border: 5px solid var(--white);
  outline: 1px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  transform: rotate(4deg);
  background: var(--white);
}

.laid img {
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
}

.about-game {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

.about-game img {
  width: 6.5rem;
  border: 1px solid var(--ink);
}

.sheet {
  margin: 1.5rem 0 0;
  border-top: 2px solid var(--ink);
}

.sheet div {
  display: grid;
  grid-template-columns: minmax(6.5rem, 11rem) 1fr;
  gap: 1rem;
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--rule);
}

.sheet dt {
  font-weight: 600;
}

.sheet dd {
  margin: 0;
}

.deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  aspect-ratio: 5 / 7;
  padding: 0.9rem;
  border: 1px solid var(--ink);
  background: var(--white);
}

.tile h3 {
  margin-top: auto;
}

.tile p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.mark {
  width: 1.6rem;
  height: 1.6rem;
  fill: var(--ink);
}

.mark.red {
  fill: var(--suit);
}

.four {
  display: grid;
  grid-template-columns: repeat(2, 1.35rem);
  gap: 0.2rem;
}

.four .mark {
  width: 1.35rem;
  height: 1.35rem;
}

.turn {
  display: grid;
  gap: 0;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
  border-top: 2px solid var(--ink);
}

.turn li {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 1rem;
  padding-block: 1rem;
  border-bottom: 1px solid var(--rule);
  counter-increment: step;
}

.turn li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  background: var(--ink);
  color: var(--white);
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 800;
}

.turn p {
  max-width: 60ch;
  margin: 0;
}

.rows {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 2px solid var(--ink);
}

.rows li {
  display: grid;
  gap: 0.25rem 2rem;
  padding-block: 1rem;
  border-bottom: 1px solid var(--rule);
}

.rows a {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  text-decoration-color: var(--teal);
}

.rows p {
  margin: 0;
  max-width: 56ch;
}

.frame {
  margin: 0;
  border: 1px solid var(--ink);
  background: repeating-conic-gradient(var(--mist) 0 25%, var(--white) 0 50%) 0 0 / 2.5rem 2.5rem;
}

.frame img {
  width: min(78%, 17rem);
  margin: 1.5rem auto;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  border: 5px solid var(--white);
  outline: 1px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
}

.frame figcaption {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--ink);
  background: var(--white);
  color: var(--quiet);
  font-size: 0.875rem;
  line-height: 1.45;
}

.beside {
  display: grid;
  gap: 1.75rem;
  align-items: start;
}

.entry {
  padding-block: clamp(2rem, 4vw, 3rem);
  border-top: 1px solid var(--rule);
}

.entry h2 {
  margin-bottom: 1rem;
}

.face {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.75rem;
  aspect-ratio: 5 / 7;
  width: min(78%, 17rem);
  margin-inline: auto;
  border: 5px solid var(--white);
  outline: 1px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  background: var(--white);
}

.face .mark {
  width: 4.5rem;
  height: 4.5rem;
}

.face .four {
  grid-template-columns: repeat(2, 3rem);
  gap: 0.5rem;
}

.face .four .mark {
  width: 3rem;
  height: 3rem;
}

.face p {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 800;
}

.felt {
  padding-block: 1.5rem;
  border: 1px solid var(--ink);
  background: repeating-conic-gradient(var(--mist) 0 25%, var(--white) 0 50%) 0 0 / 2.5rem 2.5rem;
}

.scroll {
  overflow-x: auto;
  margin-block: 1.5rem 0;
}

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.ledger caption {
  padding-bottom: 0.75rem;
  text-align: left;
  color: var(--quiet);
}

.ledger th,
.ledger td {
  padding: 0.7rem 0.75rem 0.7rem 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.ledger thead th {
  border-bottom: 2px solid var(--ink);
  font-weight: 600;
}

.ledger tbody th {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
}

.note {
  max-width: 62ch;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border-left: 5px solid var(--teal);
  background: var(--mist);
}

.note p {
  margin: 0;
}

.mode {
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 1.25rem;
  padding-block: 2rem;
  border-top: 1px solid var(--rule);
}

.token {
  display: grid;
  place-items: center;
  align-self: start;
  aspect-ratio: 1;
  border: 1px solid var(--ink);
  background: var(--mist);
}

.token .mark {
  width: 55%;
  height: 55%;
}

.mode h2 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem);
}

.cells {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}

.cell {
  padding: 1.25rem;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: var(--white);
}

.cell:nth-child(4n + 2),
.cell:nth-child(4n + 3) {
  background: var(--mist);
}

.cell h3 {
  margin-block: 0.75rem 0.5rem;
  font-size: 1.3rem;
}

.cell p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.line {
  width: 2.25rem;
  height: 2.25rem;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.75;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.closer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-block: 1rem 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--ink);
}

.closer p {
  max-width: 52ch;
  margin: 0;
}

.legal {
  max-width: 62ch;
  padding-block: clamp(2rem, 5vw, 3.5rem);
}

.legal h2 {
  margin-block: 2rem 0.75rem;
  font-size: 1.6rem;
}

.foot {
  margin-top: 2rem;
  padding-block: 2.5rem;
  background: var(--ink);
  color: var(--rule);
  font-size: 0.9375rem;
}

.foot p {
  margin: 0 0 0.35rem;
}

.foot .foot-name {
  margin-bottom: 0.75rem;
  color: var(--white);
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 800;
}

.foot ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.foot a {
  display: inline-block;
  padding-block: 0.6rem;
  color: var(--white);
}

.foot a:hover {
  color: var(--mist);
}

.foot :focus-visible {
  outline-color: var(--white);
}

.lost {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  align-content: center;
  gap: 1.5rem;
  padding-block: 3rem;
}

.lost .files {
  margin-bottom: 0;
}

.lone {
  width: 5rem;
  height: 5rem;
  fill: var(--ink);
}

.lost p {
  max-width: 44ch;
  margin: 0;
}

@media (min-width: 30rem) {
  :root {
    --gutter: 1.5rem;
  }

  .mode {
    grid-template-columns: 5.5rem 1fr;
    gap: 1.75rem;
  }
}

@media (min-width: 48rem) {
  :root {
    --gutter: 2rem;
  }

  .about-game {
    grid-template-columns: 6.5rem minmax(0, 1fr);
    gap: 2rem;
  }

  .rows li {
    grid-template-columns: 15rem 1fr;
    align-items: baseline;
  }

  .beside {
    grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr);
    gap: 3rem;
  }

  .beside.right {
    grid-template-columns: minmax(0, 1fr) minmax(15rem, 19rem);
  }

  .beside.right > :first-child {
    order: 2;
  }

  .turn li {
    grid-template-columns: 3rem minmax(0, 1fr);
  }
}

@media (min-width: 60rem) {
  .opening {
    grid-template-columns: minmax(0, 32rem) minmax(0, 1fr);
    gap: 4rem;
    align-items: center;
  }

  .board-wrap {
    grid-column: 1;
    grid-row: 1;
  }

  .copy {
    grid-column: 2;
    grid-row: 1;
  }

  .deck {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .laid {
    animation: dealt 0.7s ease-out both;
  }

  @keyframes dealt {
    from {
      opacity: 0;
      transform: translateY(1.5rem) rotate(12deg);
    }

    to {
      opacity: 1;
      transform: rotate(4deg);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .tabs a::after {
    transition: none;
  }
}

.plus {
  font-family: var(--sans);
  font-weight: 600;
  color: var(--suit);
}
