:root {
  --bg: #10151c;
  --panel: #1b2330;
  --panel-2: #232d3d;
  --line: #33405a;
  --text: #eaf0f7;
  --muted: #9fb0c6;
  --accent: #58b2ff;
  --correct: #34c777;
  --wrong: #ff5d6c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  line-height: 1.55;
}

#app {
  min-height: 100%;
  display: flex;
  justify-content: center;
  padding: 16px;
}

.screen {
  display: none;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
}

.screen.is-active { display: block; }

h1 {
  margin: 0 0 12px;
  font-size: 1.6rem;
}

.lead { color: var(--muted); margin: 0 0 16px; }

.rules {
  margin: 0 0 20px;
  padding-left: 20px;
  color: var(--text);
}

.rules li { margin-bottom: 6px; }

/* 시작 화면 공룡 */
.start-dino {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 0 12px;
}

.start-dino svg { display: block; width: 100%; height: 100%; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 26px;
  border-radius: 10px;
  cursor: pointer;
}

.btn:hover { border-color: var(--accent); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06111e;
}

/* 로딩 */
.progress {
  height: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease;
}

.progress-text { margin: 0 0 12px; font-weight: 700; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 12px; }
.load-error { color: var(--wrong); margin: 0 0 12px; }

/* HUD */
.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  font-size: 0.95rem;
}

.hud-item { color: var(--muted); }
.hud-item strong { color: var(--text); }
#lives { color: var(--wrong); letter-spacing: 2px; }

/* 문제 본문 */
.quiz-body {
  display: flex;
  gap: 18px;
  margin-top: 36px;
  margin-bottom: 16px;
}

.question { flex: 1 1 auto; min-width: 0; }
.summary { margin: 0 0 8px; }
.source { color: var(--muted); font-size: 0.8rem; margin: 0; }

/* 선택지 */
.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.option {
  appearance: none;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.option:hover:not(:disabled) { border-color: var(--accent); }
.option:disabled { cursor: default; opacity: 0.85; }

.option.correct {
  background: rgba(52, 199, 119, 0.22);
  border-color: var(--correct);
  opacity: 1;
}

.option.wrong {
  background: rgba(255, 93, 108, 0.22);
  border-color: var(--wrong);
  opacity: 1;
}

/* 문제 진행 상황 - 공룡 달리기 트랙 */
.quiz-progress {
  position: relative;
  height: 48px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #141b26 0%, #10151c 100%);
  overflow: hidden;
}

/* 지면 */
.quiz-progress::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  height: 2px;
  background: var(--line);
}

/* 지면 위로 채워지는 진행 게이지 */
.quiz-progress-fill {
  position: absolute;
  left: 0;
  bottom: 12px;
  height: 2px;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s ease;
}

/* 선인장 */
.cacti {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  height: 24px;
  pointer-events: none;
}

.cactus {
  position: absolute;
  bottom: 0;
  width: 12px;
  height: 22px;
  transform: translateX(-50%);
}

.cactus svg { display: block; width: 100%; height: 100%; }

/* 달리는 공룡 */
.quiz-dino {
  position: absolute;
  left: 6px;
  bottom: 14px;
  width: 28px;
  height: 32px;
  transition: transform 0.3s ease;
}

.quiz-dino svg { display: block; width: 100%; height: 100%; }

.feedback { min-height: 1.5em; margin: 0; font-weight: 700; }
.feedback.ok { color: var(--correct); }
.feedback.no { color: var(--wrong); }

/* 랭킹 등록 상태 안내 */
.ranking-status { min-height: 1.2em; margin: 4px 0 12px; font-weight: 600; }
.ranking-status.ok { color: var(--correct); }
.ranking-status.error { color: var(--wrong); }

/* 결과 */
.final { font-size: 1.3rem; margin: 0 0 12px; }
.final strong { color: var(--accent); font-size: 1.6rem; }
.final-time { color: var(--muted); margin: 0 0 12px; }

/* 좁은 화면 / 낮은 iframe */
@media (max-width: 560px) {
  .options { grid-template-columns: 1fr; }
  .screen { padding: 16px; }
  h1 { font-size: 1.35rem; }
}

@media (max-height: 520px) {
  .screen { padding: 12px; }
  .quiz-body { margin-top: 18px; }
  .start-dino { width: 44px; height: 44px; margin-bottom: 8px; }
}
