:root {
  color-scheme: light;
  --bg: #f6f3ff;
  --ink: #1d1831;
  --muted: #7b738f;
  --primary: #6b4eff;
  --primary-dark: #5335ec;
  --card: rgba(255, 255, 255, 0.88);
  --line: rgba(82, 65, 143, 0.14);
  --danger: #ff5f73;
  --ok: #18b77b;
  --shadow: 0 22px 60px rgba(61, 42, 130, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 192, 203, 0.55), transparent 34rem),
    radial-gradient(circle at top right, rgba(107, 78, 255, 0.22), transparent 28rem),
    linear-gradient(180deg, #fbfaff 0%, var(--bg) 100%);
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(22px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.03em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 31px;
  letter-spacing: -0.04em;
}

.ghost-btn {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--primary);
  background: rgba(255, 255, 255, 0.62);
}

.hero {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.streak-card {
  display: grid;
  gap: 2px;
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  text-align: center;
  color: var(--muted);
  background: var(--card);
  box-shadow: 0 8px 30px rgba(64, 46, 124, 0.08);
}

.big-number {
  color: var(--ink);
  font-size: 25px;
  font-weight: 800;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 6px;
  margin-bottom: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
}

.tab {
  padding: 11px 6px;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
}

.tab.active {
  color: white;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(107, 78, 255, 0.28);
}

.word-card,
.list-panel {
  border: 1px solid var(--line);
  border-radius: 34px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.word-card {
  padding: 20px;
}

.scene {
  display: grid;
  place-items: center;
  height: 210px;
  margin-bottom: 18px;
  border-radius: 28px;
  font-size: 84px;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.85), transparent 9rem),
    linear-gradient(135deg, #f9d5e5 0%, #d8c7ff 52%, #b9e7ff 100%);
}

.lesson-pill {
  display: inline-flex;
  margin: 0 0 12px;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--primary);
  background: rgba(107, 78, 255, 0.1);
  font-size: 13px;
  font-weight: 800;
}

.word-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.spell-card {
  display: grid;
  gap: 15px;
}

.spell-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.prompt-box {
  padding: 18px;
  border: 1px solid rgba(107, 78, 255, 0.15);
  border-radius: 24px;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.9), transparent 8rem),
    linear-gradient(135deg, rgba(255, 183, 213, 0.35), rgba(142, 116, 255, 0.16));
}

.prompt-box h2 {
  margin: 8px 0 8px;
  font-size: 25px;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.spell-input {
  width: 100%;
  min-height: 58px;
  padding: 0 16px;
  border: 2px solid rgba(107, 78, 255, 0.22);
  border-radius: 18px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  font: inherit;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.spell-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 5px rgba(107, 78, 255, 0.12);
}

.spell-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 34px;
}

.slot {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 32px;
  padding: 0 4px;
  border-bottom: 3px solid rgba(107, 78, 255, 0.24);
  color: var(--ink);
  font-weight: 900;
}

.space-slot {
  border-bottom-color: transparent;
  color: var(--muted);
}

.slot-filled {
  border-bottom-color: var(--ok);
}

.slot-wrong {
  border-bottom-color: var(--danger);
  color: var(--danger);
}

.spell-feedback {
  min-height: 44px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
  line-height: 1.45;
}

.spell-feedback.success {
  color: #08734d;
  background: rgba(24, 183, 123, 0.12);
}

.spell-feedback.warn {
  color: #8a5b00;
  background: rgba(255, 186, 73, 0.18);
}

.spell-feedback.error {
  color: #9d2334;
  background: rgba(255, 95, 115, 0.13);
}

#wordText {
  margin: 2px 0 2px;
  font-size: 46px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.pronunciation {
  margin-bottom: 0;
  color: var(--muted);
}

.sound-btn {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  font-size: 24px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(73, 51, 142, 0.1);
}

.memory {
  margin: 18px 0;
  padding: 14px 15px;
  border-left: 4px solid var(--primary);
  border-radius: 16px;
  line-height: 1.55;
  background: rgba(107, 78, 255, 0.08);
}

.answer-box {
  overflow: hidden;
  max-height: 220px;
  margin-bottom: 16px;
  padding: 15px;
  border: 1px solid rgba(107, 78, 255, 0.15);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  transition: 240ms ease;
}

.answer-box.locked {
  max-height: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  opacity: 0;
}

.meaning {
  margin: 6px 0 10px;
  font-size: 22px;
  font-weight: 800;
}

.example {
  margin-bottom: 4px;
  font-weight: 700;
}

.translation {
  margin-bottom: 0;
  color: var(--muted);
}

.primary-btn,
.danger-btn,
.ok-btn,
.ghost-wide-btn,
.danger-outline-btn {
  width: 100%;
  min-height: 52px;
  border-radius: 18px;
  font-weight: 800;
}

.primary-btn,
.danger-btn,
.ok-btn {
  color: white;
}

.primary-btn {
  margin-top: 16px;
  background: var(--primary);
}

.spell-actions {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 10px;
}

.spell-actions .primary-btn {
  margin-top: 0;
}

.ghost-wide-btn {
  color: var(--primary);
  border: 1px solid rgba(107, 78, 255, 0.22);
  background: rgba(255, 255, 255, 0.72);
}

.danger-outline-btn {
  color: var(--danger);
  border: 1px solid rgba(255, 95, 115, 0.28);
  background: rgba(255, 255, 255, 0.72);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.danger-btn {
  background: var(--danger);
}

.ok-btn {
  background: var(--ok);
}

.list-panel {
  padding: 18px;
}

.section-title h2 {
  margin-bottom: 6px;
}

.section-title p {
  color: var(--muted);
  line-height: 1.5;
}

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

.word-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.64);
}

.word-item .emoji {
  font-size: 28px;
}

.word-item strong {
  display: block;
}

.word-item small {
  color: var(--muted);
}

.badge {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--primary);
  background: rgba(107, 78, 255, 0.1);
  font-size: 12px;
  font-weight: 800;
}

.hidden {
  display: none;
}

@media (max-width: 380px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  #wordText {
    font-size: 38px;
  }

  .scene {
    height: 180px;
  }
}
