:root {
  color-scheme: light;
  --paper: #f8f4ea;
  --ink: #1f2320;
  --muted: #6e746d;
  --line: #d8d1c2;
  --card: #fffaf0;
  --forest: #1f5b4b;
  --forest-2: #2f7b66;
  --lake: #3066a3;
  --berry: #b3435d;
  --sun: #f0b84a;
  --shadow: 0 14px 40px rgba(30, 38, 34, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(48, 102, 163, 0.08), transparent 34%),
    var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--forest);
  color: white;
  font-weight: 750;
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: clamp(1.45rem, 8vw, 2.25rem);
  line-height: 1.05;
  max-width: 12ch;
}

h3 {
  font-size: 2.6rem;
  line-height: 1;
}

.eyebrow {
  color: var(--berry);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.icon-button {
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.78);
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.login-view {
  display: grid;
  gap: 18px;
  padding-top: 8vh;
}

.intro-panel {
  display: grid;
  gap: 14px;
  min-height: 330px;
  padding: 28px;
  border-radius: 8px;
  background:
    linear-gradient(140deg, rgba(31, 91, 75, 0.92), rgba(48, 102, 163, 0.7)),
    url("data:image/svg+xml,%3Csvg width='900' height='700' viewBox='0 0 900 700' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='900' height='700' fill='%23dfe8e3'/%3E%3Cpath d='M0 550c120-60 210-50 315-5 115 50 195 49 320-30 112-70 177-75 265-40v225H0z' fill='%23f0b84a'/%3E%3Cpath d='M0 420c105-72 220-88 360-25 135 61 260 62 540-78v210c-160 89-314 105-480 40C278 512 150 500 0 588z' fill='%231f5b4b'/%3E%3Ccircle cx='735' cy='145' r='70' fill='%23fffaf0' opacity='.95'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
  color: white;
  box-shadow: var(--shadow);
}

.intro-panel p:not(.eyebrow) {
  align-self: end;
  max-width: 28rem;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.02rem;
}

.intro-panel .eyebrow {
  color: #ffd979;
}

.login-form {
  display: grid;
  gap: 10px;
}

label {
  color: var(--muted);
  font-weight: 750;
}

input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.login-error {
  min-height: 1.4em;
  color: var(--berry);
  font-weight: 750;
}

.learn-view {
  display: grid;
  gap: 16px;
}

.dashboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.86);
}

.dashboard h2 {
  max-width: 15ch;
  font-size: 1.55rem;
}

.progress-ring {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 76px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--forest) var(--progress, 0deg), #e8dfcf 0);
}

.progress-ring span {
  display: grid;
  place-items: center;
  width: 54px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--paper);
  font-size: 0.9rem;
  font-weight: 850;
}

.lesson-tabs,
.mode-switch {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(110px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.lesson-tabs button,
.mode-switch button,
.card-actions button,
.quiz-options button,
#nextQuiz {
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.8);
  color: var(--ink);
}

.lesson-tabs button.active,
.mode-switch button.active,
.quiz-options button.correct {
  border-color: var(--forest);
  background: var(--forest);
  color: white;
}

.quiz-options button.wrong {
  border-color: var(--berry);
  background: #f9dbe2;
  color: var(--ink);
}

.mode-panel {
  min-height: 430px;
}

.vocab-card,
.quiz-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 750;
}

.speak-button {
  min-height: 38px;
  padding: 0 14px;
  background: var(--lake);
}

dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

dl div {
  padding: 14px;
  border-radius: 8px;
  background: #f1eadc;
}

dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

dd {
  margin: 4px 0 0;
  font-size: 1.18rem;
  font-weight: 850;
}

#exampleText {
  padding: 14px;
  border-left: 4px solid var(--sun);
  background: #fff3d6;
  font-weight: 700;
}

.note,
.feedback {
  color: var(--muted);
  min-height: 1.4em;
}

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

.card-actions #knowCard {
  background: var(--forest-2);
  color: white;
  border-color: var(--forest-2);
}

.quiz-options {
  display: grid;
  gap: 10px;
}

.quiz-options button {
  text-align: left;
  padding: 0 14px;
}

#nextQuiz {
  color: white;
  background: var(--lake);
  border-color: var(--lake);
}

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

.review-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.78);
}

.review-item strong {
  display: block;
}

.review-item span {
  color: var(--muted);
  font-size: 0.92rem;
}

.badge {
  padding: 6px 9px;
  border-radius: 999px;
  background: #e6f0ec;
  color: var(--forest);
  font-size: 0.78rem;
  font-weight: 850;
}

@media (min-width: 700px) {
  .login-view {
    grid-template-columns: 1.4fr 0.8fr;
    align-items: end;
    padding-top: 12vh;
  }

  .login-form {
    padding-bottom: 20px;
  }
}
