/* HI | LO: the uncut press sheet.
   White stock, black ink, process red and process cyan. */

/* Fonts, self-hosted. Both are variable fonts: one file serves every weight.
   Both use the SIL Open Font License 1.1. The licence texts are in assets/fonts/. */
@font-face {
  font-family: "Big Shoulders Display";
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
  src: url("../fonts/big-shoulders-display-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Big Shoulders Display";
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
  src: url("../fonts/big-shoulders-display-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Tokens */
:root {
  --stock: #FFFFFF;
  --ink: #111111;
  --red: #D7262E;
  --red-deep: #B51D24;
  --red-on-ink: #FF5A5F;
  --cyan: #00A3DA;
  --cyan-deep: #008CBC;
  --hair: rgba(17, 17, 17, 0.28);
  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --text: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 4vw, 58px);
  --gap: clamp(8px, 2.4vw, 36px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --flip: 520ms;
  color-scheme: light;
}

/* Dark mode: the sheet printed in reverse. The ink is a solid flood, and the
   type, rules and marks knock out to stock. Process red and cyan go up in
   lightness so they keep their contrast on the flood. The cards stay white
   card stock (see the .card rule in this block), as cards on a dark table do.
   Dark mode follows the device unless the visitor picks a theme: theme.js sets
   data-theme="light" or "dark" on <html>. "light" turns the device rule off. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --stock: #151515;
    --ink: #F3F1EC;
    --red: #FF5A5F;
    --red-deep: #FF8286;
    --cyan: #2DBDEE;
    --cyan-deep: #6BD0F3;
    --hair: rgba(243, 241, 236, 0.3);
    color-scheme: dark;
  }

  /* The cards keep the light print */
  :root:not([data-theme="light"]) .card {
    --stock: #FFFFFF;
    --ink: #111111;
    --red: #D7262E;
    --red-deep: #B51D24;
    --cyan: #00A3DA;
    --cyan-deep: #008CBC;
    --hair: rgba(17, 17, 17, 0.28);
    color: var(--ink);
  }
}

/* The same tokens when the visitor picks Dark with the theme button.
   If --stock changes, change THEME_COLOURS in theme.js and the theme-color
   tags in each page head too. */
:root[data-theme="dark"] {
  --stock: #151515;
  --ink: #F3F1EC;
  --red: #FF5A5F;
  --red-deep: #FF8286;
  --cyan: #2DBDEE;
  --cyan-deep: #6BD0F3;
  --hair: rgba(243, 241, 236, 0.3);
  color-scheme: dark;
}

:root[data-theme="dark"] .card {
  --stock: #FFFFFF;
  --ink: #111111;
  --red: #D7262E;
  --red-deep: #B51D24;
  --cyan: #00A3DA;
  --cyan-deep: #008CBC;
  --hair: rgba(17, 17, 17, 0.28);
  color: var(--ink);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--ink) var(--stock);
  /* Focus scrolling keeps controls clear of the fixed cookie banner */
  scroll-padding-bottom: var(--consent-height, 0px);
}

body {
  margin: 0;
  background: var(--stock);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.5;
  caret-color: var(--red);
}

h1,
h2,
h3,
p,
dl,
dd,
ol,
ul {
  margin: 0;
}

ol,
ul {
  padding: 0;
}

::selection {
  color: #111111;
  background: var(--cyan);
}

a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

a:hover {
  color: var(--red-deep);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

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

[hidden]:not(.panel):not(.aces) {
  display: none !important;
}

/* A hidden control panel or aces chip keeps its space. The table then
   keeps its height when the cards are dealt, so nothing below it moves */
.panel[hidden],
.aces[hidden] {
  visibility: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--stock);
  font-weight: 700;
}

.skip-link:focus {
  top: 16px;
}

.skip-link:hover {
  color: var(--stock);
}

/* The sheet */
.sheet {
  position: relative;
  max-width: 1440px;
  /* Less the cookie banner space, so the banner alone does not make the page scroll */
  min-height: calc(100svh - var(--consent-height, 0px));
  margin: 0 auto;
  padding: calc(var(--gutter) + 8px) var(--gutter) calc(var(--gutter) * 0.6);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr auto;
  row-gap: clamp(20px, 3.4vw, 40px);
  isolation: isolate;
}

.press-marks {
  position: absolute;
  z-index: -1;
  inset: clamp(6px, 1vw, 12px);
  border: 1px solid var(--hair);
  pointer-events: none;
}

.reg {
  position: absolute;
  width: clamp(18px, 2.4vw, 34px);
  height: clamp(18px, 2.4vw, 34px);
  color: var(--ink);
  fill: var(--ink);
}

.reg-tl { left: 6px; top: 6px; }
.reg-tr { right: 6px; top: 6px; }
.reg-bl { left: 6px; bottom: 6px; }
.reg-br { right: 6px; bottom: 6px; }

.colour-bar {
  position: absolute;
  top: 14px;
  left: calc(var(--gutter) + 8px);
  display: flex;
}

.bar-v {
  position: absolute;
  display: none;
  flex-direction: column;
}

.bar-v i {
  display: block;
  width: 14px;
  height: 30px;
}

.bar-left {
  left: 6px;
  top: 24%;
}

.bar-right {
  right: 6px;
  top: 56%;
}

.reg-ml,
.reg-mr {
  display: none;
  top: calc(50% - 17px);
}

.reg-ml { left: -11px; }
.reg-mr { right: -11px; }

.reg-plate {
  color: var(--red);
  fill: var(--cyan);
}

.colour-bar i,
.plates i {
  display: block;
  width: 30px;
  height: 18px;
}

.k100 { background: var(--ink); }
.k75 { background: color-mix(in srgb, var(--ink) 75%, transparent); }
.k50 { background: color-mix(in srgb, var(--ink) 50%, transparent); }
.k25 { background: color-mix(in srgb, var(--ink) 25%, transparent); }
.r100 { background: var(--red); }
.r50 { background: color-mix(in srgb, var(--red) 50%, transparent); }
.r25 { background: color-mix(in srgb, var(--red) 25%, transparent); }
.c100 { background: var(--cyan); }
.c50 { background: color-mix(in srgb, var(--cyan) 50%, transparent); }
.c25 { background: color-mix(in srgb, var(--cyan) 25%, transparent); }

/* Masthead and navigation */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.mast {
  display: flex;
  align-items: center;
  gap: 0.14em;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(3.2rem, 9vw, 7.75rem);
  line-height: 0.86;
  letter-spacing: -0.01em;
}

.mast a {
  display: flex;
  align-items: center;
  gap: 0.14em;
  text-decoration: none;
}

.mast .pipe {
  display: block;
  width: 0.1em;
  height: 0.78em;
  background: var(--red);
}

.site-nav {
  display: flex;
  gap: clamp(16px, 3vw, 36px);
  font-weight: 700;
  font-size: clamp(1rem, 1.6vw, 1.375rem);
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--red);
}

