/* ==========================================================================
   Flag Wheel Hub — homepage, battle mode, flag guess game
   Reuses design tokens from style.css
   ========================================================================== */

.hub-app {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-7);
  padding-top: max(var(--space-4), env(safe-area-inset-top));
}

/* Header */
.hub-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
}

/* Hero */
.hub-hero {
  text-align: center;
  margin-bottom: var(--space-7);
  animation: card-in 500ms var(--ease-out-expo);
}

.hub-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 40px;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-2);
  background: linear-gradient(135deg, var(--coral), var(--honey), var(--mint), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hub-subtitle {
  color: var(--text-muted);
  font-size: 16px;
  margin: 0;
}

/* Sections */
.hub-section {
  margin-bottom: var(--space-7);
}

.hub-section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--space-4);
  padding-left: var(--space-2);
}

/* Solo games grid */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}

.hub-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  text-decoration: none;
  color: var(--text);
  transition: transform var(--dur) var(--ease-out), border-color var(--dur), box-shadow var(--dur);
  animation: card-in 500ms var(--ease-out-expo) both;
}

.hub-card:nth-child(1) { animation-delay: 100ms; }
.hub-card:nth-child(2) { animation-delay: 200ms; }
.hub-card:nth-child(3) { animation-delay: 300ms; }

.hub-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.hub-card:active {
  transform: scale(0.98);
}

.hub-card-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.hub-card-emoji {
  font-size: 36px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.hub-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hub-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  margin: 0 0 var(--space-1);
}

.hub-card-desc {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 var(--space-3);
  flex: 1;
}

.hub-card-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 10px;
  background: rgba(139, 123, 255, 0.15);
  color: var(--violet);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
}

/* Battle mode card */
.hub-battle-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: linear-gradient(135deg, rgba(255, 107, 92, 0.15), rgba(139, 123, 255, 0.15));
  border: 1px solid rgba(255, 107, 92, 0.3);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  text-decoration: none;
  color: var(--text);
  transition: transform var(--dur), border-color var(--dur), box-shadow var(--dur);
  animation: card-in 500ms 400ms var(--ease-out-expo) both;
}

.hub-battle-card:hover {
  transform: translateY(-4px);
  border-color: var(--coral);
  box-shadow: 0 12px 40px rgba(255, 107, 92, 0.25);
}

.hub-battle-card:active {
  transform: scale(0.98);
}

.hub-battle-icon {
  font-size: 48px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

.hub-battle-body {
  flex: 1;
}

.hub-battle-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  margin: 0 0 4px;
}

.hub-battle-desc {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

.hub-battle-arrow {
  font-size: 32px;
  color: var(--coral);
  font-weight: 700;
}

/* Footer */
.hub-footer {
  text-align: center;
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
}

.hub-footer p {
  color: var(--text-dim);
  font-size: 12px;
  margin: 0;
}

/* ==========================================================================
   Battle Mode Screens
   ========================================================================== */

.battle-app {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) var(--space-7);
  padding-top: max(var(--space-4), env(safe-area-inset-top));
}

.battle-screen {
  animation: screen-in var(--dur-slow) var(--ease-out-expo);
}

.battle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.battle-back {
  background: none;
  border: none;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  transition: background var(--dur-fast);
}

.battle-back:hover {
  background: var(--bg-elevated);
}

.battle-title-bar {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text-muted);
}

/* Battle choice screen */
.battle-choice {
  text-align: center;
  padding: var(--space-6) 0;
}

.battle-choice h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  margin: 0 0 var(--space-2);
}

.battle-choice p {
  color: var(--text-muted);
  margin: 0 0 var(--space-6);
}

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

.battle-choice-actions .cta {
  width: 100%;
  padding: 16px;
  font-size: 16px;
}

/* Room code display */
.room-code-display {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  text-align: center;
  margin-bottom: var(--space-4);
}

.room-code-label {
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.room-code-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 48px;
  letter-spacing: 0.15em;
  color: var(--coral);
  margin: 0 0 var(--space-3);
  cursor: pointer;
  user-select: all;
}

.room-code-copy-hint {
  font-size: 12px;
  color: var(--text-dim);
}

