/* ===== 古诗小神枪手 · 样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --c-red: #e74c3c;
  --c-gold: #f39c12;
  --c-green: #27ae60;
  --c-blue: #3498db;
  --c-purple: #9b59b6;
  --c-ink: #2c3e50;
  --c-paper: #fffdf5;
}

html, body {
  height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  color: var(--c-ink);
  background: linear-gradient(180deg, #aee3f5 0%, #d4f0e0 55%, #fbe9b7 100%);
  overflow: hidden;
  user-select: none;
}

#app { width: 100vw; height: 100vh; position: relative; }

/* ---------- 屏幕切换 ---------- */
.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.screen.active { display: flex; }

/* ---------- 标题 ---------- */
.title-wrap { text-align: center; margin-bottom: 18px; }
.game-title {
  font-size: clamp(34px, 7vw, 64px);
  color: var(--c-red);
  letter-spacing: 4px;
  text-shadow: 3px 3px 0 #fff, 6px 6px 0 rgba(0,0,0,.12);
  font-weight: 900;
}
.subtitle {
  margin-top: 10px;
  font-size: clamp(14px, 2.6vw, 20px);
  color: var(--c-ink);
  opacity: .8;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--c-paper);
  border-radius: 20px;
  padding: 26px 28px;
  max-width: 560px;
  width: 100%;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
  border: 3px solid #fff;
  margin-bottom: 20px;
}
.card h3 { color: var(--c-red); margin-bottom: 12px; font-size: 20px; }
.rules { padding-left: 22px; line-height: 2; font-size: 16px; }
.rules b { color: var(--c-red); }

/* ---------- 按钮 ---------- */
.btn {
  border: none;
  border-radius: 999px;
  padding: 14px 36px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  box-shadow: 0 6px 0 rgba(0,0,0,.18);
  color: #fff;
  font-family: inherit;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.btn-primary { background: var(--c-red); }
.btn-warn { background: var(--c-gold); }
.btn-secondary { background: var(--c-blue); }
.hidden { display: none !important; }

.btn-back {
  position: absolute; top: 18px; left: 18px;
  background: rgba(255,255,255,.8);
  border: none; border-radius: 999px;
  padding: 8px 16px; font-size: 16px; cursor: pointer;
  color: var(--c-ink); font-family: inherit;
}

.api-status { margin-top: 14px; font-size: 13px; color: rgba(44,62,80,.6); }

/* ---------- 背诵界面 ---------- */
.recite-card { text-align: center; }
.hint { color: rgba(44,62,80,.7); margin-bottom: 8px; font-size: 16px; }
.poem-title-big {
  font-size: clamp(36px, 8vw, 64px);
  color: var(--c-red);
  margin: 10px 0;
  text-shadow: 2px 2px 0 #fff;
}
.poem-author { font-size: 20px; color: var(--c-ink); opacity: .75; margin-bottom: 18px; }

#recite-controls { margin-bottom: 14px; }

.listening {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--c-green); font-weight: 700; margin: 12px 0; font-size: 18px;
}
.pulse-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--c-green);
  animation: pulse 1s infinite;
}
@keyframes pulse { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(1.6);opacity:.5} }

.recite-text {
  min-height: 60px; margin: 12px 0;
  padding: 14px; border-radius: 12px;
  background: #f4f7fa; font-size: 20px; line-height: 1.6;
  color: var(--c-ink);
}
.recite-text:empty { display: none; }
.recite-result {
  font-size: 18px; font-weight: 700; margin: 10px 0; min-height: 24px;
}
.recite-result.pass { color: var(--c-green); }
.recite-result.fail { color: var(--c-red); }
.recite-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.recite-actions .btn { padding: 10px 22px; font-size: 16px; }

.type-area { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
#type-input {
  width: 100%; font-size: 18px; padding: 12px; border-radius: 12px;
  border: 2px solid #ddd; resize: vertical; font-family: inherit;
}
.browser-tip { margin-top: 12px; font-size: 13px; color: rgba(44,62,80,.55); }

/* ---------- 打靶界面 ---------- */
#shoot-screen { padding: 0; justify-content: flex-start; }
.hud {
  width: 100%; display: flex; justify-content: space-around;
  background: rgba(44,62,80,.9); color: #fff;
  padding: 12px; font-size: 18px; z-index: 5;
}
.hud-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hud-label { font-size: 12px; opacity: .7; }
.hud-value { font-size: 22px; font-weight: 900; }
#target-poem { font-size: 18px; color: #ffe66d; }

.canvas-wrap { position: relative; flex: 1; width: 100%; overflow: hidden; }
#game-canvas {
  display: block; width: 100%; height: 100%;
  cursor: none;
  background: linear-gradient(180deg, #bdeafc 0%, #cdebc1 70%, #f5e6a3 100%);
}
.shoot-tip {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.55); color: #fff; padding: 8px 18px;
  border-radius: 999px; font-size: 15px; pointer-events: none;
}
#floating-msgs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float-msg {
  position: absolute; font-size: 26px; font-weight: 900;
  animation: floatUp 1s ease-out forwards;
  text-shadow: 2px 2px 0 #fff;
}
@keyframes floatUp {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  20% { transform: translateY(-10px) scale(1.2); opacity: 1; }
  100% { transform: translateY(-70px) scale(1); opacity: 0; }
}

/* ---------- 结算界面 ---------- */
.result-card { text-align: center; }
.result-card h2 { color: var(--c-red); margin-bottom: 16px; font-size: 30px; }
.score-big { font-size: 80px; font-weight: 900; color: var(--c-gold); line-height: 1; }
.score-big small { font-size: 24px; margin-left: 6px; color: var(--c-ink); }
#result-detail { margin: 16px 0; font-size: 18px; line-height: 1.8; color: var(--c-ink); }
.rank-info { margin: 10px 0; padding: 10px; border-radius: 12px; background: #f4f7fa; font-size: 16px; }
.result-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

/* ---------- 响应式 ---------- */
@media (max-width: 480px) {
  .btn { padding: 12px 26px; font-size: 17px; }
  .card { padding: 20px 18px; }
  .score-big { font-size: 64px; }
}
