/* 近反义词闯关 · 卡通蓝紫青绿风 */

:root {
  --ink: #1C2B36;
  --muted: #5E7383;
  --line: rgba(28, 43, 54, .08);
  --surface: #FFFFFF;
  --deep: #3F4FA8;
  --deep-2: #5B6BC8;
  --gold: #E2A63A;
  --ok: #3B9B6E;
  --bad: #C45C4A;
  --soft: #F2F3FA;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', -apple-system, sans-serif;
}

* { box-sizing: border-box; }
button, a { font-family: inherit; }
button { border: 0; background: none; cursor: pointer; color: inherit; }

body {
  margin: 0;
  background: #7A88C8;
  font-family: var(--font);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

.yd-app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  height: 100dvh;
  background:
    radial-gradient(ellipse 90% 50% at 80% -10%, rgba(255, 220, 180, .4), transparent 55%),
    linear-gradient(165deg, #A8B4E8 0%, #B0C8D8 42%, #B8D6B8 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.yd-screen { display: none !important; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }
.yd-screen.on { display: flex !important; }
#scQuiz, #scResult { overflow-y: auto; }

.yd-hud {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: rgba(255,255,255,.55);
  border-bottom: 1px solid rgba(255,255,255,.35);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.yd-hud.compact {
  background: rgba(255,255,255,.82);
  border-bottom: 1px solid var(--line);
}
.yd-hud.compact p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.yd-avatar {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #FFE4B0, #F5C56B);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(214, 154, 48, .25);
}
.yd-hud-mid { flex: 1; min-width: 0; }
.yd-title-row {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .02em;
}
.yd-edition {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}
.yd-res { display: flex; gap: 6px; flex-shrink: 0; }
.yd-coin {
  display: flex; align-items: center; gap: 3px;
  background: rgba(255,255,255,.85);
  border-radius: 999px;
  padding: 4px 8px 4px 6px;
  box-shadow: 0 2px 8px rgba(28, 43, 54, .06);
}
.yd-coin span { font-size: 12px; }
.yd-coin b { font-size: 12px; font-weight: 800; }
.yd-coin.fire { background: #FFF0EC; }

.yd-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 24px;
  padding-bottom: calc(24px + var(--safe-b));
  scrollbar-width: none;
}
.yd-body::-webkit-scrollbar { display: none; }

.yd-quest {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 10px 28px rgba(28, 43, 54, .12);
}
.yd-quest-copy { flex: 1; min-width: 0; }
.yd-quest-copy em {
  display: block;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--deep-2);
  letter-spacing: .06em;
}
.yd-quest-copy strong {
  display: block;
  font-size: 18px;
  font-weight: 800;
  margin: 4px 0;
}
.yd-status {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.yd-play {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(145deg, #FFE56A, #F5B400);
  color: #5A3A00;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 6px 0 #C98A00, 0 10px 20px rgba(201, 138, 0, .28);
  flex-shrink: 0;
}
.yd-play:active { transform: translateY(2px); box-shadow: 0 4px 0 #C98A00; }

.yd-dock {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.yd-dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,.78);
  border-radius: 14px;
  padding: 10px 8px;
  box-shadow: 0 4px 12px rgba(28, 43, 54, .06);
}
.yd-dock-btn i { font-style: normal; font-size: 18px; line-height: 1; }
.yd-dock-btn b { font-size: 16px; font-weight: 800; color: var(--deep); }
.yd-dock-btn span { font-size: 11px; font-weight: 700; color: var(--muted); }

.yd-card-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--deep);
  margin: 4px 0 10px;
  letter-spacing: .04em;
}

.yd-level {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: 0 6px 18px rgba(28, 43, 54, .08);
}
.yd-level.locked { opacity: .55; }
.yd-level-no {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #1F5C6B, #2A7A8C);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.yd-level.locked .yd-level-no { background: #C5D0D6; }
.yd-level-mid { flex: 1; min-width: 0; }
.yd-level-mid strong { display: block; font-size: 15px; font-weight: 800; }
.yd-level-mid span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.yd-level-stars { color: var(--gold); font-size: 13px; font-weight: 800; flex-shrink: 0; }

.yd-rules {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.5;
  margin: 14px 0 10px;
}
.yd-back {
  display: inline-flex;
  align-items: center;
  color: var(--deep);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  padding: 8px 0;
}
button.yd-back {
  background: transparent;
  padding: 0;
}

.yd-quiz-top {
  padding: 12px 14px 0;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  flex-shrink: 0;
}
.yd-quiz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}
.yd-progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.55);
  overflow: hidden;
}
.yd-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #1F5C6B, #3FA7B8);
  border-radius: inherit;
  transition: width .25s ease;
}

.yd-qbox {
  margin: 14px;
  background: #fff;
  border-radius: 18px;
  padding: 18px 16px 16px;
  text-align: center;
  box-shadow: 0 10px 28px rgba(28, 43, 54, .12);
}
.yd-kp {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--deep-2);
  background: #E8F4F7;
  border-radius: 999px;
  padding: 4px 10px;
  letter-spacing: .04em;
}
.yd-char {
  font-size: 72px;
  font-weight: 800;
  line-height: 1.1;
  margin: 12px 0 4px;
  color: var(--ink);
  font-family: 'Songti SC', 'SimSun', 'Noto Serif SC', serif;
}
.yd-word {
  font-size: 18px;
  font-weight: 700;
  color: var(--deep);
  margin-bottom: 10px;
}
.yd-q {
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
}

.yd-opts {
  display: grid;
  gap: 8px;
  padding: 0 14px;
}
.yd-opt {
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 4px 14px rgba(28, 43, 54, .08);
  border: 2px solid transparent;
}
.yd-opt:active { transform: scale(.98); }
.yd-opt.ok { border-color: var(--ok); background: #E8F6EE; color: #1F6B45; }
.yd-opt.bad { border-color: var(--bad); background: #FBEDEA; color: #8B3A2E; }
.yd-opt.disabled { pointer-events: none; opacity: .7; }

.yd-explain {
  margin: 12px 14px 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.72);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
  display: none;
}
.yd-explain.show { display: block; }
.yd-explain.ok { border-left: 4px solid var(--ok); }
.yd-explain.bad { border-left: 4px solid var(--bad); }

.yd-next-wrap { padding: 14px 14px calc(14px + var(--safe-b)); }
.yd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 800;
  background: linear-gradient(135deg, #1F5C6B, #2A7A8C);
  color: #fff;
  box-shadow: 0 6px 16px rgba(31, 92, 107, .28);
}
.yd-btn.ghost {
  background: rgba(255,255,255,.75);
  color: var(--deep);
  box-shadow: none;
  border: 1px solid rgba(31, 92, 107, .15);
}
.yd-btn:active { transform: scale(.98); }

.yd-result {
  text-align: center;
  padding: 48px 20px 20px;
}
.yd-trophy { font-size: 48px; margin-bottom: 8px; }
.yd-result .big {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 6px;
}
.yd-result .stars {
  color: var(--gold);
  font-size: 28px;
  letter-spacing: 4px;
  margin-bottom: 10px;
}
.yd-result p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.yd-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.yd-stat {
  background: #fff;
  border-radius: 14px;
  padding: 12px 6px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(28, 43, 54, .06);
}
.yd-stat .n { display: block; font-size: 18px; font-weight: 800; color: var(--deep); }
.yd-stat .l { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 2px; }

.yd-list { display: grid; gap: 8px; }
.yd-wrong-item {
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 4px 12px rgba(28, 43, 54, .06);
}
.yd-wrong-item strong {
  display: block;
  font-size: 20px;
  font-family: 'Songti SC', 'SimSun', 'Noto Serif SC', serif;
}
.yd-wrong-item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 4px;
  line-height: 1.4;
}

.yd-sources {
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  margin-top: 12px;
  box-shadow: 0 6px 18px rgba(28, 43, 54, .08);
}
.yd-sources b {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--deep);
  margin-bottom: 6px;
}
.yd-sources p {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.5;
}
.yd-sources ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.55;
}
.yd-toast {
  position: fixed;
  left: 50%;
  top: max(12px, env(safe-area-inset-top, 0px));
  transform: translateX(-50%) translateY(-8px);
  background: rgba(28, 43, 54, .92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  z-index: 50;
  white-space: nowrap;
  max-width: 86vw;
  text-align: center;
}
.yd-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