.site-nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* Slug line: the game statistics */
.slug {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.slug .cell {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 6px 8px 4px;
  border-left: 1px solid var(--hair);
}

.slug .cell:first-child {
  border-left: 0;
  padding-left: 2px;
}

.slug dt {
  font-size: clamp(0.8125rem, 1.4vw, 1.25rem);
  font-weight: 500;
}

.slug dd {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2rem, 5.4vw, 4.5rem);
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.slug dd small {
  font-size: max(0.55em, 12px);
  font-weight: 700;
}

.slug .cell-points dd {
  color: var(--red);
}

/* A changed number lands like fresh ink: soft, then sharp */
.ink-settle {
  animation: ink-settle 320ms var(--ease-out);
}

@keyframes ink-settle {
  from {
    opacity: 0.4;
    filter: blur(2px);
  }
}

/* The table */
.table {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: clamp(20px, 3vw, 36px);
  align-content: start;
}

.cards {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  column-gap: var(--gap);
  padding-top: 26px;
}

.slot {
  position: relative;
}

.card {
  position: relative;
  aspect-ratio: 5 / 7;
  perspective: 1400px;
  container-type: inline-size;
  isolation: isolate;
}

.card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateY(180deg);
  transition: transform var(--flip) var(--ease-out);
}

.card.is-up .card-inner {
  transform: rotateY(0deg);
}

