:root {
  --ink: #2b2723;
  --cream: #f3ead6;
  --white: #fbf6e9;
  --red: #d9482e;
  --red-dark: #8f2e1c;
  --blue: #2f80b7;
  --yellow: #e5a92d;
  --kraft: #c9a878;
  --shadow: rgba(45, 28, 10, 0.3);
  --heavy: "Arial Black", "Avenir Next Heavy", "Segoe UI Black", Impact, "Helvetica Neue", Arial, sans-serif;
  --hand: "Marker Felt", "Chalkboard SE", "Comic Sans MS", "Segoe Print", "Bradley Hand", cursive;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--kraft);
  color: var(--ink);
  font-family: var(--hand);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

[hidden] {
  display: none !important;
}

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

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

/* the little round buttons that sit on the table: pause and sound */
.chip {
  position: fixed;
  left: 8px;
  top: 8px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 2px 3px 0 var(--shadow);
  font-family: var(--heavy);
  font-size: 16px;
  line-height: 1;
}

.chip:active {
  transform: translate(1px, 2px);
  box-shadow: 1px 1px 0 var(--shadow);
}

/* a sheet of paper taped to the middle of the table */
.card {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(92vw, 440px);
  max-height: 94vh;
  padding: 26px 16px 18px;
  transform: translate(-50%, -50%) rotate(-1.1deg);
  background: var(--cream);
  box-shadow: 5px 9px 0 var(--shadow);
  text-align: center;
}

.card::before,
.card::after {
  content: "";
  position: absolute;
  top: -11px;
  width: 84px;
  height: 24px;
  background: rgba(238, 222, 170, 0.86);
  box-shadow: 1px 2px 0 rgba(60, 40, 10, 0.18);
}

.card::before {
  left: 14px;
  transform: rotate(-7deg);
}

.card::after {
  right: 14px;
  transform: rotate(5deg);
}

.logo {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin: 2px 0 12px;
  font-family: var(--heavy);
  font-weight: 900;
  font-size: clamp(20px, 7vw, 46px);
  line-height: 1;
}

.logo.small {
  font-size: clamp(20px, 7vw, 40px);
}

.logo span {
  display: inline-block;
  padding: 0.16em 0.15em 0.1em;
  background: var(--white);
  box-shadow: 2px 3px 0 var(--shadow);
}

.logo .gap {
  width: 0.2em;
  padding: 0;
  background: none;
  box-shadow: none;
}

.logo span:nth-child(odd) {
  transform: rotate(-4deg) translateY(2px);
}

.logo span:nth-child(even) {
  transform: rotate(3deg) translateY(-2px);
}

.logo span:nth-child(3n + 1) {
  background: var(--red);
  color: var(--white);
}

.logo span:nth-child(4n + 2) {
  background: var(--ink);
  color: var(--white);
}

.logo span:nth-child(5n + 3) {
  background: var(--yellow);
  color: var(--ink);
}

.logo span:nth-child(7n) {
  background: var(--blue);
  color: var(--white);
}

.tag {
  margin: 0 0 14px;
  font-size: clamp(16px, 4.6vw, 20px);
  line-height: 1.35;
}

.row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 14px;
}

.big {
  min-width: 132px;
  min-height: 50px;
  padding: 10px 18px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: var(--red);
  color: var(--white);
  box-shadow: 3px 5px 0 var(--ink);
  font-family: var(--heavy);
  font-size: 19px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transform: rotate(-1.5deg);
}

.big.alt {
  background: var(--white);
  color: var(--ink);
  transform: rotate(1.2deg);
}

.big:active {
  transform: translate(2px, 3px);
  box-shadow: 1px 2px 0 var(--ink);
}

.how {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  font-size: 15px;
  line-height: 1.5;
}

.keys {
  margin: 0 0 8px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(43, 39, 35, 0.75);
}

.for-touch {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .for-keys {
    display: none;
  }

  .for-touch {
    display: block;
  }
}

.best {
  margin: 0;
  font-size: 16px;
}

.best b,
.score {
  font-family: var(--heavy);
  font-variant-numeric: tabular-nums;
}

.kind {
  margin: 0;
  font-size: 15px;
  color: var(--red-dark);
}

.score {
  margin: 2px 0 6px;
  font-size: clamp(40px, 13vw, 60px);
  line-height: 1.05;
}

.line {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.35;
}

.stats {
  margin: 0 0 14px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  color: rgba(43, 39, 35, 0.75);
}

.plain {
  margin: 0 0 16px;
  font-family: var(--heavy);
  font-size: 30px;
}

.link {
  padding: 6px 10px;
  border: 0;
  background: none;
  font-size: 15px;
  text-decoration: underline;
}

/* short windows (a phone on its side): keep the card inside the screen */
@media (max-height: 460px) {
  .card {
    padding: 18px 16px 12px;
  }

  .how,
  .keys {
    display: none !important;
  }

  .logo {
    margin-bottom: 8px;
    font-size: 30px;
  }

  .tag {
    margin-bottom: 10px;
    font-size: 15px;
  }

  .score {
    font-size: 36px;
  }

  .big {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .big:active,
  .chip:active {
    transform: none;
  }
}
