:root {
  font-synthesis: none;
  --cream-50: #fff8ee;
  --cream-100: #fff1dc;
  --cream-200: #f3e6d3;
  --white: #ffffff;
  --ink-900: #2b241c;
  --ink-600: #7a7066;
  --ink-400: #a89f94;
  --coral: #e86b4a;
  --coral-soft: #ffe0d4;
  --coral-pressed: #c85a3d;
  --border: #e8dcc8;
  --leaf: #5fae62;
  --water: #4aa3d9;
  --gold: #e8b84a;
  --overlay: rgba(45, 36, 28, 0.42);

  --bg-page: var(--cream-50);
  --bg-soft: var(--cream-100);
  --bg-muted: var(--cream-200);
  --bg-surface: var(--white);
  --text-primary: var(--ink-900);
  --text-secondary: var(--ink-600);
  --text-tertiary: var(--ink-400);
  --text-on-accent: var(--white);
  --text-accent: var(--coral);
  --fill-accent: var(--coral);
  --fill-accent-soft: var(--coral-soft);
  --fill-pressed: var(--coral-pressed);
  --border-default: var(--border);
  --board-stroke: var(--border);
  --status-remembered: var(--leaf);
  --status-learning: var(--water);
  --status-new: var(--gold);
  --status-unseen: var(--cream-200);

  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-8: 8px;
  --radius-14: 14px;
  --radius-20: 20px;
  --radius-button: 16px;
  --radius-alert: 14px;
  --radius-menu: 14px;
  --radius-sheet: 28px;
  --radius-notification: 20px;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --size-touch: 44px;
  --size-margin: 16px;
  --shadow: rgba(80, 50, 30, 0.14);

  /* Apple system typography; no SF Pro files are bundled. Fredoka is kept only for the WordNap wordmark. */
  --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font: var(--font-system);
  --display: var(--font-system);
  --font-en: var(--font-system);
  --font-ipa: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Lucida Grande", "Segoe UI", "Noto Sans", "Charis SIL", "Doulos SIL", "Apple Symbols", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --font-brand: "Fredoka", -apple-system, BlinkMacSystemFont, "PingFang SC", system-ui, sans-serif;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* legacy aliases used by older rules */
  --cream: var(--bg-page);
  --paper: var(--bg-surface);
  --ink: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-default);
  --terra: var(--fill-accent);
  --clay: #e7b194;
  --sage: var(--leaf);
  --sage-deep: #4f6a4e;
  --butter: var(--gold);
  --blush: #e39a94;
  --sky: var(--water);
  --lilac: #c4b3cf;
  --region-a: #c9dcc4;
  --region-b: #f0c8b0;
  --region-c: #efe0a8;
  --region-d: #c5ddd9;
  --region-e: #ddcde6;
  --region-f: #f0c6c2;
  --region-g: #e2d3b8;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  font-size: 13px;
  line-height: 18px;
  min-height: 0;
  height: 100%;
  height: 100svh;
  height: 100dvh;
  height: var(--app-h, 100dvh);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
body {
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
button {
  font-family: inherit;
  font-weight: 500;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}
img, svg { display: block; max-width: 100%; }

#app {
  width: 100%;
  max-width: 430px;
  min-height: 0;
  height: 100svh;
  height: 100dvh;
  height: var(--app-h, 100dvh);
  margin: 0 auto;
  position: fixed;
  top: var(--app-top, 0px);
  left: 0;
  right: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, #fffaf3 0%, transparent 60%),
    var(--cream);
  overflow: hidden;
  container-type: size;
  container-name: app;
}

.motes {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}
.mote {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 249, 242, 0.7);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
  animation: float 12s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); opacity: .35; }
  50% { transform: translateY(-18px) scale(1.15); opacity: .8; }
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  z-index: 1;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}
.screen.active { display: flex; }

/* ===== Home ===== */
#screen-home {
  padding: calc(18px + var(--safe-top)) 24px calc(16px + var(--safe-bottom));
  align-items: center;
  text-align: center;
}
.home-menu {
  position: absolute;
  top: calc(6px + var(--safe-top));
  right: 8px;
  z-index: 2;
}
.home-profile {
  position: absolute;
  top: calc(6px + var(--safe-top));
  left: 8px;
  z-index: 2;
  width: auto;
  min-width: 44px;
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
#screen-home .home-menu,
#screen-home .home-profile {
  position: absolute;
}
.brand {
  margin-top: 8px;
  font-family: var(--display);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--ink);
}
.tagline {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}
.hero {
  width: min(240px, 70vw);
  margin: 10px auto 4px;
  position: relative;
}
.hero-cushion {
  width: 100%;
  aspect-ratio: 1.3 / 1;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 40%, #f6d7c2, #e3b08a 60%, #c9896a);
  box-shadow:
    inset 0 -16px 24px rgba(90, 40, 20, 0.18),
    0 16px 24px var(--shadow);
}
.hero-cat {
  position: absolute;
  left: 50%;
  bottom: 18%;
  width: 58%;
  transform: translateX(-50%);
  filter: drop-shadow(0 8px 8px rgba(80, 40, 20, 0.2));
}
.hero-zzz {
  position: absolute;
  right: 18%;
  top: 10%;
  color: var(--muted);
  font-family: var(--display);
  font-style: italic;
  animation: zzz 2.8s ease-in-out infinite;
}
@keyframes zzz {
  0%, 100% { opacity: .3; transform: translateY(0) rotate(-8deg); }
  50% { opacity: 1; transform: translateY(-8px) rotate(6deg); }
}

.stats {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}
.stat {
  flex: 1;
  background: var(--paper);
  border-radius: 18px;
  padding: 12px 8px 10px;
  box-shadow: 0 1px 0 rgba(255,255,255,.8), 0 8px 18px var(--shadow);
}
.stat b {
  display: block;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
}
.stat span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.week-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 12px 0 6px;
}
.week-label {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.week {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.day-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #eadccb;
  box-shadow: inset 0 1px 2px rgba(80,50,30,.12);
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  color: #8a7a6c;
}
.day-dot span { line-height: 1; }
.day-dot.on {
  background: var(--sage);
  color: #3f4a3b;
  box-shadow: 0 0 0 3px rgba(127,155,120,.22);
}
.day-dot.today {
  outline: 2px solid var(--terra);
  outline-offset: 2px;
}

.coats {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 10px 0 16px;
  min-height: 36px;
}
.coat {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #eadccb;
  display: grid;
  place-items: center;
  opacity: .35;
  overflow: hidden;
}
.coat.on { opacity: 1; box-shadow: 0 2px 8px var(--shadow); }
.coat svg { width: 28px; height: 28px; }

.welcome {
  color: var(--sage-deep);
  font-size: 13px;
  margin: 0 0 8px;
  min-height: 1.2em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--terra);
  color: #fffaf3;
  font-size: 17px;
  box-shadow: 0 4px 0 #9a4d36, 0 10px 18px rgba(195, 107, 78, 0.35);
  transition: transform .15s ease, filter .15s ease;
  width: min(320px, 100%);
}
.btn:active { transform: scale(.98); filter: brightness(.97); }
.btn.ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  min-height: 36px;
  font-size: 15px;
}
.btn.soft {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 6px 14px var(--shadow);
}

.home-actions { width: 100%; display: flex; flex-direction: column; align-items: center; margin-top: auto; gap: 0; flex-shrink: 0; }
.fine { margin-top: 4px; font-size: 12px; color: var(--muted); }

