html {
  font-size: 125%;
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: #f4f7fb;
  font-family: Arial, sans-serif;
  color: #222;
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select {
  touch-action: manipulation;
}

.lesson-page {
  padding: 2rem 1rem;
}

.lesson-card {
  width: 100%;
  max-width: 820px;
  margin: auto;
  background: white;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  animation: fadeIn 0.35s ease;
}

.eyebrow {
  color: #4f46e5;
  font-size: 0.8rem;
  font-weight: bold;
  margin: 0 0 0.5rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2rem, 6vw, 2.9rem);
  line-height: 1.1;
  margin: 0;
  color: #111827;
}

h2,
h3 {
  margin-top: 0;
  line-height: 1.25;
  color: #111827;
}

p {
  max-width: 70ch;
}

.lesson-subtitle {
  font-size: 1rem;
  line-height: 1.7;
  color: #555;
  margin-top: 0.8rem;
}

.home-link {
  display: inline-block;
  margin-top: 1rem;
  text-decoration: none;
  font-weight: bold;
  color: #4f46e5;
}

.home-link:hover,
.home-link:focus {
  text-decoration: underline;
}

.assessment-box,
.placement-box {
  margin-top: 1.4rem;
  background: linear-gradient(180deg, #f8fafc, #eefcff);
  border: 1px solid #cfeff5;
  padding: 1.25rem;
  border-radius: 1rem;
}

.assessment-box p,
.placement-box p {
  color: #555;
  line-height: 1.7;
}

.assessment-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.assessment-label,
.assessment-step-label {
  display: inline-block;
  margin: 0 0 0.45rem;
  padding: 0.25rem 0.55rem;
  background: #dff7fb;
  color: #0f7f92;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.assessment-intro,
.assessment-test,
.assessment-result {
  margin-top: 1rem;
  background: white;
  border: 1px solid #dbeafe;
  padding: 1rem;
  border-radius: 0.85rem;
}

.assessment-test h3,
.assessment-result h3 {
  margin-bottom: 0.6rem;
}

.assessment-story {
  font-size: 1.05rem;
  line-height: 1.85;
  background: #fafafa;
  border-left: 0.35rem solid #1597ad;
  padding: 1rem;
  border-radius: 0.75rem;
}

.assessment-questions {
  margin-top: 1.1rem;
}

.assessment-result {
  border-left: 0.35rem solid #22c55e;
  background: #f0fdf4;
}

.assessment-result p {
  color: #166534;
}

.placement-complete {
  background: #f8fafc;
  border-color: #d1d5db;
}

.manual-levels {
  margin-top: 1rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.8rem;
  padding: 0.9rem;
}

.manual-levels summary {
  cursor: pointer;
  font-weight: bold;
  color: #4f46e5;
}

.primary-action {
  width: 100%;
  background: #1597ad;
  color: white;
  border: none;
  padding: 0.95rem 1rem;
  border-radius: 0.75rem;
  font-weight: bold;
  cursor: pointer;
}

.primary-action:hover,
.primary-action:focus {
  background: #0f7f92;
}

.placement-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-top: 1rem;
}

.placement-buttons button {
  background: #1597ad;
  color: white;
  border: none;
  padding: 0.85rem 0.6rem;
  border-radius: 0.7rem;
  font-weight: bold;
  cursor: pointer;
  min-height: 4.3rem;
}

.placement-buttons button:hover,
.placement-buttons button:focus {
  background: #0f7f92;
}

.placement-buttons span {
  display: block;
  font-size: 0.7rem;
  font-weight: normal;
  margin-top: 0.25rem;
}

.lesson-status {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.5rem;
  background: #eef2ff;
  padding: 0.9rem;
  border-radius: 0.7rem;
}

.lesson-status p {
  margin: 0;
  font-weight: bold;
}

.progress-wrap {
  margin-top: 1.2rem;
  background: #f8fafc;
  padding: 1rem;
  border-radius: 0.8rem;
  border: 1px solid #e5e7eb;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.progress-track {
  height: 0.9rem;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #1597ad, #06b6d4);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.achievement-wrap {
  margin-top: 1.2rem;
}

.achievement-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  background: linear-gradient(135deg, #f0fdf4, #ecfeff);
  border: 1px solid #bbf7d0;
  border-left: 0.35rem solid #22c55e;
  padding: 1rem;
  border-radius: 0.9rem;
}

.achievement-label {
  margin: 0 0 0.3rem;
  color: #15803d;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.achievement-card h2 {
  margin-bottom: 0.35rem;
}

.achievement-card p {
  margin-top: 0;
}

.achievement-progress {
  min-width: 4.5rem;
  height: 4.5rem;
  display: grid;
  place-items: center;
  background: white;
  border: 0.15rem solid #86efac;
  border-radius: 999px;
  font-weight: bold;
  color: #166534;
  text-align: center;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.badge-card {
  min-height: 5.5rem;
  display: grid;
  gap: 0.3rem;
  place-items: center;
  text-align: center;
  background: white;
  border: 1px solid #e5e7eb;
  padding: 0.75rem 0.45rem;
  border-radius: 0.8rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.badge-card span {
  font-size: 1.6rem;
  line-height: 1;
}

.badge-card p {
  margin: 0;
  font-size: 0.8rem;
  font-weight: bold;
  color: #334155;
}

.unlocked-badge {
  border-color: #86efac;
  background: #f0fdf4;
  box-shadow: 0 3px 12px rgba(34, 197, 94, 0.15);
}

.unlocked-badge:hover {
  transform: translateY(-2px);
}

.locked-badge {
  opacity: 0.45;
  filter: grayscale(1);
}

.level-wrap {
  margin-top: 1.2rem;
}

.level-card {
  background: #f0f9ff;
  border-left: 0.35rem solid #1597ad;
  padding: 1rem;
  border-radius: 0.8rem;
}

.level-label {
  display: block;
  color: #0369a1;
  font-size: 0.8rem;
  font-weight: bold;
  margin-bottom: 0.4rem;
}

.level-card h2 {
  margin-bottom: 0.4rem;
}

.level-card p {
  margin: 0;
  line-height: 1.7;
  color: #444;
}

.day-picker {
  margin-top: 1.25rem;
}

.day-picker label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.day-picker select {
  width: 100%;
  padding: 0.8rem;
  border-radius: 0.6rem;
  border: 1px solid #cbd5e1;
  background: white;
  color: #111827;
}

.day-picker select:focus,
.question-block input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.coach-box {
  margin-top: 1.8rem;
  background: #ecfeff;
  border-left: 0.35rem solid #06b6d4;
  padding: 1.1rem 1rem;
  border-radius: 0.8rem;
}

.story-box {
  margin-top: 1.8rem;
  background: #fafafa;
  padding: 1.4rem;
  border-radius: 0.8rem;
}

.story-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.story-level {
  display: inline-block;
  margin: 0;
  background: #eef2ff;
  color: #3730a3;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: bold;
}

.story-title {
  font-weight: bold;
  font-size: 1.2rem;
  margin-bottom: 0.9rem;
  color: #111827;
}

#storyText {
  font-size: 1.1rem;
  line-height: 2;
}

.story-word {
  cursor: pointer;
  border-radius: 3px;
  padding: 0 1px;
  transition: background 0.12s, color 0.12s;
  -webkit-tap-highlight-color: transparent;
  display: inline;
}

.story-word:hover {
  background: #bfdbfe;
}

.story-word:active {
  background: #93c5fd;
  color: #1e3a5f;
}

.small-btn {
  margin-top: 1rem;
  background: #4f46e5;
  color: white;
  border: none;
  padding: 0.8rem 1.1rem;
  border-radius: 0.6rem;
  cursor: pointer;
  font-weight: bold;
  min-height: 3rem;
}

.small-btn:hover,
.small-btn:focus {
  background: #4338ca;
}

.vocab-box {
  margin-top: 1.8rem;
  background: #fefce8;
  border-left: 0.35rem solid #eab308;
  padding: 1.1rem 1rem;
  border-radius: 0.8rem;
}

#vocabList {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.vocab-pill {
  background: white;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  font-weight: bold;
  border: 1px solid #fde68a;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  -webkit-tap-highlight-color: transparent;
  min-height: 2.6rem;
  display: inline-flex;
  align-items: center;
}

.vocab-pill:hover {
  background: #fef9c3;
  border-color: #f59e0b;
}

.vocab-pill:active {
  background: #fde68a;
  border-color: #d97706;
}

.questions-box {
  margin-top: 1.8rem;
  margin-bottom: 0.5rem;
}

.question-block {
  margin-bottom: 1.5rem;
}

.question-block label {
  display: block;
  margin-bottom: 0.6rem;
  font-weight: bold;
  line-height: 1.5;
}

.question-block input {
  width: 100%;
  padding: 0.9rem;
  border-radius: 0.6rem;
  border: 1px solid #cbd5e1;
  background: white;
  color: #111827;
  min-height: 3rem;
}

.correct-answer {
  border-color: #16a34a !important;
  background: #f0fdf4;
}

.wrong-answer {
  border-color: #dc2626 !important;
  background: #fef2f2;
}

.answer-feedback {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  font-weight: bold;
  color: #555;
}

.complete-card {
  margin-top: 1.4rem;
  background: #f0fdf4;
  border-left: 0.35rem solid #22c55e;
  padding: 1.1rem;
  border-radius: 0.8rem;
  text-align: center;
  animation: softPop 0.35s ease;
}

.complete-card h2 {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

.complete-card p {
  font-size: 1rem;
  color: #166534;
  margin-left: auto;
  margin-right: auto;
}

.hidden {
  display: none !important;
}

.helper-tip {
  margin-top: 1.8rem;
  background: #fff7ed;
  border-left: 0.35rem solid #f97316;
  padding: 1rem;
  border-radius: 0.8rem;
}

.coach-box p,
.helper-tip p,
.story-box p {
  line-height: 1.8;
}

.button-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.button-row button {
  flex: 1;
  min-width: 9rem;
  min-height: 3.2rem;
  background: #4f46e5;
  color: white;
  border: none;
  padding: 0.95rem 1rem;
  border-radius: 0.7rem;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
}

.button-row button:hover,
.button-row button:focus {
  background: #4338ca;
}

.disabled-btn,
.button-row button:disabled {
  background: #cbd5e1;
  color: #64748b;
  cursor: not-allowed;
}

.danger-row button {
  background: #ef4444;
}

.danger-row button:hover,
.danger-row button:focus {
  background: #dc2626;
}

.result-message {
  margin-top: 1.4rem;
  font-size: 1rem;
  font-weight: bold;
  line-height: 1.6;
}

/* Homepage styles */

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
}

.hero {
  text-align: center;
  padding: 3.5rem 1rem;
}

.logo {
  font-size: clamp(1.8rem, 5vw, 2.2rem);
  font-weight: bold;
  margin-bottom: 0.7rem;
  color: #1597ad;
}

.subtitle {
  font-size: 1rem;
  line-height: 1.8;
  max-width: 700px;
  margin: 1rem auto;
  color: #555;
}

.start-button {
  display: inline-block;
  margin-top: 1.2rem;
  background: #1597ad;
  color: white;
  padding: 0.85rem 1.4rem;
  border-radius: 0.7rem;
  text-decoration: none;
  font-size: 1rem;
  font-weight: bold;
}

.start-button:hover,
.start-button:focus {
  background: #0f7f92;
}

.small-note {
  margin-top: 0.8rem;
  color: #666;
  font-size: 0.8rem;
}

.feature-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 1.2rem;
}

