html {
  min-width: 320px;
}

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; 
}

body { 
  --europe-map-width: min(150vw, 1100px);
  min-width: 320px;
  background-color: #f0f7ff;
  background-image:
    radial-gradient(circle at 50% 15%, rgba(219, 234, 254, 0.34) 0%, rgba(239, 246, 255, 0.4) 50%, rgba(248, 250, 252, 0.48) 100%),
    url("../assets/maps/europe-map.svg");
  background-repeat: no-repeat, no-repeat;
  background-position: center top, center 130px;
  background-size: cover, var(--europe-map-width) auto;
  background-attachment: fixed, fixed;
  color: #1e293b; 
  min-height: 100vh; 
  padding-bottom: 40px;
}

body.home-screen-active {
  background-image:
    radial-gradient(circle at 50% 12%, rgba(219, 234, 254, 0.72) 0%, rgba(239, 246, 255, 0.86) 48%, rgba(248, 250, 252, 0.98) 100%);
  background-attachment: fixed;
}

.app-status {
  max-width: 800px;
  margin: 12px auto;
  padding: 10px 16px;
  border: 1px solid #93c5fd;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 600;
}

.app-status-error {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  pointer-events: none;
  z-index: 9999;
}

/* BARRA SUPERIOR BLANCA (TOP BAR) */
.top-bar {
  background: #ffffff;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 81, 175, 0.08);
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 500;
  flex-wrap: wrap;
  gap: 12px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.app-title {
  font-size: 1.25rem;
  color: #0051af;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 700;
}

.badge-score,
.badge-level,
.lives-container,
.diff-toggle-wrapper,
.btn-about,
.language-selector-wrapper {
  height: 40px;
  min-height: 40px;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.lives-container {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 20px;
}

.heart {
  font-size: 1.3rem;
  transition: transform 0.2s, opacity 0.2s;
}

.heart.lost {
  opacity: 0.25;
  filter: grayscale(100%);
  transform: scale(0.8);
}

/* INTERRUPTOR DESLIZANTE DE DIFICULTAD GLOBAL (SLIDING TOGGLE SWITCH) */
.diff-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
}

.diff-label {
  font-size: inherit;
  font-weight: 700;
  color: inherit;
  transition: color 0.2s;
  user-select: none;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #0051af;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

input:checked + .slider {
  background-color: #FFD200;
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.btn-about {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.language-selector-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 20px;
}

.language-selector {
  max-width: 90px;
  padding: 3px 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.language-selector:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.btn-about:hover {
  box-shadow: 0 2px 8px rgba(3, 105, 161, 0.18);
}

/* SELECTOR DE MODOS DE JUEGO (DEBAJO DEL HEADER) */
.mode-selector-wrapper {
  max-width: 800px;
  margin: 20px auto 15px auto;
  padding: 0 15px;
  width: 100%;
}

.mode-selector {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-mode {
  padding: 10px 18px;
  border-radius: 20px;
  border: 2px solid #0051af;
  background: white;
  color: #0051af;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0,81,175,0.1);
}

.btn-mode.active, .btn-mode:hover {
  background: #0051af;
  color: white;
  box-shadow: 0 4px 12px rgba(0,81,175,0.25);
}

body.hard-mode .btn-mode.active,
body.hard-mode .btn-mode:hover {
  background: #FFD200;
  color: #003d84;
  border-color: #e6bd00;
  box-shadow: 0 4px 12px rgba(230,189,0,0.25);
}

/* CONTENEDOR PRINCIPAL - TARJETA CENTRADA */
.main-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 15px;
}

.home-page {
  max-width: 1120px;
  margin: 28px auto 0;
  padding: 0 20px;
}

.home-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(30px, 6vw, 68px);
  border: 1px solid rgba(147, 197, 253, 0.65);
  border-radius: 28px;
  background:
    radial-gradient(ellipse at 92% 8%, rgba(255, 210, 0, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(239, 246, 255, 0.94));
  box-shadow: 0 20px 60px rgba(0, 61, 132, 0.12);
  text-align: center;
}

.home-brand-logo {
  display: block;
  width: clamp(140px, 22vw, 220px);
  height: auto;
  margin: 0 auto 20px;
}

.home-eyebrow,
.home-section-heading > span {
  color: #0369a1;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-hero h2 {
  max-width: 900px;
  margin-right: auto;
  margin-left: auto;
  margin-top: 16px;
  color: #003d84;
  font-size: clamp(2.2rem, 5vw, 4.1rem);
  font-weight: 850;
  letter-spacing: -0.045em;
  line-height: 1.06;
}

.home-lead,
.home-mission {
  max-width: 900px;
  margin-right: auto;
  margin-left: auto;
  color: #334155;
  font-size: clamp(1rem, 1.6vw, 1.16rem);
  line-height: 1.8;
}

.home-lead {
  margin-top: 22px;
}

.home-mission {
  margin-top: 12px;
}

.home-cta {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  margin-top: 28px;
  padding: 15px 22px;
  border: 0;
  border-radius: 14px;
  background: #0051af;
  box-shadow: 0 8px 18px rgba(0, 81, 175, 0.2);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 800;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.home-cta:hover {
  transform: translateY(-2px);
  background: #003d84;
  box-shadow: 0 12px 24px rgba(0, 81, 175, 0.25);
}

.home-cta:focus-visible {
  outline: 3px solid #facc15;
  outline-offset: 3px;
}

.home-cta span {
  font-size: 1.3rem;
}

.home-feature-cta {
  justify-content: center;
  width: 100%;
  margin-top: 18px;
  padding: 12px 10px;
  gap: 10px;
  font-size: 0.9rem;
}

.home-invitation {
  margin-top: 15px;
  color: #64748b;
  font-size: 0.92rem;
}

.home-discoveries {
  padding: clamp(36px, 6vw, 64px) 0 48px;
}

.home-section-heading {
  margin-bottom: 22px;
  text-align: center;
}

.home-section-heading h2 {
  margin-top: 8px;
  color: #0f172a;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  letter-spacing: -0.025em;
}

.home-section-heading p {
  margin-top: 8px;
  color: #475569;
  line-height: 1.6;
}

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.home-feature {
  min-height: 225px;
  padding: 20px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.home-feature-available {
  border-color: #93c5fd;
  box-shadow: 0 8px 24px rgba(0, 81, 175, 0.09);
}

.home-feature-icon {
  display: block;
  margin-bottom: 14px;
  font-size: 1.8rem;
}

.home-feature-status {
  display: inline-block;
  margin-bottom: 10px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.home-feature-available .home-feature-status {
  color: #0369a1;
}

.home-feature h3 {
  color: #0f172a;
  font-size: 1.02rem;
  line-height: 1.35;
}

.home-feature p {
  margin-top: 8px;
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.55;
}

.site-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  max-width: 1120px;
  margin: 24px auto 0;
  padding: 22px 24px;
  border-top: 1px solid rgba(148, 163, 184, 0.4);
  color: #475569;
  font-size: 0.84rem;
}

.site-footer-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
}

.footer-logo {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.site-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.site-footer-links button {
  border: 0;
  background: none;
  color: #0051af;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer-links button:hover {
  color: #003d84;
}

.site-footer-copyright {
  justify-self: end;
}

.game-card {
  background: rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(1px);
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(0, 81, 175, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(226, 232, 240, 0.8);
  position: relative;
  overflow: hidden;
}

.game-card.game-over-active {
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  border-color: transparent;
}

.game-card.game-over-active > [id$="-game-board"] {
  visibility: hidden;
}

#view-mode4 {
  position: relative;
  left: 50%;
  width: min(1200px, calc(100vw - 30px));
  transform: translateX(-50%);
}

.puzzle-game-board {
  position: relative;
}

.puzzle-status {
  min-height: 24px;
  margin: 0 0 14px;
  color: #334155;
  font-weight: 600;
}

.puzzle-status.correct,
.puzzle-status.incorrect {
  padding: 12px;
  border: 1px solid;
  border-radius: 12px;
}

.puzzle-status.correct { background: #dcfce7; color: #15803d; border-color: #86efac; }
.puzzle-status.incorrect { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

.puzzle-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 18px;
  align-items: start;
}

.puzzle-map-container {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: 12px;
  background: #fff;
}

.puzzle-map {
  display: block;
  width: 100%;
  max-height: 68vh;
}

.puzzle-country-target {
  cursor: pointer;
  transition: fill 180ms ease, stroke 180ms ease;
}

.puzzle-country-target:not(.placed):hover,
.puzzle-country-target:not(.placed):focus {
  fill: #dbeafe;
  stroke: #0051af;
  stroke-width: 2.5;
  outline: none;
}

.puzzle-map-label {
  fill: #0f172a;
  font-size: 8px;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 2.5px;
  stroke-linejoin: round;
  pointer-events: none;
}

.puzzle-tray {
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: 12px;
  background: #fff;
}

.puzzle-tray h3 {
  margin-bottom: 10px;
  color: #0051af;
  font-size: 1rem;
}

.puzzle-pieces {
  display: grid;
  gap: 7px;
  max-height: 62vh;
  overflow: auto;
  padding: 2px;
}

.puzzle-piece {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 40px;
  padding: 6px 9px;
  border: 1px solid #bfdbfe;
  border-radius: 9px;
  background: #fff;
  color: #1e293b;
  font-weight: 700;
  text-align: left;
  cursor: grab;
  touch-action: none;
}

.puzzle-piece:hover,
.puzzle-piece.selected {
  border-color: #0051af;
  background: #eff6ff;
}

.puzzle-piece img {
  width: 28px;
  height: 19px;
  object-fit: cover;
  border: 1px solid #cbd5e1;
}

.puzzle-pieces.hard-mode {
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
}

.puzzle-pieces.hard-mode .puzzle-piece {
  justify-content: center;
  min-height: 48px;
  padding: 8px;
}

.puzzle-pieces.hard-mode .puzzle-piece img {
  width: 34px;
  height: 23px;
}

.puzzle-game-over {
  position: absolute;
  inset: 30px 0 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(2px);
}

.puzzle-game-over .overlay-content {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.18);
}

.puzzle-drag-preview {
  position: fixed;
  z-index: 10000;
  width: 180px;
  pointer-events: none;
  opacity: 0.88;
  transform: translate(-50%, -50%);
}

.puzzle-victory {
  display: flex;
  justify-content: center;
  align-items: stretch;
  margin-top: 14px;
  padding: 20px;
  border-radius: 14px;
}

.puzzle-victory-content {
  max-width: 440px;
  padding: 24px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.18);
  text-align: center;
}

.puzzle-victory-content h2 {
  margin: 8px 0;
  color: #0051af;
}

.puzzle-victory-content p {
  margin-bottom: 18px;
}

.puzzle-victory-flag {
  font-size: 3rem;
}

.puzzle-eu-stars path {
  fill: #ffcc00;
  stroke: #003399;
  stroke-width: 0.8;
}

.start-screen {
  text-align: center;
  padding: 20px 10px;
}

.start-icon {
  font-size: 3.5rem;
  margin-bottom: 10px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.start-screen h2 {
  color: #0051af;
  font-size: 1.6rem;
  margin-bottom: 10px;
}

.start-screen p {
  color: #475569;
  font-size: 1.02rem;
  line-height: 1.5;
  margin-bottom: 22px;
}

.btn-start-game {
  padding: 15px 32px;
  background: #0051af;
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 81, 175, 0.3);
}

.btn-start-game:hover {
  background: #003d84;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 81, 175, 0.4);
}

.btn-start-game:active {
  background: #003d84;
  transform: translateY(0);
}

.btn-start-game:disabled {
  cursor: wait;
  opacity: 0.65;
}

.levels-heading {
  margin-top: 18px;
  color: #0051af;
  font-size: 1.05rem;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid #0051af;
  outline-offset: 3px;
}

.card-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.timer-badge {
  background: #e0f2fe;
  color: #0369a1;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.95rem;
}

.timer-badge.warning {
  background: #fee2e2;
  color: #dc2626;
  animation: pulse 0.8s infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

.timer-bar-container {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  margin-bottom: 22px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: #0051af;
  border-radius: 3px;
  transition: width 0.1s linear, background-color 0.3s;
}

.timer-bar.warning {
  background: #ef4444;
}

.card-score-info {
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.prompt-box {
  width: 100%;
  text-align: center;
  margin-bottom: 22px;
}

.prompt-tag {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #0284c7;
  font-weight: 700;
  background: #f0f9ff;
  padding: 4px 12px;
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 8px;
}

.prompt-box h2 {
  width: 100%;
  font-size: 1.75rem;
  color: #0f172a;
  margin-top: 4px;
  line-height: 1.25;
  font-weight: 800;
}

#m2-country-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.country-question {
  display: block;
  max-width: 100%;
  font-size: clamp(0.9rem, 3.5vw, 1.75rem);
  white-space: nowrap;
}

.country-answer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  font-size: 0.9em;
}

#m2-country-name .country-label {
  width: auto;
  flex-wrap: nowrap;
}

.country-question-mark {
  flex: 0 0 auto;
}

.instruction-sub {
  font-size: 0.92rem;
  color: #64748b;
  margin-top: 6px;
}

.easy-hint-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  margin-top: 10px;
  text-align: center;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 520px) {
  .options-grid { grid-template-columns: 1fr; }
}

.country-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.country-flag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 20px;
}

.country-flag img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
}

.country-flag-fallback {
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.2rem;
  line-height: 1;
}

.country-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #1e293b;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.country-name {
  white-space: nowrap;
}

