:root {
  --navy: #1D3557;
  --dark-gray: #4A4A4A;
  --crimson: #D72638;
  --gold: #CBA135;
  --light-gray: #B1B1B1;
  --white: #FFFFFF;

  --bg: var(--navy);
  --fg: var(--white);
  --tile-bg: #243B63;
  --tile-hover: #2F4C7E;
  --tile-mark: var(--gold);
  --tile-text: var(--white);
  --free-tile-bg: #153050;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem;
}

.site-header, .site-footer {
  background: #0F2742;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  border-top: 1px solid rgba(255,255,255,0.05);
}

h1 {
  margin: 0.5rem 0 0.25rem;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.tagline {
  margin: 0 0 1rem 0;
  color: var(--light-gray);
}

.controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 1rem 0 1.5rem;
}

.seed {
  color: var(--light-gray);
  font-size: 0.9rem;
}

.btn {
  background: var(--gold);
  color: #1B1202;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.08s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  opacity: 0.9;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold);
}

.small {
  padding: 0.3rem 0.6rem;
  font-size: 0.9rem;
}

.board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.tile {
  position: relative;
  background: var(--tile-bg);
  border-radius: 10px;
  padding: 0.6rem;
  text-align: center;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease, transform 0.05s ease;
  line-height: 1.2;
  font-size: clamp(0.75rem, 1.2vw, 1rem);
  color: var(--white);
}

.tile:hover {
  background: var(--tile-hover);
}

.tile.marked {
  background: var(--tile-mark);
  color: var(--navy);
  font-weight: 700;
  transform: scale(0.99);
}

.tile.free {
  background: var(--free-tile-bg);
  cursor: default;
  color: var(--white);
}

.tile.free img {
  max-width: 60%;
}

.bingo-alert {
  position: fixed;
  left: 50%;
  top: 1rem;
  transform: translateX(-50%);
  background: var(--crimson);
  color: #fff;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  font-size: 1.1rem;
  display: none;
  z-index: 9999;
}

.bingo-alert.show {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Clean View */
.clean .site-header,
.clean .site-footer,
.clean .controls {
  display: none !important;
}

.clean main {
  padding: 0;
  max-width: none;
}

.clean .board {
  width: 100vw;
  height: 100vh;
  gap: 6px;
  padding: 1rem;
}

/* Exit Clean View button */
.exit-clean {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10000;
  display: none;
  background: var(--crimson);
  color: var(--white);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

.clean .exit-clean {
  display: block !important;
}

/* --- Mobile Enhancements --- */
@media (max-width: 600px) {
  .wrap {
    padding: 0.5rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .controls .btn {
    width: 100%;
    text-align: center;
    font-size: 1.1rem;
    padding: 0.8rem 0;
  }

  .board {
    width: 100vw;
    height: calc(100vh - 150px); /* leaves space for controls */
    max-height: 80vh;
    gap: 6px;
  }

  .tile {
    font-size: clamp(0.8rem, 2.5vw, 1.2rem);
    padding: 0.4rem;
  }
}

@media (min-width: 768px) {
  .board .tile {
    font-size: 1rem;
  }
}


/* --- Submit Bingo Modal --- */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.modal-content {
  background: var(--tile-bg);
  padding: 1.5rem;
  border-radius: 8px;
  max-width: 400px;
  width: 90%;
  color: var(--white);
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.modal-content h2 {
  margin-top: 0;
  color: var(--gold);
}

.modal-content label {
  display: block;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.modal-content input {
  width: 100%;
  padding: 0.4rem;
  margin-top: 0.25rem;
  border-radius: 4px;
  border: 1px solid var(--light-gray);
  font-size: 1rem;
}

.modal-close {
  position: absolute;
  right: 1rem;
  top: 1rem;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--light-gray);
}

.form-message {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--gold);
}

.hidden {
  display: none !important;
}



/* Player Name Modal */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.modal-content {
  background: var(--tile-bg);
  padding: 1.5rem;
  border-radius: 8px;
  max-width: 400px;
  width: 90%;
  color: var(--white);
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.modal-content h2 {
  margin-top: 0;
  color: var(--gold);
}

.modal-content label {
  display: block;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.modal-content input {
  width: 100%;
  padding: 0.4rem;
  margin-top: 0.25rem;
  border-radius: 4px;
  border: 1px solid var(--light-gray);
  font-size: 1rem;
}

.modal-content button {
  margin-right: 0.5rem;
}





.player-name-display {
  margin-left: auto;
  font-size: 1rem;
  color: var(--gold);
  font-weight: bold;
  white-space: nowrap;
}




.header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand h1,
.brand .tagline {
  margin: 0;
}

.support img {
  display: block;
  max-height: 48px;
}