.feature-list p {
  background: #f5f7fb;
  padding: 0.9rem;
  border-radius: 0.7rem;
  margin: 0;
}

.bubbles-card {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  margin-top: 2rem;
  background: #ecfeff;
  padding: 1.4rem;
  border-radius: 1rem;
}

.bubbles-face {
  font-size: 3rem;
  line-height: 1;
}

.status-card {
  margin-top: 2rem;
  background: white;
  padding: 1.6rem;
  border-radius: 1rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

.questions {
  margin-top: 2rem;
}

.app-footer {
  text-align: center;
  margin-top: 3rem;
  padding: 1.5rem 1rem;
  color: #666;
  font-size: 0.8rem;
}

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

@keyframes softPop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 768px) {
  html { font-size: 115%; }

  .lesson-page { padding: 1rem 0.5rem; }

  .lesson-card { padding: 1.3rem 1rem; border-radius: 0.9rem; }

  .assessment-header,
  .lesson-status,
  .story-header,
  .achievement-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .achievement-progress {
    width: 100%;
    height: auto;
    min-height: 3rem;
    border-radius: 0.7rem;
  }

  .placement-buttons,
  .badge-grid { grid-template-columns: 1fr; }

  .button-row { flex-direction: column; gap: 0.7rem; }

  .button-row button {
    width: 100%;
    min-width: 0;
    min-height: 3.4rem;
    font-size: 1.05rem;
    padding: 1rem;
  }

  #storyText { font-size: 1.15rem; line-height: 2.1; }

  .vocab-pill {
    font-size: 1rem;
    padding: 0.6rem 1rem;
    min-height: 2.8rem;
  }

  .question-block input {
    min-height: 3.2rem;
    font-size: 1rem;
    padding: 0.9rem;
  }

  .coach-box,
  .story-box,
  .vocab-box,
  .questions-box,
  .helper-tip { margin-top: 1.5rem; }

  .hero { padding: 2.5rem 0.5rem; }

  .bubbles-card { flex-direction: column; text-align: center; }

  .start-button { width: 100%; }
}

@media (max-width: 420px) {
  html { font-size: 108%; }

  .lesson-card,
  .status-card,
  .bubbles-card,
  .assessment-box,
  .achievement-card { padding: 1rem; }

  .progress-label { flex-direction: column; gap: 0.2rem; }

  #storyText { font-size: 1.1rem; line-height: 2; }
}
