.typing-stage {
  position: relative;
  height: 116px;
  overflow: hidden;
  border: 1px solid #e8e8e1;
  border-radius: 6px;
  background: #fcfcfa;
  transition: border-color .2s, box-shadow .2s;
}

.quote-card {
  height: auto;
  min-height: 267px;
}

.quote-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.speech-controls {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px 0 20px;
}

.speech-button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #c8d7cd;
  border-radius: 8px;
  background: rgba(255, 255, 255, .75);
  color: var(--green);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.speech-button:hover { background: #fff; }
.speech-button:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.speech-button[aria-pressed="true"] { background: var(--green); color: #fff; }
.speech-button:disabled { opacity: .55; cursor: default; }
.speech-status { font-size: 11px; color: #58685c; line-height: 1.5; }
.speech-rate { font-size: .85em; opacity: .8; }
.sentence-source { border-top: 1px solid #d4ded3; padding-top: 12px; }
.sentence-source summary { cursor: pointer; color: #536257; font-size: 12px; line-height: 1.6; }
.sentence-source summary:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
.sentence-source .quote-footer { margin-top: 12px; }

.difficulty-pill {
  padding: 7px 9px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .65);
  color: #8a654f;
  font-size: 9px;
  font-weight: 700;
}

.quote-footer {
  align-items: flex-start;
}

.content-mode {
  max-width: 720px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid #e7d9c1;
  border-radius: 8px;
  background: #fbf7ef;
  color: #785d38;
  font-size: 11px;
  line-height: 1.55;
}

.content-gate {
  grid-column: 1 / -1;
  min-height: 300px;
  padding: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}

.content-gate > span {
  color: var(--orange);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.1px;
}

.content-gate h2 {
  margin: 15px 0 8px;
  font: 600 25px/1.3 var(--serif);
}

.content-gate p {
  max-width: 580px;
  color: #72766e;
  line-height: 1.7;
}

.source-license-notice:not([hidden]),
.source-terms-copy {
  display: block;
}

.source-license-notice {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f4f4f1;
}

.source-terms-copy {
  margin: 0;
  color: #73766e;
  font: 9px/1.5 var(--sans);
  overflow-wrap: anywhere;
}

.source-terms-copy a {
  color: var(--green);
}

.calendar-detail .source-terms-copy {
  margin-top: 8px;
  padding: 8px;
  background: #f4f4f1;
}

.author-details {
  display: grid;
  gap: 3px;
  min-width: 0;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .content-gate {
    min-height: 0;
    padding: 28px 22px;
  }

  .content-gate h2 {
    font-size: 21px;
  }
}

.author-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 5px;
  color: #536257;
  font-size: 11px;
  font-weight: 600;
}

.author-bio {
  max-width: 680px;
  color: #778078;
  font-size: 9px;
  font-weight: 400;
  line-height: 1.55;
}

.author-primary .quote-source {
  font-size: 9px;
}

.quote-source {
  text-decoration: none;
}

.quote-source:hover,
.calendar-detail a:hover {
  color: var(--green);
  text-decoration: underline;
}

.calendar-detail a {
  color: inherit;
  text-decoration: none;
}

.typing-stage:focus-within {
  border-color: #94ae9b;
  box-shadow: 0 0 0 2px rgba(54, 94, 74, .08);
}

.typing-guide,
.typing-stage textarea {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 12px 13px;
  border: 0;
  border-radius: 0;
  font: 14px/1.7 var(--serif);
  letter-spacing: normal;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  tab-size: 4;
}

.typing-guide {
  z-index: 1;
  overflow: hidden;
  color: #aeb1a9;
  pointer-events: none;
}

.typing-guide-content {
  min-height: 100%;
  width: 100%;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  will-change: transform;
}

.typed-remaining {
  color: #aeb1a9;
}

.typed-match {
  color: #20251f;
}

.typed-mismatch {
  color: #c26e51;
  text-decoration: underline;
  text-decoration-color: rgba(194, 110, 81, .45);
  text-underline-offset: 3px;
}

.typing-status {
  display: none;
  margin: 8px 1px 0;
  font-size: 10px;
  line-height: 1.5;
}

.typing-status.is-visible {
  display: block;
}

.typing-status.success {
  color: #3c694e;
}

.typing-status.error {
  color: #b26347;
}

.typing-status.practice {
  color: #81867d;
}

.typing-stage textarea {
  z-index: 2;
  resize: none;
  overflow: auto;
  outline: none;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: #20251f;
  appearance: none;
  -webkit-appearance: none;
}

.typing-stage textarea:focus {
  border: 0;
}

@media (max-width: 760px) {
  .quote-card {
    min-height: 240px;
  }

  .author-bio {
    max-width: 290px;
  }

  .typing-stage {
    height: 122px;
  }
}

@media (max-width: 390px) {
  .quote-card {
    min-height: 225px;
  }
}

.daily-assignment-note {
  margin: 13px 0 0;
  color: #96988e;
  font-size: 10px;
  line-height: 1.6;
}

.calendar-card {
  margin: 14px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}

.calendar-heading,
.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.calendar-heading h2 {
  font-size: 16px;
}

.calendar-heading p {
  margin: 6px 0 0;
  color: #85887f;
  font-size: 11px;
  line-height: 1.6;
}

.calendar-controls strong {
  min-width: 90px;
  color: #53594f;
  font-size: 12px;
  text-align: center;
}

.calendar-controls button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--green);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.calendar-weekdays {
  margin-top: 20px;
  color: #96988e;
  font-size: 10px;
  text-align: center;
}

.calendar-grid {
  margin-top: 8px;
}

.calendar-day {
  position: relative;
  min-width: 0;
  min-height: 52px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #f7f7f3;
  color: #4f554c;
  font: 500 11px var(--sans);
  cursor: pointer;
}

.calendar-day:hover,
.calendar-day.selected {
  border-color: #91aa96;
  background: #edf2ec;
}

.calendar-day.today > span {
  color: var(--green);
  font-weight: 700;
}

.calendar-day.outside-month {
  color: #b7b8b1;
  background: #fbfbf9;
}

.calendar-day i {
  position: absolute;
  right: 5px;
  bottom: 3px;
  color: #fff;
  font-size: 9px;
  font-style: normal;
}

.calendar-day.completed {
  background: #55745d;
  color: #fff;
}

.calendar-day.completed:hover,
.calendar-day.completed.selected {
  border-color: #314d3a;
  background: #45654e;
}

.calendar-day.in_progress {
  background: #f5eadb;
  color: #845b31;
}

.calendar-day.in_progress i {
  color: #aa7843;
  font-size: 17px;
  line-height: .6;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  color: #83867d;
  font-size: 10px;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.calendar-legend i {
  display: inline-grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 5px;
  font-size: 10px;
  font-style: normal;
}

.completed-dot {
  color: #fff;
  background: #55745d;
}

.progress-dot {
  color: #845b31;
  background: #f5eadb;
}

.today-dot {
  border: 1px solid #91aa96;
  background: #edf2ec;
}

.calendar-detail {
  margin-bottom: 13px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.calendar-detail-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #60665d;
  font-size: 11px;
}

.record-status {
  color: #85887f;
  font-size: 10px;
}

.record-status.completed {
  color: #3c694e;
}

.record-status.in_progress {
  color: #a16c33;
}

.calendar-detail blockquote {
  max-width: none;
  margin: 16px 0 9px;
  color: #354a39;
  font: 500 20px/1.45 var(--serif);
}

.calendar-detail p {
  margin: 5px 0 0;
  color: #85887f;
  font-size: 10px;
  line-height: 1.6;
}

.calendar-detail .calendar-translation {
  color: #51584f;
  font-size: 12px;
}

.calendar-detail .check-button {
  margin-top: 14px;
}

.storage-note h2 {
  font-size: 12px;
}

.storage-note p {
  margin-bottom: 0;
}

@media (max-width: 760px) {
  .calendar-card {
    padding: 15px 12px;
  }

  .calendar-heading {
    align-items: flex-start;
  }

  .calendar-controls {
    gap: 5px;
  }

  .calendar-controls strong {
    min-width: 68px;
    font-size: 10px;
  }

  .calendar-controls button {
    width: 36px;
    height: 36px;
  }

  .calendar-weekdays,
  .calendar-grid {
    gap: 3px;
  }

  .calendar-day {
    min-height: 44px;
    border-radius: 5px;
    font-size: 10px;
  }

  .calendar-day i {
    right: 3px;
    bottom: 1px;
  }

  .calendar-legend {
    gap: 9px;
    font-size: 9px;
  }

  .calendar-detail {
    padding: 17px 15px;
  }

  .calendar-detail blockquote {
    font-size: 18px;
  }

  .daily-assignment-note {
    font-size: 9px;
  }

  .saved-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 390px) {
  .calendar-heading {
    flex-direction: column;
  }

  .calendar-controls {
    align-self: stretch;
    justify-content: flex-end;
  }

  .calendar-day {
    min-height: 44px;
  }
}

.install-button {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid #dfe5dc;
  border-radius: 7px;
  background: #fff;
  color: var(--green);
  font: 600 10px var(--sans);
  cursor: pointer;
}

.install-button:hover {
  border-color: #aabcae;
  background: #f6f8f5;
}

.install-button[hidden] {
  display: none;
}

.install-dialog {
  width: min(390px, calc(100vw - 32px));
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 24px 70px rgba(30, 40, 32, .18);
}

.install-dialog::backdrop {
  background: rgba(24, 32, 25, .36);
  backdrop-filter: blur(2px);
}

.install-dialog form {
  position: relative;
}

.install-dialog .eyebrow {
  margin: 0 0 10px;
}

.install-dialog h2 {
  margin: 0 30px 10px 0;
  font-size: 18px;
}

.install-dialog p:not(.eyebrow) {
  margin: 0 0 20px;
  color: #777d74;
  font-size: 13px;
  line-height: 1.7;
}

.install-dialog .check-button {
  min-height: 42px;
  font-size: 12px;
}

.brand-mark {
  font: 700 10px var(--sans);
  letter-spacing: -.4px;
}

.brand-name {
  font-size: 17px;
  letter-spacing: -.7px;
}

.dialog-close {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: #72776f;
  background: #f3f4f0;
  font-size: 22px;
  cursor: pointer;
}

@media (max-width: 760px) {
  .sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 20;
    width: 100%;
    height: auto;
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid rgba(224, 224, 215, .92);
    background: rgba(251, 250, 247, .96);
    box-shadow: 0 -5px 20px rgba(35, 43, 35, .04);
    backdrop-filter: blur(14px);
  }

  .brand,
  .side-label,
  .sidebar-bottom {
    display: none;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
    width: min(540px, 100%);
    margin: 0 auto;
  }

  .nav-item {
    display: flex;
    min-width: 0;
    min-height: 52px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 3px;
    border-radius: 8px;
    text-align: center;
    font-size: 10px;
    line-height: 1.25;
  }

  .nav-icon {
    width: auto;
    font-size: 19px;
    line-height: 1;
  }

  .nav-label {
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .main-content {
    padding-bottom: calc(79px + env(safe-area-inset-bottom));
  }

  .topbar-right {
    gap: 9px;
  }

  .install-button {
    min-height: 34px;
    padding: 0 9px;
    font-size: 9px;
  }

  .typing-stage textarea,
  .typing-guide {
    font-size: 16px;
  }

  .typing-stage textarea {
    -webkit-text-size-adjust: 100%;
  }
}

@media (max-width: 390px) {
  .streak {
    display: none;
  }

  .main-content {
    padding-bottom: calc(75px + env(safe-area-inset-bottom));
  }
}

/* Account sheet: usable with a mobile keyboard and long email addresses. */
.account-dialog { width: min(440px, calc(100% - 32px)); max-height: 85dvh; overflow: auto; border: 1px solid #e6e6df; border-radius: 20px; padding: 28px; color: #252a26; }
.account-dialog::backdrop { background: #172b2466; }
.account-dialog h2 { margin: 12px 0; }
.account-dialog p { line-height: 1.7; overflow-wrap: anywhere; }
.account-dialog form { margin-top: 20px; }
.account-dialog [hidden] { display: none !important; }
.account-dialog label { display: block; margin-bottom: 8px; }
.account-dialog input { box-sizing: border-box; width: 100%; min-height: 48px; border: 1px solid #b8c7bc; border-radius: 8px; padding: 12px; font: inherit; font-size: 16px; margin-bottom: 12px; }
.account-dialog button { min-height: 44px; }
.account-dialog .dialog-close { float: right; }
.account-dialog .account-note { font-size: 12px; color: #68736d; margin-top: 24px; }
.account-dialog button:disabled { opacity: .55; cursor: wait; }
.account-dialog .danger-button { display: block; margin-top: 18px; border: 0; background: transparent; color: #9b332b; font: inherit; text-decoration: underline; cursor: pointer; }
[hidden] { display: none !important; }

/* Mobile learning: prioritize the sentence, playback and writing. */
@media (max-width: 760px) {
  body { -webkit-text-size-adjust: 100%; }
  .main-content { padding: 0 16px calc(94px + env(safe-area-inset-bottom)); }
  .topbar { min-height: 64px; height: auto; gap: 12px; }
  .breadcrumb { font-size: 11px; letter-spacing: .2px; }
  .breadcrumb > span { padding: 0 5px; }
  .breadcrumb { color: #626b60; }
  .topbar-right { gap: 8px; }
  .streak { font-size: 12px; white-space: nowrap; }
  .install-button { min-height: 44px; font-size: 12px; padding: 0 12px; }
  .page-heading { display: block; padding: 24px 0 20px; }
  .eyebrow { font-size: 10px; color: #70786d; }
  .page-heading h1 { font-size: 30px; line-height: 1.3; }
  .subtitle { max-width: none; font-size: 14px; line-height: 1.65; color: #626b60; }
  .daily-progress { width: 100%; margin: 16px 0 0; }
  .progress-copy { font-size: 12px; color: #626b60; }
  .progress-track { height: 5px; }
  .quote-card { min-height: 0; padding: 20px; border-radius: 16px; }
  .quote-card::after { pointer-events: none; }
  .quote-meta { flex-wrap: wrap; }
  .category-pill, .difficulty-pill { font-size: 11px; padding: 8px 10px; }
  .save-button { width: 44px; height: 44px; font-size: 28px; }
  .quote-number { position: static; margin-top: 14px; color: #657361; font-size: 11px; }
  .quote-card blockquote { margin: 12px 0 22px; font-family: Georgia, var(--serif); font-size: 26px; line-height: 1.45; letter-spacing: -.35px; overflow-wrap: break-word; }
  .speech-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 18px; }
  .speech-button { min-height: 48px; padding: 12px 8px; font-size: 14px; font-weight: 600; border-radius: 10px; }
  #listen-button { background: var(--green); color: #fff; border-color: var(--green); }
  #listen-button:hover { background: #284c39; }
  #listen-stop-button { grid-column: 1 / -1; }
  .speech-status { grid-column: 1 / -1; font-size: 13px; color: #4c5e50; }
  .speech-status:empty { display: none; }
  .sentence-source summary { min-height: 36px; padding: 8px 0; font-size: 13px; }
  .quote-footer { font-size: 13px; line-height: 1.7; }
  .author-primary .quote-source, .author-bio, .source-license-notice { font-size: 12px; line-height: 1.75; color: #596553; }
  .author-bio { max-width: none; }
  .practice-card { margin-top: 16px; padding: 20px 16px; border-radius: 16px; }
  .section-title { gap: 8px; }
  .section-title h2 { font-size: 16px; }
  .step-number { font-size: 12px; }
  .text-button { min-height: 44px; padding: 8px 0 8px 8px; font-size: 13px; color: #556550; }
  .practice-instruction { font-size: 14px; line-height: 1.7; color: #626b60; margin: 8px 0 14px; }
  .typing-stage { height: 168px; border-color: #ccd4c9; border-radius: 10px; }
  .typing-stage textarea, .typing-guide { padding: 14px; font: 18px/1.75 Georgia, var(--serif); }
  .typed-remaining, .typing-guide { color: #747f72; }
  .typing-status, .feedback { font-size: 13px; line-height: 1.7; }
  .practice-bottom { flex-wrap: wrap; gap: 12px; }
  .typing-tip { font-size: 12px; max-width: none; color: #65705e; }
  .check-button { width: 100%; min-height: 48px; font-size: 14px; border-radius: 10px; }
  .insight-grid { margin-top: 16px; gap: 12px; }
  .insight-card, .vocab-card { padding: 20px 16px; border-radius: 14px; }
  .insight-heading { font-size: 12px; color: #626b60; }
  .insight-card p { font-size: 15px; line-height: 1.8; color: #384535; }
  .vocab-item { font-size: 13px; line-height: 1.7; padding: 9px 10px; }
  .vocab-item strong { font-size: 15px; }
  .daily-assignment-note { font-size: 12px; line-height: 1.7; color: #67725f; }
  .nav-item { min-height: 60px; font-size: 12px; gap: 5px; }
  .nav-icon { font-size: 22px; }
  .content-gate { padding: 28px 20px; min-height: 0; }
  .content-gate p { font-size: 14px; line-height: 1.75; }
  .page-footer { font-size: 10px; gap: 10px; line-height: 1.6; }
}

@media (max-width: 390px) {
  .breadcrumb { font-size: 10px; }
  .quote-card { padding: 18px; }
  .quote-card blockquote { font-size: 24px; }
  .install-button { padding: 0 9px; }
}
