* {
  box-sizing: border-box;
}

/* The browser's default [hidden] rule has the same specificity as a plain
 * class selector, so any element styled with its own `display` (buttons,
 * flex containers) can end up STAYING VISIBLE despite `el.hidden = true` -
 * found this the hard way with the reveal button. One !important reset here
 * guarantees `hidden` always works, everywhere, instead of needing a bespoke
 * override rule added by hand for every element that happens to toggle it. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--hawks-white);
  color: var(--hawks-black);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
.numeral {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0;
}

a {
  color: var(--hawks-red);
}

button {
  font-family: var(--font-body);
  border-radius: var(--radius);
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--hawks-red);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* --- Header --- */

.site-header {
  background: var(--hawks-black);
  color: var(--hawks-white);
  padding: var(--space-4);
  text-align: center;
}

.site-header .wordmark {
  font-size: clamp(28px, 8vw, 40px);
  color: var(--hawks-white);
}

.site-header .wordmark strong {
  color: var(--hawks-red);
}

.site-header .tagline {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hawks-border);
  margin-top: var(--space-1);
}

.site-header .data-disclaimer {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--hawks-border); /* --hawks-grey (#373737) is meant for light backgrounds - too dark to read on this black header */
  opacity: 0.75;
  margin-top: var(--space-2);
}

.game-date {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--hawks-grey);
  text-align: center;
}

.grid-theme-alert {
  background: var(--hawks-red);
  color: var(--hawks-white);
  border: 0;
  border-radius: 0;
  padding: 20px 24px;
  margin: 0 0 16px;
  text-align: center;
}

.grid-theme-alert__title {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: clamp(22px, 5vw, 28px);
  line-height: 1.1;
  letter-spacing: 0.01em;
  margin: 0 0 8px;
  color: var(--hawks-white);
}

.grid-theme-alert__body {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.4;
  margin: 0 auto;
  max-width: 46ch;
  color: var(--hawks-white);
}

.instructions-box {
  background: var(--hawks-white);
  border: 1px solid var(--hawks-black);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: center;
  text-align: center;
}

.instructions-box p {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--hawks-grey);
  margin: 0;
  max-width: 46ch;
}

.instructions-box p.instructions-highlight {
  font-weight: 700;
  font-size: 14px;
  color: var(--hawks-black);
}

.how-to-play-link {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--hawks-red);
  text-decoration: underline;
  cursor: pointer;
}

.how-to-play-link:hover {
  color: var(--hawks-dark-red);
}

/* --- Guess tracker --- */

.guess-tracker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.guess-tracker .numeral {
  font-size: 20px;
}

.guess-dots {
  display: flex;
  gap: 6px;
}

.guess-dot {
  width: 10px;
  height: 10px;
  background: var(--hawks-border);
  transition: background var(--duration-state) var(--ease-out);
}

.guess-dot[data-state='used-correct'] {
  background: var(--hawks-teal);
}

.guess-dot[data-state='used-incorrect'] {
  background: var(--hawks-red);
}

.grid-key {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
}

.key-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--hawks-grey);
}

.key-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid var(--hawks-black);
}

.key-swatch--correct {
  background: var(--hawks-teal);
}

.key-swatch--incorrect {
  background: var(--hawks-red);
}

/* --- Grid --- */

.grid-wrap {
  display: grid;
  grid-template-columns: 84px repeat(3, 1fr);
  grid-template-rows: 84px repeat(3, 1fr);
  gap: 2px;
  background: var(--hawks-border);
  border: 2px solid var(--hawks-black);
}

.grid-corner {
  background: var(--hawks-black);
}

.grid-header {
  background: var(--hawks-black);
  color: var(--hawks-white);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-2);
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: clamp(10px, 3.1vw, 13px);
  line-height: 1.15;
  border: none;
  cursor: pointer;
  transition: background var(--duration-hover) var(--ease-out);
}

.grid-header-info {
  display: block;
  font-size: 1.4em;
  line-height: 1;
  color: var(--hawks-teal);
  margin-top: 4px;
}

.grid-header-info svg {
  display: inline-block;
  vertical-align: middle;
}

.grid-header:hover,
.grid-header:focus-visible {
  background: var(--hawks-grey);
}

.grid-cell {
  position: relative;
  background: var(--hawks-white);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1);
  border: 0;
  width: 100%;
  height: 100%;
  transition: background var(--duration-hover) var(--ease-out);
}

.grid-cell[data-state='empty'] {
  color: var(--hawks-grey);
}

.grid-cell[data-state='empty']:hover,
.grid-cell[data-state='empty']:focus-visible {
  background: var(--hawks-border);
}

.grid-cell[data-state='empty']::after {
  content: '+';
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--hawks-grey);
}

.grid-cell[data-state='correct'] {
  background: var(--hawks-teal);
  color: var(--hawks-black); /* white fails contrast on this teal - see AA check in build notes */
  cursor: default;
}

.grid-cell[data-state='incorrect'] {
  background: var(--hawks-red);
  color: var(--hawks-black); /* white fails contrast on red at cell label sizes - see AA check in build notes */
  cursor: default;
}

/* Correct/incorrect also carry a non-colour indicator (check/x) - teal and
   red are only 1.03:1 apart in luminance, nearly indistinguishable to many
   colour-blind players, so the colour fill alone can't be the only signal. */
.cell-icon {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  color: var(--hawks-black);
}

.cell-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Once the grid's finished, every filled cell becomes tappable to reveal that
   cell's possible answers - see showCellReveal in app.js. Scoped to
   .grid-wrap--complete so mid-game cells (already-answered but not yet done)
   stay inert, matching the openSearch no-op guard. */