/* Join room input */
.join-room-input {
  width: 100%;
  padding: 16px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 24px;
  text-align: center;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--bg-elevated);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text);
  margin-bottom: var(--space-3);
}

.join-room-input:focus {
  border-color: var(--coral);
  outline: none;
}

/* Waiting room / players */
.players-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.player-slot {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
  transition: all var(--dur);
}

.player-slot.connected {
  border-color: var(--mint);
}

.player-slot.ready {
  border-color: var(--mint);
  background: rgba(62, 224, 169, 0.1);
}

.player-slot.waiting {
  opacity: 0.5;
}

.player-avatar {
  font-size: 40px;
  margin-bottom: var(--space-2);
}

.player-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}

.player-status {
  font-size: 12px;
  color: var(--text-muted);
}

.player-status.ready-status {
  color: var(--mint);
  font-weight: 600;
}

.ready-button {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  margin-bottom: var(--space-3);
}

.ready-button.is-ready {
  background: var(--mint);
  color: #063a24;
}

/* Battle game selection */
.battle-games-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  text-align: center;
  margin-bottom: var(--space-4);
}

.battle-games-grid {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.battle-game-option {
  background: var(--bg-elevated);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transition: all var(--dur);
  color: var(--text);
  font-family: inherit;
}

.battle-game-option:hover {
  border-color: var(--border-strong);
}

.battle-game-option.selected {
  border-color: var(--coral);
  background: rgba(255, 107, 92, 0.1);
}

.battle-game-option-icon {
  font-size: 32px;
}

.battle-game-option-body {
  flex: 1;
}

.battle-game-option-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 2px;
}

.battle-game-option-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Battle gameplay - opponent progress */
.battle-progress-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.battle-player-progress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.battle-player-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: var(--space-2);
}

.battle-progress-dots {
  display: inline-flex;
  gap: 6px;
}

.battle-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-strong);
  transition: background var(--dur);
}

.battle-dot.correct { background: var(--mint); box-shadow: 0 0 4px rgba(62, 224, 169, 0.6); }
.battle-dot.wrong { background: var(--coral); }
.battle-dot.finished { border: 2px solid var(--honey); box-sizing: border-box; }

/* Battle result */
.battle-result {
  text-align: center;
  padding: var(--space-6) 0;
}

.battle-result-verdict {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 36px;
  margin-bottom: var(--space-2);
}

.battle-result-verdict.win { color: var(--mint); }
.battle-result-verdict.loss { color: var(--coral); }
.battle-result-verdict.tie { color: var(--honey); }

.battle-result-sub {
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}

.battle-result-scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.battle-score-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.battle-score-card.winner {
  border-color: var(--mint);
  background: rgba(62, 224, 169, 0.1);
}

.battle-score-name {
  font-family: var(--font-display);
  font-weight: 600;
  margin-bottom: 4px;
}

.battle-score-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  color: var(--text);
}

.battle-score-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Config error banner */
.config-error {
  background: rgba(255, 107, 92, 0.1);
  border: 1px solid var(--coral);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  color: var(--coral);
  font-size: 14px;
}

.config-error code {
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ==========================================================================
   Flag Guess Game
   ========================================================================== */

.fg-app {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) var(--space-7);
  padding-top: max(var(--space-4), env(safe-area-inset-top));
}

.fg-screen {
  animation: screen-in var(--dur-slow) var(--ease-out-expo);
}

.fg-progress {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: var(--space-4);
}

.fg-progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-strong);
}

.fg-progress-dot.current { background: var(--coral); box-shadow: 0 0 6px rgba(255, 107, 92, 0.5); }
.fg-progress-dot.correct { background: var(--mint); }
.fg-progress-dot.wrong { background: var(--coral); }

.fg-round-info {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: var(--space-4);
}

.fg-flag-container {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-5);
  animation: flag-in 700ms var(--ease-out-expo);
}

