/* LingoCat student app — screens. Tokens and shared components live in base.css. */

.app {
  max-width: 560px;
  margin: 0 auto;
  overflow-x: clip; /* nothing may push the page sideways (clip keeps the sticky top bar working) */
  min-height: 100vh;
  min-height: 100dvh;
}
.boot {
  display: grid;
  place-items: center;
  min-height: 80vh;
  color: var(--title);
  font-size: 2rem;
  font-weight: 800;
  text-shadow: var(--title-shadow);
}
.fatal {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 80px 24px;
  text-align: center;
}

/* ------------------------------------------------------------------ chrome */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  isolation: isolate;
}
/* frosted band: invisible over the page top, frosts content that scrolls underneath */
.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 -14px;
  z-index: -1;
  background: linear-gradient(180deg, var(--bg-a) 0%, var(--bg-a) 55%, transparent 100%);
  opacity: 0.9;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(#000 62%, transparent);
  mask-image: linear-gradient(#000 62%, transparent);
  pointer-events: none;
}
.wordmark {
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  color: var(--title);
  text-decoration: none;
  text-shadow: var(--title-shadow);
  white-space: nowrap;
}
.wordmark-lg { font-size: 2.6rem; }
.top-title {
  flex: 1;
  text-align: center;
  font-size: 1.3rem;
  color: var(--title);
  text-shadow: var(--title-shadow);
}
.capsule {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  border: 1.5px solid var(--glass-line);
  box-shadow: 0 12px 24px -16px rgb(var(--shade) / 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
}
.capsule-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 2px 10px 2px 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}
.capsule-item .emo { width: 26px; height: 26px; }
.capsule-item > .icon { color: var(--accent-ink); }
.capsule-item.is-zero { color: var(--ink-3); }
.capsule-item.is-zero .emo { filter: grayscale(0.85) opacity(0.7); }
button.capsule-item { cursor: pointer; padding: 2px 6px; }
button.capsule-item:hover { background: var(--glass-2); }
.capsule-sep { width: 1.5px; height: 20px; background: var(--glass-line); border-radius: 2px; }
.capsule-item.bump { animation: bump 0.45s ease-out; }

.page {
  padding: 4px 16px calc(120px + env(safe-area-inset-bottom));
}
.page > * + * { margin-top: 14px; }
.page-title {
  color: var(--title);
  text-shadow: var(--title-shadow);
  font-size: var(--t-xxl);
  padding: 2px 4px;
}
.section-title {
  font-size: var(--t-l);
  color: var(--ink);
  padding: 0 4px;
}
.glass .section-title,
.card .section-title { padding: 0; }

/* floating glass tab bar */
.tabbar {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 520px);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 6px;
  border-radius: 30px;
  background: linear-gradient(180deg, var(--glass-strong), var(--glass));
  border: 1.5px solid var(--glass-line);
  box-shadow: 0 20px 40px -18px rgb(var(--shade) / 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
}
.tab {
  display: grid;
  justify-items: center;
  gap: 1px;
  min-width: 0;
  padding: 6px 2px 5px;
  border-radius: 24px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 800;
  font-size: 0.68rem;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.tab .emo { width: 29px; height: 29px; transition: transform 0.2s ease; filter: grayscale(0.35) opacity(0.85); }
.tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab[aria-current="page"] {
  color: var(--accent-ink);
  background: var(--glass-strong);
  box-shadow: inset 0 0 0 2px var(--accent), 0 8px 16px -10px rgb(var(--shade) / 0.6);
}
.tab[aria-current="page"] .emo { transform: translateY(-1px) scale(1.08); filter: none; }

/* ------------------------------------------------------------------ home */

.stage-card {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 62vh;
  margin-inline: auto;
  width: 100%;
  border-radius: var(--r-xl);
  overflow: hidden;
  background:
    radial-gradient(80% 60% at 50% 30%, rgba(255, 255, 255, 0.7), transparent 70%),
    linear-gradient(175deg, var(--stage-a), var(--stage-b));
  border: 2px solid var(--glass-line);
  box-shadow:
    0 30px 60px -30px rgb(var(--shade) / 0.65),
    0 4px 10px -4px rgb(var(--shade) / 0.15),
    inset 0 2px 0 rgba(255, 255, 255, 0.8),
    inset 0 -40px 60px -40px rgb(var(--shade) / 0.12);
  isolation: isolate;
}
.stage-card[data-night="1"] {
  background:
    radial-gradient(70% 50% at 70% 18%, rgba(255, 230, 250, 0.22), transparent 70%),
    linear-gradient(175deg, #33296e, #5b3f93 62%, #8a5a9f);
  border-color: rgba(255, 255, 255, 0.28);
}
.stage-card[data-night="1"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 14%, #fff 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 28% 8%, #fff 50%, transparent 52%),
    radial-gradient(1.6px 1.6px at 66% 11%, #fff 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 84% 21%, #fff 50%, transparent 52%),
    radial-gradient(1.4px 1.4px at 46% 5%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 92% 7%, #fff 50%, transparent 52%);
  opacity: 0.8;
}
.stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
  cursor: pointer;
}
.stage-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.stage-fallback svg { width: 100%; height: 100%; }
.stage-head {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}
.stage-head > * { pointer-events: auto; }
.pet-tag {
  display: grid;
  gap: 0;
  padding: 8px 16px 9px;
  border-radius: 22px;
  background: var(--glass);
  border: 1.5px solid var(--glass-line);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  box-shadow: 0 12px 24px -16px rgb(var(--shade) / 0.6);
}
.pet-name { font-size: 1.25rem; line-height: 1.15; }
.pet-mood { font-size: var(--t-xs); font-weight: 800; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.pet-mood .emo { width: 18px; height: 18px; }
.stage-card[data-night="1"] .pet-tag { background: rgba(40, 28, 90, 0.45); color: #fff; }
.stage-card[data-night="1"] .pet-mood { color: #e7dcf7; }

.thought {
  position: absolute;
  z-index: 3;
  top: 19%;
  right: 17%;
  display: grid;
  place-items: center;
  width: 68px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--glass-strong);
  box-shadow: 0 12px 24px -12px rgb(var(--shade) / 0.6), inset 0 1px 0 #fff;
  cursor: pointer;
  animation: bob 2.4s ease-in-out infinite alternate;
}
.thought::before,
.thought::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: var(--glass-strong);
  box-shadow: 0 6px 12px -8px rgb(var(--shade) / 0.6);
}
.thought::before { width: 16px; height: 16px; left: 2px; bottom: -6px; }
.thought::after { width: 9px; height: 9px; left: -8px; bottom: -14px; }
.thought .emo { width: 36px; height: 36px; }
@keyframes bob {
  to { transform: translateY(-6px); }
}

.fx-layer { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.float-text {
  position: absolute;
  transform: translate(-50%, 0);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--accent-ink);
  background: var(--glass-strong);
  padding: 3px 12px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 10px 20px -12px rgb(var(--shade) / 0.6);
  animation: float-up 1.6s ease-out forwards;
}
.float-text .emo { width: 22px; height: 22px; margin-right: 3px; }
@keyframes float-up {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.85); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60px) scale(1); }
}
.float-emo {
  position: absolute;
  width: 34px;
  height: 34px;
  animation: heart-up 1.4s ease-out forwards;
}
@keyframes heart-up {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.4) rotate(-10deg); }
  20% { opacity: 1; transform: translate(-50%, -14px) scale(1) rotate(6deg); }
  100% { opacity: 0; transform: translate(-50%, -90px) scale(0.9) rotate(-8deg); }
}
.drop-item {
  position: absolute;
  left: 50%;
  top: 8%;
  width: 72px;
  height: 72px;
  transform: translateX(-50%);
  animation: drop-in 1.3s cubic-bezier(0.3, 0.7, 0.4, 1) forwards;
}
@keyframes drop-in {
  0% { opacity: 0; transform: translate(-50%, -30px) scale(0.6) rotate(-12deg); }
  25% { opacity: 1; transform: translate(-50%, 0) scale(1.1) rotate(6deg); }
  70% { opacity: 1; transform: translate(-50%, 70px) scale(0.9) rotate(-4deg); }
  100% { opacity: 0; transform: translate(-50%, 120px) scale(0.5); }
}

.needs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.need {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 10px;
  padding: 12px 14px;
  border-radius: 24px;
}
.need .emo { grid-row: span 2; width: 40px; height: 40px; }
.need-label { grid-column: 2 / -1; font-weight: 800; font-size: var(--t-s); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.need-value { font-size: 1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.bar {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgb(var(--shade) / 0.12);
  box-shadow: inset 0 1px 3px rgb(var(--shade) / 0.18);
  overflow: hidden;
}
.bar > i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--a), var(--b));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45);
  transition: width 0.6s cubic-bezier(0.3, 0.8, 0.3, 1);
}
.bar > i::after {
  content: "";
  position: absolute;
  inset: 2px 6px auto 6px;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.55);
}
.need[data-stat="hunger"] .bar { --a: var(--food-a); --b: var(--food-b); }
.need[data-stat="happiness"] .bar { --a: var(--joy-a); --b: var(--joy-b); }
.need.is-low .need-value { color: var(--bad-ink); }
.need.is-low .bar > i { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse {
  50% { opacity: 0.55; }
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.action {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 800;
  font-size: var(--t-s);
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.action-icon {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 120px;
  aspect-ratio: 1.35 / 1;
  border-radius: 26px;
  background: linear-gradient(160deg, var(--tile-a), var(--tile-b));
  border: 1.5px solid var(--glass-line);
  box-shadow: 0 16px 28px -18px rgb(var(--shade) / 0.65), inset 0 2px 0 rgba(255, 255, 255, 0.8), inset 0 -4px 0 rgb(var(--shade) / 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.action-icon .emo { width: 48px; height: 48px; transition: transform 0.2s ease; }
.action:hover .action-icon .emo { transform: scale(1.08) rotate(-4deg); }
.action:active .action-icon { transform: translateY(2px) scale(0.98); }

.lesson-cta { text-align: center; }
.lesson-cta .btn-lg { min-height: 62px; font-size: 1.2rem; }
.lesson-cta p { margin-top: 10px; color: var(--ink-2); font-weight: 600; }
.status-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.status-chips .chip { padding: 6px 12px; font-size: var(--t-xs); background: var(--glass); }
.status-chips .chip.is-alert { background: var(--bad-tint); color: var(--bad-ink); }
.status-chips .chip .icon { opacity: 0.85; }

/* ------------------------------------------------------------------ wardrobe */

.ward-hero {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}
.ward-stage {
  aspect-ratio: 1 / 1;
  max-height: 46vh;
  width: 100%;
}
.swatches {
  display: grid;
  gap: 10px;
  align-content: center;
}
.swatches-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.swatch {
  position: relative;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 4px solid var(--swatch-ring, #fff);
  background: var(--sw);
  cursor: pointer;
  box-shadow: 0 10px 18px -10px rgb(var(--shade) / 0.7), inset 0 -6px 10px rgba(0, 0, 0, 0.08), inset 0 6px 8px rgba(255, 255, 255, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.swatch:hover { transform: scale(1.06); }
.swatch[aria-checked="true"] {
  transform: scale(1.1);
  box-shadow: 0 0 0 3px var(--accent), 0 12px 22px -10px rgb(var(--shade) / 0.8);
}
.swatch.is-rainbow {
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.8), transparent 40%),
    conic-gradient(from 200deg, #ffb3d9, #c7b3ff, #a8d8ff, #a8f0d8, #fff1a8, #ffc8a8, #ffb3d9);
}
.slot-row { display: grid; gap: 8px; }
.slot-row h3 { font-size: 1.05rem; padding: 0 4px; color: var(--ink); }
.slot-tiles {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 4px 10px;
  margin: 0 -4px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.slot-tiles::-webkit-scrollbar { display: none; }
.slot-tile {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  padding: 6px;
  border-radius: 26px;
  border: 3px solid transparent;
  background: linear-gradient(160deg, var(--tile-a), var(--tile-b));
  box-shadow: 0 14px 24px -16px rgb(var(--shade) / 0.7), inset 0 2px 0 rgba(255, 255, 255, 0.85);
  cursor: pointer;
  scroll-snap-align: start;
  color: var(--ink-2);
  font-weight: 800;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.slot-tile:hover { transform: translateY(-2px); }
.slot-tile[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 16px 26px -16px rgb(var(--shade) / 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.85);
}
.slot-tile img { width: 100%; height: 100%; object-fit: contain; }
.slot-tile .slot-name {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 5px;
  font-size: 0.68rem;
  line-height: 1.15;
  text-align: center;
  color: var(--ink);
  background: var(--glass-strong);
  border-radius: 10px;
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-tile.is-shop { border: 2px dashed var(--line-strong); background: var(--glass-2); box-shadow: none; }
.slot-tile.is-shop .emo { width: 40px; height: 40px; }
.slot-more { font-size: var(--t-s); color: var(--ink-2); font-weight: 700; padding: 0 4px; }

/* image placeholders while 3D thumbnails render */
.thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.thumb.is-ready { opacity: 1; }
.thumb-box { position: relative; display: grid; place-items: center; }
.thumb-box::before {
  content: "";
  position: absolute;
  width: 46%;
  height: 46%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9), transparent 70%);
  animation: shimmer 1.2s ease-in-out infinite alternate;
}
.thumb-box:has(.is-ready)::before { display: none; }
@keyframes shimmer {
  to { opacity: 0.4; transform: scale(0.85); }
}

/* item rows in feed / play sheets */
.item-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 22px;
  background: linear-gradient(160deg, var(--tile-a), var(--tile-b));
  border: 1.5px solid var(--glass-line);
  box-shadow: 0 10px 20px -16px rgb(var(--shade) / 0.6);
}
.item-thumb { width: 56px; height: 56px; flex: none; display: grid; place-items: center; }
.item-thumb img,
.item-thumb svg { width: 100%; height: 100%; object-fit: contain; }
.item-info { flex: 1; display: grid; gap: 4px; min-width: 0; }
.item-info strong { font-size: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.qty { font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.resting { color: var(--ink-2); font-weight: 700; text-align: right; }

/* theme picker */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.theme-opt {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 22px;
  border: 3px solid transparent;
  background: var(--glass-2);
  cursor: pointer;
  font-weight: 800;
  font-size: var(--t-s);
  color: var(--ink);
}
.theme-opt[aria-checked="true"] { border-color: var(--accent); background: var(--glass-strong); }
.theme-dot {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 10px 18px -10px rgba(60, 20, 80, 0.6);
}
.theme-dot[data-t="dream"] { background: linear-gradient(160deg, #c4aaf6, #efb4df 50%, #ffd0b3); }
.theme-dot[data-t="ocean"] { background: linear-gradient(160deg, #9fb7ff, #a9dcf7 50%, #c4f3e2); }
.theme-dot[data-t="mint"] { background: linear-gradient(160deg, #9fe3c9, #c5f0d8 50%, #fff3b8); }
.theme-dot[data-t="sunset"] { background: linear-gradient(160deg, #ffb38f, #ff9fb2 50%, #ffd38f); }
.theme-dot[data-t="lilac"] { background: linear-gradient(160deg, #b9a6ff, #d8c6ff 50%, #f6d9ff); }
.theme-dot[data-t="night"] { background: linear-gradient(160deg, #1f1a4d, #47307c 50%, #8d4f8f); }

/* ------------------------------------------------------------------ auth */

.auth {
  max-width: 460px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 18px 40px;
}
.auth-lang { display: flex; justify-content: flex-end; }
.auth-hero { text-align: center; margin-top: -6px; }
.auth-cat {
  position: relative;
  display: block;
  width: 210px;
  height: 210px;
  margin: 0 auto -8px;
}
.auth-cat::before {
  content: "";
  position: absolute;
  inset: 12% 10% 6%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.85), transparent 68%);
}
.auth-cat img,
.auth-cat svg { position: relative; width: 100%; height: 100%; object-fit: contain; animation: bob 2.6s ease-in-out infinite alternate; }
.auth-tagline {
  margin-top: 4px;
  color: var(--title);
  text-shadow: var(--title-shadow);
  font-size: var(--t-l);
  font-weight: 800;
}
.auth-form { margin-top: 18px; padding: 22px 20px; }
.auth-form h2 { font-size: var(--t-xl); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 86px; }
.reveal {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  border-radius: 999px;
  background: var(--glass-2);
  padding: 6px 12px;
  font-weight: 800;
  font-size: var(--t-xs);
  color: var(--ink-2);
  cursor: pointer;
}
.input-code { text-transform: uppercase; letter-spacing: 0.18em; font-weight: 800; }
.input-lg { font-size: var(--t-l); min-height: 56px; }
.form-error {
  padding: 10px 14px;
  border-radius: var(--r-s);
  background: var(--bad-tint);
  color: var(--bad-ink);
  font-weight: 800;
}
.auth-switch { text-align: center; }
.auth-teacher { text-align: center; }

/* ------------------------------------------------------------------ adopt */

.adopt { padding-top: calc(18px + env(safe-area-inset-top)); }
.adopt-head { text-align: center; }
.adopt-head h1 { color: var(--title); text-shadow: var(--title-shadow); margin-bottom: 6px; }
.adopt-head p { color: var(--ink); font-weight: 600; }
.breed-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.breed-card {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 10px 14px;
  border-radius: 28px;
  border: 3px solid transparent;
  background: linear-gradient(160deg, var(--tile-a), var(--tile-b));
  box-shadow: 0 16px 28px -18px rgb(var(--shade) / 0.7), inset 0 2px 0 rgba(255, 255, 255, 0.85);
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.breed-card[aria-checked="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 18px 30px -18px rgb(var(--shade) / 0.8);
  transform: translateY(-2px);
}
.breed-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.breed-art { display: block; width: 100%; max-width: 150px; aspect-ratio: 1 / 1; }
.breed-art img,
.breed-art svg { width: 100%; height: 100%; object-fit: contain; }
.breed-card strong { font-size: 1.05rem; }
.adopt-form { padding: 18px; }

/* ------------------------------------------------------------------ practice */

.quick-lesson {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border-radius: var(--r-l);
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  background: linear-gradient(135deg, var(--cta-a), var(--cta-b));
  color: var(--cta-ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 20px 34px -18px rgba(200, 90, 20, 0.6), inset 0 2px 0 rgba(255, 255, 255, 0.6), inset 0 -4px 0 rgba(150, 60, 0, 0.2);
  transition: transform 0.12s ease;
}
.quick-lesson:active { transform: translateY(2px); }
.quick-lesson .emo { width: 54px; height: 54px; }
.quick-text { flex: 1; display: grid; gap: 2px; }
.quick-text strong { font-size: var(--t-l); }
.quick-text span { font-size: var(--t-s); font-weight: 600; }
.quick-go {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  font-weight: 800;
}
.topic-list { display: grid; gap: 10px; }
.topic-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 24px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  transition: transform 0.12s ease;
}
.topic-row:hover { transform: translateY(-1px); }
.topic-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: 18px;
  background: linear-gradient(160deg, var(--tile-a), var(--tile-b));
  box-shadow: inset 0 2px 0 #fff, 0 8px 14px -10px rgb(var(--shade) / 0.6);
  font-size: 1.7rem;
}
.topic-icon .emo { width: 38px; height: 38px; }
.topic-main { flex: 1; display: grid; gap: 5px; min-width: 0; }
.topic-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 800; }
.level {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.7rem;
  font-weight: 800;
}
.topic-meta { font-size: var(--t-xs); color: var(--ink-2); font-weight: 700; }
.topic-bar { display: block; height: 8px; border-radius: 999px; background: rgb(var(--shade) / 0.12); overflow: hidden; }
.topic-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--joy-a), var(--accent)); }

/* ------------------------------------------------------------------ lesson */

.lesson {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.lesson-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.lesson-progress {
  flex: 1;
  display: grid;
  grid-auto-flow: column;
  gap: 5px;
  padding: 5px;
  border-radius: 999px;
  background: var(--glass);
  border: 1.5px solid var(--glass-line);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.lesson-progress i { height: 10px; border-radius: 999px; background: rgb(var(--shade) / 0.14); }
.lesson-progress i.current { background: linear-gradient(90deg, var(--cta-a), var(--cta-b)); }
.lesson-progress i.right { background: linear-gradient(90deg, #5be0b0, #12a079); }
.lesson-progress i.wrong { background: linear-gradient(90deg, #ff9ab3, #e8457a); }
.lesson-body { flex: 1; padding: 4px 16px 24px; }
.lesson-count { margin: 0 4px 8px; color: var(--ink); font-weight: 800; }
.exercise {
  padding: 20px 18px;
  border-radius: var(--r-l);
  background: linear-gradient(160deg, var(--glass-strong), var(--glass));
  border: 1.5px solid var(--glass-line);
  box-shadow: 0 22px 44px -26px rgb(var(--shade) / 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
}
.ex-instruction { font-weight: 800; color: var(--ink-2); margin-bottom: 6px; font-size: var(--t-s); }
.ex-prompt { font-size: 1.55rem; line-height: 1.35; font-weight: 800; margin-bottom: 14px; overflow-wrap: anywhere; }
.ex-prompt-small { font-size: var(--t-l); }
.ex-help { color: var(--ink-2); font-size: var(--t-s); margin: 4px 0 12px; }
.blank {
  display: inline-block;
  min-width: 3.2em;
  border-bottom: 3px solid var(--accent);
  margin: 0 4px;
}
.hint { margin: 2px 0 16px; }
.hint-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1.5px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass-2);
  font-weight: 800;
  font-size: var(--t-s);
  color: var(--ink-2);
  cursor: pointer;
}
.hint-toggle .icon { display: inline-flex; }
.hint-text {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: var(--r-s);
  background: var(--accent-soft);
  font-weight: 700;
}
.choices { display: grid; gap: 10px; }
.choice,
.match-item,
.tile {
  font-weight: 800;
  color: var(--ink);
  border: 2.5px solid transparent;
  background: linear-gradient(160deg, var(--tile-a), var(--tile-b));
  box-shadow: 0 10px 18px -14px rgb(var(--shade) / 0.7), inset 0 2px 0 rgba(255, 255, 255, 0.85), inset 0 -3px 0 rgb(var(--shade) / 0.06);
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.choice {
  min-height: 58px;
  padding: 12px 16px;
  border-radius: 20px;
  text-align: left;
  font-size: 1.1rem;
}
.choice:active,
.match-item:active,
.tile:active { transform: scale(0.98); }
.choice[aria-checked="true"],
.match-item.is-picked {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 10px 18px -14px rgb(var(--shade) / 0.7);
}
.choice.is-right,
.match-item.is-right { border-color: var(--good); background: var(--good-tint); color: var(--good-ink); }
.choice.is-wrong,
.match-item.is-wrong { border-color: var(--bad); background: var(--bad-tint); color: var(--bad-ink); }
.is-locked .choice,
.is-locked .match-item,
.is-locked .tile { cursor: default; }
.fill-sentence { line-height: 2.1; }
.blank-input {
  display: inline-block;
  width: 7.5em;
  max-width: 100%;
  min-height: 46px;
  padding: 4px 10px;
  margin: 0 4px;
  border: 2.5px solid var(--glass-line);
  border-bottom-color: var(--accent);
  border-radius: 14px;
  background: var(--glass-strong);
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
}
.blank-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.blank-input.is-right { background: var(--good-tint); border-color: var(--good); }
.blank-input.is-wrong { background: var(--bad-tint); border-color: var(--bad); }
.fill-correction { margin-top: 8px; }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-col { display: grid; gap: 8px; align-content: start; }
.match-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 8px 12px;
  border-radius: 18px;
  text-align: left;
}
.match-badge {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  font-size: 0.75rem;
  font-weight: 800;
}
.match-text { overflow-wrap: anywhere; }
.match-item.is-paired .match-badge { background: var(--accent); border-color: var(--accent); color: #fff; }
.wo-answer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 70px;
  padding: 10px;
  margin-bottom: 14px;
  border-radius: 20px;
  border: 2.5px dashed var(--line-strong);
  background: var(--glass-2);
}
.wo-answer.is-right { border-style: solid; border-color: var(--good); background: var(--good-tint); }
.wo-answer.is-wrong { border-style: solid; border-color: var(--bad); background: var(--bad-tint); }
.wo-bank { display: flex; flex-wrap: wrap; gap: 8px; }
.tile {
  min-height: 46px;
  padding: 8px 14px;
  border-radius: 14px;
  font-size: 1.05rem;
}
.tile-ghost {
  background: transparent;
  border: 2px dashed var(--line-strong);
  box-shadow: none;
  color: transparent;
  cursor: default;
}
.lesson-foot {
  position: sticky;
  bottom: 0;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
}
.feedback {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--r-l);
  border: 1.5px solid var(--glass-line);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  box-shadow: 0 -10px 40px -20px rgb(var(--shade) / 0.5);
  animation: sheet-up 0.24s ease-out;
}
.feedback.is-right { background: linear-gradient(160deg, rgba(225, 252, 240, 0.94), rgba(200, 245, 225, 0.9)); color: #0b5e47; }
.feedback.is-wrong { background: linear-gradient(160deg, rgba(255, 236, 242, 0.95), rgba(255, 214, 226, 0.92)); color: #9a1f45; }
.feedback-head { display: flex; align-items: center; gap: 10px; }
.feedback-head .emo { width: 44px; height: 44px; }
.feedback-title { flex: 1; font-size: var(--t-l); }
.feedback-coins { display: inline-flex; align-items: center; gap: 4px; font-size: 1.1rem; color: #4a2a08; background: rgba(255, 255, 255, 0.7); padding: 3px 10px 3px 6px; border-radius: 999px; }
.feedback-coins .coin-dot { width: 20px; height: 20px; }
.feedback-answer { color: #3a2350; }
.feedback-answer > span:first-child { display: block; font-size: var(--t-s); font-weight: 800; color: #9a1f45; }
.correct-text { font-size: 1.1rem; }
.pair-list { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 2px; font-weight: 800; }
.feedback-explain { color: #3a2350; font-size: 0.95rem; }

/* ------------------------------------------------------------------ summary */

.summary {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 18px 40px;
  text-align: center;
}
.summary-hero { position: relative; width: 230px; height: 230px; margin: 0 auto; }
.summary-hero .thumb { animation: bob 2.6s ease-in-out infinite alternate; }
.summary-badge { position: absolute; right: -6px; top: 6px; width: 76px; height: 76px; animation: bump 1s ease-out; }
.summary h1 { color: var(--title); text-shadow: var(--title-shadow); }
.summary-score { margin-top: 4px; font-size: var(--t-l); font-weight: 800; }
.sum-list { margin: 16px 0; padding: 16px 18px; display: grid; gap: 10px; text-align: left; }
.sum-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sum-line dt { font-weight: 700; display: grid; }
.sum-line dt small { color: var(--ink-2); font-weight: 700; }
.sum-line dd { margin: 0; font-size: 1.1rem; }
.sum-total { padding-top: 10px; border-top: 1.5px dashed var(--line-strong); }
.sum-total dt { font-weight: 800; font-size: var(--t-l); }
.sum-total dd { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 1.35rem; }
.sum-total .coin-dot { width: 24px; height: 24px; }
.summary-proud { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; padding: 8px 14px; border-radius: 999px; background: var(--glass); }
.summary-actions { display: grid; gap: 10px; margin-top: 18px; }

/* ------------------------------------------------------------------ shop */

.shop-tabs { margin-top: 10px; }
.shop-note { padding: 0 4px; color: var(--ink); font-weight: 600; }
.shop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.shop-item {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px 12px;
  border-radius: 26px;
}
.shop-item .chip { white-space: normal; text-align: left; line-height: 1.25; }
.shop-art {
  display: grid;
  place-items: center;
  aspect-ratio: 1.15 / 1;
  border-radius: 20px;
  background: radial-gradient(70% 70% at 50% 40%, rgba(255, 255, 255, 0.9), transparent 75%), linear-gradient(160deg, var(--tile-a), var(--tile-b));
  margin-bottom: 4px;
  overflow: hidden;
}
.shop-art img,
.shop-art svg { width: 82%; height: 82%; object-fit: contain; }
.shop-art .thumb { width: 100%; height: 100%; }
.shop-item h3 { font-size: 1rem; }
.shop-desc { font-size: var(--t-xs); color: var(--ink-2); font-weight: 600; }
.shop-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.price-btn { padding: 6px 14px 6px 10px; }
.price-btn .coin-dot { width: 18px; height: 18px; }
.owned-badge { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: var(--good-ink); font-size: var(--t-s); }
.shop-item.is-owned .shop-art { box-shadow: inset 0 0 0 3px var(--good); }
.chip-food { background: #fff1db; color: #8a4f0c; border-color: transparent; }
.chip-heart { background: #ffe1ee; color: #b3205a; border-color: transparent; }
[data-theme="night"] .chip-food { background: rgba(255, 200, 120, 0.2); color: #ffd9a8; }
[data-theme="night"] .chip-heart { background: rgba(255, 120, 180, 0.2); color: #ffc0dc; }

/* ------------------------------------------------------------------ progress */

.progress-head { padding: 0 4px; }
.progress-head h1 { color: var(--title); text-shadow: var(--title-shadow); }
.progress-head p { color: var(--ink); font-weight: 700; }
.stat-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-tile {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px 12px;
  padding: 14px;
  border-radius: 24px;
}
.stat-tile .emo { grid-row: span 3; width: 44px; height: 44px; }
.stat-label { font-size: var(--t-xs); font-weight: 800; color: var(--ink-2); }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: var(--t-xs); color: var(--ink-2); font-weight: 700; }
.card-head { margin-bottom: 10px; }
.chart-box { min-height: 180px; }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--t-s); }
.data-table th,
.data-table td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.hbars { display: grid; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; }
.hbar-icon { font-size: 1.3rem; }
.hbar-label { font-weight: 800; font-size: var(--t-s); }
.hbar-track { grid-column: 2 / 3; height: 10px; border-radius: 999px; background: rgb(var(--shade) / 0.12); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--joy-a), var(--accent)); }
.hbar-value { font-weight: 800; font-variant-numeric: tabular-nums; }
.hbar-note { grid-column: 2 / -1; font-size: var(--t-xs); color: var(--ink-2); }
.settings { display: grid; gap: 14px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.setting-row > span { font-weight: 800; }
.empty-cat { width: 150px; height: 150px; }
.empty-cat img { width: 100%; height: 100%; object-fit: contain; }
.theme-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-inline .theme-dot { width: 40px; height: 40px; border-width: 3px; cursor: pointer; padding: 0; }
.theme-inline .theme-dot[aria-checked="true"] { box-shadow: 0 0 0 3px var(--accent), 0 10px 18px -10px rgba(60, 20, 80, 0.6); transform: scale(1.06); }

@media (min-width: 720px) {
  .app { max-width: 620px; }
  .shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .breed-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .breed-card:last-child:nth-child(odd) { grid-column: auto; }
}
