@import url('https://fonts.googleapis.com/css2?family=Jua&family=Black+Han+Sans&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-family: 'Jua', sans-serif;
  overflow: hidden;
}

#game-container {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 50px rgba(0,0,0,0.3);
}

#game-canvas { display: block; }

#ui-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#ui-layer > * { pointer-events: auto; }

.hidden { display: none !important; }

/* ========== 패널 ========== */
.panel {
  background: rgba(255, 255, 255, 0.95);
  padding: 28px 36px;
  border-radius: 24px;
  border: 4px solid #ffcc02;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2), 0 0 0 6px rgba(255,204,2,0.3);
  text-align: center;
  max-width: 92%;
}

.title-icon, .clear-icon { font-size: 3em; margin-bottom: 8px; }

h1 {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 2.4em;
  color: #ff6b6b;
  text-shadow: 3px 3px 0px rgba(0,0,0,0.1);
  margin-bottom: 8px;
}

h2 {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 1.5em;
  color: #5f27cd;
  margin-bottom: 12px;
}

.subtitle {
  font-size: 1.1em;
  color: #666;
  margin-bottom: 16px;
  line-height: 1.6;
}

p { font-size: 1.05em; color: #444; margin: 4px 0; }

/* ========== 버튼 ========== */
.btn-primary {
  font-family: 'Jua', sans-serif;
  font-size: 1.4em;
  padding: 14px 36px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, #ff6b6b, #ff8e53);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(255,107,107,0.4);
  margin-top: 12px;
}

.btn-primary:hover { transform: scale(1.05); box-shadow: 0 6px 25px rgba(255,107,107,0.5); }
.btn-primary:active { transform: scale(0.97); }

/* ========== 학년 선택 ========== */
#grade-options {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 8px;
}

.grade-card {
  background: linear-gradient(180deg, #f8f9ff, #eef1ff);
  border: 3px solid #c8d6ff;
  border-radius: 20px;
  padding: 18px 16px;
  cursor: pointer;
  transition: all 0.2s;
  width: 170px;
}

.grade-card:hover {
  border-color: #ff6b6b;
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 8px 20px rgba(255,107,107,0.2);
}

.grade-icon { font-size: 2.2em; margin-bottom: 6px; }

.grade-title {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 1.4em;
  color: #5f27cd;
  margin-bottom: 6px;
}

.grade-desc {
  font-size: 0.82em;
  color: #888;
  line-height: 1.5;
}

/* ========== 비행기 선택 ========== */
#plane-options {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.plane-card {
  background: linear-gradient(180deg, #f0f4ff, #e8ecff);
  border: 3px solid #c8d6ff;
  border-radius: 18px;
  padding: 12px 8px;
  cursor: pointer;
  transition: all 0.2s;
  width: 125px;
}

.plane-card:hover {
  border-color: #ff6b6b;
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 8px 20px rgba(255,107,107,0.2);
}

.plane-preview { display: block; margin: 0 auto 4px; }

.plane-name {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 0.95em;
  color: #5f27cd;
  margin-bottom: 2px;
}

.plane-desc { font-size: 0.8em; color: #888; }

/* ========== 퀴즈 ========== */
#quiz-label { color: #ff6b6b; font-size: 1em; margin-bottom: 4px; }
#quiz-count { color: #5f27cd; font-size: 0.9em; font-weight: bold; }

#question {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 2.6em;
  color: #5f27cd;
  margin: 12px 0 14px;
}

#choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 8px 0;
}

.choice-btn {
  font-family: 'Jua', sans-serif;
  font-size: 1.5em;
  padding: 14px 10px;
  border: 3px solid #ddd;
  border-radius: 16px;
  background: #fff;
  color: #333;
  cursor: pointer;
  transition: all 0.15s;
}

.choice-btn:hover { border-color: #ff6b6b; background: #fff5f5; transform: scale(1.04); }
.choice-btn.correct { border-color: #2ecc71; background: #d5f5e3; color: #27ae60; }
.choice-btn.wrong { border-color: #e74c3c; background: #fde8e8; color: #e74c3c; }

#quiz-feedback {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 1.2em;
  min-height: 1.5em;
  margin-top: 8px;
}

/* ========== HUD ========== */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  font-family: 'Jua', sans-serif;
  font-size: 0.9em;
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
  background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, transparent 100%);
  pointer-events: none;
}

.hud-left, .hud-center, .hud-right { display: flex; flex-direction: column; gap: 2px; }
.hud-center { align-items: center; }
.hud-right { align-items: flex-end; }

#stage-label { font-family: 'Black Han Sans', sans-serif; color: #ffcc02; font-size: 1.1em; }
#kill-progress { font-size: 0.8em; color: #ccc; }
#powerup-display { font-size: 0.85em; color: #ffcc02; }

#boss-hp-outer {
  width: 80px; height: 10px;
  background: rgba(255,255,255,0.3);
  border-radius: 5px;
  overflow: hidden;
}

#boss-hp-inner {
  height: 100%;
  background: linear-gradient(90deg, #ff4757, #ff6b81);
  border-radius: 5px;
  transition: width 0.3s;
}

#stage-clear h2 { color: #2ecc71; }

/* ========== 반응형 ========== */
@media (max-width: 500px) {
  .panel { padding: 18px 20px; }
  h1 { font-size: 1.8em; }
  h2 { font-size: 1.2em; }
  #question { font-size: 2em; }
  .plane-card { width: 100px; padding: 8px 4px; }
  .grade-card { width: 140px; padding: 12px 10px; }
  .choice-btn { font-size: 1.2em; padding: 10px 8px; }
}
