@font-face {
  font-family: "DungGeunMo";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_six@1.2/DungGeunMo.woff")
    format("woff");
  font-weight: normal;
  font-style: normal;
}

:root {
  --bg: #edf2ff;
  --card: #ffffff;
  --text: #1b2234;
  --primary: #1f7aec;
  --correct: #1f9d59;
  --wrong: #d94848;
  --dot-grass-tile: url("./dot_grass_tile.png");
}

* { box-sizing: border-box; }

button,
input,
select {
  font-family: "DungGeunMo", monospace;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 77, 77, 0.2) 0 12%, transparent 13%),
    radial-gradient(circle at 88% 20%, rgba(36, 121, 255, 0.16) 0 12%, transparent 13%),
    linear-gradient(160deg, #f3f6ff 0%, #e9efff 100%);
  font-family: "DungGeunMo", monospace;
  color: var(--text);
}

.container, .panel { width: min(92vw, 560px); }

h1 {
  text-align: center;
  margin-bottom: 1rem;
  font-family: "DungGeunMo", monospace;
  font-size: clamp(2rem, 4.8vw, 3rem);
  letter-spacing: 0.01em;
}

.intro-panel {
  position: relative;
  background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
  border-radius: 24px;
  padding: 1.6rem 1.2rem 1.4rem;
  box-shadow: 0 20px 42px rgba(33, 65, 130, 0.18);
  overflow: hidden;
  text-align: center;
}

.intro-panel .primary-btn {
  margin-top: 1rem;
}

.setup-panel {
  position: relative;
  background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
  border-radius: 24px;
  padding: 1.2rem;
  box-shadow: 0 20px 42px rgba(33, 65, 130, 0.18);
  overflow: hidden;
}

.setup-deco {
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  opacity: 0.2;
  pointer-events: none;
}

.setup-deco-red {
  top: -70px;
  right: -70px;
  background: #ff4d4d;
}

.setup-deco-blue {
  bottom: -80px;
  left: -80px;
  background: #2f7df6;
}

.setup-hero { position: relative; z-index: 1; margin-bottom: 0.5rem; }

.setup-badge {
  margin: 0 auto 0.4rem;
  width: fit-content;
  padding: 0.24rem 0.7rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff5a5a, #2f7df6);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.setup-subtitle { text-align: center; margin-top: -0.2rem; color: #4e5c75; font-weight: 600; }

.ball-showcase {
  margin: 0.9rem auto 0.1rem;
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 16px rgba(33, 65, 130, 0.15);
}

.ball {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.18));
  animation: bob 2.2s ease-in-out infinite;
}

.ball-great { animation-delay: 0.2s; }
.ball-ultra { animation-delay: 0.35s; }
.ball-master { animation-delay: 0.5s; }

.setup-block {
  position: relative;
  z-index: 1;
  background: var(--card);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 8px 20px rgba(31, 122, 236, 0.12);
  margin-bottom: 0.8rem;
}

.setup-block h2 { margin: 0 0 0.6rem; font-size: 1rem; }
.setup-option { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }

.generation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.generation-grid label {
  background: #eef3ff;
  border: 1px solid #d8e3ff;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.generation-grid label:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(31, 122, 236, 0.15);
}

#quiz-count-input,
#time-limit-input {
  width: 100%;
  border: 1px solid #c9d9f7;
  border-radius: 10px;
  padding: 0.65rem;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
}

.setup-error {
  min-height: 1.25rem;
  color: var(--wrong);
  margin: 0.2rem 0 0.7rem;
  font-weight: 700;
}

.setup-actions {
  display: flex;
  gap: 0.55rem;
}

.setup-actions button {
  padding: 0.65rem 1rem;
  border: 0;
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(18, 37, 78, 0.5);
}

.setup-actions .secondary-action {
  min-width: 108px;
  background: #9aa8c4;
}

.setup-actions .primary-btn {
  width: auto;
  flex: 1;
}

.primary-btn {
  width: 100%;
  padding: 0.76rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(90deg, #ff5757 0%, #1f7aec 100%);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(36, 105, 217, 0.3);
}

.status {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 0.8rem;
}

.quiz-card {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 24, 45, 0.5);
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  border-radius: 16px;
  z-index: 3;
}

.pause-overlay[hidden] { display: none; }