.grid-wrap--complete .grid-cell[data-state='correct'],
.grid-wrap--complete .grid-cell[data-state='incorrect'] {
  cursor: pointer;
}

.grid-wrap--complete .grid-cell[data-state='correct']:hover,
.grid-wrap--complete .grid-cell[data-state='correct']:focus-visible,
.grid-wrap--complete .grid-cell[data-state='incorrect']:hover,
.grid-wrap--complete .grid-cell[data-state='incorrect']:focus-visible {
  filter: brightness(0.92);
}

.grid-cell .cell-name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(10px, 3vw, 13px);
  text-align: center;
  line-height: 1.2;
  padding: 0 2px;
}

.grid-cell .cell-rarity {
  font-family: var(--font-display);
  font-size: 11px;
  margin-top: 2px;
}

/* --- Search overlay --- */

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-4);
  z-index: 20;
}

.search-panel {
  background: var(--hawks-white);
  width: 100%;
  max-width: 420px;
  margin-top: 10vh;
  border: 2px solid var(--hawks-black);
}

.search-panel-header {
  background: var(--hawks-black);
  color: var(--hawks-white);
  padding: var(--space-3) var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-panel-header .cell-context {
  font-family: var(--font-body);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.search-close {
  background: none;
  border: none;
  color: var(--hawks-white);
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1;
  padding: var(--space-1) var(--space-2);
}

.search-close:hover {
  color: var(--hawks-red);
}

.search-input {
  width: 100%;
  padding: var(--space-4);
  font-family: var(--font-body);
  font-size: 16px;
  border: 0;
  border-bottom: 2px solid var(--hawks-border);
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 45vh;
  overflow-y: auto;
}

.search-results li {
  border-top: 1px solid var(--hawks-border);
}

.search-results button {
  width: 100%;
  text-align: left;
  background: var(--hawks-white);
  border: none;
  padding: var(--space-3) var(--space-4);
  font-size: 15px;
  color: var(--hawks-black);
  transition: background var(--duration-hover) var(--ease-out);
}

.search-results button:hover,
.search-results button.active {
  background: var(--hawks-black);
  color: var(--hawks-white);
}

.search-empty {
  padding: var(--space-4);
  color: var(--hawks-grey);
  font-size: 14px;
}

.info-panel-body {
  padding: var(--space-4);
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--hawks-black);
}

.info-panel-body p {
  margin: 0;
}

.info-panel-body p + p {
  margin-top: var(--space-3);
}

.info-panel-body .info-most-popular {
  font-weight: 700;
  color: var(--hawks-black);
}

.how-to-play-list {
  list-style: none;
  margin: 0;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  font-size: 13px;
  line-height: 1.5;
  color: var(--hawks-black);
  max-height: 60vh;
  overflow-y: auto;
}

/* --- Results screen --- */

.results-screen {
  border: 2px solid var(--hawks-black);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  text-align: center;
}

.results-scores {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
}

.results-score .numeral {
  font-size: 40px;
  display: block;
}

.results-score .score-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hawks-grey);
}

.share-block {
  font-family: monospace;
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: 2px;
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.btn {
  display: inline-block;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
  border: 2px solid transparent;
  transition: background var(--duration-hover) var(--ease-out), color var(--duration-hover) var(--ease-out);
}

.btn-primary {
  background: var(--hawks-red);
  color: var(--hawks-white);
}

.btn-primary:hover {
  background: var(--hawks-dark-red);
}

.btn-secondary {
  background: var(--hawks-white);
  color: var(--hawks-black);
  border-color: var(--hawks-black);
}

.btn-secondary:hover {
  background: var(--hawks-black);
  color: var(--hawks-white);
}

.cta-block {
  background: var(--hawks-black);
  color: var(--hawks-white);
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.cta-block h3 {
  color: var(--hawks-white);
  font-size: 20px;
}

.cta-block p {
  font-size: 14px;
  color: var(--hawks-border);
  margin: 0;
}

/* --- Answer reveal --- */

.reveal-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.reveal-list {
  display: flex;
  flex-direction: column;
  border: 2px solid var(--hawks-black);
}

.reveal-cell + .reveal-cell {
  border-top: 1px solid var(--hawks-border);
}

.reveal-cell-header {
  width: 100%;
  text-align: left;
  background: var(--hawks-white);
  border: none;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background var(--duration-hover) var(--ease-out);
}

.reveal-cell-header:hover {
  background: var(--hawks-border);
}

.reveal-cell-pair {
  font-family: var(--font-body);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--hawks-grey);
}

.reveal-cell-summary {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--hawks-black);
}

.reveal-cell-popular {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--hawks-grey);
}

.reveal-cell-body {
  padding: 0 var(--space-4) var(--space-3);
  font-size: 13px;
  color: var(--hawks-grey);
  line-height: 1.6;
}


.landing-link {
  text-align: center;
  font-size: 13px;
}

/* --- Promo band + footer ---
   Full-width black band so the game (white, above) and the club's ticket
   embeds (black, below) read as two clearly separate things. Embed markup and
   styling come from hawks-embeds' own script (see index.html) - this only
   supplies the background, spacing and a readable fallback link colour. */

.promo-band {
  background: var(--hawks-black);
  color: var(--hawks-white);
  margin-top: var(--space-6);
}

.promo-band__inner {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.promo-band a {
  color: var(--hawks-white);
}

.site-footer {
  text-align: center;
  padding: var(--space-4);
  font-size: 11px;
  color: var(--hawks-border);
}

@media (min-width: 480px) {
  .grid-wrap {
    grid-template-columns: 100px repeat(3, 1fr);
    grid-template-rows: 100px repeat(3, 1fr);
  }
}