.card.no-anim .card-inner {
  transition: none;
}

.face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--stock);
  border: 1px solid var(--hair);
}

/* Die line for the rounded corners */
.face::after {
  content: "";
  position: absolute;
  inset: 4.5cqi;
  border: 1px dashed rgba(0, 163, 218, 0.8);
  border-radius: 7cqi;
  pointer-events: none;
}

.back {
  transform: rotateY(180deg);
}

.back::before {
  content: "";
  position: absolute;
  inset: 7cqi;
}

.back-red {
  --plate: var(--red);
}

.back-red::before {
  background:
    repeating-linear-gradient(45deg, var(--red) 0 1.3cqi, transparent 1.3cqi 6cqi),
    repeating-linear-gradient(-45deg, var(--red) 0 1.3cqi, transparent 1.3cqi 6cqi);
}

.back-cyan {
  --plate: var(--cyan);
}

.back-cyan::before {
  background:
    radial-gradient(circle, var(--cyan) 0 1.7cqi, transparent 1.9cqi) 0 0 / 7.6cqi 7.6cqi,
    radial-gradient(circle, var(--cyan) 0 1.7cqi, transparent 1.9cqi) 3.8cqi 3.8cqi / 7.6cqi 7.6cqi;
}

.medal {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40cqi;
  aspect-ratio: 1;
  translate: -50% -50%;
  display: grid;
  place-items: center;
  isolation: isolate;
  font-family: var(--display);
  font-weight: 900;
  font-size: 13cqi;
  line-height: 0.9;
  text-align: center;
}

.medal::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--stock);
  border: 2.6cqi solid var(--plate);
  rotate: 45deg;
}

/* Printed faces */
.front {
  color: var(--ink);
  fill: currentColor;
}

.front.ink-red {
  color: var(--red);
}

.suit {
  display: block;
  fill: currentColor;
}

.idx {
  position: absolute;
  left: 7cqi;
  top: 7cqi;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1cqi;
}

.idx b {
  font-family: var(--display);
  font-weight: 900;
  font-size: 22cqi;
  line-height: 0.82;
}

.idx .suit {
  width: 12cqi;
  height: 12cqi;
}

.idx-flip {
  left: auto;
  top: auto;
  right: 7cqi;
  bottom: 7cqi;
  rotate: 180deg;
}

.pips {
  position: absolute;
  inset: 16% 33%;
}

.pip {
  position: absolute;
  translate: -50% -50%;
}

/* Pip positions. game.js sets one px- and one py- class on each pip */
.px-0 { left: 0; }
.px-50 { left: 50%; }
.px-100 { left: 100%; }
.py-0 { top: 0; }
.py-17 { top: 16.667%; }
.py-25 { top: 25%; }
.py-33 { top: 33.333%; }
.py-50 { top: 50%; }
.py-67 { top: 66.667%; }
.py-75 { top: 75%; }
.py-83 { top: 83.333%; }
.py-100 { top: 100%; }

.pip .suit {
  width: 16cqi;
  height: 16cqi;
}

.pip-flip .suit {
  rotate: 180deg;
}

.ace {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.ace .suit {
  width: 50cqi;
  height: 50cqi;
}

.court {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2cqi;
}

.court b {
  font-family: var(--display);
  font-weight: 900;
  font-size: 78cqi;
  line-height: 0.8;
}

.court .suit {
  width: 22cqi;
  height: 22cqi;
}

.compact {
  display: none;
}

/* Small cards print a simpler face: big rank, big suit */
@container (max-width: 120px) {
  .idx,
  .pips,
  .ace,
  .court {
    display: none;
  }

  .compact {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4cqi;
  }

  .compact b {
    font-family: var(--display);
    font-weight: 900;
    font-size: 56cqi;
    line-height: 0.8;
  }

  .compact .suit {
    width: 38cqi;
    height: 38cqi;
  }

  .medal {
    width: 58cqi;
    font-size: 20cqi;
  }
}

/* The live card: the last card turned, printed in reverse with a cyan plate */
.slot.is-live .card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--cyan);
  translate: 5cqi 5cqi;
}

