:root {
  color-scheme: dark;
  --ink: #2a180f;
  --ink-soft: #5a3927;
  --paper: #e8c98c;
  --paper-light: #f6e5b7;
  --paper-dark: #bd8b49;
  --gold: #d59b2d;
  --gold-light: #f3cc67;
  --rust: #8f301d;
  --rust-dark: #5e1f16;
  --wood: #3a1d12;
  --cream: #fff0c7;
  --success: #4c7a44;
  --danger: #a73625;
  --shadow: rgba(15, 7, 3, 0.55);
  --font-western: Rockwell, "Roboto Slab", "Courier New", serif;
  --font-body: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #1d0e09;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    linear-gradient(rgba(19, 8, 4, 0.2), rgba(19, 8, 4, 0.82)),
    repeating-linear-gradient(
      90deg,
      #4a2818 0,
      #4a2818 4px,
      #3b1e12 5px,
      #5b321f 10px,
      #3a1d12 12px,
      #3a1d12 62px
    );
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at center, transparent 30%, rgba(18, 7, 2, 0.72) 125%),
    repeating-linear-gradient(3deg, transparent 0 7px, rgba(255, 224, 166, 0.025) 8px 9px);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold-light);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.atmosphere {
  position: fixed;
  z-index: 0;
  inset: 0 0 auto;
  height: 47vh;
  min-height: 340px;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(116, 33, 22, 0.92), rgba(211, 104, 42, 0.76) 52%, rgba(222, 157, 75, 0.1)),
    radial-gradient(ellipse at 50% 100%, #df9d54 0, transparent 67%);
  opacity: 0.72;
}