.fg-flag-frame {
  padding: 10px;
  background: linear-gradient(160deg, #f6f7fb 0%, #dfe2ec 100%);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.55),
    0 4px 10px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  line-height: 0;
}

.fg-flag-image {
  display: block;
  width: min(300px, 78vw);
  height: auto;
  max-height: 220px;
  object-fit: contain;
  border-radius: 6px;
  background: #ffffff;
}

.fg-hint {
  background: rgba(255, 176, 32, 0.1);
  border: 1px solid rgba(255, 176, 32, 0.3);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
  animation: hint-in 350ms var(--ease-out-expo);
}

.fg-hint-label {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--honey);
  margin-bottom: 4px;
}

.fg-hint-text {
  color: var(--text);
  font-size: 15px;
}

.fg-hint-btn {
  width: 100%;
  padding: 12px;
  background: rgba(139, 123, 255, 0.08);
  border: 1px dashed rgba(139, 123, 255, 0.4);
  color: var(--violet);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: var(--space-3);
  transition: background var(--dur-fast);
  font-family: inherit;
  font-size: 14px;
}

.fg-hint-btn:hover:not(:disabled) { background: rgba(139, 123, 255, 0.15); }
.fg-hint-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Multiple choice buttons — 2 per row grid (v5) */
.fg-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
@media (max-width: 360px) {
  .fg-choices { grid-template-columns: 1fr; }
}

.fg-choice-btn {
  background: var(--bg-elevated);
  border: 2px solid var(--border-subtle);
  color: var(--text);
  padding: 16px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur);
  text-align: left;
}

.fg-choice-btn:hover:not(:disabled) {
  border-color: var(--violet);
  background: var(--bg-card);
}

.fg-choice-btn.correct {
  background: rgba(62, 224, 169, 0.15);
  border-color: var(--mint);
  color: var(--mint);
}

.fg-choice-btn.wrong {
  background: rgba(255, 107, 92, 0.15);
  border-color: var(--coral);
  color: var(--coral);
}

.fg-choice-btn:disabled { cursor: not-allowed; }

/* Session summary */
.fg-summary {
  text-align: center;
  padding: var(--space-6) 0;
}

.fg-summary-verdict {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 36px;
  margin-bottom: var(--space-2);
}

.fg-summary-verdict.great { color: var(--mint); }
.fg-summary-verdict.good { color: var(--honey); }
.fg-summary-verdict.ok { color: var(--violet); }

.fg-summary-score {
  font-family: var(--font-mono);
  font-size: 24px;
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}

.fg-summary-breakdown {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  text-align: left;
}

.fg-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.fg-summary-row:last-child { border-bottom: none; }

.fg-summary-row-label { color: var(--text-muted); font-size: 13px; }
.fg-summary-row-value { color: var(--text); font-weight: 600; }

/* Continent picker for flag guess */
.fg-continents {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.fg-continent-btn {
  background: var(--bg-elevated);
  border: 2px solid var(--border-subtle);
  color: var(--text);
  padding: 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--dur-fast);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
}

.fg-continent-btn.selected {
  border-color: var(--coral);
  background: rgba(255, 107, 92, 0.1);
}

.fg-continent-btn:active {
  transform: scale(0.98);
}

/* Responsive */
@media (max-width: 480px) {
  .hub-title { font-size: 32px; }
  .hub-grid { grid-template-columns: 1fr; }
  .players-panel { grid-template-columns: 1fr; }
  .battle-result-scores { grid-template-columns: 1fr; }
}

/* ==========================================================================
   NEW STYLES for v3 — Settings, name entry, timer, round progress, daily
   ========================================================================== */

/* Global settings floating button */
.global-settings-btn {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: transform var(--dur-fast), background var(--dur-fast);
}
.global-settings-btn:hover { background: var(--bg-card); transform: scale(1.05); }
.global-settings-btn:active { transform: scale(0.95); }

/* Settings modal overlay */
.settings-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 38, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  animation: overlay-in var(--dur) var(--ease-out);
}

.settings-modal-sheet {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  animation: sheet-up var(--dur-slow) var(--ease-out-expo);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
}

.settings-modal-handle {
  width: 36px; height: 4px;
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  margin: 0 auto var(--space-3);
}

.settings-modal-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  margin: 0 0 var(--space-4);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}

