body {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  background: #483dff;
  color: #1b1d22;
}

img {
  max-width: 100%;
  height: auto;
}

.hidden {
  display: none !important;
}

.app {
  max-width: 720px;
  width: min(calc(100% - 32px), 720px);
  margin: 6px auto;
  background: #ffffff;
  padding: 28px 24px 32px;
  border-radius: 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

h1 {
  text-align: center;
  font-weight: 600;
  font-size: 2.4rem;
  margin: 0;
}

.subtitle {
  text-align: center;
  margin: 4px 0 14px;
  font-size: 1rem;
  color: #555975;
}

.settings-block {
  background: #f7f8fe;
  border: 1px solid #d0d4ea;
  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
  margin: 16px 0;
  text-align: center;
}

.settings-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  text-align: center;
}

.rounds-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.continent-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  justify-items: center;
}

.round-btn {
  cursor: pointer;
}

.continent-btn {
  position: relative;
  width: 100%;
  padding: 12px 16px 12px 44px;
  border-radius: 12px;
  border: 2px solid #0f2f82;
  background: #1545ba;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 0 #071f5a;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.2s ease;
}

.continent-btn::before {
  content: "";
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  border: 2px solid #ffd447;
  background: #1545ba;
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.15);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #0f2f82;
}

.continent-btn.active {
  background: #0f2f82;
  border-color: #1c52d6;
  box-shadow: 0 4px 0 #0a265e;
}

.continent-btn.active::before {
  background: #ffd447;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
  content: "X";
}

.continent-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #071f5a;
}

.round-btn,
.start-button,
.continent-btn {
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.2s ease, filter 0.2s ease;
}

.round-btn,
.start-button {
  position: relative;
  border-radius: 12px;
  border: 2px solid #c3c7dd;
  box-shadow: 0 4px 0 #a7abc4;
  padding: 12px 16px;
  background: #ffffff;
  font-weight: 600;
}

.round-btn:hover,
.start-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #8c90ab;
}

.round-btn.disabled {
  background: #e0e0e0;
  color: #888;
  border-color: #ccc;
  cursor: not-allowed;
}

.round-btn.active {
  background: #1a73e8;
  color: #ffffff;
  border-color: #1355a8;
  box-shadow: 0 4px 0 #0d3f86;
}

.data-status {
  margin: 10px 0 2px;
  font-size: 0.85rem;
  color: #61657c;
  text-align: center;
}

.error-message {
  color: #c62828;
  font-size: 0.9rem;
  margin: 2px 0 4px;
  min-height: 0.5em;
}

.start-button {
  display: block;
  width: min(100%, 360px);
  margin: 3px auto 0;
  padding: 14px 26px;
  border-radius: 12px;
  border: 2px solid #ff6f6f;
  background: linear-gradient(135deg, #ff9966, #ff5f6d);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  animation: startPulse 2s infinite ease-in-out;
  box-shadow: 0 6px 0 #c74747;
}

.start-button:hover {
  box-shadow: 0 6px 0 #a94242;
  filter: brightness(1.05);
}

.choose-game-button {
  width: min(100%, 252px);
  padding: 10px 18px;
  font-size: 0.95rem;
  margin-top: 10px;
  box-shadow: 0 4px 0 #1f7a4a;
  animation: none;
  background: linear-gradient(135deg, #6ee7a0, #3bbf7a);
  border-color: #28915a;
  color: #0e2c1b;
}

.choose-game-button:hover {
  box-shadow: 0 4px 0 #18633c;
}

/* FIXED HEIGHT FLAG AREA */
.flag-box {
  height: 188px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f7f8fe;
  border: 1px solid #d0d4ea;
  border-radius: 12px;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
  margin-bottom: 14px;
}

.flag {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  border: 2px solid black;
}

/* ANSWERS */
.answers {
  display: grid;
  gap: 10px;
}

.answer-btn {
  position: relative;
  padding: 12px 16px;
  border-radius: 12px;
  background: #f7f8fe;
  border: 2px solid #d0d4ea;
  box-shadow: 0 4px 0 #c3c7dd;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.2s ease;
}

.answer-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #a7abc4;
}

.answer-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 0 #a7abc4;
}

.answer-btn.correct {
  background: #c8e6c9;
  border-color: #2e7d32;
}

.answer-btn.wrong {
  background: #ffcdd2;
  border-color: #c62828;
}

.next-wrapper {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}

.quit-container {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 14px;
}

.top-bar p {
  margin: 0;
}

.score-display {
  flex: 1;
  text-align: left;
}

.question-counter {
  flex: 1;
  text-align: right;
}

.quit-btn {
  background: #888;
  color: white;
  border-radius: 999px;
  padding: 10px 16px;
  border: none;
}

.next-btn {
  background: #1a73e8;
  color: white;
  border-radius: 999px;
  padding: 10px 16px;
  border: none;
}

.next-btn:disabled {
  background: #a9b4c8;
  cursor: not-allowed;
}

.next-btn,
.quit-btn,
.modal-buttons button {
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.2s ease;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

.next-btn:hover:not(:disabled),
.quit-btn:hover,
.modal-buttons button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
  filter: brightness(1.05);
}

/* FIX FOR LAYOUT JUMP */
.result {
  min-height: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* END SCREEN */
.end-buttons {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* MODAL */
.modal.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.45);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: white;
  padding: 20px;
  border-radius: 12px;
  width: min(90vw, 340px);
  text-align: center;
}

.modal-buttons {
  margin-top: 14px;
  display: flex;
  justify-content: space-evenly;
}

.start-button,
.round-btn,
.continent-btn,
.answer-btn,
.end-buttons button,
.modal-buttons button,
#next-btn,
#quit-btn {
  font-family: "Press Start 2P", monospace;
}

