/* 我的英雄 (spec §17.3, §17.4): night-sky theme, the 10-piece jigsaw, the hero wall, the progress card
   (homework page, child home) and 英雄图库. The unlock show (spec §40) is in hero-unlock.css. §12: side-by-side
   groups share one class, use minmax(0, 1fr) columns and equal rows; long names are cut to one line. */

/* ---------- Tokens (light / dark) ---------- */
:root {
  --hr-night-1: #19134A;
  --hr-night-2: #2B2475;
  --hr-night-3: #4436B8;
  --hr-gold: #FFC233;
  --hr-gold-2: #FF9F1C;
  --hr-gold-soft: rgba(255, 194, 51, 0.18);
  --hr-board: #1C1645;
  --hr-slot-line: rgba(255, 255, 255, 0.30);
  --hr-edge: rgba(255, 255, 255, 0.50);
  --hr-badge-fill: rgba(255, 255, 255, 0.12);
  --hr-badge-line: rgba(255, 255, 255, 0.42);
  --hr-glow: #FFD45C;
  --hr-dot-off: rgba(43, 36, 117, 0.12);
  --hr-sil-body: rgba(255, 255, 255, 0.10);
  --hr-sil-visor: rgba(255, 212, 92, 0.32);
  --hr-overlay: #0B0826;
  --hr-accent: #4B3FD1;
  --hr-accent-soft: #E6E3FF;
}
@media (prefers-color-scheme: dark) {
  :root {
    --hr-night-1: #0E0A2C;
    --hr-night-2: #1A1548;
    --hr-night-3: #30289A;
    --hr-dot-off: rgba(247, 239, 255, 0.14);
    --hr-accent: #A69DFF;
    --hr-accent-soft: rgba(166, 157, 255, 0.16);
  }
}