.slot.is-live .front {
  background: var(--ink);
  color: var(--stock);
  border-color: var(--ink);
}

.slot.is-live .front.ink-red {
  color: var(--red-on-ink);
}

.slot.is-live .front::after {
  border-color: rgba(255, 255, 255, 0.55);
}

/* The card being called */
.slot.is-next::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -24px;
  translate: -50% 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 15px solid var(--red);
}

.cap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
  margin-top: 10px;
  font-size: clamp(0.75rem, 1.4vw, 1.25rem);
  font-weight: 500;
}

.cap b {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.3em;
}

/* Question line */
.ask h2 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2rem, 4.4vw, 3.75rem);
  line-height: 0.98;
  text-wrap: balance;
  max-width: 18ch;
  /* Three lines are kept free before the first deal, so the controls do
     not move down when the prompt gets longer. Only the last-round prompt
     can need four lines, on a narrow phone, after the player taps */
  min-height: 2.94em;
}

.ask em {
  font-style: normal;
  color: var(--red);
}

.aces {
  display: inline-flex;
  align-items: center;
  margin-top: 16px;
  padding: 6px 14px 6px 8px;
  border: 2px solid var(--ink);
  font-size: clamp(1rem, 1.6vw, 1.375rem);
  font-weight: 500;
}

.aces .chip {
  margin-right: 12px;
  padding: 0 8px;
  background: var(--cyan);
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.25em;
  line-height: 1.2;
}

/* Controls */
/* The four panels share one grid cell, so the controls are always as tall
   as the tallest panel */
.controls {
  display: grid;
}

.controls > .panel {
  grid-area: 1 / 1;
}

/* The browser's own [hidden] rule is display: none, so a panel needs a
   display of its own to keep its space. .call and .wager-form set theirs */
.panel {
  display: block;
}

.controls:focus {
  outline: none;
}

.panel-note {
  font-size: 1.25rem;
  font-weight: 500;
}

/* Shown only when JavaScript is off. The game cannot deal without it */
.noscript {
  max-width: 40ch;
  margin-top: 16px;
  padding: 12px 16px;
  border: 2px solid var(--red);
  font-weight: 600;
}

.tab {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.2em;
  border: 0;
  background: none;
  font-family: var(--display);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  text-transform: uppercase;
}

.tab::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--tab-bg, var(--red));
  clip-path: polygon(0 18px, 18px 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
  transition: background-color 160ms ease-out;
}

.tab:active {
  translate: 0 2px;
}

.tab-hi,
.tab-deal {
  --tab-bg: var(--red);
  color: var(--stock);
}

.tab-hi:hover,
.tab-deal:hover {
  --tab-bg: var(--red-deep);
}

.tab-lo {
  --tab-bg: var(--cyan);
  color: var(--ink);
}

.tab-lo:hover {
  --tab-bg: var(--cyan-deep);
}

.call {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2.4vw, 36px);
}

.call .tab {
  width: 100%;
  height: clamp(104px, 13vw, 180px);
  padding: 0 clamp(14px, 2vw, 30px);
  font-size: clamp(2.6rem, 5.4vw, 5.25rem);
}

.arrow {
  width: 0.55em;
  height: 0.55em;
  flex: none;
  fill: currentColor;
}

.arrow-down {
  rotate: 180deg;
}

.tab-wrap {
  position: relative;
}

/* Crop marks under each tab */
.tab-wrap::after {
  content: "";
  position: absolute;
  inset: auto -12px -12px;
  height: 12px;
  pointer-events: none;
  background:
    linear-gradient(var(--ink), var(--ink)) left 0 top 0 / 8px 1px no-repeat,
    linear-gradient(var(--ink), var(--ink)) left 12px top 3px / 1px 9px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right 0 top 0 / 8px 1px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right 12px top 3px / 1px 9px no-repeat;
}