.next-btn,
.quit-btn {
  font-family: "Press Start 2P", monospace !important;
}

.score-message {
  font-family: "Press Start 2P", monospace;
  font-size: 22px;
  color: #ff4444;
  text-shadow: 3px 3px #000;
  margin-top: 20px;
  text-align: center;
  line-height: 1.4;
}


/* ------------------------------------------ */
/* REAL 8-BIT PIXEL TITLE SCREEN (SEGA STYLE) */
/* ------------------------------------------ */

.title-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 4vh, 32px);
  padding: clamp(16px, 4vw, 40px);
  text-align: center;
  background: #0000ff url("Title background.png") center / cover no-repeat;

  /* MAKE IT PIXELATED */
  image-rendering: pixelated;
  font-family: "Press Start 2P", monospace;
  z-index: 99999;
  overflow: hidden;
}
/* MOVING LOGO PNG */
.title-logo-img {
  width: min(90vw, 650px);
  image-rendering: pixelated;
  position: relative;
  transform: translateY(-140%);
  animation-name: logoDrop, logoIdleBounce;
  animation-duration: 2.5s, 3.5s;
  animation-timing-function: cubic-bezier(0.1, 0.9, 0.05, 1.4), ease-in-out;
  animation-iteration-count: 1, infinite;
  animation-fill-mode: forwards;
  animation-delay: 0s, 2.5s;
}

@keyframes logoDrop {
  0%   { transform: translateY(-140%); }
  70%  { transform: translateY(8%); }
  85%  { transform: translateY(-4%); }
  100% { transform: translateY(0); }
}
@keyframes logoIdleBounce {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-8px); }
  100% { transform: translateY(0); }
}


.title-press {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(16px, 5vw, 40px);
  color: white;
  text-shadow: 3px 3px #000;
  animation: blink 1.7s steps(2) infinite;
  margin-top: clamp(6px, 3vh, 24px);
}
.secret-btn {
  position: relative;
  background: linear-gradient(180deg, #ff5555, #c40000);
  border: 3px solid #6b0000;
  color: #fff;
  padding: clamp(12px, 3vw, 16px) clamp(14px, 4vw, 20px);
  border-radius: 12px;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(12px, 3.5vw, 16px);
  box-shadow: 0 6px 0 #5a0000;
  cursor: pointer;
  text-shadow: 2px 2px #000;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.2s ease;
}

.secret-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #5a0000;
  filter: brightness(1.05);
}

.secret-btn:active {
  transform: translateY(0);
  box-shadow: 0 3px 0 #5a0000;
}
.title-subtitle {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(18px, 4vw, 32px);
  color: white;
  text-shadow: 3px 3px #000;
  letter-spacing: 3px;
}

@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes startPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes screenFadeOut {
  0% {
    opacity: 1;
    transform: translateY(0px) scale(1);
  }
  45% {
    opacity: 0.35;
    transform: translateY(-6px) scale(0.995);
  }
  100% {
    opacity: 0;
    transform: translateY(-14px) scale(0.985);
  }
}

@keyframes screenFadeIn {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  60% {
    opacity: 1;
    transform: translateY(-2px) scale(1);
  }
  100% {
    opacity: 1;
    transform: translateY(0px) scale(1);
  }
}

.screen-fade-out {
  animation: screenFadeOut 0.5s ease forwards;
  will-change: opacity, transform;
}

.screen-fade-in {
  animation: screenFadeIn 0.5s ease forwards;
  will-change: opacity, transform;
}

@keyframes colorCycle {
  0%   { color: #ff4444; }
  20%  { color: #ffa600; }
  40%  { color: #ffee00; }
  60%  { color: #00dd00; }
  80%  { color: #00aaff; }
  100% { color: #ff44dd; }
}

#game-title span {
  display: inline-block;
  animation: colorCycle 2.5s infinite linear;
}

#game-title span:nth-child(1) { animation-delay: 0s; }
#game-title span:nth-child(2) { animation-delay: 0.15s; }
#game-title span:nth-child(3) { animation-delay: 0.30s; }
#game-title span:nth-child(4) { animation-delay: 0.45s; }
#game-title span:nth-child(5) { animation-delay: 0.60s; }
#game-title span:nth-child(6) { animation-delay: 0.75s; }
#game-title span:nth-child(7) { animation-delay: 0.90s; }

/* ----------------------------- */
/* MOBILE RESPONSIVE ADJUSTMENTS */
/* ----------------------------- */

@media (max-width: 600px) {
  body {
    background: #483dff;
  }

  .app {
    margin: 16px auto 20px;
    padding: 20px 16px 24px;
    width: min(calc(100% - 20px), 720px);
  }

  h1 {
    font-size: 1.6rem;
  }

  .subtitle {
    font-size: 0.9rem;
    margin-bottom: 10px;
  }

  .settings-block {
    padding: 10px 12px;
  }

  .continent-buttons {
    grid-template-columns: 1fr;
  }

  .continent-btn {
    padding: 12px 14px 12px 44px;
  }

  .flag-box {
    height: 143px;
  }

  .quit-container,
  .end-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .quit-container button,
  .end-buttons button {
    width: 100%;
  }

  .title-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background-size: cover;
  }

  .title-logo-img {
    position: static;
    transform: none;
    animation: none;
    width: min(100%, 360px);
    max-width: 90vw;
  }

  .title-subtitle {
    position: static;
    transform: none;
    margin-top: 14px;
    font-size: 22px;
    text-align: center;
  }

  .title-press {
    position: static;
    transform: none;
    margin-top: 18px;
    font-size: 18px;
    text-align: center;
  }

  .secret-btn {
    position: static;
    transform: none;
    width: 100%;
    max-width: 280px;
    margin-top: 20px;
    text-align: center;
  }
}