/* ===== Round ===== */
#screen-round {
  padding: 0;
}
.topbar {
  display: grid;
  grid-template-columns: 44px 1fr 88px;
  align-items: center;
  padding: 6px 10px 4px;
  gap: 4px;
}
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: transparent;
  position: relative;
}
.icon-btn:active { background: rgba(255,255,255,.45); }
.icon-btn[disabled] { opacity: .35; }
.hint-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--terra);
  color: #fffaf3;
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}
.icon-btn[disabled] .hint-count { background: #b5a89c; }
.round-title {
  text-align: center;
}
.round-title .name {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
}
.round-title .meta {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.top-actions { display: flex; justify-content: flex-end; gap: 2px; }

.board-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px 0;
  min-height: 0;
}
.board {
  width: 100%;
  max-width: 440px;
  max-height: 100%;
  aspect-ratio: 1;
  display: grid;
  gap: 5px;
  padding: 6px;
  touch-action: none;
  filter: drop-shadow(0 10px 16px var(--shadow));
  transition: filter .6s ease;
}
.board.warm { filter: drop-shadow(0 10px 16px var(--shadow)) saturate(1.15) brightness(1.06); }
.seat {
  position: relative;
  border-radius: 18px;
  background: color-mix(in srgb, #f6e6d4 78%, white);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.65),
    inset 0 -6px 10px rgba(80,50,30,.08);
  outline: 2px solid rgba(58,47,40,.10);
  outline-offset: -1px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.seat .cell-pic {
  position: absolute;
  inset: 6%;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 1;
}
.seat .cell-pic .word-art,
.seat .cell-pic img,
.seat .cell-pic svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  border-radius: 10px;
}
.seat.occupied .cell-pic {
  inset: 38% 16% 6%;
  opacity: .22;
}
.seat .cell-word {
  display: none;
  position: absolute;
  top: 4px;
  left: 4px;
  right: 22px;
  z-index: 3;
  font-family: var(--display);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0;
  text-align: left;
  line-height: 1.1;
  padding: 1px 5px;
  color: var(--ink);
  overflow-wrap: anywhere;
  pointer-events: none;
  background: rgba(255, 249, 242, .86);
  border-radius: 7px;
}
.seat.occupied .cell-word { display: block; }
.board.size-4 .seat.occupied .cell-word,
.board.size-5 .seat.occupied .cell-word { font-size: 10px; }
.seat.drop-hover {
  transform: scale(.97);
  box-shadow: inset 0 0 0 3px rgba(80,50,30,.18);
}
.seat.pulse {
  animation: pulse 1s ease-in-out 2;
}
@keyframes pulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,.5); }
  50% { box-shadow: inset 0 0 0 3px var(--terra), 0 0 0 4px rgba(195,107,78,.28); }
}
.seat.shake { animation: shake .4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.placed-cat {
  position: absolute;
  inset: 18% 6% 2%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}
.seat.occupied .placed-cat { inset: 16% 2% 0; }
.placed-cat svg { width: 86%; height: 86%; }
.placed-cat.sleeping { animation: curl .45s ease; }
@keyframes curl {
  0% { transform: scale(.7) rotate(-8deg); opacity: .3; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.zzz-bits {
  position: absolute;
  top: 2%;
  right: 5%;
  z-index: 4;
  font-family: var(--display);
  font-style: italic;
  color: var(--muted);
  font-size: 13px;
  animation: zzz 2.4s ease-in-out infinite;
  pointer-events: none;
}

.prompt {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  min-height: 1.4em;
  padding: 6px 16px 4px;
  transition: color .2s;
}
.prompt.warn { color: var(--terra); }

.tray {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 16px calc(14px + var(--safe-bottom)) 16px;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 16px;
  -webkit-overflow-scrolling: touch;
  min-height: 128px;
  justify-content: flex-start;
  flex-shrink: 0;
}
.tray::-webkit-scrollbar { display: none; }

.cat-card {
  flex: 0 0 88px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px 8px;
  border-radius: 20px;
  background: #fffaf3;
  box-shadow: 0 8px 16px var(--shadow);
  outline: 2px solid rgba(58,47,40,.12);
  touch-action: none;
  position: relative;
  transition: transform .18s ease, box-shadow .18s ease;
}
.cat-card .cat-art {
  width: 72px;
  height: 72px;
  pointer-events: none;
  flex: 0 0 72px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.cat-card .cat-art .word-art,
.cat-card .cat-art img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}
.cat-card .word {
  position: relative;
  z-index: 1;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.15;
  padding: 3px 6px;
  border-radius: 999px;
  background: #f3e6d6;
  color: var(--ink);
  max-width: 86px;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}
.cat-card .word.long {
  font-size: 11px;
  letter-spacing: 0;
  padding: 3px 4px;
  white-space: normal;
  line-height: 1.15;
}
.cat-card.selected {
  transform: translateY(-6px);
  box-shadow: 0 14px 22px var(--shadow), 0 0 0 3px rgba(195,107,78,.45);
}
.cat-card.shake { animation: shake .4s ease; }

@media (max-width: 360px) {
  #screen-home .stat { height: auto; min-height: 73px; }
}
@media (max-height: 700px) {
  .tray { min-height: 112px; padding-top: 4px; }
  .cat-card { flex-basis: 76px; padding: 6px 5px 6px; }
  .cat-card .cat-art,
  .cat-card .cat-art img { width: 60px; height: 60px; flex-basis: 60px; }
}


.drag-ghost {
  position: fixed;
  z-index: 50;
  width: 92px;
  pointer-events: none;
  transform: translate(-50%, -70%) scale(1.05);
  filter: drop-shadow(0 12px 16px rgba(80,50,30,.28));
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px 8px;
  border-radius: 20px;
  background: #fffaf3;
  box-shadow: 0 8px 16px var(--shadow);
}
.drag-ghost.show { display: flex; }
.drag-ghost .cat-art,
.drag-ghost .cat-art img { width: 72px; height: 72px; }
.drag-ghost .word {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 999px;
  background: #f3e6d6;
  color: var(--ink);
  text-align: center;
}

.link-line {
  position: absolute;
  pointer-events: none;
  z-index: 4;
  stroke: var(--terra);
  stroke-width: 2.5;
  stroke-dasharray: 5 6;
  fill: none;
  opacity: 0;
  transition: opacity .2s;
}
.link-line.on { opacity: .85; }

/* ===== Recap ===== */
#screen-recap.active {
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  align-items: center;
  text-align: center;
}
.recap-title {
  font-family: var(--display);
  font-size: 30px;
  margin: 6px 0 4px;
}
.recap-sub { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.quilt {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 4px 2px 8px;
  align-content: start;
  align-items: start;
}
.word-tile {
  background: var(--paper);
  border-radius: 18px;
  padding: 8px 8px 10px;
  box-shadow: 0 8px 16px var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}
.word-tile .illust { width: 72px; height: 72px; border-radius: 16px; overflow: hidden; }
.word-tile .w {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
}
.word-tile .ipa { font-size: 11px; color: var(--muted); font-weight: 600; }
.word-tile:active { transform: scale(.98); }
.recap-actions {
  flex-shrink: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 4px;
}

/* ===== Overlays ===== */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(58, 47, 40, 0.32);
  z-index: 20;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
}
.overlay.active { display: flex; }
.sheet {
  width: 100%;
  max-width: 440px;
  background: var(--paper);
  border-radius: 28px;
  padding: 24px 22px 18px;
  box-shadow: 0 20px 40px rgba(80,50,30,.25);
  text-align: left;
}
.sheet h2 {
  font-family: var(--display);
  font-size: 26px;
  margin: 0 0 10px;
  text-align: center;
}
.sheet ol, .sheet p { color: var(--ink); }
.sheet ol { padding-left: 20px; margin: 0 0 16px; }
.sheet li { margin: 0 0 8px; font-size: 15px; line-height: 1.4; }
.sheet .center { text-align: center; }

.menu-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.menu-list button {
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f4ebe0;
  font-size: 15px;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(200px + var(--safe-bottom));
  transform: translateX(-50%) translateY(8px);
  background: rgba(58, 47, 40, 0.92);
  color: #fff8f0;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  max-width: 86%;
  text-align: center;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Height tweaks moved to the responsive geometry block so 390×844
   stays faithful to Figma and short viewports shrink spacers instead. */

#screen-home, #screen-recap { overflow: hidden; }

/* ===== Pack chip & onboarding ===== */
.pack-chip {
  margin-top: 10px;
  background: var(--paper);
  border-radius: 999px;
  padding: 7px 14px 7px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 4px 10px var(--shadow);
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pack-chip[hidden] { display: none !important; }
.pack-chip .chip-badge {
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f0e4d4;
  border-radius: 999px;
  padding: 2px 7px;
}
.pack-chip .chip-caret { color: var(--muted); font-size: 15px; }

#screen-onboard {
  padding-bottom: calc(16px + var(--safe-bottom));
}
#screen-onboard .topbar { flex-shrink: 0; }
.onboard-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.path-card, .pack-card {
  text-align: left;
  background: var(--paper);
  border-radius: 20px;
  padding: 18px 16px;
  box-shadow: 0 8px 18px var(--shadow);
  width: 100%;
}
.path-card:active, .pack-card:active:not(.soon) { transform: scale(.985); }
.path-card h3, .pack-card h3 {
  font-family: var(--display);
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
}
.path-card p, .pack-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.pack-card .card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.pack-card h3 { margin: 0; }
.badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: #f0e4d4;
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 800;
  white-space: nowrap;
}
.badge.soon { background: #eadccb; }
.pack-card.soon { opacity: .62; cursor: default; }
.onboard-note {
  margin: 4px 2px 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 600;
}
.pack-group-label {
  margin: 16px 2px 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.word-tile .def {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  text-align: center;
  max-width: 100%;
}
#screen-onboard, #screen-home { overflow: hidden; }

/* ===== Companion bar & house ===== */
.companion-bar {
  width: 100%;
  margin: 10px 0 8px;
  background: var(--paper);
  border-radius: 20px;
  padding: 8px 12px 8px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 14px var(--shadow);
  text-align: left;
}
.companion-mini {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.companion-mini svg { width: 52px; height: 52px; }
.companion-meta { flex: 1; min-width: 0; }
.companion-name {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.xp-track {
  height: 8px;
  border-radius: 999px;
  background: #eadccb;
  overflow: hidden;
}
.xp-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--sage);
  transition: width .35s ease;
}
.companion-go {
  font-size: 13px;
  font-weight: 800;
  color: var(--terra);
  flex-shrink: 0;
}
.btn.compact {
  width: auto;
  min-height: 40px;
  padding: 0 16px;
  font-size: 14px;
}

#screen-pets { padding-bottom: calc(12px + var(--safe-bottom)); }
.pets-tabs {
  display: flex;
  gap: 6px;
  padding: 0 16px 8px;
  flex-shrink: 0;
}
.pets-tabs button {
  flex: 1;
  min-height: 36px;
  border-radius: 999px;
  background: #eadccb;
  font-size: 13px;
  color: var(--muted);
}
.pets-tabs button.on {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 4px 10px var(--shadow);
}
.pets-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 20px;
  min-height: 0;
}
.pets-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--paper);
  border-radius: 24px;
  padding: 16px 14px 14px;
  box-shadow: 0 8px 18px var(--shadow);
  margin-bottom: 12px;
}
.pets-hero .hero-art { width: 140px; height: 150px; }
.pets-hero h3 {
  font-family: var(--display);
  font-size: 22px;
  margin: 4px 0 2px;
}
.pets-hero .tier {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}
.pets-hero p { margin: 6px 0 10px; color: var(--muted); font-size: 13px; }
.pets-hero .xp-track { width: 80%; margin: 0 auto 10px; }
.pet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.pet-card {
  background: var(--paper);
  border-radius: 16px;
  padding: 8px 6px 10px;
  box-shadow: 0 4px 10px var(--shadow);
  text-align: center;
}
.pet-card .art { width: 72px; height: 72px; margin: 0 auto; }
.pet-card .art svg { width: 72px; height: 72px; }
.pet-card h4 { margin: 2px 0 0; font-size: 13px; }
.pet-card .sub { font-size: 10px; color: var(--muted); font-weight: 700; }
.pet-card.locked { opacity: .55; }
.pet-card.locked .art { filter: grayscale(.8) brightness(.9); }
.pet-card.selected { box-shadow: 0 0 0 2px var(--terra), 0 4px 10px var(--shadow); }
.closet-grid, .recipe-list { display: flex; flex-direction: column; gap: 8px; }
.acc-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--paper);
  border-radius: 16px;
  padding: 8px 10px;
  box-shadow: 0 4px 10px var(--shadow);
  width: 100%;
  text-align: left;
}
.acc-row .icon { width: 40px; height: 40px; display: grid; place-items: center; }
.acc-row .icon svg { width: 40px; height: 40px; }
.acc-row h4 { margin: 0; font-size: 14px; }
.acc-row p { margin: 2px 0 0; font-size: 11px; color: var(--muted); }
.acc-row.on { box-shadow: 0 0 0 2px var(--sage), 0 4px 10px var(--shadow); }
.acc-row.locked { opacity: .55; }
.nest-slots {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.nest-slot {
  background: var(--paper);
  border-radius: 18px;
  min-height: 120px;
  padding: 8px;
  box-shadow: 0 4px 10px var(--shadow);
  text-align: center;
}
.nest-slot .art { width: 80px; height: 80px; margin: 0 auto; }
.nest-plus { font-family: var(--display); font-size: 28px; color: var(--muted); }
.recipe-card {
  background: var(--paper);
  border-radius: 16px;
  padding: 12px 12px 10px;
  box-shadow: 0 4px 10px var(--shadow);
  text-align: left;
  width: 100%;
}
.recipe-card h4 { margin: 0 0 4px; font-size: 15px; }
.recipe-card p { margin: 0; font-size: 12px; color: var(--muted); }
.recipe-card.done { opacity: .7; }
.reward-art { width: 140px; height: 140px; margin: 0 auto 8px; }
.reward-art svg { width: 140px; height: 140px; }
.recap-awards {
  width: 100%;
  text-align: center;
  font-size: 13px;
  color: var(--sage-deep);
  margin: 0 0 6px;
  font-weight: 700;
}
#overlay-demo .menu-list button { width: 100%; }


/* ===== Illustrated creatures & word art ===== */
.word-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px;
  background: #fff8ec;
}
.pet-sprite {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}
.pet-sprite img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.pet-sprite .pet-acc {
  position: absolute;
  inset: 6% 8% 2%;
  width: auto;
  height: auto;
  pointer-events: none;
}
.pet-sprite.pose-sleep img {
  transform: rotate(-10deg) scale(.96);
  filter: saturate(.96) brightness(.97);
}
.pet-sprite.pose-wink img { transform: rotate(4deg); }
/* Form 1 (baby) reads a touch smaller than later forms in the same frame. */
.pet-sprite.stage-f1 img { transform: scale(.88); transform-origin: 50% 92%; }
.pet-sprite.stage-f1.pose-sleep img { transform: rotate(-10deg) scale(.86); }
.pet-sprite.stage-f1.pose-wink img { transform: rotate(4deg) scale(.88); }
.pet-sprite.variant-dawn img { filter: drop-shadow(0 0 7px #eed68a); }
.pet-sprite.variant-dusk img { filter: drop-shadow(0 0 7px #5a6a9a); }
.hero-cat .pet-sprite,
.companion-mini .pet-sprite,
.placed-cat .pet-sprite,
.cat-card .cat-art .pet-sprite,
.pets-hero .hero-art .pet-sprite,
.pet-card .art .pet-sprite,
.acc-row .icon .pet-sprite,
.nest-slot .art .pet-sprite,
.reward-art .pet-sprite,
.drag-ghost .pet-sprite {
  width: 100%;
  height: 100%;
}
.companion-mini img,
.pet-card .art img,
.acc-row .icon img,
.reward-art img,
.hero-cat img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pets-hero .hero-art { width: 180px; height: 200px; overflow: hidden; position: relative; }
.pet-card .art { width: 84px; height: 84px; }
.pet-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.hero-cushion {
  outline: 3px solid rgba(58,47,40,.08);
}


/* ===== Cream growth preview ===== */
.demo-entry {
  width: 100%;
  margin: 4px 0 2px;
  min-height: 42px;
  border-radius: 999px;
  background: #fff6e4;
  color: var(--terra);
  box-shadow: 0 0 0 2px rgba(195, 107, 78, 0.4), 0 6px 12px var(--shadow);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .01em;
}
.demo-entry:active { transform: scale(.98); }
.stage-label {
  display: inline-block;
  margin: 2px 0 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f3e6d6;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.stage-timeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  margin: 8px 0 4px;
}
.stage-thumb {
  background: #fffaf3;
  border-radius: 16px;
  padding: 8px 6px 6px;
  box-shadow: inset 0 0 0 1px rgba(58,47,40,.08);
  text-align: center;
}
.stage-thumb .thumb {
  width: 72px;
  height: 80px;
  margin: 0 auto 4px;
  display: grid;
  place-items: center;
}
.stage-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.stage-thumb span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.stage-thumb.current {
  box-shadow: 0 0 0 2px var(--terra), 0 4px 10px var(--shadow);
}
.stage-thumb.current span { color: var(--terra); }
.stage-thumb.locked {
  opacity: .55;
}
/* Five-form growth timeline: tighter thumbs so 5 fit a phone card. */
.stage-timeline.stages-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.stage-timeline.stages-5 .stage-thumb {
  padding: 6px 3px 5px;
  border-radius: 14px;
  min-width: 0;
}
.stage-timeline.stages-5 .stage-thumb .thumb {
  width: 100%;
  max-width: 60px;
  height: 56px;
}
.stage-timeline.stages-5 .stage-thumb span {
  font-size: 10px;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage-timeline.stages-5 .stage-lock {
  width: 30px;
  height: 30px;
  font-size: 16px;
}
/* Next form: dark silhouette only (from the next form's own alpha). */
.stage-thumb.next { opacity: 1; }
.stage-thumb img.stage-sil {
  filter: brightness(0);
  opacity: .32;
  -webkit-user-drag: none;
  pointer-events: none;
}
.stage-thumb.next span { color: var(--ink); }
.stage-lock {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eadccb;
  color: var(--muted);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
}
#reward-sheet.stage-up .reward-art {
  width: 188px;
  height: 210px;
  margin: 0 auto 8px;
  overflow: hidden;
  position: relative;
  animation: stagePop .55s ease;
}
#reward-sheet.stage-up h2,
#reward-sheet.stage-up p {
  position: relative;
  z-index: 1;
}
.reward-art { overflow: hidden; }

#reward-sheet.stage-grown .reward-art {
  filter: drop-shadow(0 10px 16px rgba(80,50,30,.2));
}
#reward-sheet.stage-peak .reward-art {
  filter: drop-shadow(0 0 18px rgba(238, 214, 138, .85));
}
@keyframes stagePop {
  0% { transform: scale(.72); opacity: 0; }
  70% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}
.pet-sprite.stage-f5 img,
.pet-sprite.stage-peak img {
  filter: drop-shadow(0 0 6px rgba(238, 214, 138, .45));
}
.hero-cat .pet-sprite img,
.companion-mini .pet-sprite img {
  background: transparent;
}


/* ===== Language switch & CJK typography ===== */
.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  background: var(--paper);
  outline: 1.5px solid rgba(58, 47, 40, 0.22);
  outline-offset: 0;
  box-shadow: 0 1px 0 rgba(255,255,255,.8), 0 4px 10px var(--shadow);
  gap: 0;
}
.lang-opt {
  min-width: 40px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .04em;
  line-height: 28px;
}
.lang-opt.on {
  background: var(--terra);
  color: #fffaf3;
  box-shadow: 0 2px 0 #9a4d36;
}
.lang-switch.compact .lang-opt,
.lang-switch-row.compact .lang-opt {
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
  line-height: 24px;
}
.lang-switch-row {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 8px 0 0;
}
.lang-switch-row.compact { margin: 0 0 2px; }
.lang-switch-row.menu-lang { margin: 0 auto 12px; }
#screen-home .home-lang { margin-top: 10px; flex-shrink: 0; }
#screen-pets .pets-topbar {
  grid-template-columns: 44px 1fr auto;
}
#screen-pets .pets-topbar .top-actions {
  padding-right: 2px;
}
#overlay-menu .menu-lang { justify-content: center; }

