/* Final reader skin. Loaded after styles.css on purpose. */
:root {
  --reader-cream: #fffaf1;
  --reader-ink: #202329;
  --reader-line: #ded7c8;
  --reader-blue: #255baf;
  --reader-teal: #157f73;
  --reader-plum: #8e4a73;
  --reader-shadow: 0 24px 70px rgba(35, 40, 48, .11);
  --reader-soft-shadow: 0 14px 34px rgba(35, 40, 48, .075);
}

body {
  background:
    linear-gradient(90deg, rgba(210, 216, 207, .72), rgba(255, 252, 245, .08) 18%, rgba(255, 252, 245, .08) 82%, rgba(210, 216, 207, .72)),
    linear-gradient(180deg, #fbfaf5 0, #f5f4ef 46%, #f2f5f0 100%);
}

.home-hero .hero-subtitle,
.main-book > div > p.muted,
.story-card > div > p.muted {
  display: none;
}

.home-hero {
  align-items: center;
}

.story-card h3 {
  margin-bottom: 0;
}

.reader {
  width: min(1160px, calc(100vw - 48px));
  padding-top: 28px;
}

.reader .topbar {
  top: 14px;
  margin-bottom: 24px;
  border-color: rgba(212, 205, 190, .86);
  background: rgba(255, 252, 246, .88);
  box-shadow: 0 18px 44px rgba(42, 46, 54, .075);
}

.reader-top {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  margin: 0 0 14px;
  padding: 28px;
  border: 1px solid rgba(31, 36, 45, .88);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(31, 36, 45, .98), rgba(52, 59, 69, .96)),
    linear-gradient(90deg, rgba(199, 144, 63, .14), rgba(37, 91, 175, .12));
  color: var(--reader-cream);
  box-shadow: var(--reader-shadow);
}

.reader-top::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 250, 241, .08), transparent 34%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 36px);
}

.reader-top > * {
  position: relative;
}

.reader-heading {
  display: grid;
  gap: 12px;
  align-items: start;
}

.reader-title {
  max-width: 720px;
  color: var(--reader-cream);
  font-size: 41px;
  line-height: 1.14;
  font-weight: 900;
  text-wrap: balance;
}

.reader-category {
  width: max-content;
  min-height: 30px;
  padding: 0 12px;
  border-color: rgba(255, 250, 241, .22);
  background: rgba(255, 250, 241, .1);
  color: rgba(255, 250, 241, .84);
  transform: none;
}

.reader-actions {
  display: grid;
  justify-items: end;
  gap: 12px;
}

.reader-actions > .ghost {
  border-color: rgba(255, 250, 241, .22);
  background: rgba(255, 250, 241, .1);
  color: var(--reader-cream);
}

.mode-switch {
  min-width: 444px;
  padding: 5px;
  border: 1px solid rgba(255, 250, 241, .18);
  background: rgba(12, 15, 20, .26);
  box-shadow: inset 0 1px rgba(255, 255, 255, .08);
}

.mode-switch .pill {
  min-height: 42px;
  border-color: transparent;
  background: transparent;
  color: rgba(255, 250, 241, .74);
}

.mode-switch .pill.active {
  background: var(--reader-cream);
  color: #1f242d;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .18);
}

.chapter-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 24px;
  align-items: center;
  margin: 16px 0 12px;
  padding: 24px 26px;
  border: 1px solid var(--reader-line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 250, 241, .96), rgba(255, 252, 246, .98)),
    linear-gradient(180deg, rgba(199, 144, 63, .08), transparent);
  box-shadow: var(--reader-soft-shadow);
}

.chapter-header .eyebrow {
  color: var(--reader-teal);
  font-weight: 900;
}

.chapter-header h2 {
  margin-top: 8px;
  color: var(--reader-ink);
  font-size: 29px;
  line-height: 1.25;
  font-weight: 900;
}

.chapter-progress {
  height: 10px;
  background: #e7dfd0;
}

.chapter-progress span {
  background: linear-gradient(90deg, var(--reader-teal), var(--reader-blue));
}

.tool-row {
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid var(--reader-line);
  border-radius: 8px;
  background: rgba(255, 252, 246, .82);
  box-shadow: none;
}

