/* ============================================
   Bloom Bingo — Stylesheet
   ============================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --green-darkest: #1a2e1a;
  --green-dark: #2d4a2d;
  --green: #4a7c4a;
  --green-light: #6fb46f;
  --green-lighter: #a8d8a8;
  --green-pale: #d4ecd4;
  --green-palest: #eef8ee;
  --sun-yellow: #f5d020;
  --flower-red: #e85a4f;
  --flower-blue: #4a90d9;
  --flower-purple: #9b6dd7;
  --flower-orange: #f5a623;
  --flower-white: #f5f0e8;
  --text-dark: #1a2e1a;
  --text-mid: #3d5a3d;
  --text-light: #6b8a6b;
  --white: #ffffff;
  --shadow: 0 2px 8px rgba(26, 46, 26, 0.15);
  --shadow-lg: 0 4px 24px rgba(26, 46, 26, 0.2);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
}

body {
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #d4ecd4 0%, #a8d8a8 50%, #6fb46f 100%);
  background-attachment: fixed;
  color: var(--text-dark);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- Screens ---------- */
.screen {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.screen.active {
  display: flex;
}

/* ---------- Buttons ---------- */
.big-btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--green-light), var(--green));
  color: var(--white);
  border: none;
  padding: 14px 36px;
  font-size: 18px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.big-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.big-btn:active {
  transform: translateY(0);
}

/* ---------- Setup Screen ---------- */
.setup-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
}

.tagline {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 28px;
  font-size: 14px;
}

.setup-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.name-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: var(--transition);
}
.name-input:focus {
  outline: none;
  border-color: var(--green);
}

/* ---------- Card Reveal Screen ---------- */
.reveal-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.reveal-card h2 {
  color: var(--green-dark);
  margin-bottom: 16px;
}

.reveal-instruction {
  font-size: 18px;
  margin-bottom: 6px;
}

.reveal-instruction strong {
  color: var(--green-dark);
}

.reveal-subtitle {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 24px;
}

.reveal-hint {
  margin: 16px 0;
  font-size: 14px;
  color: var(--text-light);
}

/* ---------- Bingo Card ---------- */
.bingo-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.bingo-cell {
  background: var(--green-pale);
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  font-size: 13px;
  text-align: center;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.3;
  transition: var(--transition);
}

.bingo-cell.completed {
  position: relative;
  background: var(--green-light);
  border-color: var(--green-dark);
  color: var(--white);
}

.bingo-cell.completed::after {
  content: '✓';
  position: absolute;
  top: -5px;
  right: -5px;
  width: 22px;
  height: 22px;
  background: var(--green-dark);
  color: var(--white);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  border: 2px solid var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.bingo-cell.line-complete {
  background: var(--sun-yellow);
  border-color: #c9a800;
  color: var(--text-dark);
}

/* ---------- Hidden utility ---------- */
.hidden {
  display: none !important;
}

/* ---------- Garden Screen ---------- */
.garden-layout {
  display: flex;
  gap: 16px;
  max-width: 1200px;
  width: 100%;
  align-items: flex-start;
}

.garden-left-panel,
.garden-right-panel {
  flex: 0 0 220px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.garden-center {
  flex: 1;
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Round info */
.round-info {
  font-size: 14px;
  color: var(--text-mid);
  margin-bottom: 14px;
  text-align: center;
}
.round-info strong {
  color: var(--green-dark);
}
.round-info .separator {
  margin: 0 6px;
  color: var(--text-light);
}

/* Current player badge */
.current-player-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px;
  background: var(--green-palest);
  border-radius: var(--radius-sm);
}
.player-color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--white);
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.current-player-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-light);
}
.current-player-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--green-dark);
}

/* Action panel */
.action-panel {
  margin-bottom: 16px;
}
.action-buttons {
  position: relative;
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow: hidden;
}

/* ISSUE-26: the action cooldown shows as a brief sweep across the button row — an
   indicator, not a gate (the buttons stay live; the server owns the rejection). Its
   duration comes from the server's ACTION_COOLDOWN_MS via the inline --cooldown-ms. */
.action-buttons.cooling::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  pointer-events: none;
  background: linear-gradient(90deg,
    rgba(74, 124, 74, 0) 0%,
    rgba(74, 124, 74, 0.22) 45%,
    rgba(111, 180, 111, 0.35) 50%,
    rgba(74, 124, 74, 0) 100%);
  animation: action-cooldown-sweep var(--cooldown-ms, 750ms) linear forwards;
}

@keyframes action-cooldown-sweep {
  from { transform: translateX(-100%); opacity: 0.9; }
  to   { transform: translateX(100%); opacity: 0; }
}
.action-btn {
  flex: 1;
  background: var(--white);
  border: 2px solid var(--green-lighter);
  color: var(--text-dark);
  padding: 10px 6px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.action-btn:hover {
  border-color: var(--green);
}
.action-btn.active {
  background: var(--green);
  color: var(--white);
  border-color: var(--green-dark);
}

/* Plant selector */
.plant-selector {
  margin-bottom: 12px;
}
.plant-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
/* ---------- Plant selector tooltip ---------- */
.plant-option {
  position: relative;
}

.plant-option[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--green-darkest);
  color: var(--white);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  animation: tooltipFadeIn 0.15s ease;
}

.plant-option[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--green-darkest);
  pointer-events: none;
  z-index: 10;
}

@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(3px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.plant-option {
  width: 44px;
  height: 44px;
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius-sm);
  background: var(--green-palest);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.plant-option:hover {
  border-color: var(--green);
  transform: scale(1.08);
}
.plant-option.selected {
  border-color: var(--green-dark);
  border-width: 3px;
  background: var(--green-pale);
}
.plant-option.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Standings */
.standings-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.standing-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: var(--transition);
}
.standing-item.current {
  background: var(--green-pale);
  font-weight: 600;
}
.standing-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}
.standing-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.standing-score {
  font-weight: 700;
  color: var(--green-dark);
}

/* Garden Grid */
.garden-grid {
  display: grid;
  gap: 3px;
  padding: 8px;
  background: linear-gradient(135deg, var(--green-dark), var(--green-darkest));
  border-radius: var(--radius);
}
.grid-tile {
  width: 52px;
  height: 52px;
  background: var(--green-pale);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  user-select: none;
}
.grid-tile:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 2px var(--sun-yellow);
  z-index: 1;
}
.grid-tile .tile-emoji {
  line-height: 1;
}
.grid-tile .tile-owner {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--white);
}
/* ISSUE-22/23 — the watered gate, made visible. `.watered` is the tint (kept from the
   old cosmetic-only rule); `.thriving` adds the small 🌸 flourish so the garden visibly
   grows as plants come into objective credit. `online.js` adds both from the same
   `plant && watered` test shared.js states as `isThriving()`. */
.grid-tile.watered {
  box-shadow: inset 0 0 8px rgba(74, 144, 217, 0.4);
}
.grid-tile.thriving::before {
  content: '🌸';
  position: absolute;
  top: -4px;
  left: -4px;
  font-size: 12px;
  animation: bloomFlourish 0.5s ease;
}
@keyframes bloomFlourish {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  70% { transform: scale(1.25) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.grid-tile.bugged {
  animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

/* Right panel — secret card + bloom */
.secret-card-wrapper {
  position: relative;
}
.secret-card-wrapper .bingo-card {
  margin-top: 20px;
}

/* ISSUE-26: remaining destructive budget, beside the mini card (created by online.js —
   the garden markup belongs to another lane). Hidden entirely in turn-based mode, where
   no budget is enforced. */
.destruction-budget {
  margin-top: 12px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  color: var(--text-dark);
  background: var(--green-palest);
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.destruction-budget.spent {
  color: #8a6800;
  background: #fdf3d8;
  border-color: #d4a017;
}


.bloom-call-btn {
  width: 100%;
  margin-top: 16px;
  background: linear-gradient(135deg, var(--flower-red), #c94a3f);
  color: var(--white);
  border: none;
  padding: 14px;
  font-size: 18px;
  font-weight: 700;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.bloom-call-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.bloom-call-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ISSUE-24 — a complete line is available (client-side hint only; the call
   itself is still gated by turn/mode and adjudicated by the server). */
.bloom-call-btn.line-ready {
  background: linear-gradient(135deg, var(--sun-yellow), var(--flower-orange));
  color: var(--green-darkest);
  animation: bloomReadyPulse 1.2s ease-in-out infinite alternate;
}
/* Gated (not your turn / already called): show the hint without the pulse so
   the indicator never reads as "you may call now". */
.bloom-call-btn.line-ready:disabled {
  animation: none;
  opacity: 0.65;
}
@keyframes bloomReadyPulse {
  from { box-shadow: 0 0 6px 1px rgba(245, 208, 32, 0.5), var(--shadow); }
  to   { box-shadow: 0 0 18px 5px rgba(245, 208, 32, 0.85), var(--shadow-lg); }
}


/* Bloom result overlay */
.peek-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 46, 26, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.peek-overlay.hidden {
  display: none;
}
.peek-modal {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.peek-modal h3 {
  color: var(--green-dark);
  margin-bottom: 16px;
}

/* ---------- Scoring Screen ---------- */
.scoring-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  max-width: 800px;
  width: 100%;
  text-align: center;
}
.scoring-card h2 {
  color: var(--green-dark);
  margin-bottom: 8px;
}
.scoring-subtitle {
  color: var(--text-light);
  margin-bottom: 24px;
}
.scoring-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin-bottom: 24px;
}
.scoring-player-card {
  background: var(--green-palest);
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius);
  padding: 16px;
  width: 260px;
}
.scoring-player-card.bloomed {
  border-color: var(--sun-yellow);
  background: #fffae8;
}
.scoring-player-name {
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.scoring-player-card .bingo-card {
  max-width: 100%;
}
.scoring-player-card .bingo-cell {
  font-size: 11px;
  min-height: 42px;
  padding: 4px 3px;
}
.scoring-bloom-badge {
  display: inline-block;
  background: var(--sun-yellow);
  color: var(--text-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  margin-left: 6px;
}
.scoring-no-bloom {
  color: var(--text-light);
  font-size: 13px;
  margin-top: 6px;
}
.scoring-score {
  font-weight: 700;
  color: var(--green-dark);
  margin-top: 8px;
}

/* ---------- Results / Game Over ---------- */
.results-card,
.gameover-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  text-align: center;
}
.results-card h2,
.gameover-title {
  color: var(--green-dark);
  margin-bottom: 24px;
}
/* ISSUE-10: why a game ended early ("Not enough players remaining"). It replaces part of
   the title's bottom margin while visible, so the standings below do not shift twice. */
.gameover-reason {
  margin: -12px 0 20px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--green-dark);
  background: var(--green-palest);
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius-sm);
}
.gameover-reason.hidden {
  display: none;
}
.results-standings {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}
.result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--green-palest);
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.result-row.first {
  background: linear-gradient(135deg, #fffae8, #fff3c0);
  border-color: var(--sun-yellow);
}
.result-row .rank {
  font-size: 24px;
  font-weight: 800;
  color: var(--green-dark);
  width: 32px;
}
.result-row .standing-color-dot {
  width: 24px;
  height: 24px;
}
.result-row .name {
  flex: 1;
  text-align: left;
  font-weight: 600;
  font-size: 16px;
}
.result-row .score {
  font-size: 20px;
  font-weight: 800;
  color: var(--green-dark);
}

.winner-banner {
  font-size: 22px;
  font-weight: 700;
  color: var(--green-dark);
  margin: 16px 0 24px;
  padding: 16px;
  background: linear-gradient(135deg, #fffae8, #fff3c0);
  border-radius: var(--radius);
  border: 2px solid var(--sun-yellow);
}

/* ISSUE-30: the rematch waiting state on the game-over screen ("2/3 agreed").
   Reserved height so the buttons below do not jump when the text appears. */
.rematch-status {
  min-height: 20px;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--green-dark);
  opacity: 0.85;
}
.rematch-status:empty {
  min-height: 0;
  margin-bottom: 0;
}

/* ---------- Weather Banner ---------- */
.weather-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  background: linear-gradient(135deg, #eef8ee, #d4ecd4);
  border: 2px solid var(--green-lighter);
  animation: weatherFadeIn 0.5s ease;
}
.weather-banner.hidden {
  display: none;
}
.weather-emoji {
  font-size: 28px;
  line-height: 1;
}
.weather-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-light);
}
.weather-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--green-dark);
}
.weather-effect {
  flex: 1;
  text-align: right;
  font-size: 11px;
  color: var(--text-mid);
  font-style: italic;
}