.timer-wrap {
  width: 100%;
  height: 10px;
  background: #dbe8ff;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.8rem;
}

.timer-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #1f9d59 0%, #f0b429 60%, #d94848 100%);
  transition: width 0.1s linear;
}

#pokemon-image {
  width: 100%;
  height: 280px;
  object-fit: contain;
  background: transparent;
  border-radius: 12px;
}

#pokemon-image.blackout { filter: brightness(0) saturate(100%); }

.message { text-align: center; margin: 0.8rem 0; font-weight: 700; }

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.choice-btn {
  padding: 0.7rem;
  border: 0;
  border-radius: 10px;
  background: #eef3ff;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.move-btn {
  padding: 0.34rem;
  border-radius: 12px;
  border: 3px solid #2f3e67;
  box-shadow: inset 0 0 0 2px #b8bfd6;
  background: #9aa1ac;
  text-align: left;
}

.move-btn .move-name {
  display: block;
  background: #d8de97;
  border: 2px solid #a0a77a;
  border-radius: 8px;
  padding: 0.42rem 0.52rem 0.25rem;
  font-size: 1.15rem;
  color: #1f2840;
}

.move-btn .move-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.16rem 0.22rem 0.05rem;
  font-size: 0.8rem;
  color: #f8fbff;
}

.move-btn .move-meta.only-pp {
  justify-content: flex-end;
}

.move-btn .move-tag {
  padding: 0.08rem 0.3rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
}

.move-btn .move-tag:empty {
  display: none;
}

.move-btn.move-variant-0 { background: #9aa1ac; }
.move-btn.move-variant-1 { background: #9aa1ac; }
.move-btn.move-variant-2 { background: #9aa1ac; }
.move-btn.move-variant-3 { background: #9aa1ac; }

.move-btn.easy-type {
  background: var(--move-bg, #5872bd);
}

.move-btn.correct {
  border-color: #197a46;
  box-shadow: inset 0 0 0 2px #8fe0af;
}

.move-btn.wrong {
  border-color: #8f1e1e;
  box-shadow: inset 0 0 0 2px #f1a8a8;
}

.choice-btn:disabled { cursor: default; opacity: 0.9; }
.choice-btn:not(.move-btn).correct { background: #daf5e6; color: var(--correct); }
.choice-btn:not(.move-btn).wrong { background: #ffe5e5; color: var(--wrong); }

.actions {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.actions button,
.modal-actions button {
  padding: 0.65rem 1rem;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.actions button:disabled { background: #9cb9e8; cursor: not-allowed; }
.secondary-action { background: #9aa8c4; }

body[data-theme="dot"] {
  background-image: var(--dot-grass-tile);
  background-repeat: repeat;
  background-size: 40px 40px;
  background-color: #6fbf5e;
  image-rendering: pixelated;
}

body[data-theme="dot"] .setup-panel {
  border: 4px solid #213255;
  box-shadow: 0 0 0 4px #fff, 0 18px 0 #213255;
  background: #f7fbff;
}

body[data-theme="dot"] .setup-block,
body[data-theme="dot"] .quiz-card,
body[data-theme="dot"] .modal-card {
  border: 3px solid #243761;
  box-shadow: 0 8px 0 #243761;
}

body[data-theme="dot"] .primary-btn {
  background: linear-gradient(180deg, #ff5f5f 0%, #e33d3d 100%);
  box-shadow: 0 6px 0 #9a1e1e;
}

body[data-theme="dot"] .actions button,
body[data-theme="dot"] .setup-actions button,
body[data-theme="dot"] .modal-actions button {
  box-shadow: 0 5px 0 rgba(18, 37, 78, 0.5);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 19, 36, 0.45);
  padding: 1rem;
}

.modal[hidden] { display: none; }

.modal-card {
  width: min(92vw, 420px);
  background: #fff;
  border-radius: 16px;
  padding: 1.2rem;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-card h2 { margin: 0 0 0.6rem; }
.modal-score { font-size: 1.2rem; font-weight: 800; margin: 0.2rem 0; }
.modal-comment { margin: 0.3rem 0 1rem; color: #42526f; }
.modal-actions { display: flex; justify-content: center; gap: 0.6rem; }
.modal-actions .secondary { background: #dce7fb; color: #20427a; }

@media (max-width: 560px) {
  .generation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ball { width: 30px; height: 30px; }
}

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