/* Dyslexia-friendly defaults: off-white background, dark grey text, generous spacing, no justification. */
:root {
  --bg: #fbf7ee;
  --card: #fffdf8;
  --ink: #2b2b2b;
  --muted: #9a9385;
  --accent: #5b4bdb;
  --highlight: #ffe066;
  --soft: #efe9da;
  --reader-size: 32px;
  font-family: 'Lexend', 'Verdana', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 24px;
}

.logo { font-size: 26px; font-weight: 700; }
.book-title {
  font-family: 'Fredoka', 'Lexend', sans-serif;
  font-size: 26px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.t-blue { color: #2f6fc4; }
.t-orange { color: #f07a2a; }
.top .pill { justify-self: end; }

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px 150px;
}

/* --- Book page --- */

.book {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  gap: 12px;
}

.card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 2px 14px rgba(60, 50, 20, 0.1);
  overflow: hidden;
}

/* Looks like a printed picture book: paper page, spine shadow, stacked pages underneath. */
.page {
  background: #fffaf0;
  border-radius: 6px 22px 22px 6px;
  box-shadow:
    inset 18px 0 22px -18px rgba(90, 60, 20, 0.35),
    0 1px 0 #e9dfc8, 0 4px 0 -1px #fffaf0, 0 5px 0 -1px #e2d6bb,
    0 8px 0 -2px #fffaf0, 0 9px 0 -2px #dccfb2,
    0 14px 26px rgba(60, 40, 10, 0.18);
}

.picture {
  margin: 18px 18px 0 26px;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #eaf7ff;
}

.picture svg { display: block; width: 100%; height: 100%; }

/* Page art has a white, softly faded edge, so it sits on white like a printed page. */
.picture.is-photo { background: #fff; display: flex; justify-content: center; }
.page-img { height: 100%; max-width: 100%; object-fit: contain; }

.picture.is-cover {
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 50% 40%, #fff6e2, #f3e6c8);
}

.cover-img {
  height: 92%;
  border-radius: 4px 12px 12px 4px;
  box-shadow: -4px 0 0 #e6d9bd, 0 10px 24px rgba(60, 40, 10, 0.3);
}

.reader {
  font-size: var(--reader-size);
  line-height: 1.8;
  letter-spacing: 0.04em;
  word-spacing: 0.25em;
  padding: 22px 40px 28px 48px;
  min-height: 3.6em;
}

.reader p { margin: 0; }
.reader.cover { text-align: center; font-size: calc(var(--reader-size) * 1.2); font-weight: 600; }

.w {
  border-radius: 8px;
  padding: 0.04em 0.12em;
  cursor: pointer;
  transition: background-color 80ms, color 80ms;
}

.reader { color: #000; }
.v { color: #d0021b; }
.w:hover { background: #f1ecdf; }
.w.now { background: var(--highlight); }

.turn {
  width: 64px;
  height: 64px;
  font-size: 44px;
  line-height: 1;
  padding: 0 0 6px;
  background: var(--card);
  box-shadow: 0 2px 10px rgba(60, 50, 20, 0.12);
}

.turn:disabled { opacity: 0.25; cursor: default; }

.dots { display: flex; justify-content: center; gap: 10px; margin: 18px 0 4px; }
.dot { width: 14px; height: 14px; padding: 0; background: #ddd5c2; }
.dot.on { background: var(--accent); transform: scale(1.25); }

/* --- Controls --- */

.controls {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--card);
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: 0 4px 20px rgba(60, 50, 20, 0.16);
}

button, input, output { font: inherit; color: inherit; }

button {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  background: var(--soft);
  padding: 10px 18px;
  font-size: 18px;
}

button:disabled { opacity: 0.5; cursor: wait; }

.play {
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  padding: 14px 28px;
  min-width: 170px;
}

.round { width: 52px; height: 52px; padding: 0; font-size: 24px; }

.pill { display: flex; background: var(--soft); border-radius: 999px; padding: 4px; }
.pill button { background: transparent; padding: 8px 14px; font-size: 16px; }

.tempo {
  display: grid;
  grid-template-columns: auto 160px auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  font-size: 22px;
}

.tempo input { accent-color: var(--accent); width: 100%; }
.tempo output { grid-column: 1 / -1; text-align: center; font-size: 14px; color: var(--muted); }

.status { min-height: 1.4em; margin: 6px 0 0; text-align: center; color: var(--muted); font-size: 18px; }
.status.error { color: #b3261e; }
.hint { text-align: center; color: var(--muted); font-size: 15px; margin: 0; }

@media (max-width: 700px) {
  .top { grid-template-columns: 1fr auto; }
  .book-title { display: none; }
  .book { grid-template-columns: 1fr; }
  .turn { display: none; }
  .reader { padding: 18px 20px; }
  .controls { flex-wrap: wrap; justify-content: center; border-radius: 24px; width: calc(100% - 24px); }
}
