/* TaleTrail's shared study surfaces. Structure stays consistent from phone to desktop. */
:root {
  --paper: #f2f5fa;
  --surface: #fff;
  --ink: #172640;
  --muted: #586b86;
  --line: #dce4ef;
  --accent: #2458c8;
  --accent-hover: #1748ae;
  --highlight: #eaf1ff;
  --soft: #edf3fc;
  --radius: 16px;
}
body { font-size: 16px; line-height: 1.6; }
button, input, select, textarea { border-radius: 12px; }
button { font-weight: 600; border-color: #b7c5d8; }
button:hover { border-color: #93a8c4; }
button:disabled { opacity: .48; }
input, select, textarea { border-color: #aebdd1; }
.primary { border-color: var(--accent); font-weight: 700; }
h1 { font-weight: 700; letter-spacing: -.03em; }
h2 { font-weight: 700; }

header { height: 70px; gap: 22px; padding-inline: clamp(20px, 3vw, 38px); }
.brand { font-size: 25px; }
.brand img { width: 36px; height: 36px; }
#workspace { min-height: calc(100dvh - 70px); }
aside { padding: 26px 18px; }
aside .nav-home, aside nav button { border-radius: 10px; }
aside .nav-home { margin-bottom: 16px; }
aside .book { border-radius: 10px; }
.view { padding-top: 42px; }
.page-heading { gap: 22px; }
.page-heading p { font-size: 16px; line-height: 1.6; }

/* Library: reading is the primary action; utilities occupy one quiet strip. */
#welcome { max-width: 1300px; padding-top: 38px; }
#welcome .page-heading {
  background: var(--highlight);
  border-radius: 18px;
  padding: 30px 34px;
  margin-bottom: 18px;
}
#welcome .page-heading h1 { margin-bottom: 5px; }
#welcome .page-heading .intro { max-width: 43ch; }
#welcome #web-version {
  display: inline-block;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
#welcome .page-heading > button { min-width: 180px; }
.library-home {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
}
.library-entry {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.library-reading {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 20px;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 8px 14px;
  min-height: 148px;
  padding: 18px 20px;
  border: 0;
  text-align: left;
}
.library-reading:hover { background: #f9fbff; border-color: transparent; }
.reading-format, .reading-cover {
  grid-column: 1;
  grid-row: 1 / 3;
  width: 56px;
  height: 76px;
  border-radius: 8px;
  background: var(--soft);
}
.reading-format { display: grid; place-items: center; padding: 0; font-size: 11px; font-weight: 700; }
.reading-cover { object-fit: cover; }
.reading-info { min-width: 0; grid-column: 2; grid-row: 1; }
.reading-info strong { font-size: 17px; font-weight: 700; line-height: 1.35; letter-spacing: -.015em; }
.reading-info > span { margin-top: 5px; font-size: 13px; }
.reading-metric { grid-column: 2; grid-row: 2; margin: 0; max-width: none; font-size: 12px; }
.reading-metric progress { margin-top: 7px; height: 4px; }
.reading-open { grid-column: 3; grid-row: 1 / 3; align-self: center; font-size: 22px; }
.library-entry-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: #f9fbfe;
}
.library-entry-actions.has-pages { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.library-entry-actions button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 62px;
  padding: 8px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}
.library-entry-actions button:hover { background: var(--soft); color: var(--ink); }
.library-entry-actions button svg { width: 19px; height: 19px; }
.library-empty { grid-column: 1 / -1; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }

/* The same controls and surfaces serve import, review, vocabulary and settings. */
.login { border-radius: 18px; border-color: var(--line); padding: 38px; }
.login h1 { letter-spacing: -.03em; }
.import-source, #import-view > details, .history-item, .quiz-item, .table-wrap { border-color: var(--line); border-radius: 16px; }
.import-source { padding: 30px; }
.settings-section { border-color: var(--line); }
.managed-book { border-color: var(--line); }
.table-wrap th { background: #f7f9fd; }
.prose { border-color: var(--line); }

/* Keep the page in charge of the reading; the response tray stays compact. */
.practice-dock { background: var(--surface); border-top-color: var(--line); }
#dock-bottom { background: var(--surface); border-color: var(--line); }
.practice-dock #answer { border-color: #aebdd1; }
.reading-fragment.active-fragment { background: #dce8ff; color: #000000; }
#reader-settings-dialog { border-color: var(--line); border-radius: 18px; }

@media (max-width: 1050px) {
  .library-home { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  header { height: 68px; padding-inline: 18px; }
  #workspace { min-height: calc(100dvh - 68px); }
  aside.open { inset-block-start: 68px; }
  .view { padding-inline: 18px; }
  #welcome { padding-top: 18px; }
  #welcome .page-heading { gap: 16px; padding: 22px; margin-bottom: 12px; }
  #welcome .page-heading h1 { font-size: 30px; }
  #welcome .page-heading > button { width: 100%; }
  .home-tools { gap: 10px; margin-bottom: 20px; }
  .home-tools button { background: var(--surface); border-color: var(--line); }
  .library-home { gap: 12px; }
  .library-reading { min-height: 142px; padding: 18px; }
  .reading-info strong { font-size: 17px; }
  .login { margin: 20px 16px; padding: 26px 22px; }
  .import-source { padding: 22px; }
  #reader-pages .prose { margin-inline: -18px; }
  .practice-dock { border-radius: 16px 16px 0 0; }
}
@media (max-width: 375px) {
  .library-reading { grid-template-columns: 48px minmax(0, 1fr) 16px; gap: 8px 10px; padding-inline: 14px; }
  .reading-format, .reading-cover { width: 48px; height: 68px; }
  .library-entry-actions button { font-size: 11px; }
}

/* Podcast shares the reader and its discreet, fixed playback dock. */
.podcast-dock #podcast-previous,
.podcast-dock #podcast-next { display: inline-flex; }
.podcast-dock #answer-form,
.podcast-dock #record,
.podcast-dock #check { display: none; }
.podcast-original { color: var(--muted); font-family: Literata, Georgia, serif; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
