:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #17372d;
  background: #123b31;
  --cream: #fff8e7;
  --green: #173c31;
  --berry: #8d2539;
  --gold: #ecc481;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 5%, #2c5a47 0, transparent 65%),
    repeating-linear-gradient(135deg, #ffffff08 0 1px, transparent 1px 12px);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid #d17628;
  outline-offset: 3px;
}
[hidden] { display: none !important; }
.shell { width: min(100%, 56rem); margin: auto; padding: 1.6rem 1rem 1rem; }
.masthead { text-align: center; color: var(--cream); margin-bottom: 1.6rem; }
.title-decoration {
  margin: 0 auto 1rem;
  width: 8.5rem;
  height: 0.55rem;
  border-block: 1px solid #ecc48183;
  background: repeating-linear-gradient(90deg, transparent 0 6px, var(--gold) 6px 14px, transparent 14px 20px) center / 100% 3px no-repeat;
}
h1, h2, p { margin: 0; }
h1 {
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: clamp(2.55rem, 7.6vw, 4.7rem);
  letter-spacing: -.055em;
  line-height: .98;
  text-wrap: balance;
}
h1 span { color: var(--gold); }
.masthead p { margin: .8rem 0 0; color: #f4ebd4; line-height: 1.45; }
.ticket {
  padding: clamp(.65rem, 3vw, 1.35rem);
  background: var(--cream);
  border-radius: 1.15rem;
  border: 1px solid #f1dcb8;
  box-shadow: 0 18px 48px #041e14a3;
}
.ticket-top, .ticket-bottom, .card-control, .card-picker, .dialog-heading {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.ticket-top, .ticket-bottom, .dialog-heading { justify-content: space-between; }
.ticket-top { flex-wrap: wrap; padding: .2rem 0 .8rem; }
.card-control h2 { font-size: .95rem; font-weight: 800; }
.card-picker { gap: .25rem; }
.card-picker button, .invite-button, .quiet-button, .close, #individual-links button {
  border: 1px solid #d8c5a3;
  border-radius: .45rem;
  min-height: 44px;
  background: transparent;
  color: var(--green);
  font-weight: 700;
}
.card-picker button { min-width: 34px; padding: .3rem .5rem; }
.card-picker button[aria-pressed="true"] { background: var(--green); color: #fff8e7; border-color: var(--green); }
.invite-button { padding: .45rem .75rem; background: var(--berry); color: white; border-color: var(--berry); font-size: .9rem; }
.letters, .board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(.19rem, 1vw, .45rem); }
.letters { margin-bottom: .35rem; text-align: center; }
.letters span {
  background: var(--green);
  color: var(--gold);
  border-radius: .35rem;
  padding: .25rem 0;
  font: bold clamp(1rem, 4vw, 1.45rem) Georgia, serif;
}
.cell {
  display: flex;
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .24rem;
  padding: clamp(.2rem, .9vw, .55rem);
  min-height: clamp(5.8rem, 13vw, 6.65rem);
  border-radius: .42rem;
  border: 1px solid #e1cfb0;
  background: #fffdf4;
  color: var(--green);
  line-height: 1.17;
  font-size: clamp(.76rem, 2.8vw, .96rem);
  font-weight: 650;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}
.cell-icon { font-size: clamp(.95rem, 4vw, 1.35rem); line-height: 1.15; }
.cell[aria-pressed="true"] { background: #f1d7dc; color: #6a172a; border-color: #b7707c; }
.cell[aria-pressed="true"]::after {
  content: '✓';
  color: white;
  background: var(--berry);
  position: absolute;
  top: 2px;
  right: 2px;
  width: .95rem;
  height: .95rem;
  line-height: .95rem;
  font-size: .66rem;
  border-radius: 50%;
}
.cell.free { background: #e4eddf; color: var(--green); font-weight: 800; border-color: #a3ba9e; }
.cell.free::after { background: var(--green); }
.cell.winner { background: #ffe6a4; color: #522c11; border-color: #966327; box-shadow: inset 0 0 0 1px #966327; }
.message { margin-top: .7rem; border: 1px solid #bd8944; border-radius: .5rem; background: #ffe6a4; padding: .6rem; text-align: center; font-weight: 800; }
.ticket-bottom { margin-top: .55rem; }
#progress { font-size: .9rem; font-weight: 650; }
.quiet-button { padding: .4rem .65rem; font-size: .875rem; }
footer { text-align: center; margin: 1.15rem 0 .25rem; color: #eee2c7; font-size: .85rem; }
footer a { color: var(--gold); text-underline-offset: .18em; }
dialog {
  width: min(92vw, 28rem);
  padding: 1.15rem;
  border-radius: .95rem;
  border: 1px solid #f1dcb8;
  color: var(--green);
  background: var(--cream);
  box-shadow: 0 18px 48px #041e14aa;
}
dialog::backdrop { background: #061d16b0; }
dialog p { line-height: 1.45; margin: .6rem 0 1rem; }
.close { min-width: 44px; padding: 0; font-size: 1.35rem; }
.primary-button {
  width: 100%;
  padding: .7rem 1rem;
  min-height: 44px;
  border: 0;
  border-radius: .5rem;
  background: var(--berry);
  color: white;
  font-weight: 750;
}
#individual-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; margin-top: .65rem; }
#individual-links button { font-size: .9rem; }
#manual-link { width: 100%; margin-top: .65rem; padding: .6rem; }
#share-status { margin: .65rem 0 0; font-size: .9rem; }
#share-status:empty { margin: 0; }
@media (max-width: 400px) {
  .shell { padding-inline: .45rem; }
  .ticket { padding-inline: .4rem; }
  .card-control { gap: .32rem; }
  .invite-button { padding-inline: .5rem; }
}
@media (hover: hover) {
  .cell:not(.free):hover { border-color: var(--berry); }
  .invite-button:hover, .primary-button:hover { background: #711c2c; }
}