.keys {
  grid-column: 1 / -1;
  margin-top: 8px;
  font-size: 0.9375rem;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 4px;
  border: 1.5px solid var(--ink);
  font-family: var(--text);
  font-weight: 700;
  font-size: 0.875em;
  text-align: center;
}

/* Wager form */
.wager-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: clamp(1.125rem, 1.8vw, 1.5rem);
}

.wager-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
}

.wager-row input {
  width: 4.2ch;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 5ch;
  padding: 4px 12px 0;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--stock);
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3rem, 6vw, 5rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.wager-row input {
  -moz-appearance: textfield;
  appearance: textfield;
}

.wager-row input::-webkit-inner-spin-button,
.wager-row input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.wager-row input:focus-visible {
  outline-offset: -6px;
}

.wager-row input[aria-invalid="true"] {
  border-color: var(--red);
  outline-color: var(--red);
}

.tab-deal {
  min-height: 64px;
  padding: 14px clamp(20px, 3vw, 40px) 10px;
  font-size: clamp(2rem, 3.8vw, 3.25rem);
}

.wager-hint {
  margin-top: 8px;
  font-size: 0.9375rem;
}

.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.chip-btn {
  min-height: 44px;
  min-width: 56px;
  padding: 4px 14px;
  border: 2px solid var(--ink);
  background: var(--stock);
  font-weight: 700;
}

.chip-btn:hover {
  background: var(--cyan);
}

.wager-error {
  min-height: 1.5em;
  margin-top: 10px;
  color: var(--red-deep);
  font-weight: 700;
}

/* Round result */
.result-title {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.2rem, 4.4vw, 3.75rem);
  line-height: 0.95;
  text-wrap: balance;
}

.result-text {
  max-width: 40ch;
  margin-top: 10px;
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  margin-top: 20px;
}

.text-btn {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 700;
  font-size: 1.125rem;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.text-btn:hover {
  color: var(--red-deep);
}

/* Cookie consent banner, added by consent.js first in the page, so it is
   the first stop after the skip link. It is fixed over the bottom of the
   screen, so the page does not move when it shows. consent.js sets
   --consent-height while it shows, so the footer can still scroll clear */
.consent {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 24px;
  padding: 14px var(--gutter);
  border-top: 2px solid var(--ink);
  background: var(--stock);
  font-size: 0.9375rem;
}

body {
  padding-bottom: var(--consent-height, 0px);
}

@media print {
  .consent {
    display: none;
  }
}

.consent-title {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.5rem;
  line-height: 1;
  text-transform: uppercase;
}

.consent p {
  flex: 1 1 32ch;
  max-width: 64ch;
}

.consent-actions {
  display: flex;
  gap: 10px;
}

/* Footer links and the cookie settings button */
.foot-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 20px;
}

.foot .text-btn {
  font-size: inherit;
  font-weight: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Leave dialog */
.sheet-dialog {
  width: min(32rem, calc(100% - 32px));
  padding: clamp(20px, 4vw, 36px);
  border: 2px solid var(--ink);
  background: var(--stock);
  color: var(--ink);
}

.sheet-dialog::backdrop {
  background: rgba(17, 17, 17, 0.6);
}

.sheet-dialog h2 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 0.95;
}

.sheet-dialog p {
  margin-top: 10px;
}

.sheet-dialog .tab-deal {
  font-size: 2.4rem;
}

/* Footer */
.foot {
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 24px;
  padding-top: 12px;
  border-top: 1px solid var(--hair);
  font-size: 0.9375rem;
  font-weight: 500;
}

.foot a {
  display: inline-block;
  padding: 10px 0;
}

.plates {
  display: flex;
  gap: 18px;
}

.plates span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.plates i {
  width: 14px;
  height: 14px;
}

/* Text pages: How to play and the error page */
.doc {
  max-width: 68ch;
  padding-bottom: 24px;
}

.doc h2 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  line-height: 0.95;
  text-wrap: balance;
}

.doc .lead {
  margin-top: 16px;
  font-size: clamp(1.125rem, 1.8vw, 1.375rem);
}

.doc .lead + .tab-deal,
.doc .actions {
  margin-top: 28px;
}