.settings-row:last-of-type { border-bottom: none; }
.settings-row-text { flex: 1; }
.settings-row-name { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.settings-row-desc { font-size: 12px; color: var(--text-muted); }

.settings-name-input {
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.settings-name-input:focus { border-color: var(--mint); outline: none; }

.settings-toggle {
  appearance: none;
  width: 44px; height: 26px;
  background: var(--border-subtle);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background var(--dur-fast);
  flex-shrink: 0;
}
.settings-toggle::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: var(--text);
  border-radius: 50%;
  transition: transform var(--dur-fast) var(--ease-out);
}
.settings-toggle:checked { background: var(--mint); }
.settings-toggle:checked::after { transform: translateX(18px); }

.settings-modal-actions { margin-top: var(--space-4); }

/* Name entry screen (battle mode) */
.name-entry-screen {
  text-align: center;
  padding: var(--space-6) 0;
}

.name-entry-input {
  width: 100%;
  padding: 16px 20px;
  font-size: 18px;
  text-align: center;
  background: var(--bg-elevated);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text);
  margin-bottom: var(--space-4);
  font-family: inherit;
}
.name-entry-input:focus { border-color: var(--coral); outline: none; }

/* Round progress bar */
.round-progress-bar {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: var(--space-3);
}

.round-dot {
  width: 24px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  transition: background var(--dur);
}
.round-dot.current { background: var(--text-muted); box-shadow: 0 0 8px rgba(255, 255, 255, 0.35); }
.round-dot.done { background: var(--mint); }

.round-info {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: var(--space-3);
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
}

/* Timer */
.timer-display {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--space-3);
}

.timer-circle {
  position: relative;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.timer-track {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 4;
}

.timer-ring {
  fill: none;
  stroke: var(--mint);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.timer-ring.warning { stroke: var(--honey); }
.timer-ring.danger { stroke: var(--coral); }

.timer-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  z-index: 1;
}

.timer-value.warning { color: var(--honey); }
.timer-value.danger { color: var(--coral); }

/* Battle waiting-for-opponent overlay */
.waiting-opponent {
  text-align: center;
  padding: var(--space-4);
  background: rgba(139, 123, 255, 0.1);
  border: 1px solid rgba(139, 123, 255, 0.3);
  border-radius: var(--radius-md);
  margin-top: var(--space-3);
  color: var(--violet);
  font-size: 14px;
  font-weight: 500;
}

.waiting-opponent .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(139, 123, 255, 0.3);
  border-top-color: var(--violet);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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

/* Battle attempts dots — new visual per requirements */
.battle-attempts-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.battle-attempt-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-strong);  /* grey = pending */
  transition: all var(--dur);
}
.battle-attempt-dot.current {
  background: var(--text-muted);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
  animation: pulse-current 1.2s ease-in-out infinite;
}
.battle-attempt-dot.wrong { background: var(--coral); }
.battle-attempt-dot.correct {
  background: var(--mint);
  box-shadow: 0 0 6px rgba(62, 224, 169, 0.6);
}

@keyframes pulse-current {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Daily challenge card (Flag Guess) */
.daily-challenge-card {
  background: linear-gradient(160deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  text-align: center;
  box-shadow: var(--shadow-lifted);
  margin-bottom: var(--space-4);
}

.daily-challenge-label {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--violet);
  padding: 4px 10px;
  background: rgba(139, 123, 255, 0.12);
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-3);
}

.daily-challenge-preview {
  display: flex;
  justify-content: center;
  margin: 0 auto var(--space-3);
}

.daily-challenge-flag-preview {
  width: 80px;
  height: 60px;
  border-radius: 6px;
  background: #fff;
  padding: 4px;
  border: 1px solid var(--border-subtle);
  filter: blur(6px);
  transition: filter var(--dur-slow);
}

.daily-challenge-flag-preview.completed { filter: none; }

.daily-challenge-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  margin: 0 0 var(--space-1);
}

.daily-challenge-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 var(--space-4);
}

/* Result winner banner */
.winner-banner {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: var(--mint);
  color: #063a24;
  margin-top: 8px;
}

/* Battle round summary card (between rounds) */
.round-summary {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-top: var(--space-3);
  text-align: center;
}
.round-summary-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  margin-bottom: var(--space-1);
}
.round-summary-answer {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: var(--space-2);
}
.round-summary-answer strong { color: var(--text); }

