:root {
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --paper: #0f172a;
  --card: #1e293b;
  --line: #334155;
  --brand: #6366f1;
  --brand-2: #4f46e5;
  --accent: #f59e0b;
  --gold: #d4af37;
  --ok: #22c55e;
  --h1: #ffffff;
  --h2: #f1f5f9;
  --context: #cbd5e1;
  --disclaimer: #94a3b8;
  --btn-bg: #111c31;
  --btn-text: #f1f5f9;
  --voice-bg: #172336;
  --chip-bg: #1a2740;
  --item-bg: #142033;
  --badge-bg: rgba(99, 102, 241, 0.18);
  --badge-text: #c7d2fe;
  --goal-text: #dbe4f1;
  --en-text: #dbe4f1;
  --bg-gradient:
    radial-gradient(circle at 10% 15%, rgba(99, 102, 241, 0.16), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(245, 158, 11, 0.12), transparent 30%),
    linear-gradient(160deg, #0f172a 0%, #1e1b4b 45%, #312e81 100%);
  --shadow: 0 14px 36px rgba(2, 8, 23, 0.38);
}

body[data-theme='light'] {
  --ink: #0f172a;
  --muted: #64748b;
  --paper: #f1f5f9;
  --card: #ffffff;
  --line: #e2e8f0;
  --brand: #6366f1;
  --brand-2: #4f46e5;
  --accent: #f59e0b;
  --gold: #d4af37;
  --ok: #22c55e;
  --h1: #0f172a;
  --h2: #1e293b;
  --context: #334155;
  --disclaimer: #64748b;
  --btn-bg: #f8fafc;
  --btn-text: #1e293b;
  --voice-bg: #f8fafc;
  --chip-bg: #f1f5f9;
  --item-bg: #ffffff;
  --badge-bg: rgba(99, 102, 241, 0.1);
  --badge-text: #4338ca;
  --goal-text: #334155;
  --en-text: #334155;
  --bg-gradient:
    radial-gradient(circle at 10% 15%, rgba(99, 102, 241, 0.1), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(245, 158, 11, 0.1), transparent 30%),
    linear-gradient(160deg, #ffffff 0%, #f8fafc 45%, #f1f5f9 100%);
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg-gradient);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
}

.bg-shape-1 {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(63, 123, 255, 0.2) 0%, rgba(63, 123, 255, 0) 70%);
  top: -120px;
  right: -120px;
}

.bg-shape-2 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(255, 96, 118, 0.2) 0%, rgba(255, 96, 118, 0) 70%);
  bottom: -150px;
  left: -120px;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1100px, 92vw);
  margin: 26px auto 40px;
  display: grid;
  gap: 16px;
}

.hero,
.mode-panel,
.levels-panel,
.content-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
}

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

.theme-btn {
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--btn-bg);
  color: var(--btn-text);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.theme-btn:hover {
  transform: translateY(-1px);
  border-color: var(--brand);
}

.logo {
  width: 62px;
  height: 62px;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  color: var(--h1);
}

.subtitle {
  margin: 3px 0 0;
  font-weight: 700;
  color: var(--muted);
}

.tagline {
  margin: 10px 0 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--gold);
}

.context-line {
  margin: 8px 0 0;
  font-weight: 700;
  color: var(--context);
}

.disclaimer {
  margin: 8px 0 0;
  color: var(--disclaimer);
  font-size: 0.9rem;
}

h2 {
  margin: 0 0 10px;
  color: var(--h2);
}

.mode-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-btn {
  border: 1px solid var(--line);
  background: var(--btn-bg);
  color: var(--btn-text);
  padding: 9px 12px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.mode-btn:hover {
  transform: translateY(-1px);
  border-color: #3a5f9a;
}

.mode-btn.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  border-color: var(--brand);
}

.mode-description {
  margin: 10px 0 0;
  font-weight: 600;
  color: var(--muted);
}

.sound-row {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px dashed rgba(99, 102, 241, 0.4);
}

.play-hint {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px dashed rgba(99, 102, 241, 0.4);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
}

.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 8px;
}

.level-btn {
  border: 1px solid var(--line);
  background: var(--voice-bg);
  border-radius: 10px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}

.level-btn.active {
  border-color: var(--brand);
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #f4f8ff;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.28);
}

.level-btn.active .level-num {
  color: #c4d8ff;
}

.level-btn.active .level-name {
  color: #ffffff;
}

.level-num {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.level-name {
  display: block;
  margin-top: 2px;
  font-weight: 800;
}

.content-header {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.lesson-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.78rem;
  font-weight: 800;
}

.lesson-goal {
  margin: 8px 0 12px;
  font-weight: 600;
  color: var(--goal-text);
}

.category-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.category-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--chip-bg);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

h3 {
  margin: 0 0 8px;
}

.phrases-list,
.dialog-list {
  display: grid;
  gap: 8px;
}

.phrase-card,
.dialog-line {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--item-bg);
  padding: 10px;
}

.phrase-head,
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.play-btn {
  border: 1px solid var(--brand);
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  color: #ffffff;
  font-weight: 700;
  border-radius: 8px;
  padding: 5px 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.de {
  display: block;
  font-weight: 800;
  color: var(--brand);
}

.en {
  display: block;
  margin-top: 4px;
  color: var(--en-text);
}

.pron {
  display: block;
  margin-top: 4px;
  color: #90a5c8;
  font-size: 0.87rem;
}

.speaker {
  font-weight: 800;
  color: var(--ok);
}

@media (max-width: 700px) {
  .app-shell {
    width: 94vw;
  }

  .theme-btn {
    margin-left: 0;
  }
}
