*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cyan700: #1f637a;
  --cyan600: #2984a3;
  --cyan500: #34a5cb;
  --cyan200: #aedbea;
  --cyan100: #d6edf5;
  --cyan50: #ebf6fa;
  --green800: #304c1a;
  --green700: #487227;
  --green600: #609834;
  --green100: #e4f2d9;
  --green50: #f1f9ec;
  --red800: #4d1922;
  --red700: #732634;
  --red600: #9a3245;
  --red100: #f2d9dd;
  --red50: #f9ecee;
  --yellow800: #5f4707;
  --yellow700: #8f6a0a;
  --yellow600: #bf8e0d;
  --yellow100: #fcefcf;
  --yellow50: #fdf7e7;
  --cg800: #27383f;
  --cg700: #3b545e;
  --cg500: #628c9d;
  --cg400: #81a3b1;
  --cg300: #a1bac4;
  --cg200: #c0d1d8;
  --cg100: #e0e8eb;
  --cg50: #eff4f5;
  --gray900: #1a1a1a;
  --gray800: #333;
}

html,
body {
  font-family: "Work Sans", sans-serif;
  background: var(--cg50);
  color: var(--gray900);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button {
  font-family: "Work Sans", sans-serif;
  cursor: pointer;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--cg50);
  display: flex;
  flex-direction: column;
  position: relative;
}
.screen {
  display: none;
}
.screen.active {
  display: block;
}

#screen-home, #screen-exercise, #screen-complete {
  flex: 1;
  box-shadow: 0 0 15px rgba(0,0,0,.1);
}

footer {
  position: absolute;
  bottom: 8px;
  right: 24px;
  font-size: 10px;
  color: var(--cg500);
}
footer a {
  color: var(--cg700);
}
footer:hover {
  opacity: 1;
}
/* ── Difficulty label ── */
.difficulty-label {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 2px 7px;
  vertical-align: middle;
  position: relative;
  top: -2px;
}
.difficulty-label.d1 {
  background: var(--green50);
  color: var(--green700);
  border: 1px solid var(--green100);
}
.difficulty-label.d2 {
  background: var(--yellow50);
  color: var(--yellow700);
  border: 1px solid var(--yellow100);
}
.difficulty-label.d3 {
  background: var(--red50);
  color: var(--red700);
  border: 1px solid var(--red100);
}

/* ── Top bar ── */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid var(--cg100);
}
.wordmark {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray900);
}
.wordmark span {
  color: var(--cyan600);
}
.streak-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--cyan50);
  border: 1px solid var(--cyan200);
  border-radius: 20px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--cyan700);
}

/* ── Home ── */
.home-hero {
  padding: 2rem 1.5rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid var(--cg100);
}
.date-label {
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--cg500);
  margin-bottom: 0.75rem;
}
.hero-word-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}
.hero-word {
  font-family: "Libre Baskerville", serif;
  font-size: 40px;
  font-weight: 400;
  line-height: 1.1;
  color: var(--gray900);
}
.hero-pos {
  font-size: 13px;
  color: var(--cg500);
  font-style: italic;
  font-family: "Libre Baskerville", serif;
}

/* ── Hero definition toggle ── */
.hero-peek {
  margin-top: 0.75rem;
}
.hero-peek-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--cg400);
  font-family: "Work Sans", sans-serif;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}
.hero-peek-btn:hover {
  color: var(--cyan600);
}
.hero-peek-btn .peek-chevron {
  font-size: 9px;
  transition: transform 0.2s;
}
.hero-peek-btn.open .peek-chevron {
  transform: rotate(180deg);
}

.hero-peek-body {
  display: none;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--cg100);
}
.hero-peek-body.open {
  display: block;
}
.hero-peek-def {
  font-size: 13px;
  color: var(--gray800);
  font-weight: 300;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}
.hero-peek-example {
  font-size: 12px;
  color: var(--cg700);
  font-style: italic;
  font-family: "Libre Baskerville", serif;
  line-height: 1.6;
  border-left: 2px solid var(--cyan200);
  padding-left: 0.75rem;
}

.session-options {
  padding: 1.25rem 1.5rem 1rem;
}
.section-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cg400);
  margin-bottom: 0.6rem;
  font-weight: 500;
}

.session-btn {
  background: #fff;
  border: 1px solid var(--cg200);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  text-align: left;
  width: 100%;
  display: block;
  margin-bottom: 0.6rem;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.session-btn:hover {
  border-color: var(--cyan600);
  background: var(--cyan50);
}
.session-btn:active {
  background: var(--cyan100);
}
.session-btn-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}
.session-btn-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray900);
}
.session-btn-badge {
  font-size: 11px;
  color: var(--cyan700);
  font-family: monospace;
}
.session-btn-desc {
  font-size: 12px;
  color: var(--cg500);
  font-weight: 300;
}

