/* ── Profile Modal (first-time name prompt + rename) ──────── */
.profile-modal {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.82);
}
.profile-modal__panel {
  background: var(--panel-bg); border: 3px solid var(--accent-orange);
  border-radius: 4px; padding: 28px 30px; text-align: center;
  width: min(86vw, 340px); box-shadow: 6px 6px 0 #000;
  font-family: var(--font-main);
}
.profile-modal__title {
  font-size: 0.95rem; font-weight: bold; color: var(--accent-orange);
  letter-spacing: 0.04em; margin-bottom: 8px;
}
.profile-modal__sub {
  font-size: 0.5rem; color: var(--text-secondary);
  line-height: 1.5; margin-bottom: 18px;
}
.profile-modal__input {
  width: 100%; box-sizing: border-box; text-align: center;
  font-family: var(--font-main); font-size: 0.7rem; color: var(--text-primary);
  background: #000; border: 2px solid var(--panel-border); border-radius: 4px;
  padding: 10px 12px; outline: none; transition: border-color 0.15s;
}
.profile-modal__input:focus { border-color: var(--accent-orange); }
.profile-modal__error {
  min-height: 0.9rem; font-size: 0.45rem; color: var(--accent-red);
  margin: 8px 0 12px; line-height: 1.4;
}
.profile-modal .mode-select__btn--ai { width: 100%; }
.profile-modal__cancel {
  display: block; margin: 12px auto 0; background: none; border: none;
  color: var(--text-secondary); font-size: 0.45rem; font-family: var(--font-main);
  cursor: pointer; text-decoration: underline;
}
.profile-modal__cancel:hover { color: var(--accent-red); }

/* ── Message Overlay ──────────────────────────────────────── */
.message-overlay {
  /* Absolute inside .main-panel so it centers on the FIELD like the other
     overlays (not the whole window — the 380px left panel was shifting it). */
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(to bottom, transparent var(--logo-bottom), rgba(0,0,0,0.78) var(--logo-bottom));
  z-index: 130;
  opacity: 0; pointer-events: none; transition: opacity var(--fade-duration);
}
.message-overlay--visible { opacity: 1; pointer-events: auto; }
.message-overlay__content {
  background: var(--panel-bg); border: 3px solid var(--accent-orange);
  border-radius: 4px; padding: 24px 32px; text-align: center; max-width: 320px;
  box-shadow: 6px 6px 0 #000;
}
.message-overlay__title { font-size: 1rem; font-weight: bold; color: var(--accent-orange); margin-bottom: 8px; }
.message-overlay__text { font-size: 0.55rem; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.6; }

