/* Story Time Library: free classic books with words that light up as they are read */

.sl-modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 10px;
  background: rgba(15, 23, 42, .72);
  backdrop-filter: blur(6px);
}
.sl-modal.hidden { display: none; }

.sl-panel {
  width: 100%; max-width: 900px; height: 100%; max-height: 94vh;
  display: flex; flex-direction: column;
  background: #fffdf7; color: #1e293b;
  border-radius: 28px; border: 2px solid #fff;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .35);
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

.sl-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid #e2e8f0; flex-shrink: 0;
}
.sl-head-icon {
  width: 48px; height: 48px; border-radius: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: #ccfbf1;
}
.sl-head-text { flex: 1; min-width: 0; }
.sl-title { margin: 0; font-size: 20px; font-weight: 900; line-height: 1.2; }
.sl-sub { margin: 2px 0 0; font-size: 13px; font-weight: 600; color: #64748b; }

.sl-close {
  width: 44px; height: 44px; border-radius: 999px; border: 0; flex-shrink: 0;
  background: #f1f5f9; color: #475569; font-size: 18px; font-weight: 800; cursor: pointer;
}
.sl-close:hover { background: #e2e8f0; }

.sl-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sl-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sl-view.hidden { display: none; }

/* The little "saved" message must sit above every window, including the Parent Dashboard */
#toastBanner { z-index: 200; }

/* ---------- Shelf ---------- */
.sl-shelf-tools { padding: 14px 16px 6px; flex-shrink: 0; }
.sl-search {
  width: 100%; box-sizing: border-box; padding: 12px 16px; border-radius: 16px;
  border: 2px solid #cbd5e1; background: #fff; font: inherit; font-size: 16px; font-weight: 600;
  color: #1e293b;
}
.sl-search:focus { outline: none; border-color: #14b8a6; box-shadow: 0 0 0 4px #ccfbf1; }

.sl-grid {
  flex: 1; min-height: 0; overflow-y: auto;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
  padding: 10px 16px 16px; align-content: start;
}
@media (min-width: 640px) { .sl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 860px) { .sl-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.sl-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  min-height: 150px; padding: 14px 14px 12px; border: 0; border-radius: 20px;
  text-align: left; cursor: pointer; color: #fff; font: inherit;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .18);
  transition: transform .12s ease;
}
.sl-card:hover, .sl-card:focus-visible { transform: translateY(-2px); outline: none; }
.sl-card-letter { font-size: 34px; font-weight: 900; line-height: 1; opacity: .9; }
.sl-card-title { font-size: 15px; font-weight: 800; line-height: 1.25; margin-top: auto; }
.sl-card-author { font-size: 12px; font-weight: 600; opacity: .9; }
.sl-card-time { font-size: 11px; font-weight: 700; opacity: .85; background: rgba(255,255,255,.2); border-radius: 999px; padding: 2px 8px; }

.sl-c0 { background: linear-gradient(135deg, #f472b6, #db2777); }
.sl-c1 { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.sl-c2 { background: linear-gradient(135deg, #34d399, #059669); }
.sl-c3 { background: linear-gradient(135deg, #fbbf24, #d97706); }
.sl-c4 { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.sl-c5 { background: linear-gradient(135deg, #2dd4bf, #0d9488); }

.sl-empty { grid-column: 1 / -1; text-align: center; font-weight: 700; color: #64748b; padding: 30px 0; }

.sl-make {
  margin: 14px 16px 0; padding: 16px; border-radius: 18px; border: 0;
  background: linear-gradient(135deg, #6366f1, #a855f7); color: #fff;
  font: inherit; font-size: 17px; font-weight: 900; cursor: pointer; flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(99, 102, 241, .35);
}
.sl-make:hover { filter: brightness(1.08); }
.sl-tabs { padding-top: 12px; }

.sl-open-library {
  display: block; width: 100%; padding: 13px; border-radius: 16px; border: 2px dashed #14b8a6;
  background: #f0fdfa; color: #0f766e; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer;
}
.sl-open-library:hover { background: #ccfbf1; }
.sl-open-library.hidden { display: none; }

/* ---------- Reader ---------- */
.sl-reader-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid #e2e8f0; flex-shrink: 0;
}
.sl-back {
  min-height: 44px; padding: 0 14px; border-radius: 999px; border: 0; cursor: pointer;
  background: #e2e8f0; color: #334155; font: inherit; font-size: 15px; font-weight: 800;
}
.sl-back:hover { background: #cbd5e1; }
.sl-book-title { flex: 1; min-width: 120px; font-size: 16px; font-weight: 900; line-height: 1.2; }
.sl-page-info { font-size: 14px; font-weight: 800; color: #475569; white-space: nowrap; }

.sl-page {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 18px 22px 10px;
  font-size: 22px; line-height: 1.75; color: #1e293b;
  font-family: Georgia, 'Times New Roman', serif;
}
@media (max-width: 520px) { .sl-page { font-size: 20px; line-height: 1.7; padding: 14px 16px 8px; } }
.sl-page p { margin: 0 0 .9em; }
.sl-page-loading { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-weight: 700; color: #64748b; text-align: center; padding: 40px 0; }

.sl-w {
  border-radius: 8px; padding: 1px 2px; cursor: pointer;
  transition: background-color .08s ease, color .08s ease;
}
.sl-w:hover { background: #f1f5f9; }
.sl-w.sl-read { color: #64748b; }
.sl-w.sl-on { background: #fde047; color: #111827; box-shadow: 0 0 0 3px #fde047; }

.sl-hint { font-size: 13px; font-weight: 700; color: #64748b; text-align: center; padding: 0 16px 6px; flex-shrink: 0; }

.sl-controls {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px 14px; border-top: 1px solid #e2e8f0; flex-shrink: 0;
}
.sl-ctl {
  min-width: 56px; min-height: 56px; padding: 0 16px; border-radius: 18px; border: 0; cursor: pointer;
  background: #e2e8f0; color: #1e293b; font: inherit; font-size: 15px; font-weight: 800;
}
.sl-ctl:hover { background: #cbd5e1; }
.sl-ctl:disabled { opacity: .4; cursor: default; }
.sl-play { min-width: 160px; background: #14b8a6; color: #fff; font-size: 18px; }
.sl-play:hover { background: #0d9488; }
.sl-speed[aria-pressed="true"] { background: #1e293b; color: #fff; }

.sl-source { font-size: 12px; font-weight: 600; color: #94a3b8; text-align: center; padding: 0 16px 10px; flex-shrink: 0; }
.sl-source a { color: #64748b; text-decoration: underline; }
.sl-voice-note { font-size: 12px; font-weight: 700; color: #0f766e; text-align: center; padding: 0 16px 4px; flex-shrink: 0; }
.sl-voice-note:empty { display: none; }
.sl-credit-logo { float: left; width: 48px; height: auto; margin: 2px 10px 2px 0; border-radius: 6px; }
.sl-source { text-align: left; max-height: 58px; overflow-y: auto; }
.sl-page.sl-picture { min-height: 110px; }

/* ---------- Shelf tabs and picture books ---------- */
.sl-tabs { display: flex; gap: 8px; padding: 12px 16px 0; flex-shrink: 0; }
.sl-tab {
  flex: 1; min-height: 48px; border: 0; border-radius: 16px; cursor: pointer;
  background: #e2e8f0; color: #334155; font: inherit; font-size: 15px; font-weight: 800;
}
.sl-tab[aria-pressed="true"] { background: #14b8a6; color: #fff; }

/* emoji cover art for the classic stories */
.sl-cover { position: relative; overflow: hidden; min-height: 190px; padding-top: 10px; }
.sl-cover::before, .sl-cover::after {
  content: '\2726'; position: absolute; color: rgba(255, 255, 255, .55); font-size: 16px; pointer-events: none;
}
.sl-cover::before { top: 12px; right: 14px; }
.sl-cover::after { top: 56px; left: 10px; font-size: 11px; }
.sl-cover-art {
  position: relative; align-self: center; width: 100%; height: 92px; margin-bottom: 4px;
  display: flex; align-items: center; justify-content: center;
}
.sl-cover-art::before {
  content: ''; position: absolute; width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 70%);
}
.sl-e1 { position: relative; font-size: 54px; line-height: 1; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .25)); }
.sl-e2 { position: relative; font-size: 34px; line-height: 1; margin-left: -6px; align-self: flex-end; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .25)); }

.sl-picard { padding: 0 0 12px; overflow: hidden; gap: 6px; }
.sl-picard-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: #f1f5f9; }
.sl-picard .sl-card-title { margin: 6px 12px 0; }
.sl-picard .sl-card-time { margin-left: 12px; }

.sl-pic {
  display: block; width: 100%; flex-shrink: 0; max-height: 34vh; object-fit: contain;
  background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}
.sl-pic.hidden { display: none; }
.sl-page.sl-picture { font-size: 28px; line-height: 1.6; text-align: center; padding-top: 14px; }
@media (max-width: 520px) { .sl-page.sl-picture { font-size: 24px; } }