html[data-lang="zh"] {
  letter-spacing: 0;
}
html[data-lang="zh"] .stat span,
html[data-lang="zh"] .week-label,
html[data-lang="zh"] .round-title .meta,
html[data-lang="zh"] .pack-chip .chip-badge,
html[data-lang="zh"] .badge,
html[data-lang="zh"] .companion-go,
html[data-lang="zh"] .home-profile,
html[data-lang="zh"] .lang-opt[data-lang="zh"] {
  letter-spacing: 0.02em;
  text-transform: none;
}
html[data-lang="zh"] .day-dot {
  letter-spacing: 0;
  font-size: 10px;
}


/* ===== Profile / 个人中心 ===== */
#screen-profile {
  padding-bottom: calc(16px + var(--safe-bottom));
}
#screen-profile .profile-topbar {
  grid-template-columns: 44px 1fr 44px;
  flex-shrink: 0;
}
#screen-profile .round-title .meta {
  padding: 0 6px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 11px;
}
.profile-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 4px 16px 28px;
  -webkit-overflow-scrolling: touch;
}
.profile-card {
  background: var(--paper);
  border-radius: 20px;
  padding: 14px 14px 12px;
  box-shadow: 0 6px 14px var(--shadow);
  margin-bottom: 12px;
}
.profile-card h3 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}
.profile-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.profile-card-head h3 { margin: 0; }
.profile-link {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--terra);
  padding: 4px 0;
  background: none;
  white-space: nowrap;
}
.profile-stats {
  display: flex;
  gap: 8px;
}
.profile-stat {
  flex: 1;
  min-width: 0;
  text-align: center;
  background: #f6efe6;
  border-radius: 16px;
  padding: 10px 6px 8px;
}
.profile-stat b {
  display: block;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.profile-stat span {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.3;
  text-transform: none;
  letter-spacing: 0;
}
.profile-pet-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}
.profile-recipe-list,
.profile-unit-list,
.profile-word-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-pet {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
  padding: 8px 4px 8px;
  background: #f6efe6;
  border-radius: 14px;
}
.profile-pet .art {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 10px;
}
.profile-pet h4 {
  margin: 2px 0 0;
  font-size: 11px;
  line-height: 1.2;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-pet .sub {
  margin: 2px 0 4px;
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.25;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-pet .xp-track {
  width: 100%;
  height: 5px;
  margin-top: 2px;
}
.profile-pet.locked {
  opacity: 1;
}
.profile-pet.locked .art {
  filter: grayscale(1) contrast(0.35) brightness(0.55);
}
.profile-pet.locked h4,
.profile-pet.locked .sub {
  color: var(--muted);
}
.profile-pet.locked .sub {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.profile-recipe {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  background: #f6efe6;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.25;
  min-width: 0;
}
.profile-recipe .chain {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.profile-recipe .art {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.profile-recipe .art.locked {
  filter: grayscale(1) contrast(0.35) brightness(0.55);
}
.profile-recipe .plus,
.profile-recipe .arrow {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  font-size: 11px;
  flex-shrink: 0;
}
.profile-recipe .copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
.profile-recipe h4 {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-recipe p {
  margin: 0;
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-recipe.done { opacity: .7; }
.profile-recipe-list { gap: 4px; }
.profile-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0 0 10px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.profile-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.3;
  white-space: nowrap;
}
.profile-sq,
.profile-strip i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  box-sizing: border-box;
  flex-shrink: 0;
  background: transparent;
  border: 1.5px solid #d5c4b3;
}
.profile-sq.new, .profile-strip i.new { background: var(--butter); border-color: #d4bc62; }
.profile-sq.learning, .profile-strip i.learning { background: var(--sky); border-color: #7ea8a7; }
.profile-sq.remembered, .profile-strip i.remembered { background: var(--sage); border-color: var(--sage-deep); }
.profile-pack-line {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.profile-unit {
  width: 100%;
  text-align: left;
  background: #f6efe6;
  border-radius: 14px;
  padding: 8px 10px;
}
.profile-unit.open {
  padding: 10px 12px;
}
.profile-unit .row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.profile-unit h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
  min-width: 0;
  overflow-wrap: anywhere;
}
.profile-unit .count {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}
.profile-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.profile-unit:not(.open) .profile-strip {
  margin-top: 4px;
}
.profile-word-list {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.profile-word {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 8px;
  align-items: center;
}
.profile-word .illust {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff8ec;
}
.profile-word .illust img,
.profile-word .illust .word-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.profile-word .w {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}
.profile-word .def {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.profile-word .state {
  font-size: 16px;
  line-height: 1;
}
.profile-settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.profile-setting span {
  font-size: 14px;
  font-weight: 800;
}
.profile-settings .btn {
  width: 100%;
}
html[data-lang="zh"] .profile-stat span,
html[data-lang="zh"] .profile-pet .sub,
html[data-lang="zh"] .profile-unit h4,
html[data-lang="zh"] .profile-card h3,
html[data-lang="zh"] .profile-pack-line {
  letter-spacing: 0.02em;
  word-break: keep-all;
}



/* ===== v2 components (Figma 组件库 v2) ===== */
html, body {
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font);
}
#app { background: var(--bg-page); }

button {
  font-family: inherit;
  color: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--size-touch);
  height: 52px;
  padding: 0 20px;
  border-radius: var(--radius-button);
  background: var(--fill-accent);
  color: var(--text-on-accent);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 500;
  line-height: 22px;
  letter-spacing: 0;
  box-shadow: none;
  gap: 6px;
}
.btn:active { transform: none; filter: none; background: var(--fill-pressed); }
.btn[disabled], .btn:disabled {
  background: var(--bg-muted);
  color: var(--text-tertiary);
  box-shadow: none;
}
.btn.ghost,
.btn.soft {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: none;
  border: 1px solid var(--border-default);
  height: 52px;
  font-size: 17px;
  font-weight: 500;
}
.btn.ghost:active,
.btn.soft:active { background: var(--bg-soft); filter: none; }
.btn.text {
  background: transparent;
  color: var(--text-accent);
  box-shadow: none;
  border: 0;
  height: 52px;
  font-size: 17px;
  font-weight: 500;
}
.btn.text:active { background: var(--fill-accent-soft); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--size-touch);
  height: var(--size-touch);
  min-width: var(--size-touch);
  min-height: var(--size-touch);
  padding: 0;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  box-shadow: none;
  flex-shrink: 0;
}
.icon-btn img { display: block; width: 22px; height: 22px; }
.icon-btn:active { background: var(--bg-soft); }
.icon-btn[disabled] { opacity: .35; }
.icon-btn.pill {
  width: auto;
  padding: 0 14px;
  border-radius: 22px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex-shrink: 0;
  padding: 0;
  min-height: var(--size-touch);
}
.round-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.round-title .name {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}
.round-title .meta {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.3;
}
.top-actions { display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }
.hint-btn { position: relative; }
.hint-count {
  position: absolute;
  top: -4px;
  right: -2px;
  left: auto;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 9px;
  background: var(--fill-accent);
  color: var(--text-on-accent);
  font-family: var(--font-en);
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  padding: 0;
  box-shadow: none;
}
.icon-btn[disabled] .hint-count { background: var(--ink-400); }

/* Home */
#screen-home.active {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: calc(20px + var(--safe-top)) 24px calc(24px + var(--safe-bottom));
  gap: 12px;
  overflow: hidden;
}
.home-top {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex-shrink: 0;
}
.home-top-spacer { flex: 1; min-width: 0; }
.home-menu, .home-profile { position: static; }
.brand-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 4px;
  width: 100%;
  flex-shrink: 0;
}
.brand {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
  margin: 0;
}
.tagline {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-secondary);
  text-align: center;
}
.pack-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: auto;
  padding: 6px 12px 6px 10px;
  border-radius: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  box-shadow: none;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  max-width: 100%;
}
.pack-chip .chip-badge {
  background: var(--fill-accent-soft);
  color: var(--text-accent);
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.pack-chip .chip-caret {
  color: var(--text-tertiary);
  font-family: var(--font-en);
  font-size: 16px;
  font-weight: 700;
}
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  overflow: visible;
  flex-shrink: 0;
}
.hero-cushion {
  width: 300px;
  max-width: 100%;
  height: 148px;
  border-radius: var(--radius-full);
  background: var(--fill-accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  overflow: visible;
  position: relative;
}
.hero-cat {
  width: 188px;
  height: 188px;
  position: relative;
  overflow: visible;
  filter: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-cat img,
.hero-cat .pet-sprite,
.hero-cat .pet-sprite img {
  width: 188px;
  height: 188px;
  max-width: none;
  object-fit: contain;
  object-position: center;
  overflow: visible;
  background: transparent;
}
.hero-zzz { display: none; }
.welcome {
  margin: 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}
.welcome:empty { display: none; }
.stats {
  display: flex;
  gap: 10px;
  width: 100%;
  flex-shrink: 0;
}
.stat {
  flex: 1;
  min-width: 0;
  height: 73px;
  padding: 12px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}
.stat b {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  line-height: 28px;
  letter-spacing: -0.26px;
  color: var(--text-primary);
}
.stat span {
  font-size: 13px;
  font-weight: 400;
  line-height: 18px;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
}
.week-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  flex-shrink: 0;
  margin: 0;
}
.week-label {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-tertiary);
  letter-spacing: 0;
  text-transform: none;
}
.week {
  display: flex;
  gap: 8px;
  align-items: center;
}
.day-dot {
  width: 28px;
  height: 28px;
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
  outline: none;
  border: 0;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: center;
}
.day-dot span { line-height: 1; }
.day-dot.on {
  background: var(--fill-accent-soft);
  color: var(--text-accent);
  box-shadow: none;
  font-weight: 700;
}
.day-dot.today {
  background: transparent;
  outline: none;
  border: 2px solid var(--fill-accent);
  color: var(--text-accent);
  font-weight: 700;
  box-shadow: none;
}
.day-dot.on.today {
  background: transparent;
  border: 2px solid var(--fill-accent);
  color: var(--text-accent);
}

.companion-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-20);
  box-shadow: none;
  text-align: left;
  flex-shrink: 0;
}
.companion-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.companion-mini {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  overflow: visible;
}
.companion-mini svg,
.companion-mini img,
.companion-mini .pet-sprite,
.companion-mini .pet-sprite img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}
.companion-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.companion-name {
  font-family: var(--font-en);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.companion-stage {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
}
.companion-go {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-accent);
  letter-spacing: 0;
  text-transform: none;
  background: none;
}
.xp-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-muted);
  overflow: hidden;
}
.xp-fill {
  height: 6px;
  border-radius: 3px;
  background: var(--fill-accent);
}
.home-grow { flex: 1 1 auto; min-height: 0; }
.home-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  margin: 0;
  gap: 0;
  flex-shrink: 0;
}
.demo-entry {
  width: 100%;
  margin: 0;
  min-height: 42px;
  border-radius: var(--radius-button);
  background: var(--fill-accent-soft);
  color: var(--text-accent);
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
}
.demo-entry[hidden] { display: none !important; }

