/* ============================================================
   马卡龙色系 · 儿童友好 · 响应式样式
   ============================================================ */

:root {
  --pink: #ffd6e8;
  --pink-strong: #f9a8c9;
  --blue: #d6efff;
  --blue-strong: #8ed2f5;
  --yellow: #fff3c4;
  --yellow-strong: #f7d774;
  --mint: #d8f5e2;
  --mint-strong: #8fd8ae;
  --purple: #e6dfff;
  --purple-strong: #b8a8ee;
  --ink: #5b5563;
  --ink-soft: #8b8695;
  --danger: #e88aa0;
  --danger-soft: #fde2e8;
  --success: #5fb98a;
  --card-bg: #fffdf8;
  --shadow: 0 10px 30px rgba(150, 130, 170, 0.18);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--pink) 0%, var(--blue) 45%, var(--mint) 100%);
  background-attachment: fixed;
  font-size: 18px;
  line-height: 1.6;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 40px);
}

/* ---------- 首页 ---------- */
.home__header {
  text-align: center;
  margin-bottom: 28px;
}

.mascot {
  font-size: clamp(64px, 16vw, 96px);
  animation: bob 2.4s ease-in-out infinite;
}

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

h1 {
  margin: 8px 0 4px;
  font-size: clamp(30px, 7vw, 44px);
  letter-spacing: 2px;
}

.subtitle {
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(16px, 4vw, 20px);
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 600px) {
  .mode-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: clamp(28px, 6vw, 44px) 20px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.mode-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 38px rgba(150, 130, 170, 0.26);
}

.mode-card--pink { background: var(--pink); }
.mode-card--blue { background: var(--blue); }

.mode-card__icon {
  font-size: clamp(48px, 10vw, 64px);
}

.mode-card__title {
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 700;
}

.mode-card__desc {
  color: var(--ink-soft);
  font-size: 16px;
}

/* ---------- 练习页通用 ---------- */
.practice__header {
  text-align: center;
  margin-bottom: 22px;
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 16px;
}

.back-link:hover {
  color: var(--ink);
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 5vw, 32px);
  margin-bottom: 20px;
}

.card--yellow { border: 4px solid var(--yellow-strong); }
.card--mint { border: 4px solid var(--mint-strong); }
.card--blue { border: 4px solid var(--blue-strong); }

.prompt-label {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--ink-soft);
}

.chinese-text {
  margin: 0;
  font-size: clamp(22px, 5.5vw, 30px);
  font-weight: 700;
}

.english-text {
  margin: 0 0 12px;
  font-size: clamp(24px, 6vw, 34px);
  font-weight: 700;
  line-height: 1.5;
}

/* ---------- 功能一：拼写 ---------- */
.word-slots {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px 14px;
}

.word-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.word-slot__row {
  display: inline-flex;
  align-items: flex-end;
  gap: 6px;
}

.word-slot__input {
  width: auto;
  min-width: 44px;
  max-width: 100%;
  padding: 8px 10px;
  font-size: clamp(20px, 5vw, 26px);
  font-family: inherit;
  text-align: center;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--purple);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.word-slot__input:focus {
  border-color: var(--purple-strong);
  box-shadow: 0 0 0 4px rgba(184, 168, 238, 0.25);
}

.word-slot__input.correct {
  border-color: var(--success);
  background: var(--mint);
  color: #3c7d5b;
}

.word-slot__input.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: #b04a61;
  animation: shake 0.25s ease;
}

.word-slot__input.hint::placeholder {
  color: rgba(90, 85, 99, 0.42);
  letter-spacing: 2px;
  font-weight: 600;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.word-slot__punct {
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 700;
  color: var(--ink);
}

.word-slot__phonetic {
  display: inline-block;
  text-align: center;
  font-size: 16px;
  color: var(--ink-soft);
  letter-spacing: 1px;
}

.word-slot__hint {
  position: static;
  white-space: nowrap;
  font-size: 13px;
  color: var(--danger);
  background: #fff;
  padding: 2px 8px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 小灯泡求助按钮 */
.bulb {
  cursor: pointer;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 999px;
  transition: transform 0.15s ease;
}

.bulb:hover {
  transform: scale(1.15);
}

.bulb:active {
  transform: scale(0.95);
}

.bulb--0 { filter: grayscale(1) opacity(0.55); }
.bulb--1 { filter: none; }
.bulb--2 { filter: saturate(1.4); }
.bulb--3 { filter: saturate(1.8) hue-rotate(-8deg); }

/* 音节气泡 */
.syllables {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 2px;
}

.syllable-bubble {
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  padding: 5px 12px;
  border: none;
  border-radius: 999px;
  color: var(--ink);
  background: var(--blue);
  box-shadow: 0 3px 8px rgba(150, 130, 170, 0.18);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.syllable-bubble:hover {
  transform: translateY(-2px);
  background: var(--blue-strong);
}

.syllable-bubble:active {
  transform: scale(0.96);
}

.feedback {
  min-height: 28px;
  margin: 16px 0 0;
  text-align: center;
  font-size: 16px;
  color: var(--ink-soft);
}

/* ---------- 按钮 ---------- */
.icon-button,
.read-button {
  cursor: pointer;
  font-family: inherit;
  font-size: clamp(18px, 4.5vw, 22px);
  padding: 12px 24px;
  border: none;
  border-radius: 999px;
  color: var(--ink);
  background: var(--yellow-strong);
  box-shadow: 0 6px 16px rgba(150, 130, 170, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.icon-button {
  margin-top: 14px;
}

.icon-button:hover,
.read-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(150, 130, 170, 0.28);
}

.icon-button:active,
.read-button:active {
  transform: translateY(0);
}

.read-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--blue-strong);
}

.read-button__icon {
  font-size: 28px;
  display: inline-block;
}

.read-button.speaking {
  animation: pulse 0.9s ease-in-out infinite;
  background: var(--pink-strong);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.reading-actions {
  margin-top: 18px;
  text-align: center;
}

.big-button {
  display: block;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 700;
  padding: 16px 28px;
  border: none;
  border-radius: 999px;
  color: #fff;
  background: var(--purple-strong);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.big-button:hover {
  transform: translateY(-3px);
}

.big-button:active {
  transform: translateY(0);
}

/* ---------- 成功面板 ---------- */
.success-panel {
  text-align: center;
  background: var(--yellow);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(24px, 6vw, 40px) 20px;
  animation: pop 0.4s ease;
}

@keyframes pop {
  0% { transform: scale(0.85); opacity: 0; }
  70% { transform: scale(1.04); }
  100% { transform: scale(1); opacity: 1; }
}

.success-emoji {
  font-size: clamp(56px, 12vw, 72px);
  animation: bob 1.2s ease-in-out infinite;
}

.success-title {
  margin: 8px 0;
  font-size: clamp(28px, 7vw, 38px);
  font-weight: 800;
  color: #d98c1f;
}

.success-answer {
  margin: 0 0 18px;
  font-size: clamp(18px, 4.5vw, 22px);
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

/* ---------- 顶部导航 ---------- */
.topnav {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

.topnav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 15px;
  background: rgba(255, 255, 255, 0.55);
  padding: 6px 12px;
  border-radius: 999px;
}

.topnav a:hover {
  color: var(--ink);
}

/* ---------- 词级图标按钮 ---------- */
.word-icon {
  cursor: pointer;
  border: none;
  background: transparent;
  font-size: 19px;
  line-height: 1;
  padding: 5px 4px;
  border-radius: 999px;
  transition: transform 0.15s ease;
}

.word-icon:hover {
  transform: scale(1.15);
}

.word-icon:active {
  transform: scale(0.94);
}

.word-icon--speak { filter: none; }
.word-icon--book { filter: saturate(1.2); }
.word-icon--danger { filter: grayscale(0.4); }

/* 单词中文意思 */
.word-slot__meaning {
  padding-left: 6px;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.4;
}

/* 提示 toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  animation: pop 0.25s ease;
  z-index: 99;
}

.toast--hide {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* ---------- 记词本 ---------- */
.wordbook-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wordbook-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 0;
}

.wordbook-item__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.wordbook-word {
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 800;
}

.wordbook-phonetic {
  font-size: 17px;
  color: var(--ink-soft);
}

.wordbook-meaning {
  margin: 6px 0 0;
  font-size: 16px;
  color: var(--ink);
}

.wordbook-example {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.wordbook-item__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  font-size: 18px;
}