.tool-row + .tool-row {
  min-height: 44px;
  justify-content: flex-end;
  margin-top: -4px;
  background: transparent;
  border-color: transparent;
}

.reader .ghost,
.reader .pill {
  min-height: 40px;
  border-color: #d8d0c1;
  background: rgba(255, 252, 246, .9);
  color: #3a414d;
}

.reader-panel {
  position: relative;
  margin-top: 14px;
  padding: 54px 74px 58px;
  border: 1px solid var(--reader-line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 250, 241, .965), rgba(255, 250, 241, .965)),
    repeating-linear-gradient(0deg, transparent 0, transparent 43px, rgba(120, 96, 62, .045) 44px);
  color: var(--reader-ink);
  font-family: var(--font-reading);
  font-size: var(--reader-size, 20px);
  line-height: 2.12;
  font-weight: 500;
  box-shadow: var(--reader-shadow);
}

.reader-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 32px;
  width: 1px;
  background: rgba(199, 144, 63, .26);
}

.reader-panel p {
  max-width: 820px;
  margin: 0 auto 30px;
}

.reader-panel p:last-child {
  margin-bottom: 0;
}

.blank-pair {
  min-height: 1.5em;
  padding: 0 .48em;
  margin: 0 .18em;
  border: 1px solid rgba(142, 74, 115, .26);
  border-radius: 8px;
  background: rgba(255, 247, 251, .82);
  color: var(--reader-plum);
  box-shadow: inset 0 -1px rgba(255, 255, 255, .7);
}

.blank-pair:has(.english-blank) {
  border-color: rgba(37, 91, 175, .24);
  background: rgba(242, 247, 255, .86);
  color: var(--reader-blue);
}

.inline-blank {
  min-width: 6em;
  height: .86em;
  border-bottom-width: 2px;
  background: repeating-linear-gradient(90deg, transparent 0, transparent 15px, rgba(142, 74, 115, .12) 16px);
}

.english-blank {
  background: repeating-linear-gradient(90deg, transparent 0, transparent 15px, rgba(37, 91, 175, .12) 16px);
}

.chapter-done {
  border: 1px solid rgba(31, 36, 45, .86);
  background: linear-gradient(135deg, #1f242d, #343b45);
}

.word-section {
  border: 1px solid var(--reader-line);
  background: rgba(255, 252, 246, .94);
  box-shadow: var(--reader-shadow);
}

.word-card {
  border-color: #e3dacb;
  background: var(--reader-cream);
}

.word-meaning {
  border-color: #e7dece;
  background: #f7efe2;
}

@media (max-width: 980px) {
  .reader {
    width: min(100vw - 24px, 760px);
  }

  .reader-top,
  .chapter-header,
  .tool-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .reader-title {
    font-size: 32px;
  }

  .reader-actions {
    justify-items: stretch;
  }

  .mode-switch {
    min-width: 0;
    width: 100%;
  }

  .reader-panel {
    padding: 34px 24px;
    line-height: 2.02;
  }

  .reader-panel::before {
    display: none;
  }

  .reader-panel p {
    max-width: none;
  }
}

.auth-layout {
  min-height: 620px;
  display: grid;
  place-items: center;
}

.auth-box {
  width: min(440px, 100%);
}

.auth-box h1,
.admin-box h1 {
  margin: 0 0 22px;
  font-size: 30px;
  line-height: 1.2;
}

.auth-switch {
  margin-top: 12px;
}

.admin-tools {
  margin: 8px 0 18px;
}

.admin-tools select,
.admin-tools input {
  min-height: 40px;
  border: 1px solid #d8d0c1;
  border-radius: 8px;
  background: #fffaf1;
  color: #202329;
  padding: 0 12px;
  font: inherit;
  font-weight: 700;
}

.admin-tools select {
  min-width: min(420px, 100%);
}

.admin-tools input {
  width: 110px;
}

.admin-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid #ded7c8;
  border-radius: 8px;
  background: #fffaf1;
}

.admin-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e7dece;
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  background: #f7efe2;
  color: #4b5563;
  font-size: 13px;
}

.admin-table td {
  color: #202329;
  font-size: 14px;
}

.admin-table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
}