/* Round */
#screen-round.active {
  display: flex;
  flex-direction: column;
  padding: calc(20px + var(--safe-top)) 24px calc(16px + var(--safe-bottom));
  gap: 16px;
  overflow: hidden;
}
.round-grow { flex: 1 1 8px; min-height: 0; }
.board-wrap {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 0;
  overflow: visible;
}
.board {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 336px;
  margin: 0 auto;
  filter: none;
  aspect-ratio: auto !important;
}
.board.warm { filter: none; }
.seat {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 22px;
  background: var(--bg-soft);
  border: 1px solid var(--board-stroke);
  box-shadow: 0 2px 6px var(--shadow);
  overflow: hidden;
  position: relative;
}
.seat .cell-pic {
  width: 85%;
  height: 85%;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.seat.drop-hover,
.seat.selected {
  border: 2px solid var(--fill-accent);
  background: var(--fill-accent-soft);
  box-shadow: none;
}
.seat.pulse {
  animation: hintGlow 1.1s ease-in-out 2;
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(232, 184, 74, 0.35), 0 0 10px rgba(232, 184, 74, 0.55);
}
@keyframes hintGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 184, 74, 0.15); }
  50% { box-shadow: 0 0 0 5px rgba(232, 184, 74, 0.4), 0 0 12px rgba(232, 184, 74, 0.55); }
}
.seat.shake {
  animation: shake .4s ease, missStroke .4s ease;
}
.seat.occupied {
  border: 1px solid var(--board-stroke);
}
.prompt {
  width: 100%;
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-14);
  background: var(--bg-soft);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  flex-shrink: 0;
}
.prompt.warn { color: var(--text-accent); background: var(--fill-accent-soft); }
.tray {
  display: flex;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 120px;
  padding: 8px 0 0;
  flex-shrink: 0;
  overflow-x: auto;
}
.cat-card {
  width: 100px;
  min-width: 100px;
  height: 118px;
  padding: 10px 8px;
  border-radius: var(--radius-20);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
}
.cat-card .cat-art { width: 72px; height: 72px; }
.cat-card .word {
  font-family: var(--font-en);
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  letter-spacing: -0.08px;
  color: var(--text-primary);
}
.cat-card.selected {
  border: 2px solid var(--fill-accent);
  box-shadow: none;
  transform: none;
}

/* Recap */
#screen-recap.active {
  padding: calc(20px + var(--safe-top)) 24px calc(24px + var(--safe-bottom));
}
.recap-title {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}
.recap-lead {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--text-primary);
}
.recap-sub { color: var(--text-secondary); font-size: 13px; margin: 0 0 12px; }
.word-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: none;
}

/* Overlays */
.overlay {
  background: var(--overlay);
  padding: 24px 16px calc(20px + var(--safe-bottom));
}
.overlay.from-bottom {
  align-items: flex-end;
  justify-content: stretch;
  padding: 24px 16px calc(20px + var(--safe-bottom));
}
.sheet {
  background: var(--bg-page);
  border-radius: var(--radius-sheet);
  padding: 24px 20px 20px;
  box-shadow: none;
  width: 100%;
  max-width: 390px;
}
.sheet.bottom {
  border-radius: var(--radius-sheet);
  width: 100%;
  max-width: none;
}
.sheet.center,
.sheet.confirm {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 24px 20px 20px;
  text-align: center;
}
.sheet h2,
.sheet.confirm h2 {
  margin: 0 0 8px;
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: left;
}
.sheet.center h2,
.sheet.confirm h2 { text-align: center; font-size: 20px; }
.sheet p { color: var(--text-secondary); font-size: 13px; line-height: 1.45; }
.how-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.how-steps li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-primary);
}
.how-steps .num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  background: var(--fill-accent-soft);
  color: var(--text-accent);
  font-family: var(--font-en);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-list { display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; }
.menu-list button {
  width: 100%;
  min-height: var(--size-touch);
  padding: 12px 16px;
  border-radius: var(--radius-menu);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  text-align: left;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: none;
}
.menu-list button:active { background: var(--bg-soft); }
#btn-reset { color: var(--text-accent); }
.confirm-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
}
.confirm-actions .btn { flex: 1; }
.toast {
  border-radius: var(--radius-notification);
  background: var(--ink-900);
  color: var(--text-on-accent);
  padding: 10px 16px;
  font-size: 13px;
}

/* Language switch */
.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  outline: none;
  box-shadow: none;
  border: 1px solid var(--border-default);
  gap: 0;
  height: 36px;
}
.lang-opt {
  min-width: 44px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0;
  line-height: 30px;
  background: transparent;
}
.lang-opt.on {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px var(--shadow);
}
.lang-switch.compact .lang-opt,
.lang-switch-row.compact .lang-opt {
  min-width: 40px;
  height: 26px;
  line-height: 26px;
  font-size: 12px;
}
.lang-switch-row { margin: 0; }
#overlay-menu .menu-lang { justify-content: flex-start; margin: 0 0 12px; }

/* Onboarding / cards */
.path-card, .pack-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: none;
}
#screen-onboard,
#screen-profile,
#screen-pets {
  padding-left: 24px;
  padding-right: 24px;
  padding-top: calc(16px + var(--safe-top));
}
#screen-profile { padding-bottom: calc(16px + var(--safe-bottom)); }
.profile-body { padding: 12px 0 28px; }
.profile-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: none;
  margin-bottom: 12px;
}
.profile-card h3 {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 10px;
}
.profile-stats { gap: 8px; }
.profile-stat {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 12px 8px;
}
.profile-stat b {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.26px;
}
.profile-stat span {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
}
.profile-pet {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 24px;
  padding: 10px 8px;
}
.profile-pet h4 {
  font-family: var(--font-en);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-pet .sub {
  font-size: 10px;
  line-height: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  text-align: center;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.profile-pet.locked { opacity: 1; background: var(--bg-muted); }
.profile-legend { gap: 8px 12px; font-weight: 400; font-size: 11px; }
.profile-sq,
.profile-strip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  background: var(--status-unseen);
}
.profile-sq.new, .profile-strip i.new { background: var(--status-new); }
.profile-sq.learning, .profile-strip i.learning { background: var(--status-learning); }
.profile-sq.remembered, .profile-strip i.remembered { background: var(--status-remembered); }
.profile-sq.unseen, .profile-strip i.unseen { background: var(--status-unseen); }
.profile-unit {
  background: transparent;
  border-radius: 0;
  padding: 8px 0;
}
.profile-unit.open { padding: 8px 0; }
.profile-unit h4 { font-size: 13px; font-weight: 500; }
.profile-unit .count { font-size: 13px; font-weight: 400; }
.profile-pack-line { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.profile-link { font-size: 13px; font-weight: 500; color: var(--text-accent); }
.pets-tabs {
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 0;
  display: flex;
}
.pets-tabs button {
  flex: 1;
  min-height: var(--size-touch);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.pets-tabs button.on {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px var(--shadow);
}
.pet-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 24px;
  box-shadow: none;
}
.pet-card.locked { opacity: 1; background: var(--bg-muted); }
.pet-card.locked .sub {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 10px;
  line-height: 12px;
}
.pet-card.selected { box-shadow: none; border: 2px solid var(--fill-accent); }
.recipe-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: none;
}

html[data-lang="zh"] .day-dot { font-size: 11px; }


/* v2 playtest polish */
#screen-home.active { text-align: left; }
.brand-block { position: relative; z-index: 2; }
.hero { position: relative; z-index: 1; margin-top: 4px; }
.hero-cushion { align-items: flex-end; }
.hero-cat { left: auto; bottom: auto; transform: translateY(18px); }
.week-wrap, .week-label, .stats { text-align: left; }
.week-label { text-align: left; width: 100%; }
.stat { text-align: center; }
#screen-profile .profile-pet .sub,
#screen-profile .profile-pet.locked .sub {
  white-space: normal !important;
  text-overflow: clip;
  overflow: hidden;
  display: -webkit-box !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: 24px;
  line-height: 12px;
  font-size: 10px;
  word-break: normal !important;
  overflow-wrap: break-word;
}


/* ===== v3 strict Figma typography / components ===== */
.btn {
  width: auto;
  min-width: 0;
  max-width: 100%;
  height: 52px;
  min-height: 52px;
  padding: 0 20px;
  border-radius: 16px;
  background: var(--fill-accent);
  color: #ffffff;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 500;
  line-height: 22px;
  letter-spacing: 0;
  box-shadow: none;
}
.btn:active { background: var(--fill-pressed); }
.btn.ghost,
.btn.text {
  width: auto;
  height: 44px;
  min-height: 44px;
  padding: 0 12px;
  background: transparent;
  color: var(--text-accent);
  border: 0;
  box-shadow: none;
  font-size: 17px;
  font-weight: 500;
  line-height: 22px;
}
.btn.ghost:active,
.btn.text:active { background: var(--fill-accent-soft); }
.btn.soft {
  width: auto;
  height: 52px;
  min-height: 52px;
  background: var(--fill-accent-soft);
  color: var(--text-accent);
  border: 0;
  box-shadow: none;
  font-size: 17px;
  font-weight: 500;
  line-height: 22px;
}
.home-actions {
  align-items: flex-start;
}
.home-actions .btn { align-self: flex-start; }
.home-quota {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 400;
  line-height: 18px;
  color: var(--text-secondary);
  text-align: left;
  width: 100%;
}
.home-quota[hidden] { display: none !important; }

.lang-switch {
  height: 32px;
  padding: 3px;
  background: var(--bg-muted);
  border: 1px solid var(--border-default);
  border-radius: 9999px;
  box-shadow: none;
  outline: none;
}
.lang-opt {
  min-width: 42px;
  height: 26px;
  padding: 0 12px;
  border-radius: 9999px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: 0;
  color: var(--text-secondary);
  background: transparent;
}
.lang-opt.on {
  background: #ffffff;
  color: var(--text-primary);
  box-shadow: none;
}
.lang-switch.compact,
.lang-switch-row.compact .lang-switch { height: 32px; }
.lang-switch.compact .lang-opt,
.lang-switch-row.compact .lang-opt {
  min-width: 42px;
  height: 26px;
  line-height: 18px;
  font-size: 13px;
  font-weight: 500;
}

.recap-kicker {
  margin: 0;
  text-align: center;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  line-height: 14px;
  color: var(--text-secondary);
}
.recap-title {
  margin: 8px 0 0;
  text-align: center;
  font-family: var(--font);
  font-size: 28px;
  font-weight: 700;
  line-height: 34px;
  letter-spacing: 0;
  color: var(--text-primary);
}
.recap-lead { display: none; }
.recap-sub {
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
  font-weight: 400;
  line-height: 16px;
  color: var(--text-secondary);
}
#screen-recap .lang-switch-row {
  display: flex;
  justify-content: center;
  margin: 12px 0 16px;
}
.quilt {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}
.word-tile {
  border-radius: 24px;
  padding: 12px 8px 14px;
  min-height: 192px;
}
.word-tile .illust { width: 88px; height: 88px; border-radius: 16px; }
.word-tile .w {
  font-family: var(--font-en);
  font-size: 17px;
  font-weight: 700;
  line-height: 22px;
  letter-spacing: -0.43px;
  color: var(--text-primary);
}
.word-tile .ipa {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  line-height: 18px;
  color: var(--text-secondary);
}
.word-tile .zh,
.word-tile .meaning {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  line-height: 21px;
  color: var(--text-primary);
}
.recap-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.recap-actions .fine {
  text-align: center;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
}
.recap-award,
#recap-award,
.award-line {
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
  color: var(--status-remembered);
}

.sheet h2,
.sheet.bottom h2,
#how-title, #menu-title {
  text-align: left;
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  line-height: 26px;
  margin: 0 0 16px;
}
.sheet.center h2,
.sheet.confirm h2 {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  line-height: 24px;
}
.sheet .btn { width: auto; }
.sheet.center .btn,
.sheet.confirm .btn { margin-left: auto; margin-right: auto; }
.how-steps { gap: 12px; margin: 0 0 16px; }
.how-steps li {
  font-size: 14px;
  font-weight: 400;
  line-height: 17px;
  color: var(--text-primary);
}
#overlay-menu .menu-lang { justify-content: center; margin: 0 0 16px; }
.menu-list button {
  font-size: 15px;
  font-weight: 700;
  line-height: 18px;
  height: 52px;
  min-height: 52px;
  border-radius: 16px;
}
#btn-reset {
  background: var(--fill-accent-soft);
  border: 0;
  color: var(--text-accent);
  font-weight: 700;
  font-size: 15px;
}
.sheet .fine,
#overlay-menu .fine {
  font-size: 12px;
  font-weight: 400;
  line-height: 14px;
  color: var(--text-tertiary);
}

