:root {
  --plum: #08777b;
  --plum-dark: #064c50;
  --teal: #178c84;
  --teal-dark: #075a58;
  --coral: #c95662;
  --wrong-text: #a63631;
  --control-edge: #6f8587;
  --gold: #9a6400;
  --ink: #163638;
  --muted: #526668;
  --paper: #f8fffd;
  --cream: #fff8e9;
  --line: #c8dedb;
  --soft-plum: #ddf6f2;
  --soft-teal: #e1f7f2;
  --soft-gold: #fff1bd;
  --shadow: 0 18px 50px rgba(6, 76, 80, 0.13);
  --radius: 24px;
  --font: "Avenir Next", Avenir, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #e5f4f1;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 10%, rgba(23, 140, 132, 0.17), transparent 26rem),
    radial-gradient(circle at 92% 85%, rgba(255, 205, 91, 0.18), transparent 30rem),
    radial-gradient(circle at 20% 35%, rgba(8, 119, 123, 0.1) 1px, transparent 2px) 0 0 / 38px 38px,
    var(--paper);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.55;
}

body.cream {
  --paper: var(--cream);
  background:
    radial-gradient(circle at 8% 10%, rgba(23, 140, 132, 0.12), transparent 26rem),
    radial-gradient(circle at 92% 85%, rgba(255, 205, 91, 0.15), transparent 30rem),
    var(--paper);
}

