/* Web trial reader. Same calm palette as the app and the landing page (variables in /style.css). */

.trial main { width: min(760px, 100% - 32px); margin: 8px auto 0; outline: none; }
.loading, .error { color: var(--muted); margin-top: 40px; }

/* Bookshelf */
.shelf-intro h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); margin-bottom: .3em; }
.shelf-intro p { color: var(--muted); max-width: 36em; }
.books { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 18px; grid-template-columns: repeat(3, 1fr); }
.books li { display: flex; }
.book { display: block; width: 100%; text-decoration: none; color: var(--ink); background: var(--card); border-radius: 18px; overflow: hidden; }
.book img { width: 100%; aspect-ratio: 960 / 549; object-fit: cover; display: block; }
.book-title { font: 600 1.1rem var(--serif); margin: 12px 14px 2px; }
.book-meaning { color: var(--muted); font-size: .95rem; margin: 0 14px 14px; }
.book:hover .book-title { text-decoration: underline; text-underline-offset: 3px; }
.how { margin-top: 32px; padding: 18px 20px; background: var(--card); border-radius: 18px; }
.how h2 { font-size: 1.2rem; margin-bottom: .4em; }
.how ul { margin: 0; padding-left: 1.2em; }
.how li { margin-bottom: .3em; }

/* Reader */
.reader-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.reader-head h1 { font-size: 1.35rem; margin: 0; }
.page-count { color: var(--muted); font-size: .95rem; }
.picture { margin: 14px 0 0; border-radius: 20px; overflow: hidden; background: var(--card); aspect-ratio: 960 / 549; }
.picture img { width: 100%; height: 100%; object-fit: cover; display: block; }
.text { font-family: var(--serif); font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.3rem); line-height: 1.55; margin: 22px 0 6px; }
.text .word {
  font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer;
  padding: 0 .14em; margin: 0 -.04em; border-radius: .22em; min-height: 44px;
  transition: background-color .15s ease-out;
}
.text .word:hover { background: var(--card); }
.text .word.is-lit, .text .word[aria-current="true"] { background: var(--highlight); }
.text .word.is-turn { outline: 2.5px dashed var(--accent); outline-offset: 1px; }
.page-meaning { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 1.15rem; margin: 6px 0 0; }

.card {
  display: flex; align-items: center; gap: 14px; margin-top: 18px;
  padding: 14px 16px; background: var(--card); border-radius: 18px; min-height: 72px;
}
.card-body { flex: 1; }
.card-word { font: 600 1.4rem var(--serif); display: block; }
.card-text { color: var(--muted); }
.card button, .soft-button {
  min-height: 44px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--accent); background: transparent; color: var(--accent-dark); font: 600 .95rem var(--sans);
}
.card .close { border: 0; color: var(--muted); padding: 0 10px; font-size: 1.3rem; }

.controls {
  display: grid; grid-template-columns: 52px 1fr auto 1fr 52px; align-items: center; gap: 8px;
  margin: 22px 0 6px; position: sticky; bottom: 0; padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(251, 247, 239, 0), var(--paper) 30%);
}
.nav-button {
  width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff;
  font-size: 1.4rem; color: var(--accent-dark); cursor: pointer;
}
.nav-button:disabled, .nav-button.is-disabled { opacity: .35; cursor: default; pointer-events: none; }
a.nav-button { display: grid; place-items: center; text-decoration: none; }
a.soft-button { display: inline-grid; place-items: center; text-decoration: none; }
.more-stories { margin: 1em 0 0; color: var(--muted); }
.meaning-button { justify-self: end; }
.read-button {
  min-height: 52px; padding: 0 26px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; font: 600 1.05rem var(--sans);
}
.read-button[aria-pressed="true"] { background: var(--accent-dark); }
.options { display: flex; flex-wrap: wrap; gap: 6px 20px; color: var(--muted); font-size: .95rem; margin-top: 6px; }
.options label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.options input { accent-color: var(--accent); width: 18px; height: 18px; }

/* End page */
.end { text-align: center; margin-top: 24px; }
.end .moon { font-size: 4rem; }
.end h1 { font-size: 2.6rem; margin: .1em 0 0; }
.end .sub { color: var(--muted); font-size: 1.2rem; }
.talk { text-align: left; background: var(--card); border-radius: 18px; padding: 18px 20px; margin: 22px auto 0; max-width: 560px; }
.talk h2 { font: 600 1.15rem var(--sans); margin-bottom: .5em; }
.talk ul { margin: 0; padding-left: 1.2em; }
.talk li { margin-bottom: .5em; }
.end-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 22px; }
.join { margin: 30px auto 0; max-width: 560px; padding: 20px; border: 2px solid var(--highlight); border-radius: 18px; }
.join p { margin-bottom: .8em; }

.trial-footer { font-size: .9rem; }
.notice {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 10px 16px; border-radius: 14px;
  background: var(--ink); color: #fff; font-size: .95rem;
}
.read-button, .soft-button, .card button { white-space: nowrap; }
.controls > * { min-width: 0; }
.meaning-button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.hero .note + .note, .hero-copy > .note { margin-top: 12px; }

@media (max-width: 640px) {
  .books { grid-template-columns: 1fr; }
  .controls { grid-template-columns: 48px auto 1fr 48px; }
  .controls .spacer { display: none; }
  .meaning-button { justify-self: start; }
  .read-button { justify-self: end; padding: 0 20px; }
}
@media (max-width: 360px) {
  .controls { gap: 6px; grid-template-columns: 44px auto 1fr 44px; }
  .nav-button { width: 44px; height: 44px; }
  .read-button { padding: 0 14px; }
  .soft-button { padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .text .word { transition: none; }
}
