:root {
  color-scheme: light;
  font-family: "Nunito", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  --ink: #243752;
  --muted: #66758b;
  --line: #d8e7ed;
  --surface: #ffffff;
  --sky: #e8f8fd;
  --cream: #fff9eb;
  --pink: #ef547a;
  --pink-dark: #bd3f62;
  --blue: #32a9d8;
  --mint: #54c58c;
  --yellow: #f7c64b;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
}

button,
select,
input {
  font: inherit;
}

button,
a,
select,
input {
  outline-offset: 3px;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

.word-study-page {
  background:
    linear-gradient(180deg, rgba(232, 248, 253, 0.96), rgba(246, 253, 248, 0.96) 62%, rgba(255, 249, 235, 0.98)),
    #eef9fb;
  color: var(--ink);
  min-height: 100vh;
}

.study-shell {
  margin: 0 auto;
  max-width: 1320px;
  padding: 16px;
}

.study-header {
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(230px, 1fr) auto auto;
  min-height: 78px;
  padding: 10px 14px;
}

.study-brand {
  align-items: center;
  color: inherit;
  display: flex;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.study-brand__mark {
  align-items: center;
  background: linear-gradient(180deg, #ff7898, #ed4e78);
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 5px 12px rgba(190, 63, 98, 0.18);
  color: #ffffff;
  display: flex;
  flex: 0 0 50px;
  font-size: 20px;
  font-weight: 900;
  height: 50px;
  justify-content: center;
}

.study-brand span:last-child {
  display: grid;
  gap: 1px;
}

.study-brand small {
  color: var(--pink-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.study-brand strong {
  color: var(--pink);
  font-size: 27px;
  line-height: 1.05;
}

.study-header__summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
}

.study-header__summary > div {
  border-right: 1px solid var(--line);
  display: grid;
  gap: 2px;
  min-width: 100px;
  padding: 2px 16px;
}

.study-header__summary > div:last-child {
  border-right: 0;
}

.study-header__summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.study-header__summary strong {
  color: var(--ink);
  font-size: 18px;
}

.study-home-link {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #315f7c;
  font-size: 12px;
  font-weight: 900;
  min-width: 112px;
  padding: 10px 12px;
  text-align: center;
  text-decoration: none;
}

.study-planner {
  align-items: end;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(190px, 1fr) minmax(220px, 1.1fr) 140px auto auto;
  margin-top: 12px;
  padding: 12px 14px;
}

.study-planner__title {
  align-self: center;
  display: grid;
  gap: 3px;
}

.study-planner__title span,
.study-planner label > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.study-planner__title strong {
  font-size: 15px;
}

.study-planner label {
  display: grid;
  gap: 4px;
}

.study-planner select {
  background: #f7fbfd;
  border: 1px solid #cfe1e8;
  border-radius: 6px;
  color: #2d5069;
  font-size: 12px;
  font-weight: 800;
  height: 38px;
  min-width: 0;
  padding: 0 9px;
  width: 100%;
}

.study-button {
  align-items: center;
  border-radius: 7px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.study-button--primary {
  background: var(--pink);
  border: 1px solid var(--pink);
  color: #ffffff;
}

.study-button--quiet {
  background: #f7fbfd;
  border: 1px solid #cfe1e8;
  color: #35617d;
}

.study-button--reward {
  background: #fff5d5;
  border: 1px solid #e8ca72;
  color: #79571d;
}

.study-button:disabled {
  opacity: 0.48;
}

.study-workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 12px;
  overflow: hidden;
}

.study-progress {
  align-items: center;
  background: #fbfdfe;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 16px;
  grid-template-columns: 190px minmax(0, 1fr);
  min-height: 48px;
  padding: 8px 16px;
}

.study-progress__meta {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
}

.study-progress__meta span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.study-progress__meta strong {
  color: var(--pink-dark);
  font-size: 15px;
}

.study-progress__track {
  background: #e6eff2;
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
}

.study-progress__track span {
  background: linear-gradient(90deg, var(--mint), var(--blue), var(--yellow));
  display: block;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms ease;
}

.study-phases {
  background: var(--cream);
  border-bottom: 1px solid #eddfb9;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  list-style: none;
  margin: 0;
  padding: 0 18px;
}

.study-phases li {
  align-items: center;
  color: #8b8d8d;
  display: flex;
  gap: 8px;
  justify-content: center;
  min-height: 50px;
  position: relative;
}

.study-phases li:not(:last-child)::after {
  background: #dfdfd6;
  content: "";
  height: 2px;
  position: absolute;
  right: -18%;
  width: 36%;
}

.study-phases li span {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d8ddd9;
  border-radius: 50%;
  display: flex;
  font-size: 11px;
  height: 25px;
  justify-content: center;
  width: 25px;
}

.study-phases li strong {
  font-size: 12px;
}

.study-phases li.is-current {
  color: var(--pink-dark);
}

.study-phases li.is-current span {
  background: var(--pink);
  border-color: var(--pink);
  color: #ffffff;
}

.study-phases li.is-done {
  color: #267857;
}

.study-phases li.is-done span {
  background: #e4f8ed;
  border-color: #83d2aa;
  color: #267857;
}

.study-card {
  display: grid;
  grid-template-columns: minmax(290px, 0.8fr) minmax(0, 1.4fr);
  min-height: 460px;
}

.word-scene {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(232, 250, 255, 0.24), rgba(255, 249, 224, 0.7)),
    image-set(
      url("assets/map-candy-island.webp") type("image/webp"),
      url("assets/map-candy-island.png") type("image/png")
    );
  background-position: center;
  background-size: cover;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 32px;
  position: relative;
  text-align: center;
}

.word-scene::after {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  box-shadow: 0 10px 22px rgba(55, 92, 115, 0.14);
  content: "";
  height: 152px;
  position: absolute;
  top: 112px;
  width: 152px;
  z-index: 0;
}

.word-scene__category {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(201, 225, 234, 0.9);
  border-radius: 999px;
  color: #37627d;
  font-size: 11px;
  font-weight: 900;
  padding: 6px 12px;
  position: absolute;
  top: 22px;
}

.word-scene__icon {
  align-items: center;
  color: var(--pink);
  display: flex;
  font-size: 68px;
  font-weight: 900;
  height: 152px;
  justify-content: center;
  position: relative;
  width: 152px;
  z-index: 1;
}

.word-scene > strong {
  color: #274760;
  font-size: 22px;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}

.word-scene > small {
  color: #63798b;
  font-size: 11px;
  font-weight: 800;
  margin-top: 5px;
  position: relative;
  z-index: 1;
}

.study-card__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 34px 44px;
}

.study-card__heading {
  align-items: start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.study-phase-label {
  color: var(--pink-dark);
  font-size: 11px;
  font-weight: 900;
}

.study-card h1,
.study-complete h2 {
  color: var(--ink);
  font-size: clamp(31px, 3.3vw, 46px);
  letter-spacing: 0;
  line-height: 1.05;
  margin: 7px 0 0;
  overflow-wrap: anywhere;
}

.study-sound-button {
  background: #eaf8fd;
  border: 1px solid #bfe1ee;
  border-radius: 7px;
  color: #267294;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
  min-height: 40px;
  padding: 0 14px;
}

.study-phonetic {
  color: #4b7690;
  font-size: 15px;
  font-style: italic;
  margin: 8px 0 0;
}

.study-meaning {
  color: var(--pink-dark);
  font-size: 21px;
  font-weight: 900;
  line-height: 1.4;
  margin: 13px 0 0;
}

.study-sentence {
  background: #f6fbfd;
  border-left: 4px solid var(--blue);
  color: #435a70;
  font-size: 14px;
  line-height: 1.55;
  margin: 15px 0 0;
  min-height: 44px;
  padding: 10px 13px;
}

.study-challenge {
  align-content: center;
  display: grid;
  margin-top: 18px;
  min-height: 70px;
}

.study-challenge:empty,
.study-feedback:empty {
  display: none;
}

.study-choice-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.study-choice {
  background: #ffffff;
  border: 1px solid #cfdfe6;
  border-radius: 7px;
  color: #354e66;
  font-size: 13px;
  font-weight: 800;
  min-height: 48px;
  padding: 8px 10px;
}

.study-choice.is-correct {
  background: #e7f8ef;
  border-color: #75c99f;
  color: #267857;
}

.study-choice.is-wrong {
  background: #fff0f3;
  border-color: #e9a0b3;
  color: #a63d5b;
}

.study-recall-form {
  display: grid;
  gap: 9px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.study-recall-form label {
  color: var(--muted);
  display: grid;
  font-size: 10px;
  font-weight: 900;
  gap: 4px;
}

.study-recall-form input {
  background: #ffffff;
  border: 2px solid #bedce8;
  border-radius: 7px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  height: 50px;
  letter-spacing: 0;
  min-width: 0;
  padding: 0 13px;
  width: 100%;
}

.study-recall-form input:focus {
  border-color: var(--blue);
}

.study-recall-form button {
  align-self: end;
  height: 50px;
}

.study-letter-hint {
  color: #6b7787;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.2em;
  margin: 0 0 9px;
}

.study-feedback {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 26px;
  margin: 0;
  min-height: 26px;
}

.study-feedback.is-success {
  color: #267857;
}

.study-feedback.is-error {
  color: #af3d5b;
}

.study-card__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.study-complete {
  align-items: center;
  display: grid;
  gap: 42px;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 510px;
  padding: 44px 70px;
}

.study-complete__scene {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 249, 225, 0.72)),
    image-set(
      url("assets/hero-candy-island.webp") type("image/webp"),
      url("assets/hero-candy-island.png") type("image/png")
    );
  background-position: 20% center;
  background-size: auto 100%;
  border: 1px solid #cfe4ec;
  border-radius: 8px;
  display: flex;
  height: 330px;
  justify-content: center;
}

.study-complete__scene span {
  color: #ffc63d;
  font-size: 88px;
  text-shadow: 0 4px 0 #ffffff, 0 9px 18px rgba(148, 103, 26, 0.18);
}

.study-complete h2 {
  font-size: clamp(28px, 3vw, 40px);
}

.study-complete > div:last-child > p {
  color: var(--muted);
  line-height: 1.6;
}

.study-complete__stats {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 24px 0;
}

.study-complete__stats div {
  display: grid;
  gap: 3px;
  padding: 14px 18px;
}

.study-complete__stats div:not(:last-child) {
  border-right: 1px solid var(--line);
}

.study-complete__stats span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.study-complete__stats strong {
  color: var(--pink-dark);
  font-size: 25px;
}

.study-complete__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.study-footer {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  justify-content: space-between;
  padding: 15px 4px 4px;
}

.study-footer > div {
  display: grid;
  gap: 2px;
}

.study-footer strong {
  color: #425d72;
}

.study-footer nav {
  display: flex;
  gap: 16px;
}

.study-footer a {
  color: #356a88;
  font-weight: 900;
  text-decoration: none;
}

@media (hover: hover) and (pointer: fine) {
  .study-button:hover:not(:disabled),
  .study-choice:hover:not(:disabled),
  .study-home-link:hover,
  .study-sound-button:hover:not(:disabled) {
    border-color: #8fc8dc;
    box-shadow: 0 5px 12px rgba(47, 84, 109, 0.1);
  }
}

@media (max-width: 980px) {
  .study-header {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  .study-header__summary {
    order: 3;
    grid-column: 1 / -1;
  }

  .study-header__summary > div {
    align-items: baseline;
    display: flex;
    justify-content: space-between;
  }

  .study-planner {
    grid-template-columns: 1fr 1fr 140px;
  }

  .study-planner__title {
    grid-column: 1 / -1;
  }

  .study-card {
    grid-template-columns: minmax(230px, 0.7fr) minmax(0, 1.3fr);
  }

  .study-card__content {
    padding: 30px;
  }

  .study-choice-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .study-shell {
    padding: 8px;
  }

  .study-header {
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px;
  }

  .study-brand__mark {
    flex-basis: 42px;
    font-size: 16px;
    height: 42px;
  }

  .study-brand small {
    font-size: 8px;
  }

  .study-brand strong {
    font-size: 21px;
  }

  .study-home-link {
    min-width: 0;
    padding: 9px;
  }

  .study-header__summary {
    gap: 0;
  }

  .study-header__summary > div {
    display: grid;
    min-width: 0;
    padding: 5px 9px;
  }

  .study-header__summary strong {
    font-size: 16px;
  }

  .study-planner {
    align-items: stretch;
    grid-template-columns: 1fr 1fr;
    padding: 12px;
  }

  .study-planner__title,
  .study-planner .study-button {
    grid-column: 1 / -1;
  }

  .study-progress {
    gap: 8px;
    grid-template-columns: 1fr;
  }

  .study-phases {
    padding: 0 5px;
  }

  .study-phases li {
    gap: 4px;
    min-height: 45px;
  }

  .study-phases li:not(:last-child)::after {
    display: none;
  }

  .study-card {
    grid-template-columns: 1fr;
  }

  .word-scene {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    min-height: 218px;
    padding: 22px;
  }

  .word-scene::after {
    height: 104px;
    top: 54px;
    width: 104px;
  }

  .word-scene__category {
    left: 14px;
    top: 12px;
  }

  .word-scene__icon {
    font-size: 50px;
    height: 104px;
    width: 104px;
  }

  .word-scene > strong {
    font-size: 18px;
    margin-top: 10px;
  }

  .study-card__content {
    padding: 24px 18px;
  }

  .study-card h1 {
    font-size: clamp(29px, 10vw, 39px);
  }

  .study-card__heading {
    gap: 10px;
  }

  .study-sound-button {
    font-size: 11px;
    padding: 0 9px;
  }

  .study-meaning {
    font-size: 18px;
  }

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

  .study-card__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .study-complete {
    grid-template-columns: 1fr;
    padding: 24px 18px;
  }

  .study-complete__scene {
    height: 190px;
  }

  .study-complete__actions {
    display: grid;
  }

  .study-footer {
    align-items: start;
    gap: 12px;
  }

  .study-footer nav {
    display: grid;
    flex: 0 0 auto;
    gap: 7px;
    text-align: right;
  }
}

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