:root {
  --bg: #f6f1e9;
  --surface: #fffdf9;
  --ink: #2b2622;
  --muted: #8a7f74;
  --line: #e7ddd0;
  --accent: #d9534f;
  --accent-ink: #fff;
  --good: #2f9e6e;
  --good-bg: #e3f5ec;
  --bad: #d64545;
  --bad-bg: #fbe6e4;
  --locked: #d9d0c4;
  --shadow: 0 2px 10px rgba(60, 40, 20, .08);
  --jp: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Noto Sans JP", sans-serif;
  --zh: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1b19;
    --surface: #2a2724;
    --ink: #f1ebe3;
    --muted: #a39a90;
    --line: #3d3833;
    --good-bg: #1f3a2e;
    --bad-bg: #452624;
    --locked: #3d3833;
    --shadow: 0 2px 10px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--zh);
  -webkit-tap-highlight-color: transparent;
}
[lang="ja"], .jp { font-family: var(--jp); }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.logo { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.logo span {
  background: var(--accent); color: var(--accent-ink);
  font-size: 13px; padding: 2px 6px; border-radius: 6px;
}
nav { display: flex; gap: 4px; }
.nav-btn {
  border: none; background: none; padding: 6px 12px; border-radius: 8px; color: var(--muted);
}
.nav-btn.active { background: var(--bg); color: var(--ink); font-weight: 600; }

main { max-width: 640px; margin: 0 auto; padding: 16px; }
.view { display: none; }
.view.active { display: block; animation: fade .2s; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* 通用 */
.btn {
  border: 1px solid var(--line); background: var(--surface);
  padding: 10px 18px; border-radius: 10px; font-size: 15px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.link-btn { border: none; background: none; color: var(--muted); padding: 4px; font-size: 14px; }
.panel, .goal, .rarity-legend {
  background: var(--surface); border-radius: 14px; padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.panel-title, .legend-title { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s; }

/* 首页 */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border-radius: 14px; padding: 14px 8px; text-align: center; box-shadow: var(--shadow); }
.stat-num { font-size: 26px; font-weight: 700; }
.stat-label { font-size: 13px; color: var(--muted); }
.goal-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--bg); border-radius: 99px;
  padding: 6px 12px; font-size: 14px;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.big-btn {
  width: 100%; border: none; border-radius: 16px; padding: 18px;
  background: var(--accent); color: var(--accent-ink);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin-bottom: 14px; box-shadow: 0 4px 0 #a83a37;
}
.big-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #a83a37; }
.big-btn-main { font-size: 20px; font-weight: 700; }
.big-btn-sub { font-size: 13px; opacity: .9; }
.legend-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.legend-note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.mini-card {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 32px; border-radius: 4px; font-size: 12px; font-weight: 700; color: #3a2a1a;
}

/* 稀有度配色 */
.r-bronze { background: linear-gradient(135deg, #e6b17e, #b87333); }
.r-silver { background: linear-gradient(135deg, #f2f4f7, #a9b4c2); }
.r-gold   { background: linear-gradient(135deg, #fff1a8, #e0a91b); }
.r-holo {
  background: linear-gradient(120deg, #ffb3c6, #ffe29a, #b5f5c8, #a8d8ff, #d6b8ff, #ffb3c6);
  background-size: 300% 300%;
  animation: holo 4s linear infinite;
}
@keyframes holo { to { background-position: 300% 0; } }

/* 卡片 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 16px 10px; }
.card {
  position: relative; aspect-ratio: 3 / 4; border-radius: 10px; padding: 6px;
  border: none; box-shadow: var(--shadow);
}
.card-rarity {
  position: absolute; bottom: 0; left: 50%; transform: translate(-50%, 45%);
  font-size: 10px; font-weight: 700; padding: 0 6px; border-radius: 99px; color: #3a2a1a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.card-inner {
  height: 100%; border-radius: 6px; background: rgba(255, 255, 255, .78); color: #2b2622;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 4px; text-align: center; overflow: hidden;
}
.card-emoji { font-size: 28px; line-height: 1.2; }
.card-word { font-family: var(--jp); font-size: 17px; font-weight: 700; line-height: 1.2; word-break: keep-all; }
.card-reading { font-family: var(--jp); font-size: 11px; color: #6f655b; }
.card-meaning { font-size: 11px; color: #6f655b; }
.card-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 700;
  width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.card.locked { background: var(--locked); }
.card.locked .card-inner { background: transparent; color: var(--muted); }
.card.locked .card-emoji { filter: grayscale(1) opacity(.35); }
.card.big { width: 180px; margin: 0 auto; }
.card.big .card-emoji { font-size: 56px; }
.card.big .card-word { font-size: 30px; }
.card.big .card-reading { font-size: 16px; }
.card.big .card-meaning { font-size: 15px; }

/* 图鉴 */
.collection-total { font-size: 15px; color: var(--muted); margin-bottom: 14px; }
.theme-block { margin-bottom: 22px; }
.theme-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.theme-name { font-weight: 700; font-size: 16px; }
.theme-count { font-size: 13px; color: var(--muted); }
.theme-head .btn { margin-left: auto; padding: 4px 10px; font-size: 13px; }

.tabs {
  display: flex; background: var(--surface); border-radius: 12px; padding: 4px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.tabs button { flex: 1; border: none; background: none; padding: 8px 4px; border-radius: 9px; color: var(--muted); font-size: 14px; }
.tabs button.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.new-kana { font-size: 13px; color: var(--muted); margin: -4px 0 10px; }
.new-kana span { font-size: 16px; color: var(--ink); letter-spacing: 2px; }

/* 假名图鉴 */
.kana-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 8px; }
.kana-cell {
  aspect-ratio: 1; border: none; border-radius: 10px; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #2b2622; box-shadow: var(--shadow);
}
.kana-char { font-family: var(--jp); font-size: 26px; font-weight: 700; line-height: 1.1; }
.kana-ro { font-size: 11px; opacity: .75; }
.kana-cell.locked { background: var(--locked); color: var(--muted); }
.kana-cell.locked .kana-char { opacity: .7; }
.kana-cell.unused { background: none; box-shadow: none; border: 1px dashed var(--line); color: var(--line); font-size: 20px; }
.kana-cell.empty { visibility: hidden; }
.atlas-note { font-size: 12px; color: var(--muted); margin-bottom: 20px; }
.kana-big {
  width: 140px; height: 140px; margin: 0 auto; border-radius: 16px; color: #2b2622;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.kana-big span { font-family: var(--jp); font-size: 72px; font-weight: 700; line-height: 1; }
.kana-big small { font-size: 18px; margin-top: 4px; }
.kana-big.locked { background: var(--locked); color: var(--muted); }
.kana-words { margin-top: 10px; }
.kana-words .row span:first-child { color: var(--ink); }
.locked-row { opacity: .55; }
.shape-tip {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px; text-align: left;
  background: var(--surface); border-left: 4px solid #e0a91b; font-size: 14px; line-height: 1.6;
}
.shape-tip b { font-size: 18px; }
.fb-romaji { font-size: 14px; color: var(--muted); }

/* 答题 */
.quiz-top { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; font-size: 14px; color: var(--muted); }
.quiz-bar { flex: 1; }
.question {
  background: var(--surface); border-radius: 16px; padding: 24px 16px; text-align: center;
  margin-bottom: 16px; box-shadow: var(--shadow); min-height: 170px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.q-tag { font-size: 13px; color: var(--muted); }
.q-tag .new { background: var(--accent); color: var(--accent-ink); border-radius: 6px; padding: 1px 6px; margin-right: 6px; }
.q-prompt { font-size: 40px; font-weight: 700; line-height: 1.3; }
.q-prompt.zh { font-size: 30px; }
.q-prompt .emoji { display: block; font-size: 44px; }
.q-prompt ruby rt { font-size: 14px; font-weight: 400; color: var(--muted); }
.q-hint { font-size: 15px; color: var(--muted); }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option {
  border: 2px solid var(--line); background: var(--surface); border-radius: 12px;
  padding: 14px 8px; font-size: 18px; min-height: 64px; position: relative;
}
.option .key { position: absolute; top: 4px; left: 8px; font-size: 11px; color: var(--muted); }
.option.jp-opt { font-family: var(--jp); font-size: 22px; }
.option small { display: block; font-size: 12px; color: var(--muted); }
.option.correct { border-color: var(--good); background: var(--good-bg); }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); }
.option:disabled { cursor: default; }
.type-area { display: none; flex-direction: column; gap: 10px; }
.type-area.show { display: flex; }
#type-input {
  font-size: 22px; padding: 12px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--surface); color: var(--ink); text-align: center;
}
#type-input:focus { outline: none; border-color: var(--accent); }
.type-preview { text-align: center; font-size: 20px; min-height: 28px; color: var(--muted); }
.feedback {
  display: none; margin-top: 16px; padding: 16px; border-radius: 14px; text-align: center;
}
.feedback.show { display: block; animation: fade .2s; }
.feedback.ok { background: var(--good-bg); }
.feedback.ng { background: var(--bad-bg); }
.fb-title { font-weight: 700; font-size: 17px; margin-bottom: 6px; }
.feedback.ok .fb-title { color: var(--good); }
.feedback.ng .fb-title { color: var(--bad); }
.fb-word { margin-bottom: 12px; font-size: 16px; }
.fb-word .jp { font-size: 24px; font-weight: 700; }
.fb-yours { font-size: 14px; color: var(--muted); margin-top: 4px; }
.feedback .btn { width: 100%; }

/* 结算 */
.result-score { text-align: center; font-size: 40px; font-weight: 700; margin-top: 10px; }
.result-sub { text-align: center; color: var(--muted); margin-bottom: 20px; }
.result-group { margin-bottom: 20px; }
.result-group h3 { font-size: 15px; margin: 0 0 10px; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-actions .btn.primary { grid-column: 1 / -1; }
.flip-in { animation: flip .6s backwards; }
@keyframes flip {
  from { transform: rotateY(90deg) scale(.8); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* 弹窗 */
.modal {
  overflow-y: auto;
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 20;
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal.show { display: flex; }
.modal-box {
  background: var(--surface); border-radius: 18px; padding: 22px; width: 100%; max-width: 380px;
  max-height: calc(100dvh - 32px); overflow-y: auto;
}
.modal-info { margin: 16px 0; font-size: 14px; line-height: 1.9; }
.modal-info .row { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); }
.modal-info .row span:first-child { color: var(--muted); }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

@media (max-width: 400px) {
  .q-prompt { font-size: 34px; }
  .option { font-size: 16px; }
  .option.jp-opt { font-size: 19px; }
}

/* ===== 动效 ===== */

/* 按下去的手感 */
.btn, .chip, .option, .big-btn, .card, .kana-cell, .nav-btn, .tabs button, .link-btn {
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease;
}
.btn:active, .chip:active, .option:not(:disabled):active, .card:active, .kana-cell:active,
.nav-btn:active, .tabs button:active { transform: scale(.95); }
@media (hover: hover) {
  .option:not(:disabled):hover { transform: translateY(-2px); border-color: var(--accent); }
  .card:hover, .kana-cell[data-kana]:hover { transform: translateY(-4px) rotate(-1deg); box-shadow: 0 8px 18px rgba(60, 40, 20, .18); }
  .big-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #a83a37; }
  .chip:hover { border-color: var(--accent); }
}

/* 题目进场：题面浮上来，选项依次弹出 */
.question.enter { animation: rise .35s cubic-bezier(.2, .8, .3, 1.2); }
.option { animation: rise .35s cubic-bezier(.2, .8, .3, 1.2) backwards; }
.option:nth-child(2) { animation-delay: .05s; }
.option:nth-child(3) { animation-delay: .1s; }
.option:nth-child(4) { animation-delay: .15s; }
.type-area.show { animation: rise .35s backwards .05s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.97); } }

/* 答对：选项弹一下，发光 */
.option.correct { box-shadow: 0 0 0 4px rgba(47, 158, 110, .2); }
.option.pop { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 40% { transform: scale(1.08); } }
#type-input.good { border-color: var(--good); background: var(--good-bg); animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }

/* 答错：左右晃 */
.option.shake, #type-input.bad, .question.shake { animation: shake .45s; }
#type-input.bad { border-color: var(--bad); background: var(--bad-bg); }
@keyframes shake {
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

/* 反馈面板从下面滑上来 */
.feedback.show { animation: slide-up .35s cubic-bezier(.2, .8, .3, 1.1); }
.feedback.ok .fb-title { animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) .05s backwards; }
@keyframes slide-up { from { opacity: 0; transform: translateY(24px); } }

/* 获得 / 升级提示 */
.reward {
  display: inline-block; margin-top: 10px; padding: 4px 14px; border-radius: 99px;
  font-size: 14px; font-weight: 700; color: #3a2a1a;
  animation: reward-in .6s cubic-bezier(.3, 1.6, .5, 1) .15s backwards;
}
.reward.down { background: var(--line); color: var(--muted); }
@keyframes reward-in { from { opacity: 0; transform: scale(.4) rotate(-6deg); } }

/* 连对 */
.combo { font-weight: 700; color: #e07b1a; white-space: nowrap; }
.combo.bump { animation: pop .4s cubic-bezier(.3, 1.6, .5, 1); }

/* 碎片和彩纸 */
.particle {
  position: fixed; z-index: 50; width: 8px; height: 8px; border-radius: 2px; pointer-events: none;
  animation: burst .75s cubic-bezier(.1, .7, .3, 1) forwards;
}
@keyframes burst {
  from { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.3) rotate(220deg); opacity: 0; }
}
.confetti {
  position: fixed; z-index: 50; top: -12px; width: 8px; height: 12px; border-radius: 2px; pointer-events: none;
  animation: fall 2s cubic-bezier(.3, .4, .6, 1) forwards;
}
@keyframes fall {
  to { transform: translate(var(--dx), 105vh) rotate(720deg); opacity: .6; }
}

/* 金卡、闪卡扫过一道光 */
.card-inner { position: relative; }
.r-gold .card-inner::after, .r-holo .card-inner::after, .kana-cell.r-gold::after, .kana-cell.r-holo::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .7) 50%, transparent 65%);
  transform: translateX(-120%); animation: shine 3.2s ease-in-out infinite;
}
.kana-cell { position: relative; overflow: hidden; }
@keyframes shine { 60%, 100% { transform: translateX(120%); } }

/* 结算 */
.result-score { animation: pop .6s cubic-bezier(.3, 1.6, .5, 1); }
.flip-in.r-gold, .flip-in.r-holo { box-shadow: 0 0 18px rgba(243, 199, 79, .55); }

/* 弹窗 */
.modal.show { animation: fade .2s; }
.modal.show .modal-box { animation: modal-in .3s cubic-bezier(.2, .8, .3, 1.2); }
@keyframes modal-in { from { opacity: 0; transform: scale(.9) translateY(10px); } }

/* 进度条前端发亮 */
.bar-fill { position: relative; }
.quiz-bar .bar-fill::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 16px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6));
}

/* 系统设置了「减少动画」时：保留短促的点击和答题反馈，去掉一直循环的光效 */
@media (prefers-reduced-motion: reduce) {
  .r-holo, .r-gold .card-inner::after, .r-holo .card-inner::after,
  .kana-cell.r-gold::after, .kana-cell.r-holo::after { animation: none; }
}

/* ===== 首页：学习范围两级选择 ===== */
.icon-btn { padding: 6px 8px; font-size: 17px; }
.seg {
  display: flex; background: var(--bg); border-radius: 10px; padding: 3px; gap: 2px; overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1 0 auto; border: none; background: none; padding: 8px 10px; border-radius: 8px;
  font-size: 14px; color: var(--muted); white-space: nowrap;
}
.seg button.active { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }
.seg button:disabled { opacity: .4; }
.picker { margin-top: 10px; }
.picker summary {
  list-style: none; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 600;
}
.picker summary::-webkit-details-marker { display: none; }
.picker-hint { font-size: 13px; color: var(--muted); font-weight: 400; }
.picker-hint::after { content: " ▾"; }
.picker[open] .picker-hint::after { content: " ▴"; }
.picker .chips { margin-top: 10px; animation: rise .25s; }
.scope-note { font-size: 13px; color: var(--muted); margin-top: 10px; }
.round-size {
  display: flex; justify-content: center; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); margin: -4px 0 16px;
}
.round-size button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 12px; font-size: 13px; }
.round-size button.active { border-color: var(--accent); color: var(--accent); font-weight: 700; }

/* ===== 朋友挑战 ===== */
.challenge-banner {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #fff1a8, #ffd9a8); color: #3a2a1a;
  border-radius: 14px; padding: 14px; margin-bottom: 14px; font-size: 14px; line-height: 1.6;
  animation: rise .4s;
}
.challenge-banner .btn { flex-shrink: 0; }
.compare { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 18px; line-height: 1.6; }
.vs { display: flex; justify-content: center; align-items: center; gap: 18px; margin-bottom: 6px; }
.vs div { display: flex; flex-direction: column; }
.vs b { font-size: 34px; color: var(--ink); }
.vs i { font-style: normal; font-size: 28px; }
.verdict { font-size: 20px; font-weight: 700; color: var(--ink); animation: pop .6s cubic-bezier(.3, 1.6, .5, 1) .4s backwards; }

/* ===== 新卡翻面 ===== */
.question.intro { padding: 16px; }
.question.intro .q-prompt { width: 100%; font-size: 16px; line-height: 1.4; }
.flip {
  display: block; width: 100%; max-width: 280px; height: 240px; margin: 0 auto;
  border: none; background: none; padding: 0; perspective: 900px; color: inherit;
}
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform .5s cubic-bezier(.3, 1.3, .5, 1); transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 14px;
  background: var(--bg); border: 2px dashed var(--line);
}
.flip-face.back {
  transform: rotateY(180deg); border: none; color: #2b2622;
  background: linear-gradient(135deg, #e6b17e, #b87333);
}
.flip-face.back > * { position: relative; }
.flip-face.back::before { content: ""; position: absolute; inset: 6px; border-radius: 11px; background: rgba(255, 255, 255, .88); }
.flip-word { font-size: 40px; font-weight: 700; line-height: 1.2; }
.flip-word.small { font-size: 24px; }
.flip-sub { font-size: 15px; color: var(--muted); font-weight: 400; }
.flip-face.back .flip-sub { color: #6f655b; font-size: 13px; }
.flip-tap { font-size: 13px; color: var(--muted); margin-top: 14px; font-weight: 400; }
.flip-emoji { font-size: 36px; line-height: 1.1; }
.flip-meaning { font-size: 19px; font-weight: 700; }
.flip .example { margin-top: 2px; font-size: 13px; font-weight: 400; }
.flip .example-zh { color: #6f655b; }
.intro-btn { grid-column: 1 / -1; padding: 14px; font-size: 16px; animation: rise .35s backwards .1s; }

/* ===== 例句 ===== */
.example { margin-top: 12px; font-size: 15px; line-height: 1.6; text-align: center; }
.example mark { background: rgba(243, 199, 79, .45); color: inherit; border-radius: 3px; padding: 0 2px; }
.example-zh { font-size: 13px; color: var(--muted); }
.example.compact { font-size: 14px; margin-top: 10px; }

/* ===== 成就 ===== */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.badge {
  background: var(--surface); border-radius: 12px; padding: 12px 10px; text-align: center;
  box-shadow: var(--shadow); opacity: .55;
}
.badge.got { opacity: 1; }
.badge.new { animation: reward-in .6s cubic-bezier(.3, 1.6, .5, 1) .2s backwards; box-shadow: 0 0 0 2px #e0a91b, 0 0 18px rgba(243, 199, 79, .5); }
.badge-icon { font-size: 30px; }
.badge-name { font-weight: 700; font-size: 14px; margin-top: 2px; }
.badge-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 集齐的主题：金边 */
.theme-block.complete {
  padding: 12px; margin-left: -12px; margin-right: -12px; border-radius: 16px;
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
              linear-gradient(135deg, #fff1a8, #e0a91b, #fff1a8) border-box;
  border: 2px solid transparent;
}
.theme-block.complete .theme-count { color: #c48a0a; font-weight: 700; }

/* ===== 弹窗里的内容 ===== */
#modal-body h2 { margin: 0 0 12px; font-size: 20px; }
#modal-body h3 { margin: 18px 0 8px; font-size: 15px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0 0 8px; }
.modal-card { display: flex; justify-content: center; }
.setting-row { display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.switch {
  width: 50px; height: 30px; border-radius: 99px; border: none; background: var(--line); position: relative; padding: 0;
  transition: background .2s;
}
.switch span {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s cubic-bezier(.3, 1.4, .5, 1);
}
.switch.on { background: var(--good); }
.switch.on span { transform: translateX(20px); }
.code-box {
  width: 100%; height: 76px; resize: none; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: 16px/1.4 ui-monospace, Menlo, monospace; padding: 8px;
  word-break: break-all;
}
.row-btns { display: flex; gap: 8px; margin-top: 8px; }
.row-btns .btn { flex: 1; font-size: 14px; padding: 9px 8px; }
.btn.danger { color: var(--bad); }
.share-img { width: 100%; border-radius: 12px; box-shadow: var(--shadow); }

/* ===== 新手引导 ===== */
.tour {
  position: fixed; inset: 0; z-index: 30; display: none; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .5); padding: 16px;
}
.tour.show { display: flex; animation: fade .25s; }
.tour-box {
  background: var(--surface); border-radius: 20px; padding: 26px 22px 16px; width: 100%; max-width: 360px;
  text-align: center; animation: modal-in .35s cubic-bezier(.2, .8, .3, 1.2);
}
.tour-slide { animation: rise .35s; }
.tour-slide h2 { margin: 14px 0 8px; font-size: 21px; }
.tour-slide p { margin: 0 0 16px; color: var(--muted); font-size: 15px; line-height: 1.7; }
.tour-art { font-size: 56px; }
.tour-cards { display: flex; justify-content: center; gap: 8px; }
.tour-cards .mini-card { width: 44px; height: 60px; font-size: 18px; border-radius: 8px; animation: reward-in .5s backwards; }
.tour-cards .mini-card:nth-child(2) { animation-delay: .1s; }
.tour-cards .mini-card:nth-child(3) { animation-delay: .2s; }
.tour-cards .mini-card:nth-child(4) { animation-delay: .3s; }
.tour-choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.tour-choice {
  border: 2px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px; text-align: left;
  display: flex; flex-direction: column; gap: 2px; transition: transform .12s, border-color .2s;
}
.tour-choice:active { transform: scale(.97); }
.tour-choice span { font-size: 13px; color: var(--muted); }
.tour-dots { display: flex; justify-content: center; gap: 6px; margin: 4px 0 14px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: width .2s; }
.tour-dots i.on { width: 20px; border-radius: 99px; background: var(--accent); }
.tour-next { width: 100%; padding: 13px; }
#tour-skip { margin-top: 8px; }
@media (hover: hover) { .tour-choice:hover { border-color: var(--accent); } }

/* ===== 提示条 ===== */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2); transition: opacity .25s, transform .25s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 假名图鉴里的拗音格子字多一些 */
.kana-cell.combo-cell .kana-char { font-size: 20px; }
