* {
  box-sizing: border-box;
}
:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #172e2b;
  background: #f4f2e9;
  font-synthesis: none;
}
body {
  margin: 0;
}
button,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
button:focus-visible,
a:focus-visible,
textarea:focus-visible {
  outline: 3px solid #d75b38;
  outline-offset: 3px;
}
main {
  max-width: 660px;
  margin: auto;
  padding: 28px 24px 22px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #b8c0ae;
  padding-bottom: 19px;
}
.wordmark {
  font-weight: 900;
  font-size: 17px;
  letter-spacing: -0.6px;
  text-decoration: none;
  color: inherit;
}
.edition,
.eyebrow,
.ticket-top span,
.ticket-bottom,
.save-note,
footer {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.8px;
}
.edition {
  font-size: 10px;
}
.intro {
  margin: 34px 0 26px;
}
.eyebrow {
  font-weight: 700;
  color: #476354;
  margin: 0 0 12px;
}
h1 {
  font-size: clamp(40px, 9vw, 67px);
  line-height: 0.98;
  letter-spacing: -3px;
  margin: 0 0 17px;
  font-weight: 900;
}
.intro > p:last-child {
  font-size: 15px;
  line-height: 1.5;
  max-width: 410px;
  margin: 0;
  color: #42594e;
  min-height: 45px;
}
.ticket {
  background: #fffef7;
  border: 2px solid #172e2b;
  box-shadow: 5px 5px 0 #d1d9c5;
}
.ticket-top {
  padding: 15px 17px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #172e2b;
}
.ticket-top strong {
  font-size: 18px;
  letter-spacing: -0.7px;
}
.letters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: #172e2b;
  color: #d4ef77;
  font-weight: 800;
  font-size: 22px;
  text-align: center;
  padding: 7px 0;
}
.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: #8c9c86;
  border-bottom: 1px solid #8c9c86;
}
.cell {
  position: relative;
  aspect-ratio: 1;
  background: #fffef7;
  min-width: 0;
}
.cell textarea,
.cell button {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  margin: 0;
  display: block;
  background: transparent;
  color: #172e2b;
  padding: 18px 7px 5px;
  text-align: center;
  font-size: clamp(11px, 2.5vw, 15px);
  line-height: 1.2;
  overflow-wrap: anywhere;
  font-weight: 600;
  resize: none;
}
.cell textarea {
  font-weight: 500;
}
.cell textarea::placeholder {
  color: #778671;
  font-size: 11px;
}
.cell-number {
  position: absolute;
  top: 4px;
  left: 6px;
  pointer-events: none;
  font:
    9px ui-monospace,
    monospace;
  color: #6d7f65;
}
.cell button {
  padding: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cell button:disabled {
  opacity: 1;
  color: #8b9483;
}
.cell.marked {
  background: #d4ef77;
}
.cell.winning {
  background: #172e2b;
}
.cell.winning button,
.cell.winning .cell-number {
  color: #d4ef77;
}
.cell.free {
  background: #e8ecd9;
}
.free-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font:
    10px ui-monospace,
    monospace;
  font-weight: 700;
}
.free-inner span {
  font-size: 32px;
  line-height: 1;
}
.cell.free.winning {
  background: #172e2b;
  color: #d4ef77;
}
.ticket-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 16px;
  min-height: 40px;
  font-size: 9px;
  letter-spacing: 1.4px;
}
.stamp {
  font-size: 22px;
  line-height: 1;
}
.actions {
  display: flex;
  gap: 10px;
  margin-top: 5px;
}
.actions button {
  min-height: 49px;
  border: 2px solid #172e2b;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 22px;
}
.primary {
  background: #172e2b;
  color: #f8faed;
  border: 2px solid #172e2b;
  font-weight: 700;
}
.actions .primary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.secondary {
  background: transparent;
  border: 1px solid #172e2b;
  color: #172e2b;
}
.result {
  min-height: 36px;
  text-align: center;
  font-weight: 700;
  padding: 12px 0 5px;
  font-size: 14px;
}
.result.bingo {
  font-size: 25px;
  letter-spacing: -0.5px;
}
.utility {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 20px;
}
.utility button {
  border: 0;
  background: transparent;
  color: #42594e;
  font-size: 12px;
  padding: 7px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 35px;
}
.save-note {
  text-align: center;
  color: #52684e;
  font-size: 10px;
  letter-spacing: 0;
  margin-top: 8px;
}
footer {
  border-top: 1px solid #b8c0ae;
  margin-top: 32px;
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  letter-spacing: 0.6px;
  gap: 16px;
}
dialog {
  max-width: 380px;
  width: calc(100% - 32px);
  padding: 24px;
  background: #fffef7;
  border: 2px solid #172e2b;
  color: #172e2b;
}
dialog::backdrop {
  background: #172e2b88;
}
dialog h2 {
  margin-top: 0;
}
dialog p {
  line-height: 1.5;
}
.dialog-actions {
  display: flex;
  gap: 10px;
}
.dialog-actions button {
  padding: 12px;
  min-height: 44px;
}
@media (max-width: 400px) {
  main {
    padding: 19px 15px;
  }
  .intro {
    margin-top: 26px;
  }
  .edition {
    font-size: 8px;
  }
  .ticket-top {
    padding: 12px;
  }
  .cell textarea {
    padding: 16px 3px 3px;
    font-size: 12px;
  }
  .utility {
    gap: 20px;
  }
  h1 {
    letter-spacing: -2px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition: background-color 0.12s;
  }
}
@media print {
  body {
    background: white;
  }
  main {
    max-width: 680px;
    padding: 0;
  }
  .intro {
    margin: 20px 0;
  }
  .intro h1 {
    font-size: 36px;
  }
  .actions,
  .utility,
  .save-note,
  dialog,
  #result {
    display: none;
  }
  .ticket {
    box-shadow: none;
    break-inside: avoid;
  }
  .cell {
    aspect-ratio: 1;
  }
  .cell textarea,
  .cell button {
    font-size: 14px;
  }
  .letters,
  .marked,
  .winning {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  footer {
    margin-top: 20px;
  }
}

.board:has(.long) .cell {
  aspect-ratio: auto;
  min-height: 90px;
}
.cell.long button,
.cell.long textarea {
  font-size: 10px;
  line-height: 1.05;
  padding: 14px 4px 4px;
}