/* Autocomplete positioning fix for embedded games */
.embedded-input-wrapper {
  position: relative;
}
.embedded-input-wrapper .autocomplete-dropdown {
  z-index: 30;
}

/* ==========================================================================
   v4 STYLES — Config screen, round-dot won/lost, MC toggle, hint bar,
   correct-flash animation, session-time display
   ========================================================================== */

/* Round dot outcome colours (grey/red/green per spec) */
.round-dot.won  { background: var(--mint); box-shadow: 0 0 6px rgba(62, 224, 169, 0.6); }
.round-dot.lost { background: var(--coral); box-shadow: 0 0 4px rgba(255, 107, 92, 0.4); }
/* .current + .done stay from v3 */

/* Config screen sections */
.fg-config-section {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 20px 0 12px;
}

.fg-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.fg-config-btn {
  padding: 14px 12px;
  background: var(--bg-elevated);
  border: 2px solid var(--border-subtle);
  color: var(--text);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--dur-fast);
}
.fg-config-btn:hover { border-color: var(--border-strong); }
.fg-config-btn.selected {
  border-color: var(--coral);
  background: rgba(255, 107, 92, 0.1);
  color: var(--coral);
}
.fg-config-btn:active { transform: scale(0.97); }

/* Multiple-choice toggle (checkbox at start of Flag Guess config) */
.fg-mc-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  cursor: pointer;
}
.fg-mc-toggle input[type="checkbox"] {
  appearance: none;
  width: 0; height: 0;
  position: absolute;
  opacity: 0;
}
.fg-mc-toggle-visual {
  width: 44px; height: 26px;
  background: var(--border-strong);
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  transition: background var(--dur-fast);
}
.fg-mc-toggle-visual::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: var(--text);
  border-radius: 50%;
  transition: transform var(--dur-fast) var(--ease-out);
}
.fg-mc-toggle input[type="checkbox"]:checked + .fg-mc-toggle-visual { background: var(--mint); }
.fg-mc-toggle input[type="checkbox"]:checked + .fg-mc-toggle-visual::after { transform: translateX(18px); }
.fg-mc-toggle-text { flex: 1; }
.fg-mc-toggle-name { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.fg-mc-toggle-desc { font-size: 12px; color: var(--text-muted); }

/* Hint action bar (dual buttons) */
.fg-hint-actions {
  display: flex;
  gap: 8px;
  margin-bottom: var(--space-3);
}
.fg-hint-actions .fg-hint-btn {
  flex: 1;
  margin: 0;
}

/* Correct-flash visual effect */
.fg-flag-frame { position: relative; }
.fg-correct-flash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  background: rgba(62, 224, 169, 0.3);
  border-radius: 6px;
  pointer-events: none;
}
.fg-correct-flash.animate {
  animation: correct-pulse 900ms var(--ease-out-expo);
}
@keyframes correct-pulse {
  0%   { opacity: 0; transform: scale(0.5); }
  30%  { opacity: 1; transform: scale(1.1); }
  60%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.2); }
}

/* Brand header link (Flag Guess uses logo instead of back button) */
.brand-header-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-header-link:hover .brand-word {
  color: var(--coral);
}

/* ==========================================================================
   v5 STYLES — per-round summary list, avatar picker, session config for
   Flag Wheel + Capital Quiz, battle round-outcome dots
   ========================================================================== */

/* Per-round summary list (Flag Guess / Flag Wheel / Capital Quiz) */
.round-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: var(--space-4) 0;
}

.round-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-left-width: 4px;
  border-radius: var(--radius-md);
}
.round-list-item.correct { border-left-color: var(--mint); background: rgba(62, 224, 169, 0.08); }
.round-list-item.wrong   { border-left-color: var(--coral); background: rgba(255, 107, 92, 0.08); }

.round-list-visual {
  flex-shrink: 0;
  width: 48px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
}
.round-list-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.round-list-visual canvas {
  width: 32px;
  height: 32px;
}

.round-list-body {
  flex: 1;
  min-width: 0;
}
.round-list-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.round-list-sub {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.round-list-icon {
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 700;
}
.round-list-item.correct .round-list-icon { color: var(--mint); }
.round-list-item.wrong   .round-list-icon { color: var(--coral); }

/* Round list header */
.round-list-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: var(--space-5) 0 var(--space-2);
  text-align: left;
}

