:root {
  --toefl-words-ink: #17211b;
  --toefl-words-muted: #617067;
  --toefl-words-line: #dce5de;
  --toefl-words-soft: #f4f7f4;
  --toefl-words-accent: #285a43;
  --toefl-words-accent-dark: #1e4734;
  --toefl-words-warm: #f3eee4;
  --toefl-words-danger: #9f3d35;
}

.toefl-words-page {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 80px;
  color: var(--toefl-words-ink);
}

.toefl-words-page .hidden {
  display: none !important;
}

.toefl-words-page [hidden] {
  display: none !important;
}

.toefl-words-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 34px;
  border: 1px solid var(--toefl-words-line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 92% 10%, rgba(40, 90, 67, 0.14), transparent 31%),
    linear-gradient(135deg, #fbfcfa, #f2f6f2);
}

.toefl-words-eyebrow {
  margin: 0 0 9px;
  color: var(--toefl-words-accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.toefl-words-hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 4.25rem);
  line-height: 0.96;
  letter-spacing: -0.045em;
}

.toefl-words-hero p:last-child {
  max-width: 560px;
  margin: 15px 0 0;
  color: var(--toefl-words-muted);
  font-size: 1.02rem;
}

.toefl-words-legacy-link {
  flex: 0 0 auto;
  color: var(--toefl-words-accent);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.toefl-words-legacy-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.toefl-words-tabs {
  display: flex;
  gap: 8px;
  margin: 30px 0 18px;
  padding: 5px;
  border: 1px solid var(--toefl-words-line);
  border-radius: 14px;
  background: #fff;
}

.toefl-words-tabs button {
  flex: 1;
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--toefl-words-muted);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.toefl-words-tabs button.is-active {
  background: var(--toefl-words-accent);
  color: #fff;
}

.toefl-words-panel {
  padding: 30px;
  border: 1px solid var(--toefl-words-line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(24, 45, 33, 0.07);
}

.toefl-words-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.toefl-words-summary article {
  padding: 18px;
  border: 1px solid var(--toefl-words-line);
  border-radius: 15px;
  background: var(--toefl-words-soft);
}

.toefl-words-summary span {
  display: block;
  font-size: 1.75rem;
  font-weight: 850;
  line-height: 1;
}

.toefl-words-summary p {
  margin: 7px 0 0;
  color: var(--toefl-words-muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.toefl-words-state,
.toefl-words-start,
.toefl-words-complete {
  display: grid;
  justify-items: center;
  min-height: 280px;
  align-content: center;
  padding: 32px;
  text-align: center;
}

.toefl-words-state h2,
.toefl-words-start h2,
.toefl-words-complete h2 {
  margin: 16px 0 8px;
  font-size: clamp(1.45rem, 4vw, 2rem);
}

.toefl-words-state p,
.toefl-words-start p,
.toefl-words-complete p {
  max-width: 580px;
  margin: 0 0 24px;
  color: var(--toefl-words-muted);
}

.toefl-words-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--toefl-words-line);
  border-top-color: var(--toefl-words-accent);
  border-radius: 50%;
  animation: toefl-words-spin 0.8s linear infinite;
}

@keyframes toefl-words-spin {
  to { transform: rotate(360deg); }
}

.toefl-words-primary,
.toefl-words-secondary,
.toefl-words-state button,
.toefl-words-list-empty button {
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid var(--toefl-words-accent);
  border-radius: 11px;
  background: var(--toefl-words-accent);
  color: #fff;
  font: inherit;
  font-weight: 780;
  cursor: pointer;
}

.toefl-words-secondary {
  background: #fff;
  color: var(--toefl-words-accent);
}

.toefl-words-start-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.toefl-words-card-session {
  max-width: 780px;
  margin: 0 auto;
}

.toefl-words-progress-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0 2px 10px;
  color: var(--toefl-words-muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.toefl-word-card {
  min-height: 390px;
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--toefl-words-line);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(244, 247, 244, 0.96)),
    var(--toefl-words-soft);
  box-shadow: inset 0 0 0 6px rgba(40, 90, 67, 0.035);
}

.toefl-word-card-front {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 170px;
  text-align: center;
}

.toefl-word-recall {
  margin: 0 0 12px;
  color: var(--toefl-words-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.toefl-word-card-front h2 {
  margin: 0;
  font-size: clamp(2.5rem, 8vw, 5rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.toefl-word-front-meta,
.toefl-saved-word-labels {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 17px;
}

.toefl-word-front-meta span,
.toefl-saved-word-labels span {
  padding: 5px 9px;
  border-radius: 999px;
  background: #e7eee9;
  color: var(--toefl-words-accent-dark);
  font-size: 0.76rem;
  font-weight: 750;
}

.toefl-word-reveal {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 24px 0 0;
  border: 1px solid var(--toefl-words-accent);
  border-radius: 12px;
  background: var(--toefl-words-accent);
  color: #fff;
  font: inherit;
  font-weight: 780;
  cursor: pointer;
}

.toefl-word-card-back {
  padding-top: 26px;
  border-top: 1px solid var(--toefl-words-line);
}

.toefl-word-definition {
  margin: 0;
  font-size: clamp(1.15rem, 3vw, 1.48rem);
  font-weight: 650;
  line-height: 1.5;
}

.toefl-word-card-back blockquote {
  margin: 20px 0;
  padding: 15px 18px;
  border-left: 4px solid var(--toefl-words-accent);
  border-radius: 0 10px 10px 0;
  background: #fff;
  color: #435048;
  font-style: italic;
}

.toefl-word-use {
  color: var(--toefl-words-accent-dark);
  font-weight: 650;
}

.toefl-word-prompt {
  margin-top: 20px;
  padding: 17px;
  border-radius: 13px;
  background: var(--toefl-words-warm);
}

.toefl-word-prompt span {
  color: #795d32;
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.toefl-word-prompt p {
  margin: 6px 0 0;
  font-weight: 650;
}

.toefl-word-card-back details {
  margin-top: 18px;
}

.toefl-word-card-back summary {
  color: var(--toefl-words-accent);
  font-weight: 750;
  cursor: pointer;
}

.toefl-word-card-back details div {
  padding: 6px 2px 0;
  color: var(--toefl-words-muted);
}

.toefl-word-ratings {
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.toefl-word-ratings legend {
  width: 100%;
  margin-bottom: 10px;
  color: var(--toefl-words-muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
}

.toefl-word-ratings > div {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.toefl-word-ratings button {
  min-height: 48px;
  border: 1px solid var(--toefl-words-line);
  border-radius: 11px;
  background: #fff;
  color: var(--toefl-words-ink);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.toefl-word-ratings button[data-rating="again"] { border-color: #e2aaa5; }
.toefl-word-ratings button[data-rating="hard"] { border-color: #dfc47e; }
.toefl-word-ratings button[data-rating="good"] { border-color: #91b0cc; }
.toefl-word-ratings button[data-rating="easy"] { border-color: #8ab79c; }

.toefl-word-self-review {
  margin-top: 18px;
  text-align: center;
}

.toefl-word-self-review p {
  margin: 0 0 10px;
  color: var(--toefl-words-muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.toefl-word-self-review > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.toefl-words-inline-message {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--toefl-words-danger);
  font-size: 0.86rem;
  text-align: center;
}

.toefl-words-complete svg {
  width: 54px;
  height: 54px;
  padding: 12px;
  border-radius: 50%;
  background: #e7f0e9;
  fill: none;
  stroke: var(--toefl-words-accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.toefl-words-list-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.toefl-words-list-heading h2 {
  margin: 0 0 6px;
  font-size: 1.7rem;
}

.toefl-words-list-heading p {
  margin: 0;
  color: var(--toefl-words-muted);
}

.toefl-words-list-heading form {
  display: flex;
  gap: 7px;
}

.toefl-words-list-heading input {
  min-width: 220px;
  min-height: 43px;
  padding: 0 12px;
  border: 1px solid var(--toefl-words-line);
  border-radius: 10px;
  font: inherit;
}

.toefl-words-list-heading form button,
.toefl-words-pagination button,
.toefl-saved-word-actions button {
  min-height: 43px;
  padding: 0 14px;
  border: 1px solid var(--toefl-words-accent);
  border-radius: 10px;
  background: #fff;
  color: var(--toefl-words-accent);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.toefl-words-list-state {
  min-height: 22px;
  margin-bottom: 10px;
  color: var(--toefl-words-muted);
  font-size: 0.86rem;
}

.toefl-words-list {
  display: grid;
  gap: 12px;
}

.toefl-saved-word {
  padding: 20px;
  border: 1px solid var(--toefl-words-line);
  border-radius: 15px;
  background: #fff;
}

.toefl-saved-word-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.toefl-saved-word-heading h3 {
  margin: 0;
  font-size: 1.35rem;
}

.toefl-saved-word-labels {
  justify-content: flex-start;
  margin-top: 8px;
}

.toefl-word-star {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--toefl-words-line);
  border-radius: 10px;
  background: #fff;
  color: #8a948e;
  cursor: pointer;
}

.toefl-word-star svg {
  width: 21px;
  fill: transparent;
  stroke: currentColor;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.toefl-word-star[aria-pressed="true"] {
  border-color: #d7ad4d;
  color: #c28d18;
}

.toefl-word-star[aria-pressed="true"] svg {
  fill: currentColor;
}

.toefl-saved-word-definition {
  margin: 16px 0;
  color: #435048;
  line-height: 1.55;
}

.toefl-saved-word label {
  display: grid;
  gap: 7px;
  color: var(--toefl-words-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.toefl-saved-word textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--toefl-words-line);
  border-radius: 10px;
  color: var(--toefl-words-ink);
  font: inherit;
  font-size: 0.94rem;
  line-height: 1.45;
  resize: vertical;
}

.toefl-saved-word-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 9px;
}

.toefl-saved-word-actions span {
  color: var(--toefl-words-muted);
  font-size: 0.82rem;
}

.toefl-words-list-empty {
  display: grid;
  justify-items: center;
  padding: 55px 20px;
  text-align: center;
}

.toefl-words-list-empty h3 {
  margin: 0 0 8px;
}

.toefl-words-list-empty p {
  margin: 0 0 20px;
  color: var(--toefl-words-muted);
}

.toefl-words-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 22px;
}

.toefl-words-pagination span {
  color: var(--toefl-words-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.toefl-words-page :focus-visible {
  outline: 3px solid rgba(40, 90, 67, 0.32);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .toefl-words-page {
    width: min(100% - 20px, 1040px);
    padding-top: 18px;
  }

  .toefl-words-hero,
  .toefl-words-list-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .toefl-words-hero,
  .toefl-words-panel {
    padding: 22px;
    border-radius: 18px;
  }

  .toefl-words-summary {
    gap: 7px;
  }

  .toefl-words-summary article {
    padding: 13px 10px;
  }

  .toefl-word-card {
    min-height: 350px;
    padding: 24px 18px;
  }

  .toefl-word-ratings > div {
    grid-template-columns: repeat(2, 1fr);
  }

  .toefl-word-self-review > div {
    grid-template-columns: 1fr;
  }

  .toefl-words-list-heading form,
  .toefl-words-list-heading input {
    width: 100%;
  }

  .toefl-words-list-heading form button {
    flex: 0 0 auto;
  }
}

@media (max-width: 420px) {
  .toefl-words-summary p {
    font-size: 0.73rem;
  }

  .toefl-words-summary span {
    font-size: 1.45rem;
  }

  .toefl-words-progress-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toefl-words-page *,
  .toefl-words-page *::before,
  .toefl-words-page *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
