:root {
  color-scheme: light;
  --page: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-solid: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(29, 29, 31, 0.12);
  --line-strong: rgba(29, 29, 31, 0.22);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --warm: #ff6b4a;
  --green: #248a3d;
  --red: #b83b20;
  --radius: 8px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.10);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
  background: var(--page);
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

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

.page-shell {
  min-height: 100vh;
  padding: 18px clamp(16px, 4vw, 40px) 32px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 10px 0 18px;
  background: rgba(245, 245, 247, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 4px;
  border: 0;
  border-radius: var(--radius);
  color: var(--text);
  background: transparent;
  text-align: left;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.2;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.quiet-button,
.ghost-button,
.choice,
.main-button,
.icon-button,
.segment-option {
  min-height: 38px;
  border-radius: var(--radius);
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.quiet-button,
.ghost-button,
.choice,
.icon-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.64);
}

.quiet-button {
  padding: 0 12px;
}

.quiet-button:hover,
.ghost-button:hover,
.icon-button:hover {
  background: var(--surface-solid);
}

.quiet-button:active,
.ghost-button:active,
.choice:active,
.main-button:active,
.icon-button:active {
  transform: scale(0.98);
}

.focus-shell {
  width: min(780px, 100%);
  min-height: calc(100vh - 110px);
  display: grid;
  align-content: center;
  gap: 14px;
  margin: 0 auto;
  padding: 18px 0 46px;
}

.micro-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.study-card {
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.source-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.source-line span:first-child {
  padding: 4px 8px;
  border: 1px solid rgba(0, 113, 227, 0.18);
  border-radius: var(--radius);
  color: var(--accent);
  background: var(--accent-soft);
}

.quote-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
  margin: clamp(28px, 6vw, 58px) 0 14px;
  color: var(--text);
}

.word-button,
.punct {
  display: inline;
  font-size: clamp(30px, 5.2vw, 56px);
  font-weight: 700;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.word-button {
  padding: 0 2px;
  margin-right: .18em;
  border: 0;
  border-radius: var(--radius);
  color: var(--text);
  background: transparent;
}

.word-button.tight-next {
  margin-right: 0;
}

.punct {
  margin-right: .18em;
}

.word-button:hover,
.word-button:focus-visible {
  color: var(--accent);
  background: var(--accent-soft);
  outline: 0;
}

.source-detail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.listen-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.64);
}

.word-popover {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(0, 113, 227, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
}

.word-popover div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.word-popover strong {
  font-size: 18px;
}

.word-popover small,
.word-popover em,
.word-popover b {
  color: var(--muted);
  font-style: normal;
}

.word-popover b {
  font-weight: 500;
}

.word-popover p {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.step-dots {
  display: flex;
  gap: 7px;
  margin: clamp(28px, 5vw, 48px) 0 18px;
}

.step-dots span {
  width: 28px;
  height: 4px;
  border-radius: var(--radius);
  background: rgba(29, 29, 31, 0.14);
}

.step-dots span.active {
  background: var(--text);
}

.learning-step {
  min-height: 236px;
}

.prompt {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 15px;
}

.choice-stack {
  display: grid;
  gap: 10px;
}

.choice {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  text-align: left;
  font-size: 16px;
}

.choice.correct {
  border-color: rgba(36, 138, 61, 0.34);
  color: var(--green);
  background: rgba(36, 138, 61, 0.1);
}

.choice.wrong {
  border-color: rgba(255, 107, 74, 0.38);
  color: var(--red);
  background: rgba(255, 107, 74, 0.12);
}

.hint {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.big-meaning {
  max-width: 720px;
  margin: 0 0 22px;
  font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 650;
  line-height: 1.25;
}

.expression-list {
  display: grid;
  gap: 14px;
}

.expression-line {
  display: grid;
  gap: 5px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.expression-line strong {
  font-size: 18px;
}

.expression-line span {
  color: var(--muted);
}

.expression-line em {
  color: #3a3a3c;
  font-style: normal;
  line-height: 1.5;
}

.practice-task {
  margin: 0 0 14px;
  font-size: clamp(22px, 3vw, 31px);
  font-weight: 650;
  line-height: 1.28;
}

.challenge-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.challenge-head span {
  color: var(--muted);
  font-size: 12px;
}

.capsule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 10px;
}

.capsule-card {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.64);
  text-align: left;
  line-height: 1.35;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.capsule-card:hover {
  background: var(--surface-solid);
}

.capsule-card:active {
  transform: scale(0.98);
}

.capsule-card.selected {
  border-color: rgba(0, 113, 227, 0.44);
  background: var(--accent-soft);
  color: var(--accent);
}

.capsule-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.capsule-card strong {
  font-size: 19px;
  line-height: 1.2;
}

.capsule-card em {
  color: var(--muted);
  font-style: normal;
  line-height: 1.45;
}

.capsule-result {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(0, 113, 227, 0.18);
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.capsule-result span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.capsule-result strong {
  font-size: 16px;
}

.capsule-result p {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.25;
}

.bottom-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.ghost-button {
  padding: 0 13px;
  color: var(--muted);
}

.main-button {
  min-width: 142px;
  padding: 0 18px;
  border: 0;
  color: #ffffff;
  background: var(--accent);
}

.quiet {
  color: var(--muted);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(245, 245, 247, 0.76);
  backdrop-filter: blur(20px);
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  width: min(460px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.modal h2 {
  margin: 0;
  font-size: 26px;
}

.icon-button {
  width: 38px;
  height: 38px;
  font-size: 24px;
  line-height: 1;
}

.segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(29, 29, 31, 0.06);
}

.segment-option {
  border: 0;
  color: var(--muted);
  background: transparent;
}

.segment-option.active {
  color: var(--text);
  background: #ffffff;
}

.account-form {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

.account-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.account-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: rgba(255, 255, 255, 0.76);
}

.account-form input:focus {
  border-color: rgba(0, 113, 227, 0.5);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.primary-button {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--accent);
}

.form-note {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .page-shell {
    padding: 10px 12px 22px;
  }

  .topbar {
    padding-bottom: 10px;
  }

  .brand small {
    display: none;
  }

  .top-actions {
    gap: 6px;
  }

  .quiet-button {
    padding: 0 10px;
  }

  .focus-shell {
    min-height: calc(100vh - 82px);
    align-content: start;
    padding-top: 24px;
  }

  .study-card {
    padding: 22px 16px;
  }

  .word-button,
  .punct {
    font-size: 32px;
  }

  .learning-step {
    min-height: 220px;
  }

  .bottom-actions {
    justify-content: stretch;
  }

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

  .ghost-button,
  .main-button {
    flex: 1 1 auto;
  }
}