body.easy-read {
  --font: Verdana, Tahoma, Arial, sans-serif;
  letter-spacing: 0.025em;
  word-spacing: 0.08em;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

h1[tabindex="-1"]:focus {
  outline: none;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 4px solid #176f9d;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -100px;
  z-index: 20;
  padding: 12px 18px;
  color: white;
  background: var(--plum-dark);
  border-radius: 10px;
}

.skip-link:focus {
  top: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  width: min(100% - 32px, 900px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--plum-dark);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: white;
  background: var(--plum);
  background: linear-gradient(145deg, var(--plum), #22a69b);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(8, 119, 123, 0.12);
}

.icon-button,
.back-button {
  min-width: 48px;
  min-height: 48px;
  padding: 10px;
  color: var(--plum-dark);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: auto;
  padding-inline: 14px;
  font-weight: 700;
}

.home {
  display: grid;
  gap: 28px;
}

.welcome {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(190px, 0.7fr);
  align-items: center;
  gap: 18px;
  padding: 34px;
  overflow: hidden;
  background:
    radial-gradient(circle at 79% 18%, rgba(255, 219, 115, 0.2) 0 3px, transparent 4px),
    radial-gradient(circle at 90% 62%, rgba(255, 255, 255, 0.22) 0 2px, transparent 3px),
    radial-gradient(circle at 65% 80%, rgba(255, 255, 255, 0.17) 0 2px, transparent 3px),
    linear-gradient(135deg, #07595e, #08777b);
  color: white;
  border-radius: 30px;
  box-shadow: var(--shadow);
  position: relative;
}

.welcome::after {
  content: "";
  position: absolute;
  right: -36px;
  bottom: -70px;
  width: 230px;
  height: 230px;
  border: 25px solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.welcome .eyebrow {
  color: #d8fff8;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.1rem, 7vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(1.65rem, 5vw, 2.35rem);
  line-height: 1.16;
  letter-spacing: -0.035em;
}

h3 {
  line-height: 1.25;
}

.welcome p {
  max-width: 520px;
  margin-bottom: 26px;
  color: #fff9fc;
}

.welcome-copy {
  position: relative;
  z-index: 2;
}

.hero-art {
  position: relative;
  z-index: 1;
  width: min(100%, 260px);
  justify-self: end;
  color: white;
  filter: drop-shadow(0 15px 22px rgba(0, 43, 46, 0.24));
}

.hero-art svg {
  display: block;
  width: 100%;
}

.primary,
.secondary,
.quiet,
.danger {
  display: inline-flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 16px;
  font-weight: 800;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.primary {
  color: white;
  background: var(--plum);
  border: 2px solid var(--plum);
  box-shadow: 0 8px 20px rgba(62, 32, 64, 0.2);
}

.welcome .primary {
  color: #173f42;
  background: #ffd66b;
  border-color: #ffd66b;
  box-shadow: none;
}

.secondary {
  color: var(--teal-dark);
  background: var(--soft-teal);
  border: 2px solid #9ccbc1;
}

.quiet {
  color: var(--plum-dark);
  background: transparent;
  border: 2px solid var(--line);
}

.danger {
  color: #822d2a;
  background: #fff1ef;
  border: 2px solid #dfaaa5;
}

.primary:not(:disabled):hover,
.secondary:not(:disabled):hover,
.quiet:not(:disabled):hover,
.danger:not(:disabled):hover {
  transform: translateY(-2px);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button-row > button {
  flex: 1 1 180px;
}

.garden-card,
.card {
  padding: clamp(24px, 5vw, 42px);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(221, 210, 216, 0.82);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

body.cream .garden-card,
body.cream .card,
body.cream .setting-row {
  background: rgba(255, 253, 249, 0.88);
}

.garden-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.garden-header h2 {
  margin-bottom: 0;
}

.big-count {
  color: var(--plum);
  font-size: 1.4rem;
  font-weight: 900;
}

.progress-track {
  height: 18px;
  overflow: hidden;
  background: #eadfe4;
  border-radius: 20px;
}

.progress-fill {
  height: 100%;
  min-width: 0;
  background: linear-gradient(90deg, #08777b, #35b6a8 72%, #ffd66b);
  border-radius: inherit;
  transition: width 600ms ease;
}

.sprout-line {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
}

.sprout {
  color: #9fb3b1;
  opacity: 0.55;
  transition: color 300ms ease, opacity 300ms ease, transform 300ms ease;
}

.sprout.lit {
  color: #0b817e;
  opacity: 1;
  transform: scale(1.15);
}

.sprout-caption {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat {
  padding: 18px 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.stat strong {
  display: block;
  color: var(--plum-dark);
  font-size: 1.55rem;
  line-height: 1.1;
}

.stat span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.practice-shell {
  width: min(100% - 28px, 760px);
}

.practice-head {
  margin-bottom: 18px;
}

.set-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
  color: #3f5557;
  font-size: 0.86rem;
  font-weight: 750;
}

.step-dots {
  display: flex;
  gap: 7px;
}

.step-dot {
  width: 9px;
  height: 9px;
  background: #d8cbd2;
  border-radius: 10px;
}

.step-dot.done {
  background: var(--teal);
}

.practice-card {
  min-height: 530px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.practice-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: linear-gradient(90deg, var(--plum), #35b6a8, #ffd66b);
}

.instruction {
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 1.05rem;
}

.chunks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 30px;
}

.chunk {
  padding: 8px 13px;
  color: var(--plum-dark);
  background: var(--soft-plum);
  border: 1px solid #aadfd6;
  border-bottom: 4px solid #37a99f;
  border-radius: 12px;
  font-size: clamp(1.5rem, 7vw, 2.55rem);
  font-weight: 850;
  line-height: 1.15;
}

.meaning {
  padding: 20px;
  margin-bottom: 16px;
  background: var(--soft-teal);
  border-radius: 16px;
}

.meaning strong {
  color: var(--teal-dark);
}

.sentence {
  margin-bottom: 24px;
  font-size: 1.05rem;
}

mark {
  padding: 1px 4px;
  color: inherit;
  background: #ffe79c;
  border-radius: 4px;
  font-weight: 800;
}

.hear-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.hear-row button {
  flex: 1 1 180px;
}

.word-input {
  width: 100%;
  min-height: 66px;
  padding: 13px 18px;
  color: var(--ink);
  background: white;
  border: 3px solid var(--control-edge);
  border-radius: 16px;
  font-size: clamp(1.45rem, 6vw, 2.1rem);
  font-weight: 750;
  text-align: center;
}

.word-input[aria-invalid="true"] {
  border-color: var(--coral);
}

.copy-guide {
  min-height: 50px;
  margin: 18px 0 26px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: clamp(1.3rem, 6vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
}

.letter-match {
  color: var(--teal-dark);
}

.letter-wrong {
  color: var(--wrong-text);
  text-decoration: underline 3px;
  text-underline-offset: 5px;
}

.letter-waiting {
  color: var(--control-edge);
}

.hidden-word {
  display: grid;
  min-height: 100px;
  place-items: center;
  margin: 0 0 26px;
  color: var(--muted);
  background:
    radial-gradient(circle at center, rgba(23, 140, 132, 0.08), transparent 55%),
    repeating-linear-gradient(-45deg, #e9f7f4, #e9f7f4 10px, #f7fcfb 10px, #f7fcfb 20px);
  border: 2px dashed #82b9b2;
  border-radius: 18px;
  font-weight: 800;
}

.feedback-icon {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  margin: 0 auto 20px;
  color: white;
  background: var(--teal);
  border-radius: 50%;
}

.feedback-icon.wrong {
  background: var(--coral);
}

.feedback {
  text-align: center;
}

.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 22px 0 28px;
  text-align: left;
}

.comparison > div {
  padding: 16px;
  background: #edf8f6;
  border-radius: 14px;
}

.comparison > div > span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.comparison strong {
  overflow-wrap: anywhere;
  font-size: 1.3rem;
}

.diff-bad {
  color: var(--wrong-text);
  background: #ffe1dd;
  text-decoration: underline 3px;
  text-underline-offset: 4px;
}

.settings {
  display: grid;
  gap: 14px;
}

.sync-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
}

.setting-copy .sync-line {
  display: inline;
  font-size: inherit;
  font-weight: inherit;
  text-align: left;
}

.signin-card {
  max-width: 560px;
  margin: 0 auto;
}

.signin-form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.signin-form label {
  margin-top: 10px;
  font-weight: 800;
}

.text-input {
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  color: var(--ink);
  background: white;
  border: 3px solid var(--control-edge);
  border-radius: 14px;
  font-size: 1.1rem;
}

.form-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.form-error {
  min-height: 1.55em;
  margin: 8px 0 4px;
  color: var(--wrong-text);
  font-weight: 800;
}

.form-error:empty {
  min-height: 0;
  margin: 0;
}

.signin-form .primary {
  margin-top: 12px;
}

.setting-row {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.setting-copy {
  flex: 1;
}

.setting-copy strong {
  display: block;
}

.setting-copy span {
  color: var(--muted);
  font-size: 0.88rem;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 58px;
  height: 34px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch-ui {
  position: absolute;
  inset: 0;
  background: var(--control-edge);
  border-radius: 20px;
  transition: background 150ms ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  left: 4px;
  top: 4px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.24);
  transition: transform 150ms ease;
}

.switch input:checked + .switch-ui {
  background: var(--teal);
}

.switch input:checked + .switch-ui::after {
  transform: translateX(24px);
}

.switch input:focus-visible + .switch-ui {
  outline: 4px solid #176f9d;
  outline-offset: 3px;
}

.summary-list {
  display: grid;
  gap: 10px;
  margin: 24px 0 28px;
  padding: 0;
  list-style: none;
}

.summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: #edf8f6;
  border-radius: 14px;
}

.summary-word {
  font-size: 1.08rem;
  font-weight: 850;
}

.status-pill {
  padding: 5px 9px;
  color: var(--teal-dark);
  background: var(--soft-teal);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 850;
  text-align: right;
}

.status-pill.retry {
  color: #854c07;
  background: var(--soft-gold);
}

.new-progress {
  padding: 20px;
  margin-bottom: 24px;
  color: var(--plum-dark);
  background: linear-gradient(135deg, #dff7f2, #fff1bd);
  border: 2px solid #8fcec3;
  border-radius: 18px;
  text-align: center;
}

.empty-note {
  padding: 20px;
  color: var(--muted);
  background: #f7f2f5;
  border-radius: 16px;
}

@media (max-width: 600px) {
  body {
    font-size: 17px;
  }

  .shell {
    width: min(100% - 22px, 900px);
    padding-top: 14px;
  }

  .topbar {
    margin-bottom: 20px;
  }

  .welcome {
    grid-template-columns: 1fr;
    padding: 26px 22px;
  }

  .hero-art {
    position: absolute;
    right: -42px;
    bottom: -24px;
    width: 190px;
    opacity: 0.15;
  }

  .welcome-copy {
    max-width: 90%;
  }

  .garden-card,
  .card {
    padding: 24px 19px;
    border-radius: 21px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 7px;
  }

  .stat {
    padding: 14px 6px;
  }

  .stat strong {
    font-size: 1.35rem;
  }

  .practice-card {
    min-height: calc(100vh - 155px);
  }

  .comparison {
    grid-template-columns: 1fr;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row > button {
    flex-basis: auto;
    width: 100%;
  }
}

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