/* Missing Flag — game styles. Site chrome comes from shared/style.css;
   everything here rides on the shared theme variables. */

.app-container {
  max-width: 960px;
}

.tagline {
  color: var(--color-text-secondary);
  max-width: 560px;
  margin: 0 auto 1.25rem;
}

/* --- score bar --- */

.scorebar {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.score {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.25rem 0.9rem;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.score b {
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

/* --- countdown bar --- */

.countdown {
  height: 4px;
  border-radius: 2px;
  background: var(--color-border);
  overflow: hidden;
  margin-bottom: 1rem;
}

.countdown i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--color-accent);
}

.countdown i.running {
  /* duration set from JS; width animates 100% -> 0 */
  transition-property: width;
  transition-timing-function: linear;
}

/* --- flag cards --- */

.flag-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .flag-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
}

.flag-grid figure {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.75rem;
  transition: transform 0.3s ease, outline-color 0.3s ease;
  outline: 2px solid transparent;
  outline-offset: 2px;
}

/* edge-on while contents are swapped, so the shuffle can't be tracked */
.flag-grid figure.down {
  transform: rotateY(90deg);
}

.flag-grid figure:nth-child(2) { transition-delay: 60ms; }
.flag-grid figure:nth-child(3) { transition-delay: 120ms; }
.flag-grid figure:nth-child(4) { transition-delay: 180ms; }

.flag-grid figure.revealed {
  outline-color: var(--color-accent);
}

.flag-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 204 / 120;
  object-fit: cover;
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

.flag-grid figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  min-height: 2.7em; /* room for two-line names, no layout jump */
  display: flex;
  align-items: center;
  justify-content: center;
}

.flag-grid figcaption.mystery {
  color: var(--color-accent);
  font-size: 1.1rem;
  letter-spacing: 0.2em;
}

/* --- controls --- */

.play-row button {
  min-width: 8rem;
  margin: 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.mode-hint {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.guess-row label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.guess-controls {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  max-width: 420px;
  margin: 0 auto;
}

.guess-controls input {
  flex: 1;
}

.guess-controls button {
  flex-shrink: 0;
}

.result {
  margin-top: 1.25rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.result.ok {
  color: var(--color-accent);
}

/* --- confetti --- */

.confetti {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 999;
}

.confetti i {
  position: absolute;
  top: -3vh;
  left: var(--l);
  width: 8px;
  height: 14px;
  background: var(--c);
  border-radius: 2px;
  opacity: 0;
  animation: confetti-fall var(--d) linear var(--delay) forwards;
}

@keyframes confetti-fall {
  0%   { opacity: 1; transform: translate3d(0, 0, 0) rotate(0deg); }
  100% { opacity: 1; transform: translate3d(var(--sway), 105vh, 0) rotate(var(--spin)); }
}

@media (prefers-reduced-motion: reduce) {
  /* the countdown bar stays animated — it's a timer, not decoration */
  .flag-grid figure { transition: none; }
  .confetti { display: none; }
}