/* ---------- Theme: set on <html> while a hero page is open (sheets included) ---------- */
html.theme-heroes {
  --hero-1: var(--hr-night-1);
  --hero-2: var(--hr-night-2);
  --hero-glow: rgba(255, 196, 64, 0.38);
  --accent: var(--hr-accent);
  --accent-soft: var(--hr-accent-soft);
  --focus: rgba(75, 63, 209, 0.45);
}
html.theme-heroes .btn-primary {
  background: linear-gradient(135deg, #6457F0 0%, var(--hr-night-3) 55%, var(--hr-night-2) 100%);
  box-shadow: 0 1px 2px rgba(25, 19, 74, 0.2), 0 8px 20px rgba(68, 54, 184, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
html.theme-heroes .hero::before { background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 70%); }
html.theme-heroes .hero::after { background: radial-gradient(circle at 50% 50%, rgba(255, 196, 64, 0.30), rgba(255, 196, 64, 0) 70%); }
html.theme-heroes .page.is-scrolled .topbar { box-shadow: 0 1px 0 var(--hero-line), 0 8px 24px rgba(10, 6, 40, 0.30); }
html.theme-heroes .seg--glass .seg-item[aria-checked="true"] { color: var(--hr-night-2); }
/* Pieces fly in from outside the board; nothing may scroll sideways meanwhile. */
.page--heroes .page-body { overflow-x: clip; }

/* ---------- Header: three equal stat tiles ---------- */
.hr-switcher { margin: 6px 0 12px; }
.hr-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: var(--gap);
  margin-top: 14px;
}
.hr-stat {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  height: 100%;
  min-height: 78px;
  padding: 10px 6px;
  border-radius: var(--r-m);
  background: var(--hero-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  text-align: center;
}
.hr-stat-value { font-family: var(--font-rounded); font-size: 30px; font-weight: 800; line-height: 1.1; color: var(--hr-gold); }
.hr-stat-label { font-size: 13px; color: var(--hero-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---------- The jigsaw ---------- */
.hj { position: relative; width: 100%; aspect-ratio: 3 / 4; }
.hj-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hj-board { fill: var(--hr-board); }
.hj-slot { fill: rgba(255, 255, 255, 0.02); stroke: var(--hr-slot-line); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.hj-edge { fill: none; stroke: var(--hr-edge); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.55; transition: opacity 600ms var(--ease-out); }
.hj-frame { fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.hj-badge circle { fill: var(--hr-badge-fill); stroke: var(--hr-badge-line); stroke-width: 3; }
.hj-badge text { fill: #fff; font-family: var(--font-rounded); font-size: 40px; font-weight: 800; }
.hj-badge.is-next circle { fill: rgba(255, 194, 51, 0.30); stroke: var(--hr-gold); transform-box: fill-box; transform-origin: center; animation: hj-next 1.8s ease-in-out infinite; }
@keyframes hj-next { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.hj-hidden, .hj-badge { transition: opacity 500ms var(--ease-out); }
.hj-full { opacity: 0; transition: opacity 700ms var(--ease-out); }
.hj.is-whole .hj-full { opacity: 1; }
.hj.is-whole .hj-edge, .hj.is-whole .hj-hidden { opacity: 0; }

/* Earned since the last visit: a golden ring (a parent sees it standing still). */
.hj-glow { fill: none; stroke: var(--hr-glow); stroke-width: 12; opacity: 0.85; pointer-events: none; animation: hj-glow-soft 2.2s ease-in-out infinite alternate; }
@keyframes hj-glow-soft { from { opacity: 0.45; } to { opacity: 0.95; } }

/* The child's new pieces fly in one after the other, then glow. */
.hj-piece.is-fly, .hj-piece.is-assemble { transform-box: fill-box; transform-origin: 50% 50%; }
.hj-piece.is-fly { animation: hj-fly 760ms var(--ease-out) var(--d, 0ms) both; }
.hj-piece.is-assemble { animation: hj-fly 760ms var(--ease-spring) var(--d, 0ms) both; }
@keyframes hj-fly {
  0% { opacity: 0; transform: translate(var(--fx), var(--fy)) rotate(var(--fr)) scale(1.3); }
  18% { opacity: 1; }
  82% { transform: translate(0, 0) rotate(0deg) scale(1.04); }
  100% { opacity: 1; transform: none; }
}
.hj-glow.is-fly { animation: hj-glow-fly 1500ms ease-out calc(var(--d, 0ms) + 560ms) both; }
@keyframes hj-glow-fly {
  0% { opacity: 0; }
  25% { opacity: 1; }
  55% { opacity: 0.45; }
  75% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* ---------- 我的英雄: the hero being put together ---------- */
.hr-current-host { position: relative; }
.hr-current {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 18px;
  padding: 20px;
}
.hr-current.is-loading { min-height: 560px; }
.hr-current-skel { width: min(100%, 340px); aspect-ratio: 3 / 4; border-radius: 22px; }
.hr-current-board { width: min(100%, 340px); }
.hr-current-board .hj { filter: drop-shadow(0 18px 30px rgba(25, 19, 74, 0.28)); }
.hr-current.is-complete .hr-current-board .hj { filter: drop-shadow(0 0 28px rgba(255, 194, 51, 0.65)); }
.hr-current-info { display: grid; justify-items: center; gap: 8px; width: 100%; min-width: 0; text-align: center; }
.hr-kicker { font-size: 14px; font-weight: 600; color: var(--text-3); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hr-current-name { font-size: 26px; font-weight: 800; line-height: 1.2; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hr-meter { display: flex; align-items: baseline; gap: 2px; font-family: var(--font-rounded); line-height: 1; }
.hr-big {
  font-size: 64px;
  font-weight: 900;
  background: linear-gradient(180deg, var(--hr-gold) 10%, var(--hr-gold-2) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hr-of { font-size: 26px; font-weight: 800; color: var(--text-3); }
.hr-big.is-bump { animation: hr-bump 420ms var(--ease-spring); }
@keyframes hr-bump { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
.hr-dots, .hpc-dots {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
  width: min(100%, 320px);
}
.hr-dot, .hpc-dot { height: 12px; border-radius: var(--r-pill); background: var(--hr-dot-off); }
.hr-dot.is-on, .hpc-dot.is-on { background: linear-gradient(135deg, var(--hr-gold), var(--hr-gold-2)); }
.hr-dot.is-new { background: var(--hr-glow); box-shadow: 0 0 0 3px var(--hr-gold-soft); }
.hr-hint { font-size: 18px; font-weight: 600; color: var(--text-2); }
.hr-note { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); }
.hr-note svg { width: 16px; height: 16px; color: var(--hr-gold-2); flex-shrink: 0; }
.hr-cta { margin-top: 6px; min-width: 200px; }
.hr-current--empty { min-height: 240px; align-content: center; }
.hr-empty-art { width: 120px; color: var(--hr-night-3); }
.hr-empty-art .hr-sil { width: 100%; height: auto; }
.hr-empty-art .hr-sil-body { fill: var(--hr-dot-off); }
.hr-empty-art .hr-sil-visor { fill: var(--hr-gold-soft); }
.hr-retry { width: 100%; border: 0; font: inherit; color: inherit; }

@media (min-width: 700px) {
  .hr-current {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: center;
    gap: 28px;
    padding: 28px;
  }
  .hr-current-board { width: min(100%, 380px); justify-self: end; }
  .hr-current-info { justify-items: start; text-align: left; gap: 12px; }
  .hr-current-name { font-size: 32px; }
  .hr-big { font-size: 88px; }
  .hr-of { font-size: 32px; }
  .hr-hint { font-size: 22px; }
  .hr-current--empty { grid-template-columns: auto minmax(0, 1fr); }
}
/* An iPad: the jigsaw and its words as one centred group, no empty strip on one side (spec §24.3). */
@media (min-width: 700px) {
  .hr-current:not(.hr-current--empty) { grid-template-columns: minmax(0, 380px) fit-content(440px); justify-content: center; column-gap: 40px; }
}
@media (min-width: 900px) {
  .hr-current, .hr-current:not(.hr-current--empty) { grid-template-columns: minmax(0, 380px) fit-content(440px); justify-content: center; column-gap: 56px; }
}
/* The child's iPad: bigger words (spec §17.4, titles ≥ 22px). */
.page--heroes-kid .hr-hint { font-size: 22px; }
.page--heroes-kid .hr-kicker { font-size: 17px; }

/* ---------- Hero wall and locked silhouettes: equal cards ---------- */
.hr-section .section-label { font-size: 16px; }
.hr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  gap: var(--gap);
}
@media (min-width: 560px) { .hr-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .hr-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .hr-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
/* Silhouettes are smaller: one more column at every width. */
.hr-grid--locked { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 560px) { .hr-grid--locked { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 900px) { .hr-grid--locked { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .hr-grid--locked { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.hr-grid--locked .hr-card-q { font-size: 40px; }
.hr-grid--locked .hr-card-name { font-size: 14px; }
/* The child's iPad: the wall and the silhouettes on one grid, so their columns line up (spec §24.3). */
@media (min-width: 700px) { .page--heroes-kid .hr-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 900px) { .page--heroes-kid .hr-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .page--heroes-kid .hr-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.hr-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  padding: 8px;
  border: 0;
  border-radius: var(--r-l);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  color: var(--text);
  font: inherit;
  text-align: center;
  transition: transform var(--dur-1) var(--ease-out);
}
button.hr-card:active { transform: scale(0.96); }
.hr-card-pic {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--hr-night-2), var(--hr-night-1));
}
.hr-card-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hr-card-name { margin-top: 8px; padding: 0 4px; font-size: 16px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hr-card.is-locked { color: var(--text-3); box-shadow: var(--shadow-1); }
.hr-card-sil { width: 64%; }
.hr-card-sil .hr-sil { display: block; width: 100%; height: auto; }
.hr-sil-body { fill: var(--hr-sil-body); }
.hr-sil-visor { fill: var(--hr-sil-visor); }
.hr-card-q { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-rounded); font-size: 56px; font-weight: 900; color: rgba(255, 255, 255, 0.78); }
.page--heroes-kid .hr-card-name { font-size: 18px; }

/* ---------- Progress card (parents' phones) and the child's hero card ---------- */
.hpc { display: grid; color: var(--text); text-decoration: none; transition: transform var(--dur-1) var(--ease-out); }
.hpc:active { transform: scale(0.98); }
.hpc-skel { display: block; width: 100%; height: 100%; min-height: inherit; border-radius: inherit; }
.hpc .hj-badge text { font-size: 44px; }

.hpc--compact {
  grid-template-columns: 66px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  height: 112px;
  padding: 12px 16px 12px 12px;
  border-radius: var(--r-l);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.hpc--compact.is-loading { grid-template-columns: minmax(0, 1fr); padding: 0; }
.hpc-thumb { display: block; width: 66px; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--hr-board); }
.hpc-thumb .hj-glow { stroke-width: 18; }
.hpc-main { display: grid; gap: 8px; min-width: 0; }
.hpc-title { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hpc--compact .hpc-title { display: flex; align-items: center; gap: 8px; }
.hpc--compact .hpc-sub { font-size: 13px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.hpc--compact .hpc-dots { gap: 4px; width: 100%; }
.hpc--compact .hpc-dot { height: 8px; }
.hpc-hint { font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hpc-side { display: grid; justify-items: end; gap: 2px; }
.hpc-count { font-family: var(--font-rounded); font-size: 22px; font-weight: 800; color: var(--hr-gold-2); }
.hpc-new-dot { flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.hpc-img, .hpc-sil { display: block; width: 100%; height: 100%; object-fit: cover; }
.hpc-sil .hr-sil { width: 100%; height: 100%; }

/* The child's hero card (spec §24.3a #1): its own height (never stretched), the jigsaw big and centred,
   「第 3 个英雄 · 5/10」, ten segments and the hint under it; in a landscape iPad's right column the
   jigsaw sits left with the progress beside it. Same surface, padding and head row as the homework. */
.hpc--panel {
  --hpc-board-w: min(100%, 300px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: var(--kid-pad, 20px);
  border-radius: var(--r-xl);
  color: var(--text);
  background: radial-gradient(120% 70% at 100% 0%, var(--hr-accent-soft) 0%, transparent 62%), var(--surface);
  box-shadow: var(--shadow-2);
}
.hpc--panel.is-loading { min-height: 560px; padding: 0; background: none; box-shadow: none; }
.hpc-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hpc-icon { display: grid; place-items: center; flex-shrink: 0; width: var(--kid-icon, 52px); height: var(--kid-icon, 52px); border-radius: 16px; color: #5A3500; background: linear-gradient(135deg, var(--hr-gold), var(--hr-gold-2)); }
.hpc-icon svg { width: 58%; height: 58%; }
.hpc--panel .hpc-title { flex: 1; font-size: var(--kid-head-fs, 26px); font-weight: 800; line-height: 1.2; }
.hpc-new {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  color: #4A2C00;
  background: linear-gradient(135deg, #FFE07A, var(--hr-gold));
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  animation: hpc-bounce 1.6s var(--ease-spring) infinite;
}
.hpc-new svg { width: 18px; height: 18px; }
@keyframes hpc-bounce { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-4px) scale(1.04); } }
.hpc-board { display: block; width: var(--hpc-board-w); margin: 0 auto; }
.hpc-board .hj { filter: drop-shadow(0 12px 24px rgba(25, 19, 74, 0.30)); }
.hpc-board .hpc-img, .hpc-board .hpc-sil { aspect-ratio: 3 / 4; height: auto; border-radius: 18px; background: var(--hr-board); }
.hpc-progress { display: grid; gap: 10px; width: var(--hpc-board-w); min-width: 0; margin: 0 auto; }
.hpc-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.hpc--panel .hpc-sub { font-size: 20px; font-weight: 800; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hpc--panel .hpc-count { flex-shrink: 0; font-size: 40px; line-height: 1; color: var(--hr-gold-2); }
.hpc--panel .hpc-dots { width: 100%; gap: 5px; }
.hpc--panel .hpc-dot { height: 14px; }
.hpc--panel .hpc-hint { font-size: 20px; font-weight: 700; line-height: 1.35; color: var(--text); white-space: normal; text-align: center; text-wrap: balance; }
.hpc.is-failed .hpc-skel { animation: none; opacity: 0.5; }

@media (orientation: landscape) and (min-width: 900px) {
  .kid-side .hpc--panel:not(.is-loading) {
    --hpc-board-w: min(56%, 340px, calc((100dvh - 440px) * 0.75));
    display: grid;
    grid-template-columns: var(--hpc-board-w) minmax(0, 1fr);
    grid-template-areas: "head head" "board progress";
    align-items: center;
    column-gap: 22px;
    row-gap: 14px;
  }
  .kid-side .hpc--panel.is-loading { min-height: 480px; }
  .kid-side .hpc-head { grid-area: head; }
  .kid-side .hpc-board { grid-area: board; width: auto; margin: 0; }
  .kid-side .hpc-progress { grid-area: progress; width: auto; margin: 0; gap: 12px; }
  .kid-side .hpc-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .kid-side .hpc--panel .hpc-count { font-size: 56px; }
  .kid-side .hpc--panel .hpc-hint { text-align: left; }
}

/* ---------- Full-picture viewer ---------- */
.hv { position: fixed; inset: 0; z-index: 160; display: grid; place-items: center; padding: calc(var(--safe-top) + 64px) 16px calc(var(--safe-bottom) + 20px); background: rgba(8, 4, 24, 0.97); animation: fade-in 180ms both; }
.hv.is-leaving { animation: fade-out 180ms both; }
.hv-figure { display: grid; justify-items: center; gap: 14px; margin: 0; max-width: 100%; }
/* The box has its final size before any picture is in it (spec §34): the card size, the original and
   the spinner or error all fill the same box, so nothing moves when the picture comes. */
.hv-frame { position: relative; width: min(92vw, 560px, calc(70dvh * 3 / 4)); aspect-ratio: 3 / 4; border-radius: 22px; overflow: hidden; background: var(--hero-glass); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.hv-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hv-frame.is-broken .hv-img { visibility: hidden; }
.hv-slot { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; pointer-events: none; }
.hv-slot > * { pointer-events: auto; }
.hv-caption { display: grid; justify-items: center; gap: 4px; color: #fff; text-align: center; }
.hv-name { font-size: 26px; font-weight: 800; }
.hv-series { font-size: 13px; color: rgba(255, 255, 255, 0.6); }
.hv-desc { max-width: 26em; font-size: 16px; line-height: 1.5; color: rgba(255, 255, 255, 0.82); text-wrap: balance; }
.hv-listen { margin-top: 8px; }
.hv-close { position: absolute; top: calc(var(--safe-top) + 10px); right: 14px; }

/* ---------- 英雄图库 (parents) ---------- */
.ha-summary { margin-top: 6px; font-size: 15px; color: var(--hero-text-2); }
/* One button since spec §28.3 (uploads start from each series' own row). */
.ha-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
.ha-action { width: 100%; min-width: 0; }
.ha-action span { overflow: hidden; text-overflow: ellipsis; }
.ha-series-head { margin-top: 24px; }
.ha-series-name { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 16px; color: var(--text); font-weight: 700; }
.ha-count { font-size: 13px; font-weight: 600; color: var(--text-3); }
.ha-series-head .ha-more { margin: -10px -6px -10px 0; }
/* 「给：哥哥 · 妹妹」 (spec §39): right of the name, next to …. The tag keeps its width up to half the row (a
   longer list ends in an ellipsis) and the name gives way; … keeps its 44×44 in the same place on every series. */
.ha-series-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ha-series-name .ha-count { flex-shrink: 0; }
.ha-aud-tag { margin-left: auto; min-width: 0; max-width: 50%; }
.ha-series-head .ha-aud-tag, .ha-series-head .ha-more { flex-shrink: 0; }
.ha-aud-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ha-aud-tag + .ha-more { margin-left: -4px; }
.ha-note { display: flex; align-items: flex-start; gap: 6px; margin: var(--gap) 4px 0; font-size: 14px; line-height: 1.45; color: var(--text-2); }
.ha-note svg { width: 18px; height: 18px; margin-top: 1px; flex-shrink: 0; color: var(--warning); }
.ha-note[hidden] { display: none; }
/* 给谁 in the series sheet: equal option buttons, three a row (the sign-in "who" cards, smaller). */
.ha-aud { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 10px; }
.ha-aud-opt { min-width: 0; min-height: 44px; padding: 12px 6px 10px; gap: 6px; }
.ha-aud-pic, .ha-aud-all { width: 48px; height: 48px; }
.ha-aud-all { display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: var(--accent-soft); }
.ha-aud-all svg { width: 26px; height: 26px; }
.ha-aud-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.ha-aud .who-check { top: 8px; right: 8px; }
.ha-aud-hint { margin-top: 8px; }
.ha-row { gap: 10px; min-height: 76px; padding: 10px 8px 10px 12px; }
.ha-row + .ha-row::before { left: 66px; }
.ha-thumb { display: block; width: 42px; height: 56px; border-radius: 10px; overflow: hidden; flex-shrink: 0; background: var(--hr-board); }
.ha-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ha-row .row-title { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.ha-chip { height: 22px; padding: 0 8px; font-size: 12px; flex-shrink: 0; }
.ha-chip svg { width: 12px; height: 12px; }
.ha-row-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.ha-move { width: 40px; height: 44px; border-radius: 12px; }
.ha-move svg, .ha-more svg { width: 20px; height: 20px; }
.ha-add .row-title { color: var(--accent); }
.ha-foot { margin-top: 18px; }
.ha-empty-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; color: var(--accent); background: var(--accent-soft); }
.ha-empty-icon svg { width: 32px; height: 32px; }
/* No series yet (or not loaded): the card sits under 新建系列 with the usual gap, its line breaks between phrases. */
.ha-list > .card.empty { margin-top: var(--gap); }
.ha-empty-phrase { white-space: nowrap; }

.ha-form { display: grid; gap: 14px; }
.ha-form .field + .field { margin-top: 0; }
.ha-words { min-height: 72px; resize: none; }
.ha-picture { display: grid; justify-items: center; gap: 6px; }
.ha-pick {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  width: min(100%, 240px);
  aspect-ratio: 3 / 4;
  border: 2px dashed var(--line-strong);
  border-radius: 18px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  transition: transform var(--dur-1) var(--ease-out);
}
.ha-pick:active { transform: scale(0.97); }
.ha-pick-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; color: var(--accent); background: var(--accent-soft); }
.ha-pick-icon svg { width: 34px; height: 34px; }
.ha-pick strong { font-size: 17px; }
.ha-pick-hint { max-width: 12em; font-size: 13px; color: var(--text-3); text-align: center; text-wrap: balance; }

.hcrop { display: grid; justify-items: center; gap: 10px; width: 100%; }
.hcrop-frame {
  position: relative;
  width: min(100%, 240px);
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  overflow: hidden;
  background: var(--hr-board);
  touch-action: none;
  cursor: grab;
  box-shadow: var(--shadow-2);
}
.hcrop-canvas { display: block; width: 100%; height: 100%; }
.hcrop-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent calc(33.33% - 0.5px), rgba(255, 255, 255, 0.35) calc(33.33% - 0.5px), rgba(255, 255, 255, 0.35) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px), transparent calc(66.66% - 0.5px), rgba(255, 255, 255, 0.35) calc(66.66% - 0.5px), rgba(255, 255, 255, 0.35) calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px)),
    linear-gradient(180deg, transparent calc(33.33% - 0.5px), rgba(255, 255, 255, 0.35) calc(33.33% - 0.5px), rgba(255, 255, 255, 0.35) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px), transparent calc(66.66% - 0.5px), rgba(255, 255, 255, 0.35) calc(66.66% - 0.5px), rgba(255, 255, 255, 0.35) calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px));
}
.hcrop-tools { display: flex; align-items: center; gap: 10px; width: min(100%, 280px); }
.hcrop-icon { width: 20px; height: 20px; color: var(--text-3); flex-shrink: 0; }
.hcrop-zoom { flex: 1; min-width: 0; height: 44px; accent-color: var(--accent); }
.ha-again { justify-self: center; }

/* ---------- Reduced motion: nothing flies, pulses or spins ---------- */
@media (prefers-reduced-motion: reduce) {
  .hj-piece.is-fly, .hj-piece.is-assemble, .hj-glow, .hj-glow.is-fly, .hj-badge.is-next circle, .hpc-new, .hr-big.is-bump { animation: none; }
  .hj-glow { opacity: 0.85; }
}