.stats-row {
  display: flex;
  gap: 0.6rem;
  padding: 0 1.5rem 1.5rem;
}
.stat-card {
  flex: 1;
  background: #fff;
  border: 1px solid var(--cg100);
  border-radius: 8px;
  padding: 0.75rem 0.875rem;
}
.stat-num {
  font-family: "Libre Baskerville", serif;
  font-size: 24px;
  font-weight: 400;
  color: var(--gray900);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 10px;
  color: var(--cg500);
  letter-spacing: 0.04em;
  font-weight: 300;
}

/* ── Exercise ── */
.exercise-header {
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--cg100);
}
.back-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--cg700);
  padding: 0;
  font-family: "Work Sans", sans-serif;
}
.back-btn:hover {
  color: var(--gray900);
}

.progress-track {
  display: flex;
  gap: 3px;
}
.progress-dot {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: var(--cg200);
  transition: background 0.25s;
}
.progress-dot.done {
  background: var(--cyan700);
}
.progress-dot.active {
  background: var(--cyan500);
}

.exercise-body {
  padding: 1.5rem 1.5rem 1.25rem;
}
.exercise-type-tag {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan700);
  margin-bottom: 1rem;
  font-weight: 600;
}

/* Word row in exercise — word + difficulty label inline */
.exercise-word-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.2rem;
  flex-wrap: wrap;
}
.exercise-word {
  font-family: "Libre Baskerville", serif;
  font-size: 30px;
  font-weight: 400;
  color: var(--gray900);
}
.exercise-pos {
  font-size: 12px;
  color: var(--cg500);
  font-style: italic;
  font-family: "Libre Baskerville", serif;
  margin-bottom: 1.25rem;
}

.definition-card {
  background: #fff;
  border: 1px solid var(--cg200);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.definition-text {
  font-size: 15px;
  line-height: 1.65;
  color: var(--gray900);
  margin-bottom: 1rem;
  font-weight: 300;
}
.example-text {
  font-size: 13px;
  color: var(--cg700);
  font-style: italic;
  font-family: "Libre Baskerville", serif;
  line-height: 1.7;
  border-left: 2px solid var(--cyan200);
  padding-left: 0.875rem;
}

.etymology-box {
  background: var(--cyan50);
  border: 1px solid var(--cyan200);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.etymology-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan700);
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.etymology-root {
  font-family: "Libre Baskerville", serif;
  font-size: 16px;
  font-style: italic;
  color: var(--gray900);
  margin-bottom: 0.35rem;
}
.etymology-note {
  font-size: 12px;
  color: var(--cg700);
  line-height: 1.6;
  font-weight: 300;
}

.question-text {
  font-size: 13px;
  color: var(--cg700);
  margin-bottom: 1rem;
  font-weight: 300;
}

/* ── Options ── */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.options-single {
  grid-template-columns: 1fr;
}

.option-btn {
  background: #fff;
  border: 1px solid var(--cg200);
  border-radius: 6px;
  padding: 0.7rem 0.875rem;
  font-size: 14px;
  font-family: "Work Sans", sans-serif;
  color: var(--gray900);
  text-align: center;
  font-weight: 400;
  line-height: 1.3;
  transition:
    border-color 0.12s,
    background 0.12s;
}
.option-btn:hover:not(:disabled) {
  border-color: var(--cyan600);
  background: var(--cyan50);
}
.option-btn.selected-correct {
  background: var(--green100);
  border-color: var(--green600);
  color: var(--green800);
  font-weight: 500;
}
.option-btn.selected-wrong {
  background: var(--red100);
  border-color: var(--red600);
  color: var(--red800);
}
.option-btn.reveal-correct {
  background: var(--green50);
  border-color: var(--green600);
  color: var(--green800);
  font-weight: 500;
}
.option-btn:disabled {
  cursor: default;
}

/* ── Feedback — icon only ── */
.feedback-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  padding: 0.5rem 0;
  margin-bottom: 0.75rem;
  background: none;
  border: none;
}
.feedback-line .fb-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.feedback-line.correct {
  color: var(--green700);
}
.feedback-line.correct .fb-icon {
  background: var(--green600);
  color: #fff;
}
.feedback-line.wrong {
  color: var(--red700);
}
.feedback-line.wrong .fb-icon {
  background: var(--red600);
  color: #fff;
}

/* ── Fill in blank ── */
.fitb-sentence {
  font-size: 14px;
  color: var(--cg700);
  line-height: 1.75;
  font-style: italic;
  font-family: "Libre Baskerville", serif;
  margin-bottom: 1rem;
  padding: 1rem 1.125rem;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--cg200);
}
.blank-span {
  display: inline-block;
  min-width: 72px;
  border-bottom: 1.5px solid var(--cyan600);
  margin: 0 2px;
  vertical-align: bottom;
  color: transparent;
}
.fitb-input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--cg200);
  border-radius: 6px;
  font-size: 14px;
  font-family: "Work Sans", sans-serif;
  background: #fff;
  color: var(--gray900);
  outline: none;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s;
}
.fitb-input:focus {
  border-color: var(--cyan500);
}

