* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #f6f7fb;
  color: #252439;
  font:
    16px/1.6 system-ui,
    -apple-system,
    sans-serif;
}
header {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e4e4ed;
  padding: 0 6%;
}
.brand {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -1px;
  text-decoration: none;
  color: inherit;
}
.brand span {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  margin-left: 20px;
  color: #777385;
}
.tag,
.eyebrow {
  font-size: 12px;
  letter-spacing: 2px;
  color: #776683;
}
.tag {
  background: #eeebf4;
  padding: 7px 11px;
  border-radius: 7px;
}
main {
  max-width: 1400px;
  margin: auto;
  padding: 36px 5% 60px;
}
.intro {
  margin-bottom: 30px;
}
.intro h1 {
  font-size: 44px;
  line-height: 1.25;
  margin: 12px 0;
  letter-spacing: -2px;
}
.intro em {
  font-style: normal;
  color: #ae426c;
}
.intro > p:last-child {
  color: #777385;
}
.layout {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 24px;
  align-items: start;
}
.card {
  background: white;
  border: 1px solid #e6e5ef;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 5px 20px #29244404;
}
.heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
h2 {
  font-size: 19px;
  margin: 0 0 16px;
}
.heading h2 {
  margin: 0 0 14px;
}
.eyebrow {
  margin: 0 0 8px;
}
label {
  display: block;
  font-size: 14px;
  color: #6b6578;
  margin: 12px 0 6px;
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid #dddbe7;
  border-radius: 9px;
  background: #fcfbfe;
  color: #30283e;
  padding: 11px;
  font: inherit;
  font-size: 15px;
}
textarea {
  height: 250px;
  resize: vertical;
  line-height: 1.65;
}
button {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 17px;
  border: 1px solid #dfdce9;
  background: white;
  border-radius: 9px;
  color: #494054;
  cursor: pointer;
}
button:hover {
  background: #f6edf3;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
.primary {
  background: #a63e69;
  color: white;
  border-color: #a63e69;
}
.primary:hover {
  background: #8e3158;
}
.wide {
  width: 100%;
  margin-top: 14px;
}
.link {
  border: 0;
  color: #a63e69;
  padding: 5px;
  background: transparent;
}
.hint {
  font-size: 13px;
  color: #81798a;
}
.library {
  margin-top: 18px;
}
.library-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding: 10px 0;
  gap: 8px;
}
.library-row button:first-child {
  flex: 1;
  text-align: left;
  border: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  background: transparent;
}
.settings {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 3px 16px;
  margin-top: 12px;
}
.player {
  background: #f8f4f8;
  padding: 22px;
  border-radius: 12px;
  margin: 24px 0;
}
.transport {
  display: flex;
  gap: 12px;
  justify-content: center;
}
#status {
  font-size: 14px;
  text-align: center;
  color: #8d526f;
  margin: 14px 0 8px;
}
progress {
  height: 5px;
  width: 100%;
  accent-color: #aa426e;
}
.sentence {
  display: flex;
  gap: 17px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  padding: 19px 15px;
  border-radius: 10px;
  font-weight: 400;
  line-height: 1.8;
  font-size: 19px;
}
.sentence-number {
  font-size: 12px;
  color: #999;
  min-width: 22px;
  padding-top: 6px;
}
.sentence.active {
  background: #f9eaf1;
  border-color: #efd4e1;
  color: #7d244a;
}
.sentences {
  max-height: 520px;
  overflow: auto;
}
.empty {
  text-align: center;
  padding: 30px 25px 50px;
  color: #817789;
}
.empty > span {
  font: 90px Georgia;
  color: #d6a1b8;
  line-height: 1;
}
.empty h3 {
  color: #51435d;
}
.footer {
  border-top: 1px solid #eee;
  padding-top: 18px;
  margin-bottom: 0;
}
:focus-visible {
  outline: 3px solid #c58eaa;
  outline-offset: 3px;
}
@media (max-width: 800px) {
  header {
    height: 75px;
  }
  .brand span {
    display: none;
  }
  header > .tag {
    font-size: 10px;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .intro h1 {
    font-size: 36px;
  }
  main {
    padding: 24px 5%;
  }
  .settings {
    grid-template-columns: 1fr 1fr;
  }
  textarea {
    height: 170px;
  }
  .card {
    padding: 20px;
  }
  .sentence {
    font-size: 18px;
  }
  .transport {
    gap: 7px;
  }
  .transport button {
    padding: 10px 13px;
  }
}

[hidden] {
  display: none !important;
}
.import-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.import-options {
  margin: 14px 0;
  font-size: 14px;
  color: #6b6578;
}
.import-options summary {
  cursor: pointer;
}
.file-button {
  position: relative;
  display: inline-block;
  margin: 0;
  padding: 5px;
  color: #a63e69;
  cursor: pointer;
  font-weight: 600;
}
.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.file-button:focus-within {
  outline: 3px solid #c58eaa;
  outline-offset: 3px;
}
#import-status:empty,
#ai-status:empty {
  display: none;
}
.drop-active {
  outline: 3px dashed #c58eaa;
  outline-offset: 3px;
}
#article-help {
  background: #fcf9fc;
  padding: 14px 17px;
  border-radius: 10px;
}
#article-help p {
  white-space: pre-wrap;
}
.help-paragraph {
  padding: 10px 0;
  border-top: 1px solid #e4e4ed;
}
.help-paragraph:first-child {
  border-top: 0;
}
.help-paragraph dl {
  margin: 8px 0;
}
.help-paragraph dt {
  font-weight: 600;
  color: #7d244a;
}
.help-paragraph dd {
  margin: 2px 0 8px;
  color: #777385;
}
select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #777385 50%),
    linear-gradient(135deg, #777385 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 50%,
    calc(100% - 10px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

/* Compact controls keep the article close to the title. */
.practice > .heading {
  align-items: flex-start;
}
.practice > .heading h2 {
  margin-bottom: 12px;
}
.practice > .heading .tag {
  white-space: nowrap;
}
.practice-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  padding: 8px 0 10px;
  border-bottom: 1px solid #eee;
  margin-bottom: 10px;
}
.toolbar-row,
.toolbar-options {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-row {
  justify-content: space-between;
}
.transport {
  justify-content: flex-start;
  gap: 6px;
}
.transport button {
  padding: 8px 12px;
}
.toolbar-options {
  gap: 10px;
}
.rate-control label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
}
.rate-control select {
  width: 190px;
  font-size: 14px;
  padding: 7px 25px 7px 9px;
}
.playback-options {
  position: relative;
  font-size: 14px;
  color: #6b6578;
}
.playback-options summary {
  cursor: pointer;
  list-style: none;
  padding: 7px 2px;
}
.playback-options summary::-webkit-details-marker {
  display: none;
}
.playback-options[open] summary {
  color: #a63e69;
}
.playback-options .settings {
  position: absolute;
  right: 0;
  top: 34px;
  z-index: 5;
  width: 290px;
  max-width: 75vw;
  background: white;
  border: 1px solid #e6e5ef;
  border-radius: 12px;
  box-shadow: 0 8px 24px #29244418;
  padding: 14px;
  display: block;
  margin: 0;
}
.playback-options .settings label:first-child {
  margin-top: 0;
}
.playback-options select {
  padding-top: 8px;
  padding-bottom: 8px;
}
#status {
  font-size: 13px;
  text-align: left;
  margin: 7px 0 0;
}
.practice-toolbar progress {
  display: block;
  margin: 7px 0 0;
  height: 3px;
}
.vocabulary-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.vocabulary-bar .link {
  font-size: 13px;
  padding: 0;
}
.vocabulary-bar span {
  font-size: 12px;
  color: #81798a;
}
.sentences {
  max-height: 70vh;
  scroll-padding-top: 12px;
}
.sentence {
  cursor: pointer;
  position: relative;
  padding: 15px 10px;
  gap: 12px;
}
.sentence-content {
  flex: 1;
  min-width: 0;
}
.sentence-trigger {
  align-self: flex-start;
  flex: none;
  padding: 3px 7px;
  font-size: 12px;
  margin-top: 6px;
  opacity: 0;
  color: #81798a;
}
.sentence:hover .sentence-trigger,
.sentence:focus-within .sentence-trigger,
.sentence.active .sentence-trigger {
  opacity: 1;
}
.term-wrap {
  position: relative;
  display: inline;
}
.gloss-term {
  border: 0;
  border-bottom: 1px dotted #a63e69;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}
.gloss-term:hover,
.gloss-term[aria-expanded="true"] {
  background: #f0d8e4;
}
.term-meaning {
  display: block;
  font:
    14px/1.6 system-ui,
    sans-serif;
  color: #7d244a;
  background: #fff;
  border-left: 2px solid #c58eaa;
  padding: 5px 9px;
  margin: 5px 0;
}
@media (max-width: 800px) {
  .toolbar-row {
    gap: 8px;
  }
  .toolbar-options {
    flex: 1;
    justify-content: space-between;
  }
  .sentence {
    font-size: 18px;
  }
  .sentence-trigger {
    opacity: 1;
  }
  .sentences {
    max-height: 65vh;
  }
}

/* Keep the original Read Along design, with a larger pane once practice starts. */
header nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
}
header nav a {
  color: #6b6578;
  text-decoration: none;
  white-space: nowrap;
}
header nav a[aria-current] {
  color: #a63e69;
  font-weight: 700;
}
.more-menu {
  position: relative;
}
.more-menu summary {
  cursor: pointer;
  font-size: 20px;
  list-style: none;
}
.more-menu > div {
  position: absolute;
  right: 0;
  top: 100%;
  background: #fff;
  padding: 10px 18px;
  min-width: 110px;
  border: 1px solid #e6e5ef;
  border-radius: 10px;
  z-index: 8;
}
.more-menu a {
  display: block;
  padding: 7px 0;
}
.layout {
  grid-template-columns: 310px minmax(0, 1fr);
}
main {
  max-width: 1640px;
  padding-left: 3%;
  padding-right: 3%;
}
.practice {
  min-width: 0;
  position: relative;
}
.sentence {
  font-size: 21px;
  line-height: 1.9;
}
.sentences {
  overscroll-behavior: contain;
  min-height: 350px;
  max-height: 75dvh;
}
.reading-focus header {
  height: 70px;
}
.reading-focus main {
  padding-top: 18px;
  padding-bottom: 18px;
}
.reading-focus .intro,
.reading-focus aside {
  display: none;
}
.reading-focus .layout {
  grid-template-columns: minmax(0, 1fr);
}
.reading-focus .practice {
  height: calc(100dvh - 106px);
  min-height: 480px;
  display: flex;
  flex-direction: column;
}
.reading-focus .practice-toolbar {
  flex-shrink: 0;
}
.reading-focus .sentences {
  flex: 1;
  min-height: 0;
  max-height: none;
  width: 100%;
  max-width: 1180px;
  margin: auto;
}
.reading-focus .sentence {
  font-size: 23px;
  padding: 19px 14px;
}
.reading-focus #article-help {
  max-height: 30dvh;
  overflow: auto;
  flex-shrink: 0;
}
.reading-focus .footer {
  font-size: 12px;
  margin-top: 10px;
  padding-top: 10px;
  flex-shrink: 0;
}
.word-card {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 10;
  width: min(390px, calc(100vw - 32px));
  padding: 18px 20px;
  background: #fff;
  border: 1px solid #e7c4d5;
  border-radius: 14px;
  box-shadow: 0 8px 34px #30283e20;
}
.word-card strong {
  overflow-wrap: anywhere;
}
.word-card label {
  margin-top: 4px;
}
.word-card .hint {
  min-height: 20px;
}
.word-card input {
  font-size: 16px;
}
@media (max-width: 800px) {
  header {
    height: 70px;
    padding: 0 5%;
  }
  .brand {
    font-size: 23px;
  }
  header nav {
    gap: 13px;
  }
  main {
    padding: 18px 4% 32px;
  }
  .intro {
    margin-bottom: 20px;
  }
  .intro h1 {
    font-size: 30px;
  }
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .layout aside {
    order: 2;
  }
  .practice {
    order: 1;
    padding: 16px;
  }
  .sentence {
    font-size: 19px;
    padding: 14px 5px;
    gap: 8px;
  }
  .sentence-number {
    min-width: 18px;
  }
  .sentence-trigger {
    padding: 4px;
    font-size: 11px;
  }
  .transport button {
    padding: 9px 11px;
  }
  .reading-focus .practice {
    height: calc(100dvh - 106px);
    min-height: 480px;
  }
  .reading-focus .sentence {
    font-size: 20px;
    padding: 16px 5px;
  }
  .reading-focus .footer {
    display: none;
  }
  .word-card {
    right: 16px;
    bottom: 12px;
    max-height: 45dvh;
    overflow: auto;
  }
}

.intro h1 small {
  display: block;
  font-size: 18px;
  color: #71667d;
  letter-spacing: 0;
  font-weight: 500;
  margin-top: 10px;
}
@media (max-width: 600px) {
  header {
    padding: 0 12px;
    gap: 10px;
  }
  .brand {
    font-size: 19px;
    flex-shrink: 0;
  }
  header nav.study-nav {
    gap: 4px;
  }
}