/* Privacy notice */
.legal .updated {
  margin-top: 8px;
  font-size: 0.9375rem;
}

.legal h3 {
  margin-top: 36px;
  padding-top: 10px;
  border-top: 1px solid var(--hair);
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1;
  text-transform: uppercase;
}

.legal p,
.legal ul,
.legal .table-wrap {
  margin-top: 12px;
}

.legal ul {
  padding-left: 1.2em;
}

.legal li + li {
  margin-top: 6px;
}

.legal code {
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.legal .text-btn {
  min-height: 0;
  font-size: inherit;
}

.table-wrap {
  overflow-x: auto;
}

.table-wrap table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table-wrap th,
.table-wrap td {
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--hair);
  text-align: left;
  vertical-align: top;
}

.table-wrap th {
  border-bottom: 2px solid var(--ink);
  font-weight: 700;
}

.rules {
  list-style: none;
  margin-top: 36px;
  border-top: 2px solid var(--ink);
}

.rules li {
  padding: 14px 0;
  border-bottom: 1px solid var(--hair);
}

.faq {
  margin-top: 44px;
  border-top: 2px solid var(--ink);
}

.faq details {
  border-bottom: 1px solid var(--hair);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 12px 0;
  font-weight: 700;
  font-size: clamp(1.125rem, 1.8vw, 1.375rem);
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  border-right: 3px solid var(--red);
  border-bottom: 3px solid var(--red);
  rotate: 45deg;
  translate: 0 -4px;
  transition: rotate 200ms var(--ease-out);
}

.faq details[open] summary::after {
  rotate: 225deg;
  translate: 0 3px;
}

.faq details p {
  padding-bottom: 18px;
}

.doc a.tab {
  text-decoration: none;
  min-height: 72px;
}

.doc a.tab:hover {
  color: var(--stock);
}

.misprint {
  width: min(220px, 46vw);
  margin: 12px 0 32px 14px;
}

.misprint .card .card-inner {
  transform: rotate(-7deg);
}

.misprint .face {
  display: grid;
  place-items: center;
}

.misprint .misreg {
  position: relative;
  font-family: var(--display);
  font-weight: 900;
  font-size: 52cqi;
  line-height: 1;
}

.misprint .misreg::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: var(--cyan);
  translate: 3cqi 2cqi;
  z-index: -1;
}

.misprint .misreg-face {
  isolation: isolate;
  color: var(--red);
}

/* Touch screens have no keys to press */
@media (hover: none) and (pointer: coarse) {
  .keys {
    display: none;
  }
}

/* Phones: drop the captions of face-down cards and the plate legend */
@media (max-width: 759px) {
  .slot.is-down .cap-text {
    visibility: hidden;
  }

  .colour-bar {
    top: 10px;
  }

  .sheet {
    padding-top: calc(var(--gutter) + 20px);
  }

  .colour-bar i {
    width: 16px;
    height: 8px;
  }

  .colour-bar i:nth-child(n+8) {
    display: none;
  }

  .tab-wrap::after {
    display: none;
  }

  .plates {
    display: none;
  }
}

/* Tablet and up */
@media (min-width: 760px) {
  .bar-v {
    display: flex;
  }

  .reg-ml,
  .reg-mr {
    display: block;
  }

  /* Crop marks at the four corners of each card */
  .card::after {
    content: "";
    position: absolute;
    inset: -14px;
    z-index: -2;
    pointer-events: none;
    background:
      linear-gradient(var(--ink), var(--ink)) left 0 top 14px / 9px 1px no-repeat,
      linear-gradient(var(--ink), var(--ink)) left 14px top 0 / 1px 9px no-repeat,
      linear-gradient(var(--ink), var(--ink)) right 0 top 14px / 9px 1px no-repeat,
      linear-gradient(var(--ink), var(--ink)) right 14px top 0 / 1px 9px no-repeat,
      linear-gradient(var(--ink), var(--ink)) left 0 bottom 14px / 9px 1px no-repeat,
      linear-gradient(var(--ink), var(--ink)) left 14px bottom 0 / 1px 9px no-repeat,
      linear-gradient(var(--ink), var(--ink)) right 0 bottom 14px / 9px 1px no-repeat,
      linear-gradient(var(--ink), var(--ink)) right 14px bottom 0 / 1px 9px no-repeat;
  }

  .slot.is-next::before {
    top: -30px;
  }
}