/* ── Game Over Modal (§17) — flashy varsity gold ─────────── */
.message-overlay--game-over .message-overlay__content {
  border-color: #FFD700;
  box-shadow: 0 0 28px rgba(255,215,0,0.4), 6px 6px 0 #000;
}
.message-overlay--game-over .message-overlay__title {
  font-family: var(--font-logo);
  font-size: 2.6rem;
  color: #FFD700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-shadow: 0 0 16px rgba(255,215,0,0.65), 3px 3px 0 #000;
  margin-bottom: 14px;
  animation: game-over-pulse 1.2s ease-in-out infinite;
}
@keyframes game-over-pulse {
  0%, 100% { transform: scale(1);    text-shadow: 0 0 16px rgba(255,215,0,0.65), 3px 3px 0 #000; }
  50%      { transform: scale(1.06); text-shadow: 0 0 30px rgba(255,215,0,0.95), 3px 3px 0 #000; }
}
/* Game-over buttons stack vertically with spacing */
.message-overlay--game-over .message-overlay__btn {
  display: block; width: 80%; margin: 8px auto;
}
.message-overlay--game-over .message-overlay__btn:not(.actions__btn--primary) {
  background: #333; color: #aaa; font-size: 0.55rem;
}

/* ── Opening Scene (§18) ─────────────────────────────────── */
.opening-scene {
  position: fixed; inset: 0; z-index: 250;
  background: #0D0F1F;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.opening-scene--hidden { display: none !important; }
.opening-scene__content {
  text-align: center; padding: 20px 40px; max-width: 640px;
}
.opening-scene__line {
  font-family: var(--font-main); font-size: 1.0rem;
  color: var(--text-gold); line-height: 1.8;
  opacity: 0; animation: scene-fade-in 0.8s ease forwards;
}
.opening-scene__line[data-line="0"] { animation-delay: 0.3s; }
.opening-scene__line[data-line="1"] { animation-delay: 1.4s; }
@keyframes scene-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.opening-scene__tap {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-main); font-size: 0.35rem;
  color: var(--text-secondary); letter-spacing: 0.2em;
  animation: tap-pulse 1.4s ease-in-out infinite;
}

/* §13 Down Result Modal */
.down-result-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(to bottom, transparent var(--logo-bottom), rgba(0,0,0,0.72) var(--logo-bottom)); z-index: 110;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.down-result-overlay--visible { opacity: 1; pointer-events: auto; }
.down-result-modal {
  background: #1A1E3A; border: 3px solid var(--accent-orange);
  border-radius: 4px; padding: 24px 32px; text-align: center;
  max-width: 480px; width: 92%; box-shadow: 6px 6px 0 #000;
  font-family: var(--font-main);
}
.down-result__header {
  font-size: 0.52rem; color: var(--text-gold);
  text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 14px;
}
.down-result__matchup {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-bottom: 16px;
}
.down-result__side {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.down-result__card {
  width: 64px; height: 90px; border-radius: 4px;
  background: #f5f0e8; border: 2px solid #888;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #1a1a1a; font-family: var(--font-main);
}
.down-result__card--red { color: #cc2222; }
.down-result__card-rank { font-size: 1.8rem; font-weight: bold; line-height: 1; }
.down-result__card-suit { font-size: 1.1rem; line-height: 1; }
.down-result__card-value {
  font-size: 0.42rem; color: var(--text-gold);
  font-family: var(--font-main); letter-spacing: 0.04em;
}
.down-result__vs {
  font-size: 0.5rem; color: var(--text-secondary);
  font-weight: bold; letter-spacing: 0.1em;
  align-self: center; padding-bottom: 20px;
}
.down-result__yards {
  font-size: 3.5rem; font-weight: bold; line-height: 1;
  font-family: var(--font-score); color: var(--text-gold);
  margin-bottom: 4px;
}
.down-result__yards--positive { color: var(--accent-green); }
.down-result__yards--negative { color: var(--accent-red); }
.down-result__yards--neutral  { color: var(--text-secondary); }
.down-result__label {
  font-size: 0.48rem; font-weight: bold; letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.down-result__label--positive { color: var(--accent-green); }
.down-result__label--negative { color: var(--accent-red); }
.down-result__label--neutral  { color: var(--text-secondary); }
.down-result__divider {
  font-size: 0.52rem; color: var(--text-gold);
  font-weight: bold; letter-spacing: 0.14em;
  margin: 14px 0 8px;
}
.down-result__set-row {
  font-size: 0.46rem; font-weight: bold; margin: 4px 0;
}
.down-result__set-row--offense { color: var(--accent-green); }
.down-result__set-row--defense { color: var(--accent-red); }
.down-result__bet-row {
  font-size: 0.46rem; font-weight: bold; margin: 4px 0; color: var(--text-secondary);
}
.down-result__bet-row--win  { color: var(--accent-green); }
.down-result__bet-row--loss { color: var(--accent-red); }
.down-result__bet-row--push { color: var(--text-secondary); }
.down-result__dice-strip {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin: 10px 0;
  font-size: 0.42rem; color: var(--text-secondary);
}
/* Mini card labels in side bet rows */
.bet-card-mini {
  display: inline-block; padding: 1px 4px; margin: 0 2px;
  background: #f5f0e8; color: #1a1a1a; border-radius: 2px;
  font-weight: bold; font-size: 0.44rem; letter-spacing: 0;
  border: 1px solid #888;
}
.bet-card-mini--red { color: #cc2222; }

.down-result__btn {
  font-family: var(--font-main); font-size: 0.5rem;
  background: var(--accent-orange); color: #fff;
  border: none; padding: 10px 24px; margin-top: 14px;
  cursor: pointer; box-shadow: 3px 3px 0 #000;
  letter-spacing: 0.1em; width: 100%;
}
.down-result__btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 #000; }

/* §14 set bonuses are shown in the result modal's SETS rows; the on-field
   floating toast was removed as redundant. */

/* Bet Resolution Interstitial */
.bet-resolution-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(to bottom, transparent var(--logo-bottom), rgba(0,0,0,0.78) var(--logo-bottom)); z-index: 112;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.bet-resolution-overlay--visible { opacity: 1; pointer-events: auto; }
.bet-resolution-panel {
  background: #1A1E3A; border: 3px solid var(--text-gold);
  border-radius: 4px; padding: 20px 28px; text-align: center;
  max-width: 380px; width: 90%; box-shadow: 6px 6px 0 #000;
  font-family: var(--font-main);
}
.bet-resolution__title {
  font-size: 0.54rem; color: var(--text-gold);
  text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 14px;
}
.bet-resolution__row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; margin: 6px 0; border-radius: 3px;
  font-size: 0.48rem; font-weight: bold;
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.3s, transform 0.3s;
  background: rgba(255,255,255,0.04);
}
.bet-resolution__row--revealed {
  opacity: 1; transform: translateY(0);
}
.bet-resolution__row--win  { color: var(--accent-green); border-left: 3px solid var(--accent-green); }
.bet-resolution__row--loss { color: var(--accent-red);   border-left: 3px solid var(--accent-red); }
.bet-resolution__row--push { color: var(--text-secondary); border-left: 3px solid var(--text-secondary); }
.bet-resolution__pos { min-width: 40px; text-align: left; }
.bet-resolution__cards { flex: 1; text-align: center; }
.bet-resolution__result { min-width: 80px; text-align: right; }
.bet-resolution__total {
  margin-top: 14px; padding-top: 10px;
  border-top: 2px solid rgba(255,255,255,0.1);
  font-size: 0.52rem; font-weight: bold;
  opacity: 0; transition: opacity 0.3s;
}
.bet-resolution__total--revealed { opacity: 1; }
.bet-resolution__total--win  { color: var(--accent-green); }
.bet-resolution__total--loss { color: var(--accent-red); }
.bet-resolution__total--even { color: var(--text-secondary); }
@keyframes money-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.bet-resolution__total--pop { animation: money-pulse 0.4s ease; }

/* §15 4th Down Modal — amber border */
.fourth-down-modal .message-overlay__content {
  border-color: #FFA500;
}
.fourth-down-modal .message-overlay__title { color: #FFA500; }
.fourth-down-btn--fg {
  background: #FFA500 !important; color: #fff !important;
  width: 100%; margin-bottom: 8px;
}
.fourth-down-btn--go {
  background: transparent !important; color: var(--text-secondary) !important;
  border: 2px solid var(--panel-border) !important; width: 100%;
}

/* §16 Drive Change Interstitial */
.drive-interstitial-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(to bottom, transparent var(--logo-bottom), rgba(0,0,0,0.72) var(--logo-bottom)); z-index: 115;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.drive-interstitial-overlay--visible { opacity: 1; pointer-events: auto; }
.drive-interstitial-modal {
  background: #1A1E3A; border: 3px solid var(--accent-orange);
  border-radius: 4px; padding: 24px 32px; text-align: center;
  max-width: 300px; width: 90%; box-shadow: 6px 6px 0 #000;
  font-family: var(--font-main);
}
.drive-interstitial__title {
  font-size: 1.05rem; font-weight: bold; color: var(--accent-orange);
  margin-bottom: 10px; line-height: 1.2;
}
.drive-interstitial__subtitle {
  font-size: 0.45rem; color: var(--text-secondary);
  line-height: 1.6; margin-bottom: 18px;
}
.drive-interstitial__btn {
  font-family: var(--font-main); font-size: 0.5rem;
  background: var(--accent-orange); color: #fff;
  border: none; padding: 10px 28px;
  cursor: pointer; box-shadow: 3px 3px 0 #000;
  letter-spacing: 0.1em; width: 100%;
}
.drive-interstitial__btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 #000; }

/* ── Quit / Return-to-Lobby confirm ────────────────────────────
   Shown by the Lobby button while a match is live. Field-centered
   like the Busted overlay rather than viewport-centered, so it reads
   as part of the game rather than a browser dialog. */
.quit-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.18s;
}
.quit-overlay--visible {
  opacity: 1; pointer-events: auto;
  background: linear-gradient(to bottom, transparent var(--logo-bottom), rgba(0,0,0,0.72) var(--logo-bottom));
}
.quit-modal {
  background: var(--panel-bg, #1A1E3A);
  border: 3px solid var(--accent-red, #ff2244);
  border-radius: 6px;
  padding: 22px 34px 20px;
  text-align: center;
  box-shadow: 8px 8px 0 #000;
  max-width: min(420px, 90%);
  font-family: var(--font-main);
}
.quit-modal__title {
  font-size: 0.8rem; font-weight: bold;
  color: var(--accent-red, #ff2244);
  letter-spacing: 0.04em; margin-bottom: 10px;
}
.quit-modal__text {
  font-size: 0.5rem; color: var(--text-primary, #f0f0f0);
  line-height: 1.5; margin-bottom: 6px;
}
.quit-modal__returned {
  font-size: 0.45rem; font-weight: bold;
  color: var(--accent-green, #33cc66);
  line-height: 1.5; margin-bottom: 14px;
}
.quit-modal__returned:empty { margin-bottom: 8px; }
.quit-modal__btn {
  display: block; width: 100%;
  font-family: var(--font-main); font-size: 0.5rem; font-weight: bold;
  border: 2px solid #000; border-radius: 3px;
  padding: 9px 22px; margin-top: 8px;
  cursor: pointer; box-shadow: 3px 3px 0 #000;
}
.quit-modal__btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 #000; }
.quit-modal__btn--stay  { background: var(--accent-green, #33cc66); color: #08210f; }
.quit-modal__btn--stay:hover { filter: brightness(1.1); }
.quit-modal__btn--leave { background: var(--accent-red, #ff2244); color: #fff; }
.quit-modal__btn--leave:hover { filter: brightness(1.1); }

/* Inline failure line under the game-over "Play Again" button — the new
   session is created before the overlay closes, so errors surface here. */
.message-overlay__error {
  font-family: var(--font-main); font-size: 0.4rem;
  color: var(--accent-red, #ff2244);
  line-height: 1.4; margin: 6px 0 2px; text-align: center;
}
.message-overlay__error:empty { margin: 0; }
