:root {
  --bg1: #fff7ed;
  --bg2: #e0f2fe;
  --ink: #1f2937;
  --muted: #6b7280;
  --card: #ffffff;
  --accent: #f97316;
  --accent-2: #2563eb;
  --good: #10b981;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 22px;
  --nav: #0f172a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Nunito", "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at -10% -20%, #fdba74 0%, transparent 50%),
    radial-gradient(900px 500px at 110% 0%, #93c5fd 0%, transparent 45%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}

.app-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 16px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  object-fit: cover;
  background: #fff7ed;
  box-shadow: var(--shadow);
}
.brand h1 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.1;
}
.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: #fff;
  padding: 8px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.nav button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.nav button.active {
  background: var(--nav);
  color: #fff;
}

.page { display: none; }
.page.active { display: block; }

.hero-card, .panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
}

.hero-card h2, .panel h2 {
  margin: 0 0 8px;
  font-size: 1.6rem;
}
.lede {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 700;
}

.input-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.input-row input {
  flex: 1 1 240px;
  min-height: 64px;
  border: 3px solid #fed7aa;
  border-radius: 18px;
  padding: 12px 16px;
  font: inherit;
  font-size: 1.35rem;
  font-weight: 800;
  outline: none;
}
.input-row input:focus { border-color: #fb923c; }
.input-row button.go {
  min-height: 64px;
  min-width: 140px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 0 #c2410c;
}
.input-row button.go:active { transform: translateY(3px); box-shadow: 0 5px 0 #c2410c; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  border: 0;
  background: #fff7ed;
  color: #9a3412;
  font: inherit;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.speed {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.speed span.label { font-weight: 800; color: var(--muted); }
.speed button {
  border: 2px solid #e5e7eb;
  background: #fff;
  font: inherit;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.speed button.active {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1e3a8a;
}

.status {
  margin-top: 12px;
  min-height: 1.4em;
  font-weight: 800;
  color: #0369a1;
}

.cards { display: grid; gap: 12px; }
.lang-card {
  background: #fff;
  border-radius: 20px;
  padding: 16px 16px 16px 18px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 12px;
  align-items: center;
  border-left: 10px solid #ddd;
}
.lang-card.empty { opacity: 0.7; }
.lang-name {
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.lang-text {
  grid-column: 1;
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1.25;
  word-break: break-word;
}
.speak {
  grid-row: 1 / span 2;
  grid-column: 2;
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 6px 0 #020617;
}
.speak:active { transform: translateY(3px); box-shadow: 0 3px 0 #020617; }
.speak:disabled {
  background: #d1d5db;
  color: #6b7280;
  box-shadow: none;
  cursor: not-allowed;
}
.placeholder { color: #9ca3af; font-size: 1.2rem; font-weight: 800; }

.history-list { display: grid; gap: 8px; }
.hist-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  font-weight: 800;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.hist-item small { display: block; color: var(--muted); font-weight: 700; }
.wotd-word {
  font-size: 2rem;
  font-weight: 900;
  margin: 4px 0 8px;
}
.star-btn {
  margin-top: 12px;
  border: 0;
  background: #fef3c7;
  color: #92400e;
  font: inherit;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
}
.star-btn.on { background: #fde68a; }
#act-play,
button#act-play,
.listen-play {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: none;
  margin: 12px auto 16px;
  min-width: 280px;
  min-height: 68px;
  padding: 14px 28px;
  border: 0 !important;
  border-radius: 18px !important;
  background: #f97316 !important;
  background-image: linear-gradient(135deg, #f97316, #ef4444) !important;
  color: #fff !important;
  font-family: inherit !important;
  font-size: 1.25rem !important;
  font-weight: 900 !important;
  cursor: pointer;
  box-shadow: 0 8px 0 #c2410c;
}
#act-play.show,
button#act-play.show,
.listen-play.show {
  display: inline-block !important;
}
.act-modes { margin-bottom: 14px; }
.ghost {
  margin-top: 12px;
  border: 0;
  background: #fee2e2;
  color: #991b1b;
  font: inherit;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
}

.activity-card { text-align: center; }
.shown-word {
  font-size: 2.2rem;
  font-weight: 900;
  margin: 10px 0 18px;
}
.choices { display: grid; gap: 10px; }
.choice {
  border: 3px solid #e5e7eb;
  background: #fff;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  padding: 14px;
  border-radius: 16px;
  cursor: pointer;
}
.choice.right { border-color: #10b981; background: #d1fae5; }
.choice.wrong { border-color: #ef4444; background: #fee2e2; }
.next-btn {
  margin-top: 16px;
  border: 0;
  background: #2563eb;
  color: #fff;
  font: inherit;
  font-weight: 900;
  padding: 12px 18px;
  border-radius: 14px;
  cursor: pointer;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.tile {
  background: #fff;
  border: 0;
  border-radius: 22px;
  padding: 22px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  font: inherit;
}
.tile .emoji { font-size: 2.2rem; }
.tile h3 { margin: 8px 0 4px; font-size: 1.3rem; }
.tile p { margin: 0; color: var(--muted); font-weight: 700; }

.lang-switch-label {
  margin: 0 0 8px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
}
.sound-lang {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 16px;
}
.sound-lang button {
  border: 3px solid #fed7aa;
  background: #fff;
  color: #1f2937;
  font: inherit;
  font-weight: 900;
  font-size: 1.05rem;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 16px;
  cursor: pointer;
}
.sound-lang button.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
}
.sound-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.sound-tabs button {
  border: 2px solid #e5e7eb;
  background: #fff;
  font: inherit;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.sound-tabs button.active {
  border-color: #7c3aed;
  background: #ede9fe;
  color: #5b21b6;
}
.ph-group { margin-bottom: 14px; }
.ph-group h3 { margin: 0 0 4px; font-size: 1.25rem; }
.ph-group .hint { margin: 0 0 10px; color: var(--muted); font-weight: 700; }
.ph-row {
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 10px;
}
.ph-chunk {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 8px;
}
.ph-chunk small {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 800;
  margin-left: 8px;
  text-transform: uppercase;
}
.ph-words { display: flex; flex-wrap: wrap; gap: 8px; }
.ph-word {
  border: 0;
  background: #f5f3ff;
  color: #1f2937;
  font: inherit;
  font-weight: 800;
  font-size: 1.15rem;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.ph-word:active { background: #ddd6fe; }

.footer-note {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  margin-top: 10px;
}

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .nav { justify-content: center; border-radius: 22px; }
  .lang-text { font-size: 1.4rem; }
  .speak { width: 58px; height: 58px; }
}