.atmosphere::after {
  position: absolute;
  inset: auto 0 0;
  height: 44%;
  content: "";
  background:
    linear-gradient(165deg, transparent 0 29%, #32180f 30% 48%, transparent 49%) 0 100% / 48% 100% no-repeat,
    linear-gradient(195deg, transparent 0 30%, #2a140d 31% 53%, transparent 54%) 100% 100% / 52% 100% no-repeat;
  opacity: 0.76;
}

.sun {
  position: absolute;
  top: 76px;
  left: 50%;
  width: 150px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f6bd56;
  box-shadow: 0 0 50px #f6aa43, 0 0 110px rgba(255, 193, 89, 0.7);
  transform: translateX(-50%);
}

.mesa {
  position: absolute;
  bottom: 12%;
  width: 34%;
  height: 28%;
  border-radius: 60% 30% 0 0;
  background: #4d2215;
  opacity: 0.8;
}

.mesa-left {
  left: -8%;
  transform: skewX(-20deg);
}

.mesa-right {
  right: -10%;
  transform: skewX(18deg);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1460px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(76px, 10vh, 116px) 0 72px;
}

.poster {
  position: relative;
  color: var(--ink);
  border: 1px solid #8b5b30;
  border-radius: 5px 9px 4px 7px;
  background:
    radial-gradient(circle at 10% 8%, rgba(105, 62, 29, 0.13) 0 1px, transparent 2px),
    radial-gradient(circle at 86% 78%, rgba(105, 62, 29, 0.09) 0 1px, transparent 2px),
    linear-gradient(105deg, rgba(255, 244, 201, 0.8), rgba(226, 190, 125, 0.92)),
    var(--paper);
  background-size: 23px 25px, 31px 29px, auto, auto;
  box-shadow:
    0 22px 55px var(--shadow),
    inset 0 0 45px rgba(99, 54, 23, 0.24),
    inset 0 0 0 4px rgba(109, 67, 33, 0.16);
}

.poster::after {
  position: absolute;
  z-index: 0;
  inset: 9px;
  border: 1px solid rgba(90, 48, 22, 0.35);
  border-radius: 2px;
  pointer-events: none;
  content: "";
}

.poster > * {
  position: relative;
  z-index: 1;
}

.selection-screen {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: clamp(34px, 6vw, 68px);
}

.selection-header {
  max-width: 760px;
  margin: 0 auto 34px;
  text-align: center;
}

.brand-seal {
  display: grid;
  width: 72px;
  aspect-ratio: 1;
  margin: -4px auto 17px;
  place-items: center;
  color: var(--paper-light);
  border: 4px double #d8a643;
  border-radius: 50%;
  background: var(--rust-dark);
  box-shadow: 0 3px 0 #4d1a12, 0 8px 18px rgba(58, 25, 12, 0.35);
  font-family: var(--font-western);
  font-size: 34px;
  transform: rotate(-4deg);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--rust-dark);
  font-family: var(--font-western);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  line-height: 1.4;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: var(--font-western);
  text-transform: uppercase;
}

.selection-header h1 {
  margin: 0;
  font-size: clamp(2.8rem, 8vw, 6.4rem);
  line-height: 0.9;
  letter-spacing: -0.045em;
  text-shadow: 2px 2px 0 rgba(255, 237, 183, 0.68), 4px 4px 0 rgba(102, 57, 26, 0.16);
}

.ornament {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(420px, 80%);
  margin: 22px auto 17px;
  color: var(--rust);
}

.ornament::before,
.ornament::after {
  flex: 1;
  height: 2px;
  content: "";
  background: linear-gradient(to right, transparent, var(--rust));
}

.ornament::after {
  background: linear-gradient(to left, transparent, var(--rust));
}

.intro-copy {
  max-width: 600px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-style: italic;
  line-height: 1.65;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.group-card {
  position: relative;
  display: flex;
  min-height: 178px;
  padding: 20px;
  overflow: hidden;
  flex-direction: column;
  align-items: flex-start;
  color: var(--ink);
  border: 2px solid rgba(78, 42, 20, 0.66);
  border-radius: 4px;
  background:
    linear-gradient(145deg, rgba(255, 247, 211, 0.52), rgba(177, 121, 62, 0.2)),
    rgba(239, 211, 157, 0.62);
  box-shadow: inset 0 0 0 3px rgba(255, 237, 188, 0.28), 0 5px 0 rgba(93, 52, 25, 0.28);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.group-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  content: "";
  background: var(--group-color, var(--rust));
}

.group-card:not(:disabled):hover {
  background:
    linear-gradient(145deg, rgba(255, 250, 222, 0.72), rgba(194, 135, 68, 0.26)),
    rgba(243, 218, 168, 0.8);
  box-shadow: inset 0 0 0 3px rgba(255, 237, 188, 0.4), 0 9px 0 rgba(93, 52, 25, 0.31);
  transform: translateY(-4px) rotate(-0.4deg);
}

.group-card:disabled {
  cursor: not-allowed;
  filter: grayscale(0.65) sepia(0.25);
  opacity: 0.62;
}

.group-card-top {
  display: flex;
  width: 100%;
  align-items: flex-start;
  justify-content: space-between;
}

.group-number {
  color: var(--ink-soft);
  font-family: var(--font-western);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.group-symbol {
  color: var(--group-color, var(--rust));
  font-size: 1.5rem;
  line-height: 1;
}

.group-name {
  margin: auto 0 12px;
  font-family: var(--font-western);
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  line-height: 1;
  text-transform: uppercase;
}

.group-status {
  padding: 5px 9px;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-family: var(--font-western);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.group-status.is-free {
  color: #345a31;
  background: rgba(70, 113, 63, 0.11);
}

.group-status.is-taken {
  color: var(--rust-dark);
  background: rgba(126, 39, 27, 0.12);
}

.group-sheriffs { --group-color: #9a6a18; }
.group-bandieten { --group-color: #7b211b; }
.group-mijnwerkers { --group-color: #5c6260; }
.group-indianen { --group-color: #a04b24; }
.group-cowboys { --group-color: #3f5f61; }
.group-goudzoekers { --group-color: #bc7c0f; }

.selection-footer {
  display: flex;
  margin: 30px 0 -8px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-style: italic;
  text-align: center;
}

.selection-footer span {
  color: var(--rust);
}

.loading-message {
  display: flex;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--ink-soft);
  font-style: italic;
}

.spinner {
  width: 24px;
  aspect-ratio: 1;
  border: 3px solid rgba(89, 49, 25, 0.22);
  border-top-color: var(--rust);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.connection-status {
  position: fixed;
  z-index: 20;
  top: 16px;
  right: 18px;
  display: flex;
  padding: 9px 13px;
  align-items: center;
  gap: 8px;
  color: #fff0c7;
  border: 1px solid rgba(255, 232, 181, 0.22);
  border-radius: 999px;
  background: rgba(31, 15, 9, 0.86);
  box-shadow: 0 6px 20px rgba(20, 8, 3, 0.26);
  backdrop-filter: blur(8px);
  font-family: var(--font-western);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.connection-dot {
  width: 9px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #d9a63b;
  box-shadow: 0 0 0 4px rgba(217, 166, 59, 0.16);
}

.connection-status[data-state="online"] .connection-dot {
  background: #75bb65;
  box-shadow: 0 0 0 4px rgba(117, 187, 101, 0.16);
}

.connection-status[data-state="offline"] .connection-dot {
  background: #d35c47;
  box-shadow: 0 0 0 4px rgba(211, 92, 71, 0.16);
}

.game-screen {
  width: 100%;
}

.game-header {
  display: flex;
  margin-bottom: 22px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--cream);
}

.game-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.game-brand .eyebrow {
  color: var(--gold-light);
}

.game-brand h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3.6rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
  text-shadow: 3px 3px 0 #4c1c11;
}

.mini-star {
  display: grid;
  width: 56px;
  aspect-ratio: 1;
  place-items: center;
  color: #2d170e;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: inset 0 0 0 4px #7c4b1e, 0 5px 0 #4d2514;
  font-size: 1.8rem;
}

.active-group {
  display: grid;
  min-width: 225px;
  padding: 11px 16px;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 10px;
  color: var(--cream);
  border: 1px solid color-mix(in srgb, var(--group-color) 70%, #f5d88e);
  border-radius: 4px;
  background: rgba(29, 13, 8, 0.88);
  box-shadow: inset 5px 0 0 var(--group-color), 0 7px 20px rgba(20, 7, 3, 0.34);
}

.active-group-symbol {
  grid-row: span 2;
  color: color-mix(in srgb, var(--group-color) 55%, #ffe29a);
  font-size: 1.8rem;
}

.active-group-label {
  color: #c9a871;
  font-family: var(--font-western);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.active-group-name {
  font-family: var(--font-western);
  font-size: 1rem;
  text-transform: uppercase;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  align-items: start;
  gap: 22px;
}

.board-panel {
  min-width: 0;
  padding: clamp(22px, 3.5vw, 44px);
}

.board-header {
  display: flex;
  margin-bottom: 17px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.board-header h2,
.score-header h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  line-height: 1;
}

.board-progress {
  margin: 0;
  padding: 8px 11px;
  color: var(--rust-dark);
  border: 1px solid rgba(100, 54, 27, 0.36);
  background: rgba(126, 70, 31, 0.07);
  font-family: var(--font-western);
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.bingo-word {
  display: none;
  margin-bottom: 10px;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.bingo-word span {
  padding: 7px;
  color: var(--paper-light);
  border: 2px solid #4f2116;
  background: var(--rust-dark);
  box-shadow: inset 0 0 0 2px rgba(255, 216, 146, 0.15), 0 3px 0 rgba(64, 29, 15, 0.33);
  font-family: var(--font-western);
  font-size: clamp(1.1rem, 2.5vw, 1.8rem);
  font-weight: 900;
  text-align: center;
}

.bingo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.bingo-cell {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 196px;
  padding: 13px;
  overflow: hidden;
  flex-direction: column;
  align-items: stretch;
  color: var(--ink);
  border: 1px solid #855a33;
  border-radius: 2px;
  background:
    linear-gradient(155deg, rgba(255, 251, 226, 0.72), rgba(201, 153, 87, 0.17)),
    #f1d69f;
  box-shadow: inset 0 0 0 2px rgba(255, 245, 208, 0.42), 0 3px 0 rgba(93, 54, 27, 0.28);
  cursor: pointer;
  text-align: left;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.bingo-cell:not(:disabled):hover {
  z-index: 2;
  background: #f8e5b9;
  box-shadow: inset 0 0 0 2px rgba(255, 245, 208, 0.6), 0 7px 0 rgba(93, 54, 27, 0.29);
  transform: translateY(-3px);
}

.cell-top {
  display: flex;
  margin-bottom: 13px;
  align-items: center;
  justify-content: space-between;
}

.cell-code {
  display: inline-grid;
  min-width: 36px;
  height: 27px;
  padding: 0 6px;
  place-items: center;
  color: var(--cream);
  border-radius: 2px;
  background: var(--ink);
  font-family: var(--font-western);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.cell-mark {
  color: var(--rust);
  font-size: 1.15rem;
}

.cell-title {
  display: block;
  margin-bottom: 7px;
  font-family: var(--font-western);
  font-size: 0.94rem;
  hyphens: auto;
  line-height: 1.08;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.cell-description {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.77rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.cell-action {
  margin-top: auto;
  padding-top: 10px;
  color: var(--rust-dark);
  border-top: 1px dashed rgba(91, 51, 28, 0.35);
  font-family: var(--font-western);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.bingo-cell.is-claimed {
  color: #fff0c9;
  border-color: color-mix(in srgb, var(--group-color) 62%, #231108);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--group-color) 78%, #1d0e08), #2b150e),
    var(--group-color);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--group-color) 38%, #e8ca8b), 0 3px 0 rgba(60, 27, 13, 0.4);
  cursor: default;
  opacity: 1;
}

.bingo-cell.is-claimed .cell-code {
  color: #2b160d;
  background: #efd594;
}

.bingo-cell.is-claimed .cell-mark,
.bingo-cell.is-claimed .cell-description {
  color: #f0d7a5;
}

.cell-claim {
  display: grid;
  margin-top: auto;
  padding-top: 9px;
  grid-template-columns: 1fr auto;
  align-items: end;
  border-top: 1px solid rgba(255, 236, 191, 0.26);
}

.claim-label {
  grid-column: 1 / -1;
  color: #d9bd84;
  font-family: var(--font-western);
  font-size: 0.56rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.claim-group {
  overflow: hidden;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.claim-time {
  color: #d9bd84;
  font-size: 0.64rem;
}

.scoreboard {
  position: sticky;
  top: 74px;
  padding: 32px 26px 24px;
}

.score-header {
  margin-bottom: 21px;
  text-align: center;
}

.score-star {
  display: block;
  margin-bottom: 5px;
  color: var(--rust);
  font-size: 1.8rem;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
}

.score-table thead th {
  padding: 0 5px 8px;
  color: var(--ink-soft);
  border-bottom: 2px solid rgba(77, 40, 19, 0.55);
  font-family: var(--font-western);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.score-table thead th:first-child,
.score-table thead th:last-child {
  text-align: center;
}

.score-row {
  border-bottom: 1px dashed rgba(93, 52, 25, 0.32);
}

.score-row.is-active {
  background: color-mix(in srgb, var(--group-color) 11%, transparent);
  box-shadow: inset 4px 0 0 var(--group-color);
}

.score-row td,
.score-row th {
  padding: 12px 5px;
}

.score-position {
  width: 42px;
  text-align: center;
}

.position-badge {
  display: inline-grid;
  width: 27px;
  aspect-ratio: 1;
  place-items: center;
  color: var(--cream);
  border-radius: 50%;
  background: var(--ink-soft);
  font-family: var(--font-western);
  font-size: 0.71rem;
}

.score-row:first-child .position-badge {
  color: #2b180f;
  background: var(--gold-light);
  box-shadow: 0 0 0 3px rgba(190, 126, 20, 0.18);
}

.score-group {
  text-align: left;
}

.score-symbol {
  margin-right: 7px;
  color: var(--group-color);
}

.score-name {
  font-size: 0.9rem;
}

.score-points {
  width: 58px;
  text-align: center;
}

.points-number {
  display: block;
  font-family: var(--font-western);
  font-size: 1.1rem;
}

.points-label {
  display: block;
  color: var(--ink-soft);
  font-size: 0.58rem;
}

.admin-panel {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 2px solid rgba(77, 40, 19, 0.38);
  text-align: center;
}

.admin-panel p {
  margin: 0 0 6px;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-style: italic;
}

.text-button {
  padding: 6px;
  color: var(--rust-dark);
  border: 0;
  border-bottom: 1px dashed currentColor;
  background: none;
  cursor: pointer;
  font-family: var(--font-western);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.text-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.western-dialog {
  width: min(520px, calc(100% - 28px));
  padding: 0;
  color: var(--ink);
  border: 2px solid #6d3a20;
  border-radius: 5px;
  background:
    radial-gradient(circle at 20% 20%, rgba(99, 53, 23, 0.1) 0 1px, transparent 2px) 0 0 / 23px 23px,
    var(--paper-light);
  box-shadow: 0 28px 90px rgba(20, 7, 2, 0.7), inset 0 0 50px rgba(116, 65, 29, 0.18);
}

.western-dialog::backdrop {
  background: rgba(22, 8, 3, 0.76);
  backdrop-filter: blur(4px);
}

.western-dialog form {
  padding: clamp(28px, 6vw, 46px);
  text-align: center;
}

.western-dialog h2 {
  margin: 0 0 13px;
  font-size: clamp(1.5rem, 5vw, 2.2rem);
}

.dialog-icon {
  display: grid;
  width: 54px;
  aspect-ratio: 1;
  margin: 0 auto 14px;
  place-items: center;
  color: var(--cream);
  border: 4px double var(--gold-light);
  border-radius: 50%;
  background: var(--rust-dark);
  font-family: var(--font-western);
  font-size: 1.5rem;
  font-weight: 900;
}

.dialog-icon-alert {
  background: var(--danger);
}

.dialog-copy {
  margin: 0 0 24px;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.55;
}

.dialog-actions {
  display: flex;
  margin-top: 25px;
  justify-content: center;
  gap: 10px;
}

.button {
  min-height: 48px;
  padding: 11px 18px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  box-shadow: 0 4px 0 rgba(49, 24, 12, 0.35);
  cursor: pointer;
  font-family: var(--font-western);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.button-primary,
.button-danger {
  color: var(--cream);
  background: var(--rust-dark);
}

.button-danger {
  background: var(--danger);
}

.button-ghost {
  color: var(--ink);
  background: transparent;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  font-family: var(--font-western);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.code-input {
  width: 100%;
  min-height: 50px;
  padding: 10px 12px;
  color: var(--ink);
  border: 2px solid #764527;
  border-radius: 2px;
  background: rgba(255, 250, 223, 0.72);
  font-family: var(--font-western);
  font-size: 1rem;
}

.toast {
  position: fixed;
  z-index: 30;
  right: 18px;
  bottom: 18px;
  width: min(430px, calc(100% - 36px));
  padding: 15px 18px 15px 48px;
  color: #ffebc3;
  border: 1px solid #de826d;
  border-radius: 4px;
  background: #652319;
  box-shadow: 0 13px 40px rgba(17, 6, 2, 0.5);
  font-weight: 700;
  line-height: 1.4;
  animation: toast-in 220ms ease-out;
}

.toast::before {
  position: absolute;
  top: 50%;
  left: 18px;
  content: "!";
  font-family: var(--font-western);
  font-size: 1.2rem;
  transform: translateY(-50%);
}

.toast[data-kind="success"] {
  border-color: #9ac58e;
  background: #355b31;
}

.toast[data-kind="success"]::before {
  content: "★";
}

.noscript-message {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  color: var(--ink);
  background: var(--paper-light);
  font-family: var(--font-western);
  text-align: center;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
}

@media (max-width: 1180px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 310px;
  }

  .bingo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bingo-word {
    display: none;
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 22px, 720px);
    padding-top: 76px;
  }

  .group-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-header {
    align-items: stretch;
    flex-direction: column;
  }

  .active-group {
    min-width: 0;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .scoreboard {
    position: static;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 14px, 520px);
    padding-bottom: 36px;
  }

  .connection-status {
    top: 9px;
    right: 9px;
    max-width: calc(100% - 18px);
  }

  .selection-screen {
    padding: 35px 17px 29px;
  }

  .brand-seal {
    width: 58px;
    font-size: 27px;
  }

  .selection-header h1 {
    font-size: clamp(2.55rem, 16vw, 4rem);
  }

  .group-grid {
    grid-template-columns: 1fr;
  }

  .group-card {
    min-height: 126px;
  }

  .selection-footer {
    align-items: flex-start;
  }

  .mini-star {
    width: 45px;
    font-size: 1.4rem;
  }

  .board-panel {
    padding: 22px 13px;
  }

  .board-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .bingo-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .bingo-cell {
    min-height: 180px;
    padding: 7px 6px;
    text-align: center;
  }

  .cell-top {
    margin-bottom: 9px;
  }

  .cell-code {
    min-width: 28px;
    height: 23px;
    padding: 0 3px;
    font-size: 0.6rem;
  }

  .cell-mark {
    font-size: 0.8rem;
  }

  .cell-title {
    display: flex;
    width: 100%;
    flex: 1;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    line-height: 1.15;
  }

  .cell-description {
    font-size: 0.55rem;
  }

  .cell-action {
    width: 100%;
    padding-top: 7px;
    font-size: 0.5rem;
    letter-spacing: 0.02em;
    text-align: center;
  }

  .claim-group {
    font-size: 0.55rem;
    white-space: normal;
  }

  .claim-time {
    font-size: 0.48rem;
  }

  .scoreboard {
    padding-inline: 16px;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .button {
    width: 100%;
  }

  .toast {
    right: 9px;
    bottom: 9px;
    width: calc(100% - 18px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
