*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
}

nav {
  width: 100%;
  background: #1a3d2b;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0 2rem;
  height: 56px;
  flex-shrink: 0;
}

nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0.85;
}

nav a:hover { opacity: 1; }
nav a.brand { font-size: 1.1rem; opacity: 1; margin-right: auto; }

.game-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem 2rem;
  gap: 1rem;
  width: 100%;
  max-width: 820px;
}

.game-nav-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
}

#btn-next-top {
  justify-self: end;
}

.game-logo {
  height: 40px;
  width: auto;
}

.back-btn {
  display: inline-block;
  background: #1a3d2b;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  transition: background 0.15s;
  justify-self: start;
}

.back-btn:hover { background: #256b47; }

#btn-next-top {
  background: #FFD700;
  color: #1a0000;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  visibility: hidden;
  transition: background 0.15s;
}

#btn-next-top:hover { background: #ffe040; }

/* ── Puzzle board ── */
#board {
  width: 100%;
}

.category-label {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #FFD700;
  margin-bottom: 0.5rem;
}

.board-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}

.board-row {
  display: flex;
  gap: 5px;
  justify-content: center;
  flex-wrap: nowrap;
}

.tile {
  width: 34px;
  height: 42px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 900;
  text-transform: uppercase;
  flex-shrink: 0;
}

.tile.letter {
  background: #1a2a1a;
  border: 1px solid #2a4a2a;
  color: transparent;
}

.tile.letter.revealed {
  background: #f0e8c0;
  border-color: #c8b860;
  color: #1a1200;
}

.tile.space {
  background: transparent;
  border: none;
}

/* ── Wheel ── */
#wheel-canvas {
  display: block;
}

#wheel-canvas.picking {
  display: none;
}

/* ── Status / score strip ── */
.status-strip {
  display: flex;
  gap: 2rem;
  align-items: center;
  font-size: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.score-box {
  background: #1a2a1a;
  border: 1px solid #2a4a2a;
  border-radius: 8px;
  padding: 0.4rem 1.1rem;
  min-width: 110px;
  text-align: center;
}

.score-box .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888;
}

.score-box .value {
  font-size: 1.3rem;
  font-weight: 900;
  color: #FFD700;
}

.message-box {
  font-size: 1.05rem;
  font-weight: 700;
  min-height: 1.6em;
  text-align: center;
  color: #FFD700;
}

/* ── Buttons ── */
.controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

button {
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.55rem 1.4rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
}

button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#btn-spin {
  background: #FFD700;
  color: #1a0000;
}

#btn-spin:hover:not(:disabled) { background: #ffe040; }

#btn-buy-vowel {
  background: #3a6ea8;
  color: #fff;
}

#btn-buy-vowel:hover:not(:disabled) { background: #4a8acc; }

#btn-solve {
  background: #1a3d2b;
  color: #fff;
}

#btn-solve:hover:not(:disabled) { background: #256b47; }

#btn-next {
  background: #FFD700;
  color: #1a0000;
  font-size: 1.05rem;
  display: none;
}

#btn-next:hover { background: #ffe040; }

/* ── Letter keyboard ── */
.keyboard {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  max-width: 440px;
}

.key-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  font-size: 0.9rem;
  padding: 0;
  background: #1a3d2b;
  color: #fff;
  border: 1px solid #2a5a3b;
}

.key-btn:hover:not(:disabled) { background: #256b47; }

.key-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* ── Solve input modal overlay ── */
#solve-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

#solve-overlay.open { display: flex; }

.solve-modal {
  background: #141a14;
  border: 2px solid #2a5a3b;
  border-radius: 12px;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  min-width: 280px;
}

.solve-modal h2 {
  color: #FFD700;
  font-size: 1.2rem;
}

.solve-modal input {
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #2a5a3b;
  background: #0a100a;
  color: #fff;
  width: 100%;
  letter-spacing: 0.1em;
}

.solve-modal .modal-btns {
  display: flex;
  gap: 0.75rem;
}

.solve-modal .modal-btns button {
  padding: 0.45rem 1.2rem;
}

#modal-submit { background: #FFD700; color: #1a0000; }
#modal-cancel { background: #1a3d2b; color: #fff; }

/* ── Win overlay ── */
#win-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 200;
  overflow: hidden;
}

#win-overlay.open { display: block; }

#fireworks-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#win-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 16, 10, 0.93);
  border: 2px solid #FFD700;
  border-radius: 16px;
  padding: 2rem 2.5rem;
  text-align: center;
  flex-direction: column;
  gap: 1.2rem;
  align-items: center;
  display: none;
  min-width: 260px;
}

#win-card.show { display: flex; }

.win-title {
  font-size: 1.9rem;
  font-weight: 900;
  color: #FFD700;
  letter-spacing: 0.06em;
}

.win-scores {
  font-size: 1rem;
  color: #ccc;
  line-height: 1.8;
}

.win-scores strong { color: #fff; }

#btn-win-next {
  background: #FFD700;
  color: #1a0000;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.65rem 1.6rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

#btn-win-next:hover { background: #ffe040; }

/* ── Southern Sayings promo ── */
#promo-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 300;
  align-items: center;
  justify-content: center;
}

#promo-overlay.open { display: flex; }

.promo-card {
  background: #141a14;
  border: 2px solid #5cb882;
  border-radius: 16px;
  padding: 2rem 2.2rem 2rem 1.6rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  max-width: 300px;
  width: 88vw;
  position: relative;
  overflow: hidden;
}

.promo-gent {
  position: absolute;
  bottom: -4px;
  right: -8px;
  height: 92%;
  opacity: 0.22;
  pointer-events: none;
  user-select: none;
}

.promo-question {
  font-size: 1.15rem;
  color: #fff;
  line-height: 1.55;
  margin: 0;
}

.promo-question strong {
  color: #5cb882;
  font-size: 1.25rem;
}

.promo-btns {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

#btn-promo-yes {
  background: #5cb882;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.55rem 1.4rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

#btn-promo-yes:hover { background: #4aab6e; }

#btn-promo-no {
  background: #1a3d2b;
  color: #aaa;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

#btn-promo-no:hover { background: #256b47; }

/* ── Mobile: scale tiles to fit viewport ── */
@media (max-width: 500px) {
  /* 12 tiles + 11 gaps of 3px + 2rem (32px) horizontal padding = viewport */
  /* tile width = (100vw - 32px - 33px) / 12 = (100vw - 65px) / 12        */
  .board-row  { gap: 3px; }
  .board-rows { gap: 3px; }
  .tile {
    width:  calc((100vw - 65px) / 12);
    height: calc((100vw - 65px) / 9.71);
    font-size: clamp(0.6rem, 2.8vw, 1.25rem);
    border-radius: 3px;
  }
}
