/* ========== Tokens ========== */
:root {
  --bg: #FFF8F0;
  --card: #FFFFFF;
  --ink: #2B2B3C;
  --muted: #7A7A8C;
  --sky: #4C9EEB;
  --sky-soft: #E8F3FF;
  --sun: #FFC940;
  --sun-soft: #FFF6DC;
  --coral: #FF7B6B;
  --coral-soft: #FFE8E5;
  --mint: #5ECB8A;
  --mint-soft: #E5F8EE;
  --lilac: #A78BFA;
  --lilac-soft: #F0EBFF;
  --border: #F0E6DC;
  --shadow: 0 8px 28px rgba(43, 43, 60, 0.08);
  --shadow-sm: 0 2px 10px rgba(43, 43, 60, 0.06);
  --radius: 18px;
  --radius-sm: 12px;
  --tab-h: 64px;
  --top-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font-en: "Nunito", "Quicksand", system-ui, -apple-system, sans-serif;
  --font-zh: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Nunito", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-zh);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

img { max-width: 100%; display: block; }

/* ========== Layout ========== */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 248, 240, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(240, 230, 220, 0.7);
  padding-top: env(safe-area-inset-top, 0px);
}

.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--sky);
  color: #fff;
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 11px;
  display: grid;
  place-items: center;
  letter-spacing: -0.5px;
}

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
}

.brand-text p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.icon-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--sun-soft);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  font-family: var(--font-en);
  color: var(--ink);
  min-height: 36px;
}

.streak-flame { font-size: 16px; }

.main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tab-h) + var(--safe-b) + 24px);
}

/* ========== Views ========== */
.view { display: none; animation: fadeIn 0.25s ease; }
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ========== Home ========== */
.hero {
  text-align: center;
  padding: 20px 8px 24px;
}

.hero-emoji {
  font-size: 56px;
  line-height: 1;
  animation: bounce 2.4s ease-in-out infinite;
  display: inline-block;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.hero-title {
  margin: 12px 0 6px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hero-desc {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.home-grid {
  display: grid;
  gap: 12px;
}

.home-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 2px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 84px;
}

.home-card:active { transform: scale(0.98); }

.home-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 28px;
  flex-shrink: 0;
}

.card-phonics .home-card-icon { background: var(--sky-soft); }
.card-words .home-card-icon { background: var(--mint-soft); }
.card-spell .home-card-icon { background: var(--coral-soft); }

.home-card-body { flex: 1; min-width: 0; }
.home-card-body h3 { margin: 0 0 2px; font-size: 18px; font-weight: 800; }
.home-card-body p { margin: 0; color: var(--muted); font-size: 13px; }

.home-card-arrow {
  color: var(--muted);
  font-size: 20px;
  flex-shrink: 0;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0 14px;
}

.stat-item {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-num {
  font-family: var(--font-en);
  font-size: 22px;
  font-weight: 800;
  color: var(--sky);
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.tip-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--sun-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 4px;
}

.tip-card p {
  margin: 0;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.45;
}

.tip-icon { font-size: 20px; flex-shrink: 0; }

/* ========== Phonics ========== */
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: #F5EDE4;
  border-radius: 14px;
  padding: 5px;
  margin-bottom: 16px;
}

.seg-btn {
  border-radius: 10px;
  padding: 10px 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  min-height: 40px;
  transition: all 0.15s ease;
}

.seg-btn.active {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.phonics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.phonics-chip {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 2px solid transparent;
  transition: transform 0.12s ease;
  min-height: 96px;
}

.phonics-chip:active { transform: scale(0.96); }
.phonics-chip.learned { border-color: var(--mint); }

.phonics-sym {
  font-family: var(--font-en);
  font-size: 26px;
  font-weight: 800;
  color: var(--sky);
  line-height: 1.1;
}

.phonics-name {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.3;
}

.phonics-example {
  font-family: var(--font-en);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 6px;
}

/* Sheet */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet[hidden] { display: none; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(43, 43, 60, 0.4);
  backdrop-filter: blur(2px);
}

.sheet-panel {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  padding: 12px 20px calc(28px + var(--safe-b));
  animation: slideUp 0.28s ease;
}

@keyframes slideUp {
  from { transform: translateY(30%); opacity: 0.5; }
  to { transform: none; opacity: 1; }
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: #E0D5C8;
  margin: 0 auto 12px;
}

.sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  font-size: 16px;
  box-shadow: var(--shadow-sm);
}

.phonics-detail { text-align: center; padding-top: 8px; }

.detail-sym {
  font-family: var(--font-en);
  font-size: 64px;
  font-weight: 800;
  color: var(--sky);
  line-height: 1;
  margin: 8px 0;
}

.detail-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.detail-type {
  display: inline-block;
  background: var(--sky-soft);
  color: var(--sky);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.detail-tip {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 12px 0 18px;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.detail-tip h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.detail-tip p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

.detail-examples {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.example-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.example-emoji { font-size: 28px; flex-shrink: 0; }

.example-word {
  font-family: var(--font-en);
  font-size: 18px;
  font-weight: 800;
}

.example-ipa {
  font-family: var(--font-en);
  font-size: 12px;
  color: var(--muted);
}

.example-zh {
  font-size: 13px;
  color: var(--muted);
}

.speak-btn {
  margin-left: auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--sky);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 4px 14px rgba(76, 158, 235, 0.35);
}

.speak-btn:active { transform: scale(0.92); }
.speak-btn.large { width: 72px; height: 72px; }
.speak-btn.playing { animation: pulseRing 0.8s ease infinite; }

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(76, 158, 235, 0.5); }
  70% { box-shadow: 0 0 0 16px rgba(76, 158, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(76, 158, 235, 0); }
}

/* ========== Words ========== */
.cat-bar-wrap {
  margin: 0 -16px 16px;
  padding: 0;
  overflow: hidden;
}

.cat-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 16px 10px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.cat-bar::-webkit-scrollbar { display: none; }

.cat-chip {
  flex-shrink: 0;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  min-height: 40px;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.cat-chip.active {
  border-color: var(--sky);
  color: var(--sky);
  background: var(--sky-soft);
}

.cat-chip-emoji { font-size: 16px; }

.words-panel {
  display: none;
}

.progress-block {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.progress-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-cat-emoji { font-size: 28px; }

.progress-title h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.progress-title p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-en);
}

.progress-pct {
  font-family: var(--font-en);
  font-size: 22px;
  font-weight: 800;
  color: var(--sky);
}

.progress-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--sky) 0%, var(--sky) 0%, #F0E6DC 0%);
  outline: none;
  margin: 4px 0 10px;
}

.progress-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--sky);
  box-shadow: 0 2px 8px rgba(76, 158, 235, 0.35);
  cursor: pointer;
}

.progress-range::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--sky);
  box-shadow: 0 2px 8px rgba(76, 158, 235, 0.35);
  cursor: pointer;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

.text-btn {
  color: var(--sky);
  font-weight: 700;
  font-size: 13px;
  padding: 6px 10px;
  min-height: 32px;
}

/* Word card */
.word-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 16px 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.word-visual {
  position: relative;
  display: grid;
  place-items: center;
  height: 160px;
  margin-bottom: 12px;
}

.word-visual-ring {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px dashed var(--border);
  animation: spin 18s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.word-emoji {
  font-size: 88px;
  line-height: 1;
  animation: floaty 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(43, 43, 60, 0.12));
  z-index: 1;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.04); }
}

.word-main { text-align: center; }

.word-en-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.word-en {
  margin: 0;
  font-family: var(--font-en);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.word-ipa {
  font-family: var(--font-en);
  font-size: 16px;
  color: var(--muted);
  background: #F7F1E9;
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  margin: 8px 0 6px;
}

.word-zh {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.word-ext {
  margin: 18px 0 8px;
  padding: 14px;
  background: var(--sky-soft);
  border-radius: var(--radius-sm);
}

.word-ext-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--sky);
  margin-bottom: 8px;
}

.word-ext-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ext-chip {
  background: var(--card);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--font-en);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.word-nav {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin-top: 16px;
}

.nav-btn {
  min-height: 48px;
  border-radius: 14px;
  background: #F5EDE4;
  font-weight: 800;
  font-size: 15px;
  padding: 12px 14px;
  transition: transform 0.12s ease;
}

.nav-btn:active { transform: scale(0.97); }
.nav-btn.primary {
  background: var(--sky);
  color: #fff;
  box-shadow: 0 6px 18px rgba(76, 158, 235, 0.3);
}

/* ========== Spell ========== */
.section-title {
  margin: 8px 0 6px;
  font-size: 26px;
  font-weight: 800;
}

.section-desc {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 15px;
}

.spell-options {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A7A8C' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 16px center;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px 40px 14px 16px;
  font-size: 16px;
  font-weight: 600;
  min-height: 52px;
  width: 100%;
}

.big-btn {
  display: block;
  width: 100%;
  min-height: 54px;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 800;
  padding: 14px 18px;
  transition: transform 0.12s ease;
}

.big-btn:active { transform: scale(0.98); }

.big-btn.primary {
  background: var(--sky);
  color: #fff;
  box-shadow: 0 8px 22px rgba(76, 158, 235, 0.35);
}

.big-btn.ghost {
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--border);
}

.big-btn.danger {
  background: var(--coral-soft);
  color: var(--coral);
}

.spell-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.spell-score {
  background: var(--sun-soft);
  border-radius: 12px;
  padding: 8px 12px;
  text-align: center;
  min-width: 64px;
}

.spell-score span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
}

.spell-score strong {
  font-family: var(--font-en);
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
}

.spell-progress-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
}

.dot.ok { background: var(--mint); }
.dot.bad { background: var(--coral); }
.dot.current { background: var(--sky); transform: scale(1.25); }

.spell-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 16px;
  box-shadow: var(--shadow);
}

.spell-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.spell-hint-zh {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
}

.spell-slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
  min-height: 56px;
}

.slot {
  width: 42px;
  height: 52px;
  border-radius: 12px;
  background: #F7F1E9;
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  font-family: var(--font-en);
  font-size: 22px;
  font-weight: 800;
  text-transform: lowercase;
}

.slot.filled {
  border-color: var(--sky);
  background: var(--sky-soft);
  color: var(--sky);
}

.slot.ok {
  border-color: var(--mint);
  background: var(--mint-soft);
  color: var(--mint);
}

.slot.bad {
  border-color: var(--coral);
  background: var(--coral-soft);
  color: var(--coral);
  animation: shake 0.35s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.spell-keyboard {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.key {
  min-height: 46px;
  border-radius: 10px;
  background: #F5EDE4;
  font-family: var(--font-en);
  font-size: 16px;
  font-weight: 800;
  text-transform: lowercase;
  transition: transform 0.08s ease, background 0.08s ease;
}

.key:active {
  transform: scale(0.94);
  background: var(--sky-soft);
}

.key.wide {
  grid-column: span 2;
  font-family: var(--font-zh);
  font-size: 13px;
}

.key.used { opacity: 0.35; }

.spell-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  gap: 8px;
}

.spell-status {
  min-height: 28px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  margin: 4px 0 12px;
  line-height: 1.4;
}

.spell-status.ok { color: var(--mint); }
.spell-status.bad { color: var(--coral); }
.spell-status.info { color: var(--sky); }

.slot.hinted {
  border-color: var(--sun);
  background: var(--sun-soft);
  color: var(--ink);
}

/* ===== Me extras ===== */
.curve-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.curve-card canvas {
  width: 100%;
  height: 160px;
  display: block;
}

.curve-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.curve-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.dot-sky { background: var(--sky); }
.dot-mint { background: var(--mint); }

.me-badge {
  display: inline-block;
  background: var(--coral-soft);
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}

.wrong-list {
  display: grid;
  gap: 8px;
}

.wrong-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.wrong-emoji { font-size: 24px; flex-shrink: 0; }

.wrong-body { flex: 1; min-width: 0; }

.wrong-en {
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 16px;
}

.wrong-zh {
  font-size: 12px;
  color: var(--muted);
}

.wrong-meta {
  font-size: 11px;
  color: var(--coral);
  font-weight: 700;
}

.wrong-empty {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}

.parent-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.parent-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.parent-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.parent-row input {
  flex: 1;
  min-height: 48px;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 0 14px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  background: var(--bg);
}

.parent-row input:focus {
  outline: none;
  border-color: var(--sky);
}

.parent-report {
  margin-top: 8px;
}

.parent-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.parent-line strong {
  font-family: var(--font-en);
  font-size: 16px;
  color: var(--sky);
}

.parent-report .big-btn {
  margin-top: 14px;
}

/* larger tap targets for spell keys on tiny screens */
@media (max-width: 360px) {
  .key.wide { font-size: 12px; }
  .spell-status { font-size: 13px; }
}

.spell-result {
  text-align: center;
  padding: 40px 12px;
}

.result-emoji {
  font-size: 72px;
  animation: bounce 1.6s ease-in-out infinite;
  display: inline-block;
}

.spell-result h2 {
  margin: 16px 0 8px;
  font-size: 28px;
  font-weight: 800;
}

.spell-result p {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 16px;
}

.result-actions {
  display: grid;
  gap: 10px;
  max-width: 360px;
  margin: 0 auto;
}

/* ========== Me ========== */
.me-hero {
  text-align: center;
  padding: 16px 8px 24px;
}

.me-avatar {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 10px;
}

.me-hero h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
}

.me-hero p {
  margin: 0;
  color: var(--muted);
}

.me-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}

.me-stat {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 18px 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.me-stat-num {
  font-family: var(--font-en);
  font-size: 28px;
  font-weight: 800;
  color: var(--sky);
}

.me-stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.me-section {
  margin-bottom: 22px;
}

.me-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 800;
}

.me-cat-list {
  display: grid;
  gap: 10px;
}

.me-cat-item {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.me-cat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
}

.me-cat-bar {
  height: 8px;
  border-radius: 999px;
  background: #F0E6DC;
  overflow: hidden;
}

.me-cat-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sky), var(--mint));
  transition: width 0.4s ease;
}

.me-actions {
  display: grid;
  gap: 10px;
}

/* ========== Tabbar ========== */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: 720px;
  margin: 0 auto;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  min-height: 56px;
  transition: color 0.15s ease;
}

.tab-item.active { color: var(--sky); }
.tab-icon { font-size: 22px; line-height: 1; }
.tab-label { line-height: 1; }

/* ========== Toast & Confetti ========== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 20px);
  transform: translateX(-50%) translateY(12px);
  background: rgba(43, 43, 60, 0.92);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 300;
}

/* ========== Responsive ========== */
@media (min-width: 600px) {
  .hero-title { font-size: 34px; }
  .home-grid { grid-template-columns: 1fr; }
  .word-emoji { font-size: 100px; }
  .phonics-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .sheet-panel {
    border-radius: 24px;
    margin-bottom: 40px;
    max-height: 80dvh;
    padding: 24px 32px 32px;
  }
  .sheet { align-items: center; padding: 24px; }
}

@media (max-width: 360px) {
  .slot { width: 34px; height: 44px; font-size: 18px; }
  .key { min-height: 40px; font-size: 14px; }
  .spell-keyboard { grid-template-columns: repeat(6, 1fr); }
  .word-en { font-size: 30px; }
}

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
