:root {
  color-scheme: light;
  --ink: #13262f;
  --paper: #fff9ea;
  --paper-strong: #ffffff;
  --mint: #48b7a5;
  --mint-soft: #d6f1eb;
  --coral: #ff7f5c;
  --coral-soft: #ffe0d7;
  --yellow: #f8e36d;
  --pink: #f4cfe0;
  --blue: #6aa8ff;
  --shadow: 0 18px 45px rgba(19, 38, 47, 0.18);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(19, 38, 47, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(19, 38, 47, 0.055) 1px, transparent 1px),
    linear-gradient(135deg, #fff9ea 0%, #f5fbf8 54%, #ffe9df 100%);
  background-size: 38px 38px, 38px 38px, auto;
}

button {
  font: inherit;
}

.app-shell {
  width: min(900px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  padding: 28px 0;
}

.game-panel {
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.game-panel {
  padding: clamp(16px, 2.2vw, 28px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand-lockup {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  width: clamp(54px, 7vw, 72px);
  aspect-ratio: 1;
  flex: 0 0 auto;
  filter: drop-shadow(4px 5px 0 rgba(19, 38, 47, 0.16));
}

.eyebrow {
  margin: 0 0 3px;
  color: #6b3848;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.25rem);
  line-height: 0.92;
  letter-spacing: 0;
  text-wrap: balance;
}

.reset-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--yellow);
  padding: 0 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 5px 5px 0 var(--ink);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.reset-button:hover {
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 var(--ink);
}

.reset-button:active {
  transform: translate(5px, 5px);
  box-shadow: 0 0 0 var(--ink);
}

.status-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 16px;
}

.status-strip > div {
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  background: var(--mint-soft);
  padding: 10px 12px;
}

.status-strip > div:last-child {
  background: var(--coral-soft);
  min-width: 96px;
}

.status-label {
  display: block;
  margin-bottom: 2px;
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-strip strong {
  display: block;
  font-size: clamp(0.92rem, 2vw, 1.15rem);
  line-height: 1.2;
}

.board-wrap {
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  background: #ffffff;
  padding: clamp(8px, 1.4vw, 14px);
}

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

.board-heading {
  margin-bottom: 8px;
}

.board-heading span {
  display: grid;
  min-height: 34px;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  background: var(--pink);
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 950;
}

.tile {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--paper);
  padding: clamp(7px, 1.2vw, 13px);
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 850;
  font-size: clamp(0.62rem, 1.45vw, 1rem);
  line-height: 1.08;
  cursor: pointer;
  overflow-wrap: anywhere;
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.tile:nth-child(3n + 1) {
  background: #fff3b0;
}

.tile:nth-child(3n + 2) {
  background: #e1f5ef;
}

.tile:nth-child(3n) {
  background: #ffe1d7;
}

.tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 rgba(19, 38, 47, 0.13);
}

.tile:focus-visible,
.reset-button:focus-visible {
  outline: 4px solid var(--blue);
  outline-offset: 3px;
}

.tile.is-marked {
  color: #ffffff;
  background: var(--ink);
}

.tile.is-marked::after {
  content: "✓";
  position: absolute;
  inset: auto 8px 8px auto;
  display: grid;
  width: 30px;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--coral);
  font-size: 1rem;
  font-weight: 950;
}

.tile.is-winning {
  animation: executiveGlow 900ms ease-in-out infinite alternate;
}

.tile[data-free="true"] {
  cursor: default;
}

.bingo-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 10;
  width: min(360px, calc(100% - 32px));
  transform: translate(-50%, 140%);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  background: var(--yellow);
  padding: 13px 16px;
  box-shadow: 8px 8px 0 var(--ink);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}

.bingo-toast span {
  display: block;
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.bingo-toast strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1.1;
}

.bingo-toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.confetti-piece {
  position: fixed;
  top: -18px;
  z-index: 20;
  width: 10px;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  pointer-events: none;
  animation: fall 950ms ease-in forwards;
}

@keyframes executiveGlow {
  from {
    box-shadow: 0 0 0 0 var(--coral);
  }
  to {
    box-shadow: 0 0 0 5px var(--coral);
  }
}

@keyframes fall {
  to {
    transform: translateY(105vh) rotate(420deg);
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 18px, 560px);
    padding: 10px 0;
  }

  .topbar,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .reset-button {
    width: 100%;
  }

  .board-heading,
  .board {
    gap: 5px;
  }

  .tile {
    border-width: 2px;
    padding: 4px;
    font-size: clamp(0.5rem, 2.45vw, 0.72rem);
  }

  .tile.is-marked::after {
    width: 22px;
    right: 4px;
    bottom: 4px;
    font-size: 0.78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