@keyframes weatherFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Turn Timer Bar ---------- */
.turn-timer-bar {
  position: relative;
  height: 28px;
  border-radius: 14px;
  background: var(--green-pale);
  overflow: hidden;
  margin-bottom: 12px;
  border: 2px solid var(--green-lighter);
}
.turn-timer-bar.hidden {
  display: none;
}
.turn-timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--green-light), var(--sun-yellow));
  transition: width 1s linear, background 0.3s ease;
  border-radius: 12px;
}
.turn-timer-fill.warning {
  background: linear-gradient(90deg, #f5a623, var(--flower-red));
  animation: timerPulse 0.5s ease infinite alternate;
}
.turn-timer-fill.critical {
  background: linear-gradient(90deg, var(--flower-red), #c94a3f);
  animation: timerPulse 0.3s ease infinite alternate;
}
@keyframes timerPulse {
  from { opacity: 0.7; }
  to { opacity: 1; }
}
.turn-timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  text-shadow: 0 0 3px rgba(255,255,255,0.8);
}

/* ---------- Bug Action Button ---------- */
.action-btn.bug-btn {
  border-color: #d4a017;
  color: #8a6800;
}
.action-btn.bug-btn.active {
  background: linear-gradient(135deg, #d4a017, #b8860b);
  border-color: #8a6800;
  color: var(--white);
}

/* ---------- Bug Tile Animation ---------- */
.grid-tile.bugged .tile-emoji {
  animation: bugShake 0.4s ease-in-out infinite;
}
.grid-tile.bugged::after {
  content: '🐞';
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 14px;
  animation: bugBounce 0.6s ease infinite alternate;
}
@keyframes bugShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-2px) rotate(-3deg); }
  75% { transform: translateX(2px) rotate(3deg); }
}
@keyframes bugBounce {
  from { transform: translateY(0); }
  to { transform: translateY(-3px); }
}

/* ---------- Plant Pop-in Animation ---------- */
.grid-tile .tile-emoji.plant-pop {
  animation: plantPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes plantPop {
  0% { transform: scale(0) rotate(-15deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ---------- Water Ripple Animation ---------- */
.grid-tile.water-rippling {
  animation: waterRipple 0.5s ease;
}
@keyframes waterRipple {
  0% { box-shadow: 0 0 0 0 rgba(74, 144, 217, 0.6); }
  100% { box-shadow: 0 0 0 12px rgba(74, 144, 217, 0); }
}

/* ---------- Weed Poof Animation ---------- */
.grid-tile.weed-poof {
  animation: weedPoof 0.4s ease forwards;
}
@keyframes weedPoof {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; filter: blur(2px); }
  100% { transform: scale(0); opacity: 0; }
}

/* ---------- Bloom Celebration ---------- */
.bloom-celebration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 300;
  overflow: hidden;
}
.bloom-celebration.hidden {
  display: none;
}
.bloom-particle {
  position: absolute;
  font-size: 28px;
  animation: bloomParticle 1.5s ease-out forwards;
}
@keyframes bloomParticle {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(0.5) rotate(0);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(1.2) rotate(var(--rot));
  }
}

/* ---------- Round Transition Flash ---------- */
.round-flash {
  position: fixed;
  inset: 0;
  background: var(--green-dark);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 800;
  color: var(--white);
  animation: roundFlash 0.8s ease forwards;
  pointer-events: none;
}
@keyframes roundFlash {
  0% { opacity: 0; }
  30% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* ---------- Sound Toggle Button ---------- */
.sound-toggle {
  width: 100%;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--green-palest);
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  cursor: pointer;
  transition: var(--transition);
}
.sound-toggle:hover {
  border-color: var(--green);
}
.sound-toggle.muted {
  opacity: 0.6;
}

/* ---------- Online: Setup Grid ---------- */
.online-setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}
.online-setup-panel {
  background: var(--green-palest);
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.online-setup-panel h3 {
  color: var(--green-dark);
  font-size: 16px;
  margin-bottom: 4px;
}
.room-code-input {
  font-family: monospace;
  font-weight: 700;
}

@media (max-width: 500px) {
  .online-setup-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Online: Lobby ---------- */
.lobby-card {
  max-width: 420px;
}
.lobby-share-buttons {
  display: flex;
  gap: 8px;
  margin: 4px 0 8px;
}

.copy-code-btn {
  display: inline-block;
  background: var(--green-pale);
  border: 1px solid var(--green-lighter);
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}
.copy-code-btn:hover {
  background: var(--green-lighter);
}
.lobby-player-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.lobby-player-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--green-palest);
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius-sm);
  font-size: 15px;
}
.lobby-player-item.me {
  border-color: var(--green);
  background: var(--green-pale);
}
.ready-badge {
  margin-left: auto;
  font-size: 16px;
}
.ready-badge.ready {
  color: var(--green-dark);
}
.lobby-host-panel {
  margin-bottom: 12px;
  padding: 16px;
  background: var(--green-pale);
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius);
}
.lobby-host-panel.hidden {
  display: none;
}