/* ---------- Avatar picker (Battle Mode) ---------- */
.avatar-picker-label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 20px 0 10px;
  text-align: left;
}

.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: var(--space-4);
}

.avatar-picker-btn {
  aspect-ratio: 1;
  background: var(--bg-elevated);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 28px;
  cursor: pointer;
  transition: all var(--dur-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.avatar-picker-btn:hover { border-color: var(--border-strong); }
.avatar-picker-btn.selected {
  border-color: var(--coral);
  background: rgba(255, 107, 92, 0.1);
  transform: scale(1.05);
}
.avatar-picker-btn:active { transform: scale(0.95); }

/* Round-outcome dots in battle (grey/red/green) */
.battle-round-outcome-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: var(--space-3);
}
.battle-round-outcome {
  width: 24px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  transition: background var(--dur);
}
.battle-round-outcome.win  { background: var(--mint); box-shadow: 0 0 6px rgba(62, 224, 169, 0.6); }
.battle-round-outcome.loss { background: var(--coral); box-shadow: 0 0 4px rgba(255, 107, 92, 0.4); }
.battle-round-outcome.draw { background: var(--text-muted); }
.battle-round-outcome.current { background: var(--text-muted); box-shadow: 0 0 8px rgba(255, 255, 255, 0.35); }

/* Battle result score card win/loss highlight */
.battle-score-card.winner-highlight {
  border-color: var(--mint);
  background: rgba(62, 224, 169, 0.12);
}
.battle-score-card.loser-highlight {
  border-color: var(--coral);
  background: rgba(255, 107, 92, 0.10);
}

/* Result screen small avatar next to name */
.battle-score-avatar {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 4px;
}

/* Play-again section in Flag Wheel session summary */
.fw-summary-actions {
  display: flex;
  gap: 8px;
  margin-top: var(--space-4);
}

/* ==========================================================================
   v5.2 — Progressive hints (battle Flag Wheel), battle results table,
   daily-result badge (Flag Guess), All-Countries mode adjustments
   ========================================================================== */

/* Battle Flag Wheel progressive hint bar (after wrong attempts) */
.battle-hint-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0;
}
.battle-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text);
  animation: hint-in var(--dur) var(--ease-out);
}
.battle-hint-label {
  padding: 2px 8px;
  background: var(--honey);
  color: #1a0f00;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.battle-hint-text { flex: 1; }
.battle-hint-text strong { color: var(--honey); }

/* Battle result table (after Home + Rematch) */
.battle-results-table {
  margin-top: 20px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elevated);
}
.battle-results-row {
  display: grid;
  grid-template-columns: 28px 78px 1fr 56px 56px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.battle-results-row:last-child { border-bottom: none; }
.battle-results-head {
  background: var(--bg-card);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.brr-cell { min-width: 0; overflow: hidden; }
.brr-round { text-align: center; color: var(--text-muted); }
.brr-flag { display: flex; align-items: center; gap: 6px; }
.brr-flag img { width: 40px; height: 26px; object-fit: cover; border-radius: 3px; flex: none; }
.brr-country { font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.brr-me, .brr-opp { text-align: center; font-family: var(--font-mono); }
.brr-tick { color: var(--mint); font-weight: 700; }
.brr-cross { color: var(--coral); font-weight: 700; }
.brr-att { color: var(--text-muted); font-size: 11px; }
.brr-none { color: var(--text-dim); }

/* Daily result badge (Flag Guess) */
.fg-daily-badge {
  border: 1px solid transparent;
}
.fg-daily-badge.correct {
  background: rgba(62, 224, 169, 0.15);
  border-color: var(--mint);
  color: var(--mint);
}
.fg-daily-badge.wrong {
  background: rgba(255, 107, 92, 0.15);
  border-color: var(--coral);
  color: var(--coral);
}

/* Round list item: an inline flag next to the wheel */
.round-list-item .round-list-visual img {
  width: 100%;
  height: auto;
  max-height: 32px;
  object-fit: cover;
  border-radius: 3px;
}