.btn-option {
  padding: 15px 14px;
  border-radius: 14px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

.btn-option:hover:not(:disabled) {
  border-color: #0051af;
  background: #f0f7ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,81,175,0.12);
}

.btn-option.correct {
  background: #10b981 !important;
  color: white !important;
  border-color: #059669 !important;
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

.btn-option.incorrect {
  background: #ef4444 !important;
  color: white !important;
  border-color: #dc2626 !important;
  box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0;
}

@media (max-width: 480px) {
  .checklist-grid { grid-template-columns: 1fr; }
}

.checklist-item {
  padding: 14px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  cursor: pointer;
  background: #ffffff;
  font-weight: 700;
  color: #334155;
  transition: all 0.2s ease;
  user-select: none;
}

.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #0051af;
  cursor: pointer;
  margin-right: 6px;
}

.checklist-item:hover {
  border-color: #93c5fd;
  background: #f0f7ff;
}

.checklist-item.selected {
  border-color: #0051af;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(0, 81, 175, 0.15);
  color: #0051af;
}

.checklist-desc {
  font-size: 0.8rem;
  font-weight: 400;
  color: #64748b;
  margin-top: 2px;
}

.reveal-panel {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  padding: 20px;
  margin-top: 20px;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.status-banner {
  font-size: 1.3rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 15px;
  padding: 12px;
  border-radius: 12px;
}

.status-banner.correct { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.status-banner.incorrect { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

.country-reveal-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.status-banner .country-label {
  width: auto;
}

.reveal-details .detail-block { margin-bottom: 12px; }
.reveal-details h4 { color: #0051af; font-size: 0.95rem; margin-bottom: 4px; font-weight: 700; }
.reveal-details p { font-size: 0.95rem; color: #334155; line-height: 1.4; }
.sub-text { font-size: 0.9rem; color: #64748b; font-style: italic; margin-top: 3px; }
.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  margin-top: 10px;
  color: #475569;
}

.country-memberships {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-next {
  width: 100%;
  padding: 15px;
  background: #0051af;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  margin-top: 16px;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0,81,175,0.25);
}

.btn-next:hover {
  background: #003d84;
  transform: translateY(-1px);
}

.overlay-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(1px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn 0.3s ease;
}

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

.overlay-content {
  text-align: center;
  max-width: 420px;
  padding: 20px;
}

.overlay-content h2 {
  font-size: 2rem;
  color: #dc2626;
  margin-bottom: 10px;
  font-weight: 900;
}

.overlay-content p {
  color: #475569;
  font-size: 1.05rem;
  margin-bottom: 16px;
}

.final-score {
  font-size: 1.25rem;
  background: #FFD200;
  padding: 10px 20px;
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 20px;
  color: #1e293b;
}

.btn-restart {
  padding: 14px 28px;
  background: #0051af;
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,81,175,0.25);
  transition: all 0.2s;
}

.btn-restart:hover {
  background: #003d84;
  transform: translateY(-2px);
}

.trophy-badge {
  font-size: 4rem;
  margin-bottom: 10px;
  animation: bounce 1.5s infinite;
}

.victory-title {
  color: #059669 !important;
}

/* MODAL ABOUT */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 15px;
}

.modal-box {
  background: white;
  border-radius: 20px;
  max-width: 540px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: popIn 0.25s ease;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  background: #0051af;
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 800;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.modal-close-btn:hover {
  opacity: 1;
}

.modal-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-body h4 {
  color: #0f172a;
  margin-bottom: 4px;
}

.about-brand-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.about-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.about-brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
}

.modal-version {
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.3;
  text-align: right;
}

.games-about-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 22px;
  padding-left: 22px;
  color: #334155;
  line-height: 1.55;
}

.games-about-list li::marker {
  color: #0051af;
}

.games-about-list strong {
  color: #0f172a;
}

.language-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  color: #0369a1;
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: -0.08em;
  line-height: 1;
}

.site-footer button:focus-visible {
  outline: 2px solid #0051af;
  outline-offset: 3px;
}

.modal-version strong {
  font-weight: 700;
}

.modal-version span {
  font-weight: 700;
}

.modal-divider {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 12px 0;
}

.modal-body p {
  font-size: 0.95rem;
  color: #334155;
  line-height: 1.5;
}

.levels-list-modal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.modal-level-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
}

.level-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.level-item-title {
  font-weight: 800;
  color: #0051af;
  font-size: 0.95rem;
}

.level-item-pts {
  font-size: 0.8rem;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
}

.level-item-desc {
  font-size: 0.88rem;
  color: #475569;
  font-style: italic;
}

.modal-footer {
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  text-align: right;
}

.btn-modal-ok {
  background: #0051af;
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
}

.confirmation-modal-box {
  max-width: 440px;
}

.confirmation-modal-box .modal-body {
  color: #334155;
  font-size: 1rem;
  line-height: 1.6;
}

.confirmation-modal-box .modal-body p {
  margin: 0;
}

.confirmation-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-confirm-cancel,
.btn-confirm-accept {
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.btn-confirm-cancel {
  background: #e2e8f0;
  color: #334155;
}

.btn-confirm-accept {
  background: #0051af;
  color: #fff;
}

.btn-confirm-cancel:focus-visible,
.btn-confirm-accept:focus-visible {
  outline: 3px solid #38bdf8;
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

@media (min-width: 1200px) {
  .mode-selector-wrapper,
  .main-container {
    max-width: 900px;
  }
}

@media (max-width: 900px) {
  .home-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-footer {
    grid-template-columns: 1fr 1fr;
  }

  .site-footer-links {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .site-footer-copyright {
    grid-column: 2;
    grid-row: 1;
  }

  .top-bar {
    position: relative;
    justify-content: center;
    padding: 12px 18px;
  }

  .top-bar-left,
  .top-bar-right {
    width: 100%;
    justify-content: center;
  }

  .mode-selector-wrapper {
    margin-top: 14px;
  }
}

@media (max-width: 600px) {
  body {
    --europe-map-width: max(150vw, 560px);
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    background-attachment: scroll, scroll;
    background-size: cover, var(--europe-map-width) auto;
  }

  .top-bar {
    gap: 10px;
    padding: 12px max(12px, env(safe-area-inset-left));
  }

  .home-page {
    margin-top: 16px;
    padding: 0 12px;
  }

  .home-hero {
    border-radius: 20px;
  }

  .home-brand-logo {
    width: clamp(132px, 42vw, 176px);
    margin-bottom: 16px;
  }

  .home-feature-grid {
    grid-template-columns: 1fr;
  }

  .home-feature {
    min-height: 0;
  }

  .site-footer {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 12px;
    padding-right: 14px;
    padding-left: 14px;
    text-align: center;
  }

  .site-footer-links {
    grid-column: auto;
    grid-row: auto;
    flex-wrap: wrap;
    gap: 10px 18px;
  }

  .site-footer-copyright {
    grid-column: auto;
    grid-row: auto;
    justify-self: center;
  }

  .about-brand-row {
    align-items: flex-start;
  }

  .about-brand-heading {
    font-size: 0.98rem;
  }

  .about-brand-logo {
    width: 32px;
    height: 32px;
  }

  .modal-version {
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  .home-cta {
    padding: 14px 12px;
    font-size: 0.94rem;
  }

  .home-feature-cta {
    padding: 12px 8px;
    font-size: 0.9rem;
  }

  .top-bar-left {
    justify-content: flex-start;
    gap: 8px;
  }

  .app-logo {
    width: 32px;
    height: 32px;
  }

  .app-title {
    font-size: clamp(1rem, 5vw, 1.25rem);
    line-height: 1.2;
  }

  .top-bar-right {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    width: 100%;
  }

  .badge-score {
    justify-content: center;
    flex-wrap: wrap;
    flex: 0 1 auto;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.15;
  }

  .badge-level {
    justify-content: center;
    flex: 0 1 auto;
    max-width: 100%;
    min-width: 0;
    text-align: center;
    line-height: 1.15;
  }

  #current-level-text {
    overflow-wrap: anywhere;
  }

  .lives-container {
    justify-content: center;
  }

  .diff-toggle-wrapper {
    justify-content: center;
    min-width: 0;
    gap: clamp(2px, 1vw, 5px);
  }

  .badge-score,
  .badge-level,
  .lives-container,
  .diff-toggle-wrapper,
  .btn-about,
  .language-selector-wrapper {
    min-width: 0;
    height: 40px;
    min-height: 40px;
    padding: 5px 10px;
    font-size: clamp(0.65rem, 3.4vw, 0.78rem);
  }

  .badge-score {
    align-content: center;
    gap: 2px 4px;
  }

  .badge-score .label {
    overflow-wrap: anywhere;
  }

  .diff-label {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: center;
  }

  .heart {
    font-size: 1.2rem;
  }

  .mode-selector-wrapper {
    margin: 12px auto 8px;
    padding: 0 10px;
  }

  .mode-selector {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .btn-mode {
    min-width: 0;
    min-height: 48px;
    padding: 8px 10px;
    border-radius: 20px;
    font-size: clamp(0.75rem, 3.4vw, 0.9rem);
    line-height: 1.2;
    overflow-wrap: normal;
  }

  #btn-mode3 {
    grid-column: auto;
  }

  #view-mode4 {
    left: auto;
    width: 100%;
    transform: none;
  }

  .puzzle-layout {
    grid-template-columns: 1fr;
  }

  .puzzle-map {
    max-height: none;
  }

  .puzzle-pieces {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 45vh;
  }

  .puzzle-piece {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.85rem;
  }

  .app-status {
    margin: 8px 10px;
    padding: 9px 12px;
    font-size: 0.9rem;
  }

  .main-container {
    width: 100%;
    padding: 0 10px;
  }

  .game-card {
    padding: clamp(14px, 4vw, 20px);
    border-radius: 16px;
  }

  .start-screen {
    padding: 18px 4px;
  }

  .start-screen h2 {
    font-size: clamp(1.25rem, 5vw, 1.55rem);
  }

  .start-screen p {
    font-size: 0.95rem;
  }

  .btn-start-game {
    width: 100%;
    max-width: 360px;
    padding: 14px 16px;
    font-size: 1rem;
  }

  .card-topbar {
    align-items: flex-start;
    gap: 8px;
  }

  .timer-badge {
    flex: 0 0 auto;
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .card-score-info {
    min-width: 0;
    max-width: calc(100% - 76px);
    font-size: clamp(0.68rem, 2.8vw, 0.82rem);
    overflow-wrap: anywhere;
    text-align: right;
  }

  .timer-bar-container {
    margin-bottom: 16px;
  }

  .prompt-box {
    margin-bottom: 18px;
  }

  .prompt-tag {
    max-width: 100%;
    font-size: clamp(0.68rem, 3.2vw, 0.82rem);
    letter-spacing: 0.06em;
    line-height: 1.35;
  }

  .prompt-box h2 {
    font-size: clamp(1.3rem, 6vw, 1.75rem);
    overflow-wrap: anywhere;
  }

  .country-question {
    font-size: clamp(0.9rem, 4vw, 1.75rem);
    line-height: 1.2;
    white-space: normal;
    text-wrap: balance;
  }

  .country-answer {
    flex-wrap: wrap;
  }

  #m2-country-name .country-label {
    flex-wrap: wrap;
  }

  .country-name {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .options-grid,
  .checklist-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .btn-option {
    min-width: 0;
    min-height: 48px;
    padding: 12px 10px;
    font-size: clamp(0.9rem, 3.8vw, 1rem);
  }

  .checklist-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    min-width: 0;
    padding: 12px;
    overflow-wrap: anywhere;
  }

  .checklist-item input[type="checkbox"] {
    grid-column: 1;
    grid-row: 1;
    width: 20px;
    height: 20px;
    margin: 0;
  }

  .checklist-item label {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .checklist-desc {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .reveal-panel {
    padding: 14px;
  }

  .status-banner {
    padding: 10px;
    font-size: clamp(0.95rem, 4.5vw, 1.2rem);
  }

  .reveal-details h4 {
    line-height: 1.35;
  }

  .reveal-details p,
  .detail-meta {
    overflow-wrap: anywhere;
  }

  .overlay-panel {
    padding: max(12px, env(safe-area-inset-left));
  }

  .overlay-content {
    width: 100%;
    padding: 14px;
  }

  .overlay-content h2 {
    font-size: clamp(1.5rem, 7vw, 2rem);
  }

  .final-score {
    max-width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    overflow-wrap: anywhere;
  }

  .btn-restart {
    max-width: 100%;
    padding: 12px 18px;
    font-size: 0.95rem;
  }

  .modal-backdrop {
    padding: max(10px, env(safe-area-inset-left));
  }

  .modal-box {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: 16px;
  }

  .modal-header,
  .modal-footer {
    flex: 0 0 auto;
    padding: 12px 14px;
  }

  .modal-header h3 {
    font-size: 1.05rem;
  }

  .modal-body {
    min-height: 0;
    padding: 14px;
    max-height: none;
    overflow-y: auto;
  }
}

@media (max-width: 360px) {
  .top-bar {
    padding-right: 10px;
    padding-left: 10px;
  }

  .app-title {
    font-size: 1rem;
  }

  .badge-score {
    gap: 4px;
  }

  .badge-score,
  .badge-level,
  .lives-container,
  .diff-toggle-wrapper,
  .btn-about,
  .language-selector-wrapper {
    height: 48px;
    min-height: 48px;
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  .btn-mode {
    font-size: 0.82rem;
  }

  .mode-selector {
    grid-template-columns: minmax(0, 1fr);
  }

  #btn-mode3 {
    grid-column: auto;
  }

  .game-card {
    padding: 12px;
  }

  .country-answer {
    gap: 4px;
  }
}
