/* Lumi · 旅行英语冒险乐园 —— 设计变量（天空蓝+日落橙） */
:root {
  --sky: #1e88e5;
  --sky-light: #64b5f6;
  --sunset: #ff7043;
  --sunset-light: #ffab91;
  --star: #ffc107;
  --bg: #e3f2fd;
  --fg: #1a2a3a;
  --muted: #7a8aa0;
  --border: #d4e4f0;
  --surface: #ffffff;
  --radius: 20px;
  --shadow: 0 2px 12px rgba(30, 136, 229, .1), 0 8px 24px rgba(30, 136, 229, .06);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(600px 300px at 85% -5%, #d0e8ff 0%, transparent 60%),
    radial-gradient(500px 300px at 0% 100%, #ffe0d0 0%, transparent 55%),
    var(--bg);
  color: var(--fg);
  font-family: "Segoe UI", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--sky); color: #fff; padding: 10px 16px;
  border-radius: 0 0 12px 0; text-decoration: none; font-weight: 700;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 3px solid var(--sunset); outline-offset: 2px; }

/* ---------- 移动端触屏基础 ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
button, .side-btn, .opt, .match-card, .play, .daily-listen, .card-open,
.cat-chip, .icon-btn, .listen-replay, .song-play, .link-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.daily-list, .phrase-list, .modal-inner { -webkit-overflow-scrolling: touch; }

/* ---------- 布局 ---------- */
.layout {
  display: flex; gap: 16px; max-width: 1440px;
  margin: 0 auto; padding: 16px; align-items: flex-start;
}

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* ---------- 侧栏 ---------- */
.sidebar {
  position: sticky; top: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 10px;
  box-shadow: var(--shadow);
}
.logo {
  width: 48px; height: 48px; border-radius: 16px;
  background: linear-gradient(135deg, var(--sky), var(--sunset));
  color: #fff; font-weight: 800; font-size: 24px;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(30, 136, 229, .3);
}
.side-btn {
  width: 48px; height: 48px; border: 0; background: transparent;
  border-radius: 14px; font-size: 22px; cursor: pointer;
  display: grid; place-items: center;
  transition: background .2s;
}
.side-btn:hover { background: #e8f4fe; }
.side-btn.active { background: #e3f2fd; box-shadow: inset 0 0 0 1px var(--sky-light); }
.coins {
  margin-top: 8px; background: #fff8e0; border-radius: 16px;
  padding: 10px 10px; text-align: center; min-width: 56px;
}
.coins strong { display: block; font-size: 20px; color: #b8860b; }
.coins span { font-size: 11px; color: #b08a3c; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 10px 20px; box-shadow: var(--shadow);
}
.profile { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: #e3f2fd; border: 2px solid var(--sky-light);
  display: grid; place-items: center; font-size: 25px;
}
.hello { margin: 0; display: flex; flex-direction: column; line-height: 1.3; }
.hello strong { font-size: 16.5px; }
.hello span { font-size: 12px; color: var(--muted); }
.pill { border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.pill-level { background: #e3f2fd; color: var(--sky); }
.pill-streak { background: #ffe0d0; color: var(--sunset); }
.search { margin-left: auto; position: relative; }
.search input {
  border: 1px solid var(--border); background: #f0f8ff;
  border-radius: 999px; padding: 10px 18px 10px 38px;
  width: 220px; max-width: 100%; font: inherit; color: inherit;
}
.search input::placeholder { color: var(--muted); }
.search::before {
  content: "🔍"; position: absolute; left: 13px; top: 50%;
  transform: translateY(-50%); font-size: 14px; opacity: .7; pointer-events: none;
}

/* ---------- 网格 ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.grid > * { min-width: 0; }
.hero { grid-column: 1 / -1; }
.word-panel { grid-column: 1 / -1; }
.sec-courses { grid-column: 1 / -1; }
.sec-games { grid-column: 1 / -1; }
.sky-panel { grid-column: 1 / -1; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(115deg, var(--sky), #29b6f6 50%, var(--sunset));
  border-radius: var(--radius); padding: 32px;
  color: #fff; box-shadow: 0 16px 36px rgba(30, 136, 229, .25);
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, .15); pointer-events: none;
}
.hero::before { width: 240px; height: 240px; right: -50px; bottom: -110px; }
.hero::after { width: 120px; height: 120px; left: 42%; top: -60px; }
.hero .eyebrow { margin: 0; font-size: 12.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .85); }
.hero-copy { max-width: calc(100% - 230px); }
.hero h1 { font-size: 42px; margin: 8px 0 10px; line-height: 1.15; font-weight: 800; }
.rainbow span:nth-child(1) { color: #ffd700; }
.rainbow span:nth-child(2) { color: #fff; }
.rainbow span:nth-child(3) { color: #ff8a8a; }
.hero .lead { max-width: 44ch; margin: 0 0 18px; font-size: 15.5px; }
.mascot {
  position: absolute; right: 34px; top: 50%;
  transform: translateY(-50%); width: 188px; height: 188px;
  filter: drop-shadow(0 10px 20px rgba(0, 30, 80, .3));
  animation: float 4s ease-in-out infinite alternate;
}
@keyframes float { from { transform: translateY(-52%); } to { transform: translateY(-46%); } }

/* ---------- 按钮 ---------- */
.btn {
  border: 0; border-radius: 999px; padding: 12px 20px;
  font-weight: 800; font-size: 14.5px; cursor: pointer; font-family: inherit;
  transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-dark { background: #1a2a3a; color: #fff; font-size: 15.5px; padding: 13px 24px; box-shadow: 0 8px 18px rgba(26, 42, 58, .3); }
.btn-solid { background: var(--sky); color: #fff; box-shadow: 0 6px 14px rgba(30, 136, 229, .35); }
.btn-ghost { background: #2a3a4a; color: #e0e8f0; }
.btn-ghost:hover { background: #364a62; }
.link-btn { border: 0; background: none; color: var(--sky); font-weight: 700; font-size: 14px; cursor: pointer; font-family: inherit; text-decoration: underline; }
.link-btn:hover { color: #1565c0; }

/* ---------- 课程卡片 ---------- */
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-title { font-size: 24px; margin: 0; font-weight: 800; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 14px; }
.course-card {
  position: relative; color: #fff; border-radius: var(--radius);
  padding: 18px 18px 16px; overflow: hidden;
  box-shadow: 0 12px 26px rgba(30, 136, 229, .16);
  transition: transform .2s;
}
.course-card:hover { transform: translateY(-3px); }
.card-blue { background: linear-gradient(135deg, #42a5f5, #1976d2); }
.card-purple { background: linear-gradient(135deg, #7e57c2, #512da8); }
.card-pink { background: linear-gradient(135deg, #ec407a, #c2185b); }
.card-green { background: linear-gradient(135deg, #66bb6a, #388e3c); }
.card-orange { background: linear-gradient(135deg, #ffa726, #f57c00); }
.card-teal { background: linear-gradient(135deg, #26c6da, #00acc1); }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-top h3 { margin: 0; font-size: 19px; font-weight: 800; }
.card-sub { margin: 4px 0 0; font-size: 12.5px; opacity: .92; }
.card-icon { width: 46px; height: 46px; flex: none; border-radius: 14px; background: rgba(255, 255, 255, .24); display: grid; place-items: center; font-size: 22px; }
.bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .35); margin: 14px 0 10px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: #fff; transition: width .4s; }
.card-foot { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; opacity: .96; }
.card-open { position: absolute; inset: 0; background: transparent; border: 0; cursor: pointer; border-radius: var(--radius); }
.card-open:focus-visible { outline: 3px solid #fff; outline-offset: -5px; }
.empty { color: var(--muted); font-size: 14px; margin: 14px 4px 0; }

/* ---------- 今日单词 ---------- */
.word-panel { display: flex; flex-direction: column; background: #1a2a3a; color: #fff; border-radius: var(--radius); padding: 24px; box-shadow: 0 16px 36px rgba(26, 42, 58, .3); }
.eyebrow { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #8ab0e8; }
.word-big { font-size: 38px; margin: 8px 0 2px; font-weight: 800; }
.word-meta { color: #a8b8d8; font-size: 14px; margin: 0; }
.word-meta .romaji { font-style: italic; }
.wotd-row { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.wotd-row .wotd-main { flex: 1; min-width: 0; }
.wotd-listen { width: 46px; height: 46px; font-size: 18px; flex: none; }
.word-panel .daily-count { color: var(--star); }
.word-panel .daily-note { color: #a8b8d8; }
.word-panel .daily-list { margin-top: 8px; }
.word-panel .daily-list li { border-bottom-color: #2a3a5a; }
.word-panel .daily-list li:last-child { border-bottom: 0; }
.word-panel .daily-word { color: #fff; }
.word-panel .daily-romaji { color: #8898b8; }
.word-panel .daily-meaning { color: #b8c8e8; }
.word-panel .daily-listen { background: #2a3a5a; border-color: #3a4a6a; }
.word-panel .daily-listen:hover { background: #364a72; }
.word-panel .daily-actions { margin-top: auto; }

.daily-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.daily-count { font-weight: 800; color: var(--sky); font-size: 16px; }
.daily-note { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.daily-list { list-style: none; margin: 10px 0 0; padding: 0; }
.daily-list li { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.daily-list li:last-child { border-bottom: 0; }
.daily-check { width: 18px; height: 18px; accent-color: var(--sky); flex: none; cursor: pointer; }
.daily-word { font-weight: 800; font-size: 15px; white-space: nowrap; flex: none; }
.daily-word.done { color: var(--muted); text-decoration: line-through; }
.daily-romaji { color: var(--muted); font-style: italic; font-size: 12px; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.daily-meaning { flex: 1; min-width: 0; font-size: 13px; color: #5a6a8a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daily-listen { width: 30px; height: 30px; flex: none; border-radius: 50%; border: 1px solid var(--border); background: #f0f8ff; font-size: 13px; cursor: pointer; transition: background .2s; }
.daily-listen:hover { background: #e0e8f8; }
.daily-actions { margin-top: 14px; display: flex; }
.daily-actions .btn { flex: 1; }

/* ---------- 小游戏 ---------- */
.mini-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.mini:last-child:nth-child(odd) { grid-column: 1 / -1; }
.mini { position: relative; color: #fff; min-height: 150px; border-radius: var(--radius); padding: 16px; overflow: hidden; box-shadow: 0 12px 26px rgba(30, 136, 229, .16); }
.mini h3 { margin: 0 0 2px; font-size: 17px; font-weight: 800; }
.mini .sub { margin: 0; font-size: 12px; opacity: .92; }
.mini-hunt { background: linear-gradient(135deg, #42a5f5, #1976d2); }
.mini-songs { background: linear-gradient(135deg, #26c6da, #00acc1); }
.mini-tile { position: absolute; right: 14px; top: 14px; width: 52px; height: 52px; border-radius: 14px; background: rgba(255, 255, 255, .26); display: grid; place-items: center; font-size: 24px; font-weight: 800; transform: rotate(8deg); }
.mini .play { position: absolute; right: 14px; bottom: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff; color: var(--sky); font-size: 14px; cursor: pointer; display: grid; place-items: center; box-shadow: 0 6px 14px rgba(0, 30, 80, .25); transition: transform .2s; }
.mini .play:hover { transform: scale(1.08); }
.mini-songs .play { color: #00acc1; }
.mini-match { background: linear-gradient(135deg, #66bb6a, #388e3c); }
.mini-listen { background: linear-gradient(135deg, #7e57c2, #512da8); }
.mini-quiz { background: linear-gradient(135deg, #ec407a, #c2185b); }
.mini-match .play { color: #388e3c; }
.mini-listen .play { color: #512da8; }
.mini-quiz .play { color: #c2185b; }

/* ---------- 星空 ---------- */
.sky-panel { background: linear-gradient(165deg, #1a2a3a, #0d1a28); border-radius: var(--radius); padding: 20px; box-shadow: 0 16px 36px rgba(13, 26, 40, .35); }
.sky-panel .section-title { color: #fff; }
.sky-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.sky-count { color: var(--star); font-weight: 800; font-size: 14px; }
.sky { position: relative; height: 150px; margin-top: 12px; border-radius: 18px; overflow: hidden; background: linear-gradient(180deg, #16224a 0%, #0a1228 100%); box-shadow: inset 0 0 30px rgba(0, 0, 0, .45); }
.sky-moon { position: absolute; right: 14px; top: 12px; font-size: 26px; }
.sky-phrase { position: absolute; inset: 0; margin: 0; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 0 12px; }
.sky-char { position: relative; width: 58px; height: 58px; flex: none; }
.sky-dot { position: absolute; width: 8%; height: 8%; border-radius: 50%; background: rgba(255, 255, 255, .08); transform: translate(-50%, -50%); }
.sky-dot.lit { background: var(--star); box-shadow: 0 0 4px rgba(255, 193, 7, .85), 0 0 9px rgba(255, 193, 7, .4); animation: dotTw 2.6s ease-in-out infinite alternate; }
@keyframes dotTw { from { opacity: 1; } to { opacity: .55; } }
.star { position: absolute; transform: translate(-50%, -50%); color: #3a4a6a; opacity: .7; }
.sky-note { color: #8898b8; font-size: 12.5px; margin: 10px 0 0; }

/* ---------- 页脚 ---------- */
.footer { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 4px 8px 20px; color: var(--muted); font-size: 12.5px; }
.footer p { margin: 0; max-width: 72ch; }
.ver-chip { font-weight: 700; color: var(--sky); }

/* ---------- 弹窗 ---------- */
.modal { border: 0; padding: 0; border-radius: var(--radius); width: min(520px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(26, 42, 58, .35); color: var(--fg); }
.modal-wide { width: min(560px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(26, 42, 58, .45); }
.modal-inner { padding: 22px 24px 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #e3f2fd; color: var(--sky); font-size: 15px; cursor: pointer; transition: background .2s; }
.icon-btn:hover { background: #d0e8ff; }
.modal-note { color: var(--muted); font-size: 13px; margin: 8px 0 4px; }

/* quiz */
.quiz-progress { color: var(--muted); font-size: 13px; text-align: center; margin: 6px 0 0; }
.quiz-q { font-size: 60px; text-align: center; margin: 12px 0 0; font-weight: 800; line-height: 1.1; }
.quiz-q.long { font-size: 27px; line-height: 1.4; }
.quiz-meta { text-align: center; color: var(--muted); font-style: italic; margin: 2px 0 0; font-size: 14px; min-height: 1.2em; }
.quiz-hint { text-align: center; color: var(--muted); margin: 4px 0 14px; font-size: 14px; }
.quiz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { border: 2px solid var(--border); background: #f0f8ff; border-radius: 16px; padding: 14px 10px; font-size: 18px; font-weight: 700; cursor: pointer; font-family: inherit; color: var(--fg); transition: transform .2s, border-color .2s, background .2s; }
.opt:hover:not(:disabled) { border-color: var(--sky); transform: translateY(-2px); }
.opt:disabled { cursor: default; }
.opt.correct { background: #e8f5e9; border-color: #43a047; color: #2e7d32; }
.opt.wrong { background: #ffebee; border-color: #e53935; color: #c62828; }
.quiz-feedback { min-height: 26px; text-align: center; font-weight: 700; margin: 14px 0 0; }
.quiz-feedback.good { color: #2e7d32; }
.quiz-feedback.bad { color: #e53935; }
.quiz-actions { display: flex; justify-content: center; margin-top: 10px; min-height: 46px; }
.quiz-result { text-align: center; padding: 18px 6px 4px; }
.quiz-result .big { font-size: 52px; margin: 0 0 6px; }
.quiz-result h3 { font-size: 22px; margin: 0 0 6px; }
.quiz-result p { color: var(--muted); margin: 0 0 8px; }
.quiz-result .result-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }

/* songs */
.song { border: 1px solid var(--border); border-radius: 18px; padding: 14px 16px; margin-top: 12px; background: #f0f8ff; }
.song h3 { margin: 0 0 6px; font-size: 16px; }
.song p { margin: 4px 0; font-size: 14px; }
.song .song-lyrics { font-size: 15.5px; font-weight: 600; }
.song .song-romaji { color: var(--muted); font-style: italic; }
.song .song-cn { color: #5a6a8a; }
.song-play { margin-top: 8px; padding: 10px 18px; }

/* phrases */
.phrase-tools { display: flex; gap: 10px; align-items: center; margin: 10px 0 8px; }
#phrase-search { flex: 1; min-width: 0; border: 2px solid var(--border); border-radius: 12px; padding: 9px 12px; font: inherit; font-size: 14px; background: #f0f8ff; color: var(--fg); }
#phrase-search:focus { outline: none; border-color: var(--sky); }
.phrase-count { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.phrase-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.cat-chip { border: 1.5px solid var(--border); border-radius: 999px; background: #f0f8ff; color: #5a6a8a; padding: 5px 11px; font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: inherit; transition: background .2s, border-color .2s; }
.cat-chip:hover { border-color: var(--sky); }
.cat-chip.active { background: #e3f2fd; border-color: var(--sky); color: #1565c0; }
.phrase-list { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow-y: auto; border-top: 1px solid var(--border); }
.phrase-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "box en listen" "box meta listen"; align-items: center; column-gap: 10px; row-gap: 3px; padding: 9px 4px; border-bottom: 1px dashed var(--border); min-width: 0; }
.phrase-list li .daily-check { grid-area: box; }
.phrase-en { grid-area: en; font-weight: 700; font-size: 15.5px; white-space: normal; overflow-wrap: anywhere; }
.phrase-meta { grid-area: meta; color: var(--muted); font-size: 13px; }
.phrase-list li .daily-listen { grid-area: listen; }
.phrase-list li.done .phrase-en { color: #a8b8d8; text-decoration: line-through; }
.phrase-empty { justify-content: center; color: var(--muted); font-size: 13.5px; padding: 18px 4px; }

/* match / listen */
.match-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 4px; }
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match-card { border: 2px solid var(--border); background: #f0f8ff; color: var(--fg); border-radius: 14px; padding: 12px 8px; min-height: 50px; font-size: 17px; font-weight: 700; font-family: inherit; cursor: pointer; transition: background .2s, border-color .2s; }
.match-card:hover { border-color: var(--sky); }
.match-card.picked { border-color: var(--sky); background: #e3f2fd; }
.match-card.matched { background: #e8f5e9; border-color: #43a047; color: #2e7d32; opacity: .7; cursor: default; }
.match-card.shake { animation: matchShake 400ms; border-color: #e53935; background: #ffebee; }
@keyframes matchShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.listen-replay { display: block; margin: 10px auto 14px; padding: 14px 24px; border: 0; border-radius: 999px; background: #1a2a3a; color: #fff; font-size: 17px; font-weight: 700; font-family: inherit; cursor: pointer; transition: background .2s; }
.listen-replay:hover { background: #2a3a5a; }
.listen-opts { grid-template-columns: 1fr 1fr; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%) translateY(20px); background: #1a2a3a; color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 14px; max-width: 90vw; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (min-width: 1181px) {
  .hero { grid-column: 1 / -1; grid-row: 1; }
  .hero h1 { font-size: 30px; }
  .hero .lead { font-size: 14px; }
  .mascot { width: 150px; height: 150px; right: 20px; }
  .sec-courses { grid-column: 1 / 9; grid-row: 2; }
  .word-panel { grid-column: 9 / -1; grid-row: 2; }
  .sky-panel { grid-column: 1 / -1; grid-row: 3; }
  .sec-games { grid-column: 1 / -1; grid-row: 4; }
  .mini-cards { grid-template-columns: repeat(5, 1fr); }
  .mini:last-child:nth-child(odd) { grid-column: auto; }
  .sky { height: 230px; }
  .sky-char { width: 66px; height: 66px; }
}

/* iPad 竖屏 768-1023：卡片 2 列，触屏目标放大 */
@media (min-width: 641px) and (max-width: 1180px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mini:last-child:nth-child(odd) { grid-column: auto; }
  .sky { height: 200px; }
  .sky-char { width: 58px; height: 58px; }
  .daily-listen { width: 42px; height: 42px; }
  .daily-check { width: 24px; height: 24px; }
  .listen-replay { padding: 14px 28px; }
  .opt { min-height: 52px; }
}

/* iPad 横屏 1024-1180：课程与今日单词并排 */
@media (min-width: 1024px) and (max-width: 1180px) {
  .sec-courses { grid-column: 1 / 9; grid-row: 2; }
  .word-panel { grid-column: 9 / -1; grid-row: 2; }
  .sky-panel { grid-column: 1 / -1; grid-row: 3; }
  .sec-games { grid-column: 1 / -1; grid-row: 4; }
  .hero h1 { font-size: 34px; }
}

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: sticky; top: 0; z-index: 50;
    flex-direction: row; width: 100%;
    justify-content: space-between; padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top));
    border-radius: 0;
  }
  .coins { margin: 0; }
  .search { margin-left: 0; width: 100%; }
  .search input { width: 100%; }
  .topbar { border-radius: var(--radius); }
}

@media (max-width: 640px) {
  .cards, .quiz-opts { grid-template-columns: 1fr; }
  .layout { gap: 10px; padding: 0 0 calc(10px + env(safe-area-inset-bottom)); }
  .content { gap: 10px; }
  .grid { gap: 10px; }
  .sidebar, .topbar, .hero, .word-panel, .sky-panel { border-radius: 0; }
  .sidebar { gap: 4px; padding: 6px 8px; padding-top: calc(6px + env(safe-area-inset-top)); }
  .logo { width: 38px; height: 38px; font-size: 19px; border-radius: 13px; }
  .side-btn { width: 44px; height: 44px; font-size: 20px; border-radius: 14px; }
  .coins { min-width: 46px; padding: 6px; }
  .coins strong { font-size: 15px; }
  .coins span { font-size: 10px; }
  .footer { padding-left: 16px; padding-right: 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal, .modal-wide { width: 100%; height: 100vh; height: 100dvh; max-width: none; max-height: none; border-radius: 0; }
  .modal-inner { height: 100%; overflow-y: auto; display: flex; flex-direction: column; padding: 16px 14px calc(20px + env(safe-area-inset-bottom)); }
  .phrase-list { flex: 1 1 auto; min-height: 0; max-height: none; }
  .topbar { padding: 8px 14px; gap: 8px; }
  .avatar { width: 38px; height: 38px; font-size: 20px; }
  .pill { padding: 5px 10px; font-size: 12px; }
  .search input { padding: 9px 14px 9px 34px; }
  .hero { padding: 14px 16px; }
  .hero .eyebrow { font-size: 11px; }
  .hero h1 { font-size: 22px; margin: 4px 0; }
  .hero .lead { font-size: 13px; margin: 0 0 12px; }
  .hero-copy { max-width: calc(100% - 84px); }
  .mascot { position: absolute; right: 8px; bottom: 8px; transform: none; width: 64px; height: 64px; margin: 0; display: block; animation: none; }
  .btn-dark { padding: 12px 20px; font-size: 14px; }
  .btn-solid, .btn-ghost { min-height: 48px; }
  .word-panel { padding: 18px; }
  .word-big { font-size: 32px; }
  .word-meta { margin-bottom: 10px; }
  .daily-check { width: 26px; height: 26px; }
  .daily-listen { width: 42px; height: 42px; font-size: 17px; }
  .daily-word { font-size: 16px; }
  .daily-romaji { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .daily-meaning { min-width: 0; flex: none; white-space: nowrap; }
  /* 练习弹窗：大触摸目标 */
  .quiz-q { font-size: 34px; }
  .quiz-q.long { font-size: 20px; }
  .opt { min-height: 54px; padding: 14px 12px; font-size: 16px; }
  .match-card { min-height: 56px; font-size: 15px; }
  .quiz-actions .btn { min-width: 150px; }
  .result-actions { flex-wrap: wrap; }
  .result-actions .btn { min-width: 140px; }
  /* 儿歌 */
  .song-lyrics { font-size: 16px; line-height: 2; }
  /* 星空 */
  .sky-char { width: 40px; height: 40px; }
  .sky-phrase { gap: 4px; }
  .mini { min-height: 140px; }
  .play { width: 44px; height: 44px; }
  .cat-chip { padding: 8px 14px; font-size: 13px; }
  .phrase-list li { padding: 11px 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* 触屏设备：输入框 16px 防 iOS 聚焦自动放大；触摸目标放大覆盖所有触屏布局（含 iPad 横屏桌面布局） */
@media (pointer: coarse) {
  #search, #phrase-search { font-size: 16px; }
  .daily-listen { width: 44px; height: 44px; font-size: 17px; }
  .daily-check { width: 24px; height: 24px; }
  .opt { min-height: 50px; }
  .match-card { min-height: 52px; }
}