/* ── Buttons ── */
.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.primary-btn {
  width: 100%;
  padding: 0.8rem;
  background: var(--cyan700);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-family: "Work Sans", sans-serif;
  font-weight: 500;
  transition:
    background 0.15s,
    transform 0.1s;
  letter-spacing: 0.01em;
}
.primary-btn:hover {
  background: var(--cyan600);
  color: #fff;
}
.primary-btn:active {
  transform: scale(0.99);
}
.primary-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.secondary-btn {
  width: 100%;
  padding: 0.8rem;
  background: transparent;
  color: var(--cg700);
  border: 1px solid var(--cg200);
  border-radius: 6px;
  font-size: 14px;
  font-family: "Work Sans", sans-serif;
  font-weight: 400;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.secondary-btn:hover {
  background: #fff;
  border-color: var(--cyan600);
  color: var(--gray900);
}

/* ── Complete ── */
.complete-screen {
  padding: 2rem 1.5rem;
  text-align: center;
}
.complete-icon {
  width: 52px;
  height: 52px;
  background: var(--cyan50);
  border: 1px solid var(--cyan200);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 20px;
  color: var(--cyan700);
}
.complete-title {
  font-family: "Libre Baskerville", serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--gray900);
  margin-bottom: 0.4rem;
}
.complete-subtitle {
  font-size: 13px;
  color: var(--cg500);
  margin-bottom: 1.5rem;
  line-height: 1.6;
  font-weight: 300;
}

.review-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid var(--cg200);
  border-radius: 8px;
  margin-bottom: 1rem;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray900);
  width: 100%;
  transition: border-color 0.15s;
}
.review-toggle:hover {
  border-color: var(--cyan600);
}
.review-toggle-chevron {
  font-size: 10px;
  color: var(--cg400);
  transition: transform 0.2s;
}
.review-toggle.open .review-toggle-chevron {
  transform: rotate(180deg);
}

.review-list {
  display: none;
  margin-bottom: 1.25rem;
  text-align: left;
}
.review-list.open {
  display: block;
}

.review-word-block {
  background: #fff;
  border: 1px solid var(--cg100);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.review-word-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--cg100);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.review-word-name {
  font-family: "Libre Baskerville", serif;
  font-size: 16px;
  color: var(--gray900);
}
.review-word-pos {
  font-size: 11px;
  color: var(--cg500);
  font-style: italic;
  font-family: "Libre Baskerville", serif;
}

.review-exercises {
  padding: 0.5rem 0;
}
.review-exercise-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--cg100);
}
.review-exercise-row:last-child {
  border-bottom: none;
}

.review-result-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}
.review-result-icon.correct {
  background: var(--green600);
  color: #fff;
}
.review-result-icon.wrong {
  background: var(--red600);
  color: #fff;
}
.review-result-icon.neutral {
  background: var(--cg200);
  color: var(--cg700);
  font-size: 9px;
}

.review-exercise-detail {
  flex: 1;
}
.review-exercise-type {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cg400);
  font-weight: 500;
  margin-bottom: 2px;
}
.review-exercise-answer {
  font-size: 13px;
  color: var(--gray900);
  line-height: 1.45;
}
.review-exercise-answer .correct-ans {
  color: var(--green700);
  font-weight: 500;
}
.review-exercise-answer .wrong-ans {
  color: var(--red700);
  text-decoration: line-through;
  margin-right: 4px;
}

/* ── How to play modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 30, 0.5);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.5rem 1.5rem 2.5rem;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.modal-title {
  font-family: "Libre Baskerville", serif;
  font-size: 20px;
  font-weight: 400;
  color: var(--gray900);
}
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--cg400);
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.modal-close:hover {
  color: var(--gray900);
}

.modal-intro {
  font-size: 14px;
  color: var(--cg700);
  line-height: 1.7;
  font-weight: 300;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--cg100);
}
.modal-intro strong {
  font-weight: 500;
  color: var(--gray900);
}

.modal-section-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cg400);
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.modal-sessions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.modal-session-card {
  flex: 1;
  background: var(--cg50);
  border: 1px solid var(--cg100);
  border-radius: 8px;
  padding: 0.875rem 1rem;
}
.modal-session-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray900);
  margin-bottom: 2px;
}
.modal-session-desc {
  font-size: 12px;
  color: var(--cg500);
  font-weight: 300;
  line-height: 1.5;
}

.modal-exercises {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}
.modal-exercise-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: var(--cg50);
  border-radius: 6px;
}
.modal-exercise-tag {
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--cyan700);
  font-weight: 600;
  white-space: nowrap;
  min-width: 80px;
}
.modal-exercise-desc {
  font-size: 13px;
  color: var(--cg700);
  font-weight: 300;
  line-height: 1.5;
}

.modal-footer {
  font-size: 12px;
  color: var(--cg400);
  text-align: center;
  font-style: italic;
  font-family: "Libre Baskerville", serif;
}

/* How to play link in top bar */
.htp-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--cg400);
  font-family: "Work Sans", sans-serif;
  font-weight: 400;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: color 0.15s;
}
.htp-btn:hover {
  color: var(--cyan600);
}