:root {
  --bg: #fff8ee;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: #ffffff;
  --ink: #163246;
  --muted: #587287;
  --accent: #ff7f50;
  --accent-strong: #ff5c2b;
  --sky: #5bc0eb;
  --mint: #71d6c1;
  --sun: #ffd166;
  --line: rgba(22, 50, 70, 0.12);
  --success: #2a9d8f;
  --danger: #d1495b;
  --shadow: 0 20px 60px rgba(22, 50, 70, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 209, 102, 0.65), transparent 25%),
    radial-gradient(circle at top right, rgba(91, 192, 235, 0.35), transparent 22%),
    linear-gradient(180deg, #fff4db 0%, #fffdf7 100%);
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 28px 22px 28px 28px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(16px);
}

.brand h1,
.hero h2,
.panel h3 {
  margin: 0;
  font-family: "Baloo 2", cursive;
  letter-spacing: 0.02em;
}

.brand-copy,
.hero-subtitle,
.rule-copy,
.quiz-prompt,
.feedback {
  color: var(--muted);
}

.eyebrow,
.card-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--accent-strong);
}

.progress-card,
.panel,
.hero-panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.progress-card {
  margin: 22px 0;
  padding: 18px;
}

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

.progress-stats span {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
}

.progress-stats small {
  color: var(--muted);
}

.wide-button,
.primary-button,
.secondary-button,
.ghost-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.wide-button {
  display: block;
  width: 100%;
}

.progress-card .wide-button + .wide-button {
  margin-top: 12px;
}

.wide-button,
.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 22px rgba(255, 92, 43, 0.26);
}

.secondary-button {
  color: var(--ink);
  background: rgba(91, 192, 235, 0.18);
}

.ghost-button {
  color: var(--ink);
  background: rgba(22, 50, 70, 0.06);
}

button:hover {
  transform: translateY(-1px);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 800;
}

.lesson-menu {
  display: grid;
  gap: 12px;
}

.lesson-button {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 22px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.7);
}

.lesson-button.active {
  border-color: rgba(255, 92, 43, 0.2);
  background: linear-gradient(135deg, rgba(255, 127, 80, 0.18), rgba(113, 214, 193, 0.25));
}

.lesson-button.complete {
  border-color: rgba(42, 157, 143, 0.22);
  background: linear-gradient(135deg, rgba(111, 214, 165, 0.22), rgba(236, 255, 244, 0.94));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.lesson-button.complete.active {
  border-color: rgba(42, 157, 143, 0.28);
  background: linear-gradient(135deg, rgba(111, 214, 165, 0.3), rgba(224, 255, 239, 0.98));
}

.lesson-button strong {
  display: block;
  margin-bottom: 4px;
}

.lesson-button small {
  display: block;
  color: var(--muted);
}

.lesson-meter {
  margin-top: 10px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(22, 50, 70, 0.08);
}

.lesson-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sun), var(--accent));
}

.main-panel {
  padding: 28px;
}

.home-view {
  display: grid;
  gap: 20px;
}

.home-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.home-copy,
.home-map-card,
.home-lessons-panel {
  padding: 24px;
}

.home-copy h2 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  line-height: 0.96;
  font-family: "Baloo 2", cursive;
}

.world-map-shell {
  width: 100%;
}

.world-map {
  width: 100%;
  height: auto;
  display: block;
}

.world-map.compact {
  min-height: 150px;
}

.map-route {
  fill: none;
  stroke: rgba(22, 50, 70, 0.12);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 10 14;
}

.map-region {
  fill: rgba(255, 255, 255, 0.92);
  stroke: rgba(22, 50, 70, 0.12);
  stroke-width: 3;
  filter: url(#softShadow);
  transition: fill 180ms ease, stroke 180ms ease, transform 180ms ease;
  cursor: pointer;
}

.map-node:hover .map-region {
  transform: translateY(-2px);
  stroke: rgba(255, 92, 43, 0.28);
}

.map-region.complete {
  fill: rgba(111, 214, 165, 0.78);
  stroke: rgba(42, 157, 143, 0.45);
}

.map-region.current,
.map-region.focus {
  fill: rgba(255, 209, 102, 0.96);
  stroke: rgba(255, 92, 43, 0.42);
}

.map-label {
  font-family: "Baloo 2", cursive;
  font-size: 16px;
  fill: rgba(22, 50, 70, 0.68);
  pointer-events: none;
}

.world-map.compact .map-label {
  display: none;
}

.home-lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.home-lesson-card {
  border: 1px solid rgba(22, 50, 70, 0.08);
  border-radius: 28px;
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 209, 102, 0.26), transparent 26%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(255, 248, 234, 0.96));
  padding: 18px;
  text-align: left;
  box-shadow: var(--shadow);
}

.home-lesson-card.current {
  border-color: rgba(255, 92, 43, 0.18);
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 209, 102, 0.32), transparent 26%),
    linear-gradient(150deg, rgba(255, 255, 255, 0.98), rgba(255, 239, 224, 0.98));
}

.home-lesson-card.complete {
  border-color: rgba(42, 157, 143, 0.2);
  background:
    radial-gradient(circle at 84% 18%, rgba(111, 214, 165, 0.22), transparent 24%),
    linear-gradient(150deg, rgba(246, 255, 251, 0.98), rgba(236, 255, 245, 0.98));
}

.home-lesson-map {
  margin-bottom: 14px;
  padding: 8px;
  border-radius: 22px;
  background: rgba(91, 192, 235, 0.08);
}

.home-lesson-map .map-region {
  cursor: default;
}

.home-lesson-map .map-node:hover .map-region {
  transform: none;
}

.home-lesson-copy h3 {
  margin: 0;
  font-size: 1.4rem;
}

.home-lesson-copy p {
  margin: 8px 0 0;
  color: var(--muted);
}

.home-lesson-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  font-size: 0.95rem;
  font-weight: 800;
}

.hero {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr;
  gap: 20px;
  margin-bottom: 20px;
}

.hero-copy,
.hero-panel {
  padding: 26px;
}

.hero-copy {
  position: relative;
  overflow: hidden;
  border-radius: 30px;
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 209, 102, 0.75), transparent 20%),
    radial-gradient(circle at 78% 72%, rgba(113, 214, 193, 0.55), transparent 16%),
    linear-gradient(135deg, #ffffff 0%, #fff6e8 100%);
  box-shadow: var(--shadow);
}

.hero-copy h2 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.95;
}

.hero-actions,
.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.mode-tabs {
  display: inline-flex;
  gap: 10px;
  margin: 4px 0 18px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
}

.tab-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  background: transparent;
  cursor: pointer;
}

.tab-button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--sky), #2f89c5);
}

.rule-copy {
  min-height: 84px;
  line-height: 1.55;
}

.audio-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.34);
  font-weight: 800;
}

.badge-alt {
  background: rgba(91, 192, 235, 0.18);
}

.content-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  align-items: start;
}

.hidden {
  display: none;
}

.panel {
  padding: 22px;
}

.learn-panel {
  grid-column: 1 / -1;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

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

.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.word-card {
  position: relative;
  padding: 16px;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.word-card h4 {
  margin: 0;
  font-size: 1.28rem;
}

.word-sentence {
  margin: 10px 0 0;
  line-height: 1.5;
  color: var(--muted);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.card-actions button {
  flex: 1 1 100px;
}

.learn-input {
  width: 100%;
  margin-top: 12px;
  padding-right: 42px;
}

.learn-input-row {
  position: relative;
}

.learn-input.correct {
  border-color: rgba(42, 157, 143, 0.9);
  box-shadow: inset 0 0 0 2px rgba(42, 157, 143, 0.18);
}

.learn-input.incorrect {
  border-color: rgba(209, 73, 91, 0.9);
  box-shadow: inset 0 0 0 2px rgba(209, 73, 91, 0.14);
}

.learn-check {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  font-size: 1rem;
  font-weight: 800;
  color: var(--success);
  opacity: 0;
  pointer-events: none;
}

.learn-check.visible {
  opacity: 1;
}

.quiz-panel {
  display: grid;
  gap: 0;
}

.test-grid,
.test-sections {
  display: grid;
  gap: 20px;
}

.test-card {
  padding: 22px;
}

.test-card.complete {
  background:
    linear-gradient(140deg, rgba(111, 214, 165, 0.28), rgba(234, 255, 244, 0.92)),
    var(--panel);
  border-color: rgba(42, 157, 143, 0.28);
  box-shadow:
    0 22px 44px rgba(42, 157, 143, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.test-sections {
  grid-template-columns: 1fr;
}

.score-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(91, 192, 235, 0.16);
  font-weight: 800;
}

.quiz-box {
  display: grid;
  gap: 16px;
}

.quiz-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input {
  width: 100%;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

input:focus {
  outline: 3px solid rgba(91, 192, 235, 0.2);
  border-color: rgba(91, 192, 235, 0.7);
}

.feedback {
  min-height: 24px;
  margin: 0;
  font-weight: 700;
}

.feedback.good {
  color: var(--success);
}

.feedback.bad {
  color: var(--danger);
}

.feedback-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 1100px) {
  .app-shell,
  .home-hero,
  .hero,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .test-grid,
  .test-sections {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main-panel,
  .sidebar {
    padding: 18px;
  }

  .home-copy,
  .home-map-card,
  .panel,
  .hero-copy,
  .hero-panel,
  .progress-card {
    padding: 18px;
  }

  .quiz-form {
    grid-template-columns: 1fr;
  }
}