/* ---------- Online: Lobby configuration (ISSUE-27) ---------- */
.lobby-settings-panel {
  margin-bottom: 12px;
  padding: 14px 16px;
  background: var(--green-palest);
  border: 2px dashed var(--green-lighter);
  border-radius: var(--radius);
}
.lobby-settings-panel.hidden {
  display: none;
}
.lobby-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.lobby-settings-live {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--green-dark);
  background: var(--green-pale);
  border: 1px solid var(--green-lighter);
  border-radius: 10px;
  padding: 2px 8px;
}
.lobby-settings-summary {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--green-dark);
}
.lobby-settings-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}
.lobby-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--white);
  border: 1px solid var(--green-lighter);
  border-radius: var(--radius-sm);
}
.lobby-settings-row-wide {
  grid-column: 1 / -1;
}
.lobby-settings-row-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.lobby-settings-row-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-dark);
}

.mode-toggle-group {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.mode-toggle-btn {
  flex: 1;
  background: var(--white);
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.mode-toggle-btn small {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-mid);
}
.mode-toggle-btn.active {
  border-color: var(--green);
  background: var(--green-pale);
  color: var(--green-dark);
}
.mode-toggle-btn:hover:not(.active) {
  border-color: var(--green-light);
}

.host-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.host-config-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.host-config-item.hidden {
  display: none;
}
.host-config-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.host-config-select {
  padding: 6px 8px;
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--white);
  cursor: pointer;
}
.host-config-select:focus {
  outline: none;
  border-color: var(--green);
}

.turn-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--green-pale);
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
}
.turn-indicator.hidden {
  display: none;
}
.turn-indicator .player-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}
.turn-indicator .current-player-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--green-dark);
}

.leave-btn {
  background: linear-gradient(135deg, #e85a4f, #c94a3f);
  margin-top: 8px;
}

/* ---------- Online: Reveal Weather ---------- */
.reveal-weather {
  background: var(--green-pale);
  border: 2px solid var(--green-lighter);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}

/* ---------- Night Mode (Fog of War) ---------- */
.garden-grid.night-mode .grid-tile {
  opacity: 0.15;
  filter: blur(2px);
  transition: opacity 0.2s ease, filter 0.2s ease;
}
.garden-grid.night-mode .grid-tile.night-visible {
  opacity: 1;
  filter: none;
}

/* ---------- Flash Message Animation ---------- */
@keyframes flashIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .garden-layout {
    flex-direction: column;
    align-items: center;
  }
  .garden-left-panel,
  .garden-right-panel {
    flex: 0 0 auto;
    width: 100%;
    max-width: 480px;
  }
  .grid-tile {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }
}

@media (max-width: 560px) {
  .grid-tile {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  .lobby-settings-rows {
    grid-template-columns: 1fr;
  }
  .garden-grid {
    gap: 2px;
    padding: 6px;
  }
  .setup-card,
  .reveal-card,
  .results-card,
  .gameover-card {
    padding: 24px;
  }
}
/* ============================================
   RECONNECT OVERLAY & DISCONNECTED INDICATORS
   ============================================ */

.reconnect-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 20, 10, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  animation: fadeIn 0.3s ease;
}

.reconnect-overlay.hidden {
  display: none;
}

.reconnect-content {
  text-align: center;
  padding: 40px;
}

.reconnect-spinner {
  font-size: 48px;
  animation: spin 1.5s linear infinite;
  margin-bottom: 20px;
}

.reconnect-content p {
  color: #a8c8a8;
  font-size: 16px;
  margin: 0;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Disconnected player indicators */
.lobby-player-item.disconnected {
  opacity: 0.5;
}

.disconnected-badge {
  background: #555 !important;
  color: #aaa !important;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
}

.standing-item.disconnected {
  opacity: 0.5;
}

.standing-item.disconnected .standing-name {
  text-decoration: line-through;
  color: #888;
}