.path-card h3, .pack-card h3 {
  font-family: var(--font);
  font-size: 20px;
  font-weight: 500;
  line-height: 25px;
  margin: 0;
}
.pack-card h3 {
  font-size: 16px;
  line-height: 21px;
}
.path-card p, .pack-card p {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  line-height: 20px;
  color: var(--text-secondary);
  margin: 8px 0 0;
}
.pack-card p { font-size: 13px; line-height: 18px; }
.pack-card .meta {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 400;
  line-height: 18px;
  color: var(--text-tertiary);
}
.path-card, .pack-card {
  border-radius: 24px;
  padding: 20px 21px;
  border: 1px solid var(--border-default);
  background: #ffffff;
  box-shadow: none;
}
.pack-card .badge,
.path-card .badge {
  background: var(--fill-accent-soft);
  color: var(--text-accent);
  border-radius: 9999px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: 0;
  text-transform: none;
}
.pack-card.soon { opacity: 0.6; }
.onboard-note {
  margin: 0;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 400;
  line-height: 14px;
  color: var(--text-secondary);
}
.pack-group-label {
  margin: 18px 2px 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.onboard-note.plain {
  background: none;
  padding: 0;
}
.onboard-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 0 16px;
  gap: 4px;
}
.onboard-hero .kicker {
  font-size: 14px;
  font-weight: 500;
  line-height: 17px;
  color: var(--text-secondary);
}
.onboard-hero .brand {
  font-family: var(--display);
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  margin: 4px 0;
}
.onboard-hero .sub {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 400;
  line-height: 18px;
  color: var(--text-secondary);
}
#screen-onboard.onboard-welcome .topbar .round-title { visibility: hidden; }
#screen-onboard.onboard-welcome #onboard-lang {
  position: absolute;
  top: calc(20px + var(--safe-top));
  right: 24px;
  margin: 0;
  z-index: 2;
}
#screen-onboard { position: relative; }
#screen-onboard.onboard-welcome .topbar { min-height: 44px; }

.icon-btn {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: 22px;
  box-shadow: none;
}
.icon-btn.pill {
  font-size: 13px;
  font-weight: 700;
  height: 44px;
  min-height: 44px;
}

.profile-pet .sub,
.profile-pet.locked .sub {
  font-size: 11px;
  line-height: 13px;
  font-weight: 400;
  max-height: none;
  -webkit-line-clamp: 2;
}
.profile-card { border-radius: 32px; }
.profile-pet h4,
.pet-card h4 {
  font-family: var(--font-en);
  font-weight: 700;
}

.tray-empty {
  width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-tertiary);
  padding: 36px 0;
}

.cat-card .word {
  font-family: var(--font-en);
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  letter-spacing: -0.08px;
}

.round-title .name {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}
.round-title .meta {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-secondary);
}


/* v3 restore: occupied cell word + profile nest tiles */
.seat.occupied .cell-word {
  display: block;
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 13px;
  line-height: 18px;
  letter-spacing: -0.08px;
  color: var(--text-primary);
  background: transparent;
  padding: 0;
  top: auto;
  left: 8px;
  right: 8px;
  bottom: 6px;
  text-align: center;
}
.profile-pet .xp-track { display: none; }
.profile-card-head h3 + .profile-link,
.profile-card > h3 { font-family: var(--font); }


/* v3 typography: Medium 17 titles, Nunito names, muted how-to copy */
.path-card h3,
.pack-card h3 {
  font-family: var(--font);
  font-weight: 500;
  font-size: 17px;
  line-height: 22px;
  color: var(--text-primary);
  letter-spacing: 0;
}
.path-card p,
.pack-card p {
  font-family: var(--font);
  font-weight: 400;
  font-size: 13px;
  line-height: 18px;
  color: var(--text-secondary);
}
.onboard-note.plain {
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 16px;
}
#onboard-title,
.topbar .round-title .name,
.profile-topbar .name,
.pets-topbar .name {
  font-family: var(--font);
  font-weight: 500;
  font-size: 17px;
  line-height: 22px;
  color: var(--text-primary);
}
#round-name {
  font-weight: 500;
  font-size: 16px;
  line-height: 22px;
}
#btn-profile,
.icon-btn.me,
button#btn-profile {
  font-family: var(--font);
  font-weight: 500;
  font-size: 15px;
  line-height: 20px;
}
.sheet h2,
.sheet.bottom h2,
.sheet.center h2,
#how-title,
#menu-title,
#cap-title,
#reset-title {
  font-family: var(--font);
  font-weight: 500;
  font-size: 17px;
  line-height: 22px;
  letter-spacing: 0;
}
#reward-title {
  font-family: var(--font);
  font-weight: 700;
  font-size: 22px;
  line-height: 28px;
}
.how-steps,
.how-steps li,
.how-steps li span {
  font-family: var(--font);
  font-weight: 400;
  font-size: 15px;
  line-height: 20px;
  color: var(--text-secondary);
}
.menu-list button,
.menu-list #btn-menu-profile,
.menu-list #btn-choose-pack,
.menu-list #btn-menu-pets {
  font-family: var(--font);
  font-weight: 500;
  font-size: 17px;
  line-height: 22px;
}
.menu-list #btn-reset {
  font-weight: 500;
  font-size: 17px;
  line-height: 22px;
}
.chip-badge {
  font-family: var(--font);
  font-weight: 500;
  font-size: 12px;
}
.pets-hero h3 {
  font-family: var(--font-en);
  font-weight: 700;
  letter-spacing: -0.2px;
}
.recap-awards {
  font-family: var(--font);
  font-weight: 400;
  font-size: 13px;
  line-height: 18px;
  color: var(--leaf);
}
.profile-card h3,
.profile-card-head h3 {
  font-family: var(--font);
  font-weight: 500;
  font-size: 15px;
  line-height: 20px;
}
.pack-card .meta,
.pack-card .count {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-tertiary);
}

.pack-card .badge {
  font-family: var(--font);
  font-weight: 500;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-accent);
}


/* v3 polish: square progress dots, plain tray words, companion ring */
.profile-sq,
.profile-strip i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 0;
}
.cat-card .word,
.cat-card .word.long {
  background: transparent;
  padding: 0;
  border-radius: 0;
  max-width: none;
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 13px;
  line-height: 18px;
  letter-spacing: -0.08px;
}
.profile-pet.companion,
.profile-pet:first-child {
  /* companion highlight is applied via JS class if present */
}
.word-tile .illust {
  background: transparent;
}

.profile-pet.companion { outline: 2px solid var(--fill-accent); outline-offset: 0; }

/* ===== v5 responsive geometry =====
   At 390×844 the proportions stay on the Figma boxes.
   Everywhere else, widths fluidly fill the 24px gutters and
   heights follow the visual viewport (--app-h / 100dvh, never 100vh).
   Short viewports shrink the hero and spacers first; if that is not
   enough, middle content scrolls while the bottom CTA stays pinned. */

#app {
  width: 100%;
  max-width: 430px;
  min-height: 0;
  height: 100svh;
  height: 100dvh;
  height: var(--app-h, 100dvh);
  margin: 0 auto;
  position: fixed;
  top: var(--app-top, 0px);
  left: 0;
  right: 0;
}

.screen {
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* —— Round —— */
#screen-round.active {
  padding: calc(20px + var(--safe-top)) 24px calc(20px + var(--safe-bottom));
  gap: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
}
#screen-round .topbar {
  height: 44px;
  min-height: 44px;
  margin: 0;
  flex-shrink: 0;
  width: 100%;
}
#screen-round .round-spacer-top {
  flex: 0 1 auto;
  height: clamp(8px, 5.69cqh, 48px);
  min-height: 0;
  max-height: 48px;
}
#screen-round .round-spacer-bottom {
  flex: 1 1 auto;
  min-height: 0;
}
#screen-round .board-wrap {
  flex: 0 1 auto;
  width: 100%;
  min-height: 0;
  height: auto;
  margin: 0;
  padding: 0 !important;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}
#screen-round .board {
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0 !important;
  display: grid;
  grid-template-columns: repeat(var(--board-cols, 3), minmax(44px, 104px));
  grid-template-rows: none;
  gap: 12px;
  aspect-ratio: auto !important;
  justify-content: start;
  align-content: start;
}
#screen-round .seat {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  min-width: 0;
  min-height: 44px;
  border-radius: 22px;
  background: #fff1dc;
  border: 1px solid #e8dcc8;
  box-shadow: none;
  overflow: hidden;
}
#screen-round .seat .cell-pic {
  position: absolute;
  inset: 8px;
  width: auto;
  height: auto;
  border-radius: 16px;
  overflow: hidden;
  background: transparent;
}
#screen-round .seat .cell-pic .word-art,
#screen-round .seat .cell-pic img,
#screen-round .seat .cell-pic svg {
  width: 100%;
  height: 100%;
  background: transparent !important;
  border-radius: 0;
}
#screen-round .prompt {
  flex: 0 1 auto;
  width: 100%;
  height: auto;
  min-height: 36px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  border-radius: 14px;
  background: #fff1dc;
  box-sizing: border-box;
}
#screen-round .tray {
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  min-height: 118px;
  padding: 8px 0 0;
  gap: 12px;
  justify-content: center;
  overflow-x: auto;
  overflow-y: visible;
}
#screen-round .cat-card {
  flex: 0 1 100px;
  width: 100px;
  min-width: 72px;
  max-width: 100px;
  height: 118px;
  min-height: 118px;
  max-height: 118px;
  padding: 11px 8px 0;
  border-radius: 20px;
  background: #ffffff;
  border: 1px solid #e8dcc8;
  box-shadow: none;
  outline: none;
  gap: 6px;
  overflow: visible;
  box-sizing: border-box;
}
#screen-round .cat-card .cat-art {
  position: relative;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  background: transparent !important;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}
#screen-round .cat-card .cat-art .pet-sprite,
#screen-round .cat-card .cat-art img,
#screen-round .cat-card .cat-art .pet-sprite img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain;
  background: transparent !important;
  border-radius: 0;
}
#screen-round .cat-card.selected {
  border: 2px solid var(--fill-accent);
  transform: none;
  box-shadow: none;
}
#screen-round .tray-empty {
  padding: 0;
  width: auto;
  font-size: 13px;
  line-height: 14px;
  color: var(--text-tertiary);
}

/* —— Recap —— */
#screen-recap.active {
  padding: calc(16px + var(--safe-top)) 24px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
}
#screen-recap .recap-kicker { margin: 0; line-height: 14px; height: 14px; width: 100%; }
#screen-recap .recap-title {
  margin: 12px 0 0;
  font-size: 28px;
  line-height: 34px;
  font-weight: 700;
  width: 100%;
}
#screen-recap .recap-sub { margin: 12px 0 0; line-height: 16px; width: 100%; }
#screen-recap .lang-switch-row {
  margin: 12px 0 0;
  height: 32px;
  width: 100%;
}
#screen-recap .quilt,
#screen-recap .quilt.cols-3 {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 0;
  max-height: 192px;
  margin: 12px 0 0;
  padding: 0;
  gap: 8px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
}
#screen-recap .word-tile {
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: 108.67 / 192;
  margin: 0;
  padding: 12.5px 10px 10px;
  border-radius: 24px;
  background: #ffffff;
  border: 1px solid #e8dcc8;
  box-shadow: none;
  gap: 0;
}
#screen-recap .word-tile .illust,
#screen-recap .word-tile .illust .word-art,
#screen-recap .word-tile .illust img {
  width: min(88px, 100%);
  height: auto;
  aspect-ratio: 1;
  border-radius: 0;
  background: transparent !important;
  overflow: visible;
}
#screen-recap .word-tile .w { margin-top: 6px; }
#screen-recap .word-tile .ipa { margin-top: 6px; }
#screen-recap .word-tile .def {
  margin-top: 6px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  line-height: 21px;
  color: var(--text-primary);
}
#screen-recap .recap-actions {
  margin-top: auto;
  width: 100%;
  height: auto;
  padding: 0 0 calc(20px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: var(--bg-page);
  z-index: 3;
  box-shadow: 0 -12px 16px var(--bg-page);
}
#screen-recap .recap-foot {
  width: 100%;
  height: auto;
  min-height: 34px;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  flex-shrink: 0;
}
#screen-recap .recap-awards {
  margin: 0;
  min-height: 16px;
  height: auto;
  font-weight: 400;
  font-size: 13px;
  line-height: 16px;
  color: var(--leaf);
}
#screen-recap #recap-note,
#screen-recap .recap-actions .fine {
  margin: 0;
  min-height: 14px;
  height: auto;
  font-size: 13px;
  line-height: 14px;
  color: var(--text-secondary);
}
#screen-recap #btn-back-home,
#screen-recap .recap-actions .btn.ghost,
#screen-recap .recap-actions .btn.text {
  width: auto;
  min-width: 75px;
  height: 44px;
  min-height: 44px;
  margin-top: 12px;
  padding: 0 12px;
}
#screen-recap #btn-next,
#screen-recap .recap-actions .btn:not(.ghost):not(.text) {
  width: auto;
  min-width: 91px;
  height: 52px;
  min-height: 52px;
  margin-top: 12px;
  padding: 0 20px;
}

/* —— Home —— */
#screen-home.active {
  padding: calc(20px + var(--safe-top)) 24px 0;
  gap: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  text-align: left;
  min-height: 0;
}
#screen-home .home-top {
  height: 44px;
  min-height: 44px;
  flex-shrink: 0;
  width: 100%;
}
#screen-home .brand-block {
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 0;
  gap: 0;
  justify-content: flex-start;
  align-items: center;
  overflow: visible;
  width: 100%;
  flex-shrink: 0;
}
#screen-home .brand {
  margin-top: 4px;
  line-height: 39px;
  font-size: 32px;
}
#screen-home .tagline {
  margin-top: 6px;
  line-height: 16px;
}
#screen-home .pack-chip {
  margin-top: 6px;
  height: 36px;
  min-height: 36px;
  padding: 0 12px 0 10px;
}
#screen-home .hero {
  height: clamp(100px, 17.54cqh, 148px);
  min-height: 100px;
  max-height: 148px;
  margin: 0;
  position: relative;
  overflow: visible;
  flex: 0 1 auto;
  width: 100%;
}
#screen-home .hero-cushion {
  width: min(300px, 100%);
  height: 100%;
  margin: 0 auto;
  align-items: center;
  justify-content: center;
  overflow: visible;
  position: relative;
}
#screen-home .hero-cat {
  position: absolute;
  left: 50%;
  top: -13.5%;
  transform: translateX(-50%);
  height: min(188px, 127%);
  width: auto;
  max-width: 127%;
  aspect-ratio: 1;
  margin: 0;
  overflow: visible;
}
#screen-home .hero-cat .pet-sprite {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
#screen-home .hero-cat img,
#screen-home .hero-cat .pet-sprite img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain;
  object-position: center;
}
#screen-home .welcome { display: none; }
#screen-home .welcome:empty { display: none; }
#screen-home .stats {
  width: 100%;
  height: auto;
  min-height: 73px;
  margin: 0;
  gap: 10px;
  flex-shrink: 0;
}
#screen-home .stat { height: 73px; min-height: 73px; }
#screen-home .week-wrap {
  width: 100%;
  height: auto;
  min-height: 49px;
  margin: 0;
  gap: 8px;
  flex-shrink: 0;
  align-items: flex-start;
}
#screen-home .week-label {
  height: 13px;
  line-height: 13px;
  font-size: 13px;
  margin: 0;
}
#screen-home .week {
  width: min(244px, 100%);
  height: 28px;
  gap: 8px;
  justify-content: flex-start;
}
#screen-home .companion-bar {
  width: 100%;
  height: auto;
  min-height: 88px;
  margin: 0;
  padding: 11px 13px;
  flex-shrink: 0;
  box-sizing: border-box;
}
#screen-home .home-grow { flex: 1 1 auto; min-height: 0; }
#screen-home .home-actions {
  width: 100%;
  flex-shrink: 0;
  align-items: flex-start;
  position: sticky;
  bottom: 0;
  padding: 0 0 calc(24px + var(--safe-bottom));
  background: var(--bg-page);
  z-index: 4;
  box-shadow: 0 -12px 16px var(--bg-page);
}
#screen-home #btn-start {
  width: auto;
  min-width: 108px;
  height: 52px;
  min-height: 52px;
  padding: 0 20px;
  align-self: flex-start;
}
#screen-home #btn-profile {
  width: 56px;
  min-width: 56px;
  padding: 0 8px;
}

/* —— Profile —— */
#screen-profile.active {
  padding: calc(16px + var(--safe-top)) 24px calc(16px + var(--safe-bottom));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#screen-profile .profile-topbar {
  height: auto;
  min-height: 44px;
  flex-shrink: 0;
  margin: 0;
  width: 100%;
  overflow: visible;
}
#screen-profile.active {
  gap: 8px;
}
#screen-profile .profile-body {
  padding: 12px 0 16px;
  overflow-y: auto;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}
#screen-profile .profile-card {
  width: 100%;
  margin: 0 0 12px;
  padding: 17px;
  border-radius: 32px;
  box-sizing: border-box;
}
#screen-profile .profile-legend .profile-sq {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
}
#screen-profile .profile-legend .profile-sq.unseen {
  background: #f3e6d3;
  box-shadow: inset 0 0 0 1px #e8dcc8;
}
#screen-profile .profile-strip {
  display: flex;
  gap: 4px;
  width: 80px;
  height: 10px;
  margin-top: 8px;
}
#screen-profile .profile-strip i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 0;
  flex: 0 0 10px;
}
#screen-profile .profile-unit { min-height: 52px; height: auto; padding: 6px 0; }
#screen-profile .profile-unit-list { gap: 8px; }
#screen-profile .profile-card-head {
  height: auto;
  min-height: 22px;
  margin-bottom: 7px;
  align-items: center;
}
#screen-profile .profile-link { padding: 0; }
#screen-profile .profile-body .profile-card:first-child {
  height: auto;
  min-height: 136px;
  overflow: visible;
}
#screen-profile .profile-body .profile-card:nth-child(2) {
  height: auto;
  min-height: 0;
  overflow: visible;
}
#screen-profile .profile-nest {
  height: auto;
  max-height: none;
  overflow: visible;
}
#screen-profile .profile-pet-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  justify-content: start;
  margin: 0;
}
#screen-profile .profile-pet {
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 125px;
  padding: 9px 4px 8px;
  border-radius: 24px;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
  box-sizing: border-box;
}
#screen-profile .profile-pet.companion {
  width: 100%;
  min-width: 0;
  height: auto;
  outline: 2px solid var(--fill-accent);
  outline-offset: 0;
  border-radius: 24px;
}
#screen-profile .profile-pet .art,
#screen-profile .profile-pet .art .pet-sprite,
#screen-profile .profile-pet .art img,
#screen-profile .profile-pet .art .pet-sprite img {
  width: min(64px, 100%);
  height: auto;
  aspect-ratio: 1;
  background: transparent !important;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}
#screen-profile .profile-pet h4 {
  margin-top: 6px;
  font-size: 13px;
  line-height: 18px;
}
#screen-profile .profile-pet .sub {
  font-size: 11px;
  line-height: 13px;
  max-height: none;
  -webkit-line-clamp: 2;
}
#screen-profile .profile-pet .xp-track { display: none !important; }

/* —— Pets house —— */
#screen-pets.active {
  padding: calc(16px + var(--safe-top)) 24px calc(16px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  min-height: 0;
}
#screen-pets .pets-topbar {
  height: auto;
  min-height: 44px;
  flex-shrink: 0;
  margin: 0;
  width: 100%;
  overflow: visible;
  align-items: center;
}
#screen-pets .pets-topbar .round-title {
  min-width: 0;
  overflow: visible;
}
#screen-pets .pets-topbar .name,
#screen-pets .pets-topbar .meta {
  overflow: visible;
  max-width: 100%;
}
#screen-pets .pets-tabs {
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 3px;
  box-sizing: border-box;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  gap: 0;
  align-items: stretch;
}
#screen-pets .pets-tabs button {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  padding: 0 8px;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#screen-pets .pets-body {
  padding: 0;
  width: 100%;
  max-width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
#screen-pets .pets-hero {
  width: 100%;
  max-width: 100%;
  margin: 0 0 12px;
  padding: 16px 14px 14px;
  overflow: hidden;
  box-sizing: border-box;
}
#screen-pets .pets-hero .hero-art {
  position: relative;
  width: min(180px, 100%);
  height: 200px;
  overflow: hidden;
  flex-shrink: 0;
}
#screen-pets .pets-hero .hero-art .pet-sprite {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
#screen-pets .pets-hero .hero-art img,
#screen-pets .pets-hero .hero-art .pet-sprite img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain;
  object-position: center;
}
#screen-pets .pet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 9px;
  width: 100%;
  justify-content: start;
}
#screen-pets .pet-card {
  width: 100%;
  min-width: 0;
  min-height: 125px;
  padding: 9px 8px 8px;
  background: #ffffff;
  border: 1px solid #e8dcc8;
  border-radius: 24px;
  box-shadow: none;
  box-sizing: border-box;
  overflow: hidden;
}
#screen-pets .pet-card .art {
  position: relative;
  width: 64px;
  height: 64px;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  flex-shrink: 0;
}
#screen-pets .pet-card .art .pet-sprite,
#screen-pets .pet-card .art img,
#screen-pets .pet-card .art .pet-sprite img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: auto;
  object-fit: contain;
  object-position: center;
  background: transparent !important;
  border-radius: 0;
  overflow: hidden;
}
#screen-pets .nest-slot .art {
  position: relative;
  overflow: hidden;
}
#screen-pets .nest-slot .art img,
#screen-pets .nest-slot .art .pet-sprite,
#screen-pets .nest-slot .art .pet-sprite img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

/* kill leftover tinted squares on illustrations */
.word-art,
.cell-pic .word-art,
.word-tile .illust,
.word-tile .illust img,
.profile-word .art,
.profile-unit-words .art img {
  background: transparent !important;
}

/* —— Onboard —— */
#screen-onboard {
  padding-left: 24px;
  padding-right: 24px;
}
#screen-onboard.active {
  padding: calc(20px + var(--safe-top)) 24px calc(16px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  min-height: 0;
}
#screen-onboard .topbar {
  height: 44px;
  min-height: 44px;
  width: 100%;
  flex-shrink: 0;
  margin: 0;
}
#screen-onboard .onboard-body {
  padding: 16px 0 0;
  width: 100%;
  gap: 16px;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}
#screen-onboard.onboard-welcome .topbar {
  position: absolute;
  top: calc(20px + var(--safe-top));
  left: 24px;
  right: 24px;
  width: auto;
  height: 44px;
  pointer-events: none;
}
#screen-onboard.onboard-welcome .onboard-body {
  padding-top: 48px;
  gap: 16px;
}
#screen-onboard .onboard-hero {
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: 135px;
  aspect-ratio: 342 / 135;
  margin: 0;
  flex-shrink: 0;
}
#screen-onboard .path-card,
#screen-onboard .pack-card {
  width: 100%;
  box-sizing: border-box;
}
#screen-onboard .path-card {
  min-height: 95px;
  height: auto;
  padding: 16px 18px;
}
#screen-onboard #onboard-lang {
  position: absolute;
  top: calc(20px + var(--safe-top));
  right: 24px;
  left: auto;
  width: auto;
  margin: 0;
  z-index: 2;
  justify-content: flex-end;
}
#screen-onboard.onboard-welcome #onboard-lang {
  top: calc(20px + var(--safe-top));
  right: 24px;
}
#screen-onboard #onboard-lang .lang-switch {
  width: 106px;
  height: 32px;
}
#screen-onboard .onboard-body { padding-top: 16px; gap: 2px; }
#screen-onboard.onboard-welcome .onboard-body { padding-top: 48px; gap: 16px; }
#screen-onboard .pack-card {
  height: auto;
  min-height: 116px;
  margin: 0 0 14px;
}
#screen-onboard .pack-card:last-child { margin-bottom: 0; }
#screen-onboard .pack-card.soon {
  height: auto;
  min-height: 90px;
}
#screen-onboard.onboard-book .onboard-note { margin-bottom: 12px; padding-top: 8px; padding-bottom: 8px; }
#screen-onboard.onboard-stage .pack-card,
#screen-onboard.onboard-grade .pack-card {
  height: auto;
  min-height: 85px;
}
#screen-onboard .onboard-note {
  height: auto;
  min-height: 34px;
  box-sizing: border-box;
  margin: 0;
  display: flex;
  align-items: center;
}
#screen-onboard.onboard-self .onboard-note { height: auto; min-height: 22px; }
#screen-onboard.onboard-self .pack-card { margin-bottom: 16px; }
#screen-onboard.onboard-self .onboard-body { gap: 0; }

/* —— Sheets / overlays —— */
.overlay {
  padding: 16px 16px calc(16px + var(--safe-bottom));
}
.overlay.from-bottom {
  padding: 16px 16px calc(16px + var(--safe-bottom));
}
#overlay-how .sheet.bottom,
#overlay-menu .sheet.bottom {
  width: 100%;
  max-width: 358px;
  margin: 0 auto;
  box-sizing: border-box;
}
#overlay-reset .sheet.confirm,
#overlay-reward .sheet,
#overlay-cap .sheet,
#overlay-demo .sheet {
  width: 100%;
  max-width: 342px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Short viewports: tighten leftover spacers even more, keep CTA visible. */
@media (max-height: 700px) {
  #screen-home .hero {
    height: clamp(96px, 16cqh, 130px);
    min-height: 96px;
  }
  #screen-round .round-spacer-top {
    height: clamp(0px, 2cqh, 16px);
  }
  #screen-home.active,
  #screen-round.active,
  #screen-recap.active {
    gap: 10px;
  }
}

