@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-400.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-500.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-600.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-700.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-800.ttf") format("truetype");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --green: #07563b;
  --green-dark: #06452f;
  --green-soft: #eaf4ef;
  --ink: #171a18;
  --muted: #69706c;
  --line: #e4e9e6;
  --surface: #f5f8f6;
  --white: #ffffff;
  --good: #11734d;
  --bad: #b13c3c;
  --warning: #8a5700;
  --shadow: 0 14px 48px rgba(16, 41, 29, 0.08);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: #eef2f0;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: #eef2f0;
  color: var(--ink);
  font-family: "Montserrat", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(7, 86, 59, 0.28);
  outline-offset: 3px;
}

.app-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 520px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--white);
  box-shadow: var(--shadow);
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  width: 220px;
  height: 48px;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: transparent;
  text-align: left;
}

.official-logo {
  position: relative;
  display: block;
  width: 218px;
  height: 48px;
  overflow: hidden;
}

.logo-sprite {
  position: absolute;
  top: -108px;
  left: -42px;
  width: 512px;
  height: 288px;
  background-image: url("../images/cosmos-branding.jpg");
  background-repeat: no-repeat;
  background-size: 512px 288px;
}

.lang-pill {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 800;
}

.progress-track { height: 4px; background: #edf0ee; }
.progress-bar {
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 220ms ease;
}

main {
  flex: 1;
  padding: 24px 22px 112px;
}

.screen {
  animation: screen-in 180ms ease;
}

@keyframes screen-in {
  from { opacity: 0.4; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 12px;
  font-size: clamp(1.75rem, 7.2vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
}
h2 {
  margin-bottom: 10px;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.16;
}
h3 {
  margin-bottom: 6px;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.3;
}
p {
  margin-bottom: 14px;
  color: #3e4541;
  font-size: 1rem;
  line-height: 1.55;
}
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }

.language-list, .task-list, .button-stack, .sequence-list, .check-list {
  display: grid;
  gap: 11px;
}

.language-list { margin-top: 22px; }
.language-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}
.language-option.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(7, 86, 59, 0.08);
}
.language-code {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 54px;
  padding: 14px 18px;
  border: 0;
  border-radius: 16px;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.25;
  transition: transform 120ms ease, background-color 120ms ease;
}
.button:active { transform: scale(0.99); }
.button.primary { background: var(--green); color: var(--white); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { border: 1px solid var(--line); background: var(--white); color: var(--ink); }
.button.soft { background: var(--surface); color: var(--ink); }
.button.compact { width: auto; min-height: 44px; padding: 10px 14px; }
.button[disabled] { cursor: default; opacity: 0.52; }
.button-stack { margin-top: 20px; }

.task-list { margin-top: 20px; }
.task-card {
  position: relative;
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 118px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--white);
  color: var(--ink);
  overflow: hidden;
  text-align: left;
}
.task-card:hover { border-color: #bdcbc4; }
.task-thumb {
  width: 94px;
  height: 94px;
  border-radius: 14px;
  background-position: center;
  background-size: cover;
}
.task-copy { min-width: 0; padding-right: 28px; }
.task-copy h3 { font-size: 1.04rem; }
.task-copy p { margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.task-arrow {
  position: absolute;
  right: 16px;
  color: var(--green);
  font-size: 1.2rem;
  font-weight: 800;
}
.task-number {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.hero-card, .learning-card, .dark-card, .info-card {
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 23px;
  background: var(--white);
}
.hero-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--surface);
  object-fit: cover;
}
.hero-body { padding: 18px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.tag {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: 0.76rem;
  font-weight: 700;
}

.word-image, .choice-image, .step-image {
  background-color: var(--surface);
  background-repeat: no-repeat;
}
.word-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-position: center;
  background-size: cover;
}
.word-body { padding: 20px; text-align: center; }
.big-word {
  margin-bottom: 6px;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.translation {
  min-height: 24px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.95rem;
}
.example {
  margin: 16px 0 0;
  color: var(--ink);
  font-size: 1.03rem;
  font-weight: 600;
}
.audio-row { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.round-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  font-size: 1.25rem;
}
.round-button.primary { border-color: var(--green); background: var(--green); color: var(--white); }
.dots { display: flex; justify-content: center; gap: 7px; margin-top: 16px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #d5dcd8; }
.dot.active { background: var(--green); }

.voice-status {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 14px 0;
  padding: 13px 14px;
  border-radius: 15px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.45;
}
.voice-status.warning { background: #fff4df; color: var(--warning); }
.voice-dot { flex: 0 0 9px; width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--good); }
.voice-status.warning .voice-dot { background: #bf7400; }

.quiz-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin: 18px 0;
}
.choice-card {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
}
.choice-card.correct { border-color: var(--good); }
.choice-card.wrong { border-color: var(--bad); }
.choice-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-position: center;
  background-size: cover;
}
.choice-label { display: block; padding: 11px 8px 12px; font-size: 0.8rem; font-weight: 700; }

.feedback {
  margin: 14px 0;
  padding: 14px 15px;
  border-radius: 15px;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.45;
}
.feedback.good { background: #e8f5ed; color: var(--good); }
.feedback.bad { background: #fff0f0; color: var(--bad); }

.sequence-list { margin: 18px 0; }
.sequence-card {
  display: grid;
  grid-template-columns: 30px 66px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 82px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--white);
  color: var(--ink);
  text-align: left;
}
.sequence-card.done { opacity: 0.54; }
.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--surface);
  font-size: 0.75rem;
  font-weight: 800;
}
.step-image {
  width: 66px;
  height: 66px;
  border-radius: 12px;
  background-position: center;
  background-size: cover;
}
.step-label { font-size: 0.9rem; font-weight: 700; line-height: 1.35; }

.speak-box {
  margin: 18px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  text-align: center;
}
.target-phrase {
  margin-bottom: 11px;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.45;
}
.mic-button {
  width: 82px;
  height: 82px;
  margin: 9px auto;
  border: 0;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  font-size: 1.85rem;
}
.mic-button.listening { animation: pulse 1s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(7, 86, 59, 0.2); }
  50% { box-shadow: 0 0 0 15px rgba(7, 86, 59, 0); }
}
.heard { min-height: 52px; margin-top: 12px; font-size: 0.92rem; line-height: 1.5; }