/* Desktop: the full press sheet */
@media (min-width: 1100px) {
  .sheet {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto 1fr auto;
    grid-template-areas:
      "mast nav"
      "mast slug"
      "table table"
      "foot foot";
    column-gap: 36px;
    row-gap: 0;
    padding-top: 56px;
    padding-bottom: 20px;
  }

  .ask h2 {
    max-width: none;
    font-size: 3rem;
  }

  .table {
    margin: 8px 0 14px;
    row-gap: 26px;
  }

  .page-table .cards {
    grid-template-columns: repeat(5, minmax(0, 212px));
    justify-content: space-between;
  }

  .call .tab {
    height: 136px;
  }

  .keys {
    margin-top: 4px;
  }

  .wager-form {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "label label"
      "row quick"
      "hint hint"
      "error error";
    column-gap: 24px;
    align-items: center;
  }

  .wager-form label { grid-area: label; }
  .wager-row { grid-area: row; }
  .wager-hint { grid-area: hint; }
  .wager-error { grid-area: error; margin-top: 4px; }

  .wager-form .quick {
    grid-area: quick;
    margin-top: 0;
  }

  .mast {
    font-size: 7rem;
  }

  .masthead {
    display: contents;
  }

  .mast {
    grid-area: mast;
    align-self: start;
  }

  .site-nav {
    grid-area: nav;
    justify-self: end;
    margin-top: -30px;
  }

  .slug {
    grid-area: slug;
    grid-template-columns: repeat(5, auto);
    align-self: end;
  }

  .slug .cell {
    padding: 8px 24px 6px 20px;
  }

  .table {
    grid-area: table;
    grid-template-columns: minmax(0, 1fr) minmax(0, 744px);
    grid-template-areas:
      "cards cards"
      "ask controls";
    column-gap: 36px;
  }

  .cards {
    grid-area: cards;
  }

  .ask {
    grid-area: ask;
  }

  .controls {
    grid-area: controls;
  }

  .foot {
    grid-area: foot;
  }

  .doc {
    grid-area: table;
    margin: 40px 0 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card-inner,
  .tab::before,
  .faq summary::after {
    transition: none;
  }

  .ink-settle {
    animation: none;
  }
}

/* Dark mode, component layer. It sits last so it wins over the component
   rules above. The tokens are remapped in the dark block under Tokens. */
@media (prefers-color-scheme: dark) {
  /* The live card is black on a black flood, so its edge is printed in stock */
  :root:not([data-theme="light"]) .slot.is-live .front {
    box-shadow: 0 0 0 1px rgba(243, 241, 236, 0.55);
  }

  /* The legend names the black plate, which is now the flood itself */
  :root:not([data-theme="light"]) .plates .k100 {
    background: #111111;
    outline: 1px solid var(--hair);
  }

  /* Type on a red or cyan fill prints in the flood colour */
  :root:not([data-theme="light"]) .tab-lo,
  :root:not([data-theme="light"]) .aces .chip,
  :root:not([data-theme="light"]) .chip-btn:hover {
    color: var(--stock);
  }
}

/* The same rules when the visitor picks Dark with the theme button */
/* The live card is black on a black flood, so its edge is printed in stock */
:root[data-theme="dark"] .slot.is-live .front {
  box-shadow: 0 0 0 1px rgba(243, 241, 236, 0.55);
}

/* The legend names the black plate, which is now the flood itself */
:root[data-theme="dark"] .plates .k100 {
  background: #111111;
  outline: 1px solid var(--hair);
}

/* Type on a red or cyan fill prints in the flood colour */
:root[data-theme="dark"] .tab-lo,
:root[data-theme="dark"] .aces .chip,
:root[data-theme="dark"] .chip-btn:hover {
  color: var(--stock);
}