/* ===== t62 recap overflow, sleeping pets, home CTA / drowsy hero ===== */

/* Recap: cards size to their content; the quilt scrolls if needed. */
#screen-recap.active {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#screen-recap .quilt,
#screen-recap .quilt.cols-3 {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
  align-items: start;
  align-content: start;
  grid-auto-rows: min-content;
}
#screen-recap .word-tile {
  aspect-ratio: auto;
  height: auto;
  min-height: 0;
  max-height: none;
  align-self: start;
  overflow: visible;
  justify-content: flex-start;
  box-sizing: border-box;
}
#screen-recap .word-tile .def,
#screen-recap .word-tile .ex {
  display: block !important;
  -webkit-line-clamp: unset !important;
  line-clamp: unset !important;
  -webkit-box-orient: initial;
  overflow: visible !important;
  text-overflow: unset;
  white-space: normal;
  max-height: none;
  word-break: break-word;
  overflow-wrap: anywhere;
}
#screen-recap .word-tile .def {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 400;
  line-height: 18px;
  color: var(--text-primary);
  text-align: center;
}
#screen-recap .word-tile .ex {
  margin-top: 4px;
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 400;
  line-height: 15px;
  color: var(--text-secondary);
  text-align: center;
}
#screen-recap .recap-actions {
  margin-top: auto;
  position: static;
  box-shadow: none;
  flex-shrink: 0;
}

/* Sleeping pets: real sleep art, kept inside the cell above the word tag. */
.pet-sprite.pose-sleep img {
  transform: none;
  filter: none;
}
#screen-round .seat.occupied .placed-cat,
.seat.occupied .placed-cat {
  inset: 6% 10% 28%;
  overflow: hidden;
}
#screen-round .seat.occupied .placed-cat .pet-sprite,
#screen-round .seat.occupied .placed-cat .pet-sprite img,
#screen-round .seat.occupied .placed-cat img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  transform: none;
}

/* Home: complete backdrop oval, pet tucked inside, drowsy loop, prominent CTA. */
#screen-home .hero {
  width: min(240px, 100%, 24cqh);
  height: auto;
  aspect-ratio: 1 / 1;
  min-height: 0;
  max-height: none;
  margin: 0 auto;
  overflow: visible;
  flex: 0 1 auto;
  position: relative;
}
#screen-home .hero-cushion {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 50%;
  overflow: visible;
  box-sizing: border-box;
}
#screen-home .hero-cat {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 72%;
  height: 72%;
  max-width: 72%;
  max-height: 72%;
  aspect-ratio: 1;
  margin: 0;
  overflow: visible;
}
#screen-home .hero-drowsy {
  position: relative;
  width: 100%;
  height: 100%;
  transform-origin: 50% 80%;
  animation: drowsy-loop 4.8s ease-in-out infinite;
}
#screen-home .hero-drowsy .drowsy-frame {
  position: absolute;
  inset: 0;
}
#screen-home .hero-drowsy .drowsy-frame.is-idle {
  opacity: 1;
  animation: drowsy-idle-fade 4.8s ease-in-out infinite;
}
#screen-home .hero-drowsy .drowsy-frame.is-yawn {
  opacity: 0;
  animation: drowsy-yawn-fade 4.8s ease-in-out infinite;
}
#screen-home .hero-drowsy .drowsy-frame .pet-sprite,
#screen-home .hero-drowsy .drowsy-frame .pet-sprite img,
#screen-home .hero-drowsy .pet-sprite,
#screen-home .hero-drowsy .pet-sprite img,
#screen-home .hero-cat.is-drowsy img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain;
  object-position: center;
}
#screen-home .stats,
#screen-home .week-wrap,
#screen-home .companion-bar {
  position: relative;
  z-index: 2;
}
#screen-home .drowsy-z {
  position: absolute;
  top: 2%;
  right: 2%;
  z-index: 2;
  font-family: var(--font-en), var(--display), sans-serif;
  font-style: italic;
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
  color: var(--text-secondary);
  opacity: 0;
  pointer-events: none;
  animation: drowsy-z 9.6s ease-in-out infinite;
}
/* 4.8s home loop: half-lidded idle → slow nod → yawn crossfade → blink back up, plus gentle breathing. */
@keyframes drowsy-loop {
  0%   { transform: translateY(0) scale(1) rotate(0deg); }
  16%  { transform: translateY(1.5px) scale(1.02) rotate(0deg); }
  32%  { transform: translateY(0) scale(1) rotate(0deg); }
  46%  { transform: translateY(4px) scale(1.015) rotate(7deg); }
  58%  { transform: translateY(5px) scale(1.02) rotate(8deg); }
  70%  { transform: translateY(1px) scale(1.01) rotate(1deg); }
  82%  { transform: translateY(0) scale(1) rotate(0deg); }
  90%  { transform: translateY(1.5px) scale(1.02) rotate(0deg); }
  100% { transform: translateY(0) scale(1) rotate(0deg); }
}
@keyframes drowsy-yawn-fade {
  0%, 46% { opacity: 0; }
  52%, 62% { opacity: 1; }
  70%, 100% { opacity: 0; }
}
@keyframes drowsy-idle-fade {
  0%, 46% { opacity: 1; }
  52%, 62% { opacity: 0; }
  70%, 100% { opacity: 1; }
}
@keyframes drowsy-z {
  0%, 20% { opacity: 0; transform: translate(0, 4px) scale(0.7); }
  28% { opacity: 0.8; transform: translate(4px, -8px) scale(1); }
  38% { opacity: 0; transform: translate(8px, -16px) scale(0.85); }
  38.01%, 100% { opacity: 0; transform: translate(0, 4px) scale(0.7); }
}
@media (prefers-reduced-motion: reduce) {
  #screen-home .hero-drowsy,
  #screen-home .hero-drowsy .drowsy-frame.is-idle,
  #screen-home .hero-drowsy .drowsy-frame.is-yawn,
  #screen-home .drowsy-z {
    animation: none !important;
  }
  #screen-home .hero-drowsy {
    transform: none;
  }
  #screen-home .hero-drowsy .drowsy-frame.is-idle {
    opacity: 1;
  }
  #screen-home .hero-drowsy .drowsy-frame.is-yawn,
  #screen-home .drowsy-z {
    opacity: 0 !important;
    visibility: hidden;
  }
}


#screen-home .home-actions {
  align-items: center;
}
#screen-home .home-actions .btn,
#screen-home #btn-start {
  width: 100%;
  max-width: 100%;
  align-self: center;
  height: 58px;
  min-height: 58px;
  padding: 0 24px;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}
#screen-home .home-quota {
  text-align: center;
  width: 100%;
  margin: 0 0 8px;
}

@media (max-height: 700px) {
  #screen-home .hero {
    width: min(200px, 100%, 22cqh);
    height: auto;
    aspect-ratio: 1 / 1;
    min-height: 0;
    max-height: none;
  }
}
@media (max-height: 600px) {
  #screen-home .hero {
    width: min(160px, 100%, 20cqh);
    height: auto;
    aspect-ratio: 1 / 1;
  }
}

@media (max-height: 700px) {
  #screen-recap .word-tile .illust,
  #screen-recap .word-tile .illust .word-art,
  #screen-recap .word-tile .illust img {
    width: min(72px, 100%);
  }
}

/* ===== t71: pack list scroll, onboard back, tray start padding ===== */

/* Onboard must fill the app instead of growing with the pack list.
   A relative screen sized to its content is clipped by #app and cannot scroll. */
#screen-onboard {
  position: absolute !important;
  inset: 0;
  max-height: 100%;
}
#screen-onboard.active {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  min-height: 0;
  height: 100%;
  max-height: 100%;
}
#screen-onboard .topbar {
  flex-shrink: 0;
  position: relative;
  z-index: 3;
}
#screen-onboard .onboard-body,
#screen-onboard.active .onboard-body,
#screen-onboard.onboard-self .onboard-body,
#screen-onboard.onboard-stage .onboard-body,
#screen-onboard.onboard-grade .onboard-body,
#screen-onboard.onboard-book .onboard-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding-bottom: calc(24px + var(--safe-bottom));
}

/* Welcome topbar stays click-through so the language switch works,
   but the back button itself must receive taps. */
#screen-onboard.onboard-welcome .topbar {
  pointer-events: none;
}
#screen-onboard.onboard-welcome .topbar #btn-onboard-back,
#screen-onboard #btn-onboard-back,
#screen-round #btn-home,
#screen-profile #btn-profile-back,
#screen-pets #btn-pets-back {
  pointer-events: auto !important;
  position: relative;
  z-index: 6;
}
#screen-onboard #onboard-lang {
  pointer-events: none;
  z-index: 5;
}
#screen-onboard #onboard-lang .lang-switch,
#screen-onboard #onboard-lang button {
  pointer-events: auto;
}

/* Tray: centering plus overflow clips the leftmost card and it cannot
   be scrolled into view. Start aligned when overflowing; keep a little
   side padding so the first card is fully visible. */
#screen-round .tray,
.tray {
  justify-content: flex-start;
  padding-left: 8px;
  padding-right: 16px;
  scroll-padding-left: 8px;
  scroll-padding-right: 16px;
  -webkit-overflow-scrolling: touch;
}
#screen-round .tray:not(.is-overflowing):not(.is-empty),
.tray:not(.is-overflowing):not(.is-empty) {
  justify-content: center;
  padding-right: 8px;
}

/* ===== home option A: compact strip, big pet, bottom CTA ===== */

#screen-home.active {
  padding: calc(20px + var(--safe-top)) 24px 0;
  gap: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
  min-height: 0;
  background: var(--bg-page, var(--cream, #FFF8EE));
}
#screen-home .home-top {
  flex-shrink: 0;
  width: 100%;
}
#screen-home .brand-block {
  flex-shrink: 0;
  margin-top: 8px;
  width: 100%;
  height: auto;
  max-height: none;
  overflow: visible;
}
#screen-home .brand {
  font-size: 28px;
  line-height: 34px;
  margin: 0;
}
#screen-home .tagline {
  margin-top: 4px;
  font-size: 13px;
  line-height: 18px;
}
#screen-home .pack-chip {
  margin-top: 8px;
  height: 32px;
  min-height: 32px;
}

#screen-home .hero-tap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: center;
}
#screen-home .hero-tap:active {
  transform: none;
  filter: none;
  background: none;
}
#screen-home .hero {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: auto;
  max-height: none;
  aspect-ratio: auto !important;
  margin: 8px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
}
#screen-home .hero-cushion {
  width: min(340px, 100%, 46cqh);
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 50%;
  overflow: visible;
  position: relative;
}
#screen-home .hero-cat {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 82%;
  height: 82%;
  max-width: 82%;
  max-height: 82%;
  aspect-ratio: 1;
  margin: 0;
  overflow: visible;
}
#screen-home .pet-caption,
#screen-home #companion-line {
  display: block;
  margin: 8px 0 0;
  padding: 0;
  width: 100%;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  color: var(--text-primary);
  flex-shrink: 0;
}

#screen-home .info-pill {
  flex-shrink: 0;
  width: 100%;
  margin: 10px 0 12px;
  padding: 10px 14px 8px;
  border-radius: 18px;
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border-default, #e8dcc8);
  box-sizing: border-box;
}
#screen-home .info-pill .line {
  margin: 0;
  font-size: 12px;
  line-height: 18px;
  color: var(--text-secondary, #6e6258);
  text-align: center;
}
#screen-home .info-pill .line b {
  color: var(--text-primary, #2b2420);
  font-weight: 700;
}
#screen-home .info-pill .week,
#screen-home #week {
  width: 100%;
  height: 22px;
  margin-top: 8px;
  justify-content: center;
  gap: 6px;
}
#screen-home .info-pill .day-dot { width: 18px; height: 18px; font-size: 8px; }

#screen-home .home-actions {
  flex-shrink: 0;
  width: 100%;
  align-items: center;
  position: relative;
  margin-top: 0;
  padding: 0 0 calc(24px + var(--safe-bottom));
  box-shadow: none;
  background: transparent;
}
#screen-home .home-actions .btn,
#screen-home #btn-start {
  width: 100%;
  max-width: 100%;
  align-self: center;
  height: 60px;
  min-height: 60px;
  padding: 0 24px;
  border-radius: 999px;
  font-size: 19px;
  font-weight: 700;
}

#screen-home .stats,
#screen-home .week-wrap,
#screen-home .companion-bar,
#screen-home .home-grow,
#screen-home .welcome {
  display: none !important;
}
#screen-home #btn-demo-home[hidden] { display: none !important; }
#screen-home #btn-demo-home:not([hidden]) {
  flex-shrink: 0;
  margin: 0 0 8px;
}