.review-target {
  color: var(--green);
  font-size: 1.15rem;
}
.review-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}
.review-choice {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 17px;
  background: var(--surface);
  color: var(--ink);
}
.review-choice.correct { border-color: var(--good); }
.review-choice.wrong { border-color: var(--bad); }
.review-choice:disabled { cursor: default; opacity: 0.72; }
.review-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: var(--surface);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}
.review-label {
  display: block;
  padding: 10px 5px 11px;
  overflow-wrap: anywhere;
  font-size: 0.72rem;
  font-weight: 800;
}

.dark-card {
  padding: 20px;
  border: 0;
  background: #0f1713;
  color: var(--white);
}
.dark-card h2 { color: var(--white); }
.dark-card p { color: #dbe4df; }
.dark-card .eyebrow { color: #9fd4bc; }

.check-list { margin: 18px 0; }
.check-row { display: flex; gap: 11px; align-items: center; font-size: 0.9rem; font-weight: 700; line-height: 1.4; }
.check-mark {
  display: flex;
  flex: 0 0 26px;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--good);
}
.practical-steps { margin: 12px 0 0; padding-left: 1.35rem; color: #dbe4df; }
.practical-steps li { margin: 7px 0; padding-left: 3px; line-height: 1.45; }

.completion-icon {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  margin: 24px auto 20px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 2.4rem;
  font-weight: 800;
}

.app-footer {
  position: fixed;
  z-index: 30;
  bottom: 0;
  left: 50%;
  width: min(100%, 520px);
  padding: 12px 22px calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
}
.footer-row { display: flex; gap: 10px; }
.back-button {
  flex: 0 0 54px;
  width: 54px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  color: var(--ink);
  font-size: 1.25rem;
}
.app-footer.hidden { display: none; }

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  width: min(calc(100% - 32px), 470px);
  padding: 12px 15px;
  transform: translate(-50%, 18px);
  border-radius: 14px;
  background: #101713;
  color: var(--white);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

.notice-dialog {
  width: min(calc(100% - 36px), 430px);
  padding: 24px;
  border: 0;
  border-radius: 22px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.24);
}
.notice-dialog::backdrop { background: rgba(9, 18, 14, 0.5); backdrop-filter: blur(3px); }
.dialog-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: #fff4df;
  font-size: 1.4rem;
}
.notice-dialog p { margin-bottom: 20px; }

.noscript {
  margin: 20px;
  padding: 16px;
  border-radius: 14px;
  background: #fff0f0;
  color: var(--bad);
}

@media (min-width: 700px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100dvh - 48px); border-radius: 28px; }
  .app-header { border-radius: 28px 28px 0 0; }
  .app-footer { bottom: 24px; border-radius: 0 0 28px 28px; }
}

@media (max-width: 390px) {
  .app-header { padding-inline: 15px; }
  .brand, .official-logo { width: 185px; }
  .logo-sprite { left: -47px; transform: scale(0.88); transform-origin: left center; }
  main { padding-inline: 17px; }
  .app-footer { padding-inline: 17px; }
  .task-card { grid-template-columns: 82px 1fr; }
  .task-thumb { width: 82px; height: 82px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