@media (max-height: 700px) {
  #screen-home .brand-block { margin-top: 4px; }
  #screen-home .brand { font-size: 24px; line-height: 30px; }
  #screen-home .tagline { margin-top: 2px; }
  #screen-home .pack-chip { margin-top: 6px; }
  #screen-home .hero {
    width: 100%;
    min-height: 0;
    aspect-ratio: auto !important;
    margin-top: 4px;
  }
  #screen-home .hero-cushion {
    width: min(280px, 100%, 40cqh);
    height: auto;
    aspect-ratio: 1 / 1;
    max-height: 100%;
  }
  #screen-home .info-pill { margin: 8px 0 10px; padding: 8px 12px 6px; }
  #screen-home .home-actions { padding-bottom: calc(16px + var(--safe-bottom)); }
}
@media (max-height: 600px) {
  #screen-home .hero-cushion {
    width: min(220px, 100%, 34cqh);
  }
  #screen-home .pet-caption,
  #screen-home #companion-line { margin-top: 4px; font-size: 13px; }
  #screen-home .info-pill { margin: 6px 0 8px; }
}

/* Contrast cards (function words): example sentence + its Chinese meaning on the recap tile */
#screen-recap .word-tile .ex-zh {
  margin-top: 0;
  color: var(--text-secondary);
  opacity: 0.85;
}

/* Recap: tap to hear (TTS); 跟读 / Read after me starts the microphone */
#screen-recap .recap-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  text-align: center;
}
#screen-recap #recap-sub-text { min-width: 0; }
#screen-recap #btn-recap-repeat {
  flex: 0 0 auto;
  width: auto;
  min-width: 88px;
  height: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}
#screen-recap #btn-recap-repeat[hidden] { display: none; }
#screen-recap #btn-recap-repeat.is-listening {
  background: var(--cream-100);
  box-shadow: 0 0 0 0 rgba(224, 208, 180, 0.55);
  animation: recap-listen-pulse 1.6s ease-in-out infinite;
}
#screen-recap #btn-next:disabled,
#screen-recap #btn-next[aria-disabled="true"] {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
  background: var(--bg-muted);
  color: var(--text-tertiary);
  box-shadow: none;
}
#screen-recap .word-tile {
  position: relative;
  cursor: pointer;
}
#screen-recap .word-tile.is-current {
  background: var(--cream-100);
  border-color: #e0d0b4;
  box-shadow: 0 0 0 2px rgba(224, 208, 180, 0.7);
}
#screen-recap .word-tile.is-matched {
  background: var(--cream-100);
  border-color: #e0d0b4;
  box-shadow: inset 0 0 0 1px rgba(95, 174, 98, 0.22);
}
#screen-recap .word-tile.is-matched::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--leaf);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  pointer-events: none;
}
#screen-recap .word-tile.is-listening {
  background: var(--cream-100);
  animation: recap-listen-pulse 1.6s ease-in-out infinite;
}
#screen-recap .word-tile.is-listening::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--leaf);
  box-shadow: 0 0 0 4px rgba(95, 174, 98, 0.18);
  pointer-events: none;
  animation: recap-mic-dot 1s ease-in-out infinite;
}
#screen-recap .word-tile.shake { animation: shake .4s ease; }
#screen-recap .word-tile .ex {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 100%;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(122, 112, 102, 0.35);
  text-underline-offset: 2px;
}
#screen-recap .word-tile .ex.ex-zh {
  cursor: default;
  text-decoration: none;
}
@keyframes recap-listen-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 208, 180, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(224, 208, 180, 0.18); }
}
@keyframes recap-mic-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}
@media (prefers-reduced-motion: reduce) {
  #screen-recap .word-tile.is-listening,
  #screen-recap .word-tile.is-listening::before,
  #screen-recap #btn-recap-repeat.is-listening {
    animation: none;
  }
}

/* ===== Account / 账号 + sign-in sheet ===== */
.profile-account .profile-card-head { margin-bottom: 6px; }
.account-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-muted);
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}
.account-body {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.profile-account .btn.account-signin { width: 100%; min-height: 48px; font-size: 16px; }
.account-who { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.account-avatar {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--fill-accent-soft);
  color: var(--text-accent);
  font-family: var(--display);
  font-size: 20px; font-weight: 600;
}
.account-meta { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.account-meta b { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; line-height: 1.3; }
.account-status { font-size: 12px; color: var(--text-secondary); line-height: 1.35; }
.account-status::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
  background: var(--status-remembered);
}
.account-status[data-status="syncing"]::before { background: var(--status-learning); }
.account-status[data-status="offline"]::before,
.account-status[data-status="error"]::before { background: var(--status-new); }
.account-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.account-actions .btn.soft.compact { width: auto; min-height: 40px; padding: 0 18px; font-size: 15px; }
.account-actions .btn.text { height: 40px; min-height: 40px; font-size: 15px; color: var(--text-secondary); }

.signin-sheet [hidden] { display: none !important; }
.signin-sheet h2 { margin-bottom: 6px; text-align: center; }
.signin-step { display: flex; flex-direction: column; align-items: stretch; }
.signin-step[hidden] { display: none; }
.signin-lead { margin: 0 0 14px; text-align: center; font-size: 14px; line-height: 1.45; color: var(--text-secondary) !important; }
.signin-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.signin-field input {
  font: inherit;
  font-size: 17px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-soft);
  border: 1.5px solid var(--border-default);
  border-radius: 14px;
  padding: 12px 14px;
  line-height: 1.4;
  height: auto;
  min-height: 50px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.signin-field input:focus { border-color: var(--fill-accent); background: var(--bg-surface); }
#signin-code { letter-spacing: 0.3em; text-align: center; font-size: 22px; }
.signin-error { min-height: 1.3em; margin: 6px 2px 8px; font-size: 13px; color: var(--fill-pressed) !important; }
.signin-hint { margin: 8px 0 0; font-size: 12px; color: var(--text-tertiary) !important; text-align: center; }
.signin-step .btn { width: 100%; align-self: center; }
.signin-step .btn.soft.signin-apple { margin-top: 10px; background: #1d1d1f; color: #fff; }
.signin-note { margin: 12px 0 0; font-size: 12px; line-height: 1.4; color: var(--text-tertiary) !important; text-align: center; }
.signin-links { display: flex; justify-content: center; gap: 4px; margin-top: 6px; }
.signin-links .btn.text { width: auto; font-size: 15px; }
.signin-cancel { display: flex; margin: 6px auto 0; width: auto; }

.signin-modes { display: flex; justify-content: center; gap: 8px; margin: 0 0 12px; }
.signin-modes .signin-mode { width: auto; min-width: 72px; font-size: 15px; }
.signin-modes .signin-mode.is-active { font-weight: 700; color: var(--text-primary); text-decoration: underline; text-underline-offset: 4px; }
#btn-signin-forgot { display: flex; margin: 8px auto 0; width: auto; font-size: 15px; }
#signin-forgot-result { margin-top: 8px; }

.onboard-signin { display: flex; margin: 4px auto 0; width: auto; font-size: 15px; }
.account-body:last-child { margin-bottom: 2px; }

/* ===== Quick study: pack-card entry + waterfall word wall (#screen-study) ===== */
#screen-onboard .pack-card-wrap {
  position: relative;
  width: 100%;
  margin: 0 0 14px;
  flex-shrink: 0;
}
#screen-onboard.onboard-self .pack-card-wrap { margin-bottom: 16px; }
#screen-onboard .pack-card-wrap:last-child { margin-bottom: 0; }
#screen-onboard .pack-card-wrap > .pack-card { margin: 0; width: 100%; }
#screen-onboard .pack-card.has-study .card-top { padding-right: 104px; min-height: 32px; }
#screen-onboard .pack-card-wrap .pack-study {
  position: absolute;
  right: 16px;
  top: 21px;
  z-index: 2;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid #f2c9b9;
  border-radius: 999px;
  background: var(--fill-accent-soft);
  color: var(--text-accent);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#screen-onboard .pack-card-wrap .pack-study:active { transform: scale(.97); background: #ffd3c3; }
#screen-onboard .pack-card-wrap .pack-study::after {
  /* Bigger touch target without changing the look. */
  content: "";
  position: absolute;
  inset: -8px -6px;
}

#screen-study.active {
  padding: calc(16px + var(--safe-top)) 16px 0;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-page);
}
#screen-study .study-topbar { position: relative; z-index: 3; gap: 10px; }
#screen-study .study-topbar .round-title { text-align: left; align-items: flex-start; }
#screen-study #study-title {
  font-family: var(--font);
  font-weight: 500;
  font-size: 17px;
  line-height: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
#screen-study #study-meta { font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.study-mode {
  flex: 0 0 auto;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg-muted);
}
.study-mode-opt {
  appearance: none;
  border: 0;
  background: transparent;
  height: 30px;
  min-width: 48px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}
.study-mode-opt.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: 0 1px 2px var(--shadow); }
#screen-study .study-hint {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-tertiary);
  text-align: left;
  flex-shrink: 0;
}
#screen-study .study-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding-bottom: calc(24px + var(--safe-bottom));
}
/* Waterfall: js/app.js layoutStudy() picks the column count from the width (phone ≈2–3, iPad/desktop 5–8)
   and deals cards left to right (card i → column i % n). */
.study-cols {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 4px;
}
.study-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
#screen-study.study-compact .study-cols { gap: 8px; }
/* Unit-jump chips above the study wall (student packs). One scrollable row; never wraps. */
#screen-study .study-units {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0 6px;
  margin: 4px 0 0;
}
#screen-study .study-units[hidden] { display: none; }
#screen-study .study-units::-webkit-scrollbar { display: none; }
.study-unit-chip {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border, rgba(0,0,0,0.08));
  border-radius: 999px;
  background: var(--bg-surface);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
}
.study-unit-chip.active { color: var(--text-primary); border-color: var(--text-tertiary); }
.study-unit {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 10px 2px 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  color: var(--text-secondary);
}
.study-unit:first-child { margin-top: 2px; }
.study-unit span { font-size: 12px; font-weight: 400; color: var(--text-tertiary); }
.study-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 10px;
  padding: 8px 8px 10px;
  border: 1px solid var(--border-default);
  border-radius: 18px;
  background: var(--bg-surface);
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.study-card:active { background: var(--cream-50); }
.study-card .illust {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: var(--bg-soft);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.study-card .illust .word-art { width: 88%; height: 88%; background: transparent; border-radius: 0; }
.study-card .w {
  margin-top: 6px;
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 17px;
  line-height: 22px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.study-card .ipa { margin-top: 2px; font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.study-card .def { margin-top: 2px; font-size: 13px; line-height: 18px; color: var(--text-primary); overflow-wrap: anywhere; }
.study-card .study-more { width: 100%; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border-default); }
.study-card .ex {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--font);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-primary);
  text-align: center;
  text-decoration: underline;
  text-decoration-color: rgba(122, 112, 102, 0.35);
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.study-card .ex.ex-zh { margin-top: 2px; color: var(--text-secondary); text-decoration: none; cursor: default; }
/* 紧凑 / Compact: picture + word + gloss, denser columns */
#screen-study.study-compact .study-card .ipa,
#screen-study.study-compact .study-card .study-more { display: none; }
#screen-study.study-compact .study-card { padding: 6px 6px 8px; border-radius: 14px; margin-bottom: 8px; }
#screen-study.study-compact .study-card .illust { border-radius: 10px; }
#screen-study.study-compact .study-card .w { margin-top: 4px; font-size: 15px; line-height: 19px; }
#screen-study.study-compact .study-card .def { font-size: 12px; line-height: 16px; }

/* t218: narrow onboard (max-width 389px; 390×844 rules above stay verbatim).

   Welcome page (the QA issue): #screen-onboard .onboard-hero is locked to
   aspect-ratio 342/135 and max-height 135px. At 390px content width is 342px
   so the box is 135px as designed. At 320px content width is 272px and the
   ratio shrinks the hero to ~107px, but kicker + WordNap + “Choose a path
   that fits you” plus padding still need ~139px. The subtitle then overflows
   the hero and sits against / on the Student card. Release the ratio only
   under 390 so the hero can grow with its text and keep the 16px body gap.

   Non-welcome topbar: the language switch still occupies the right 106px.
   Reserve that space and allow the title to wrap inside the remaining width
   instead of ellipsizing a real label. Topbar height may grow. 390 unchanged. */
@media (max-width: 389px) {
  #screen-onboard.onboard-welcome .onboard-hero {
    aspect-ratio: auto;
    height: auto;
    max-height: none;
  }
  #screen-onboard:not(.onboard-welcome) .topbar {
    height: auto;
    min-height: 44px;
  }
  #screen-onboard:not(.onboard-welcome) .topbar .round-title {
    padding-right: 106px;
    box-sizing: border-box;
    align-items: flex-start;
  }
  #screen-onboard:not(.onboard-welcome) #onboard-title,
  #screen-onboard:not(.onboard-welcome) .topbar .round-title .name,
  #screen-onboard:not(.onboard-welcome) .topbar .round-title .meta {
    max-width: 100%;
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
