/* Pravljice: website and app shell. Values come from tokens.css (Miha UI preset). */

/* Sentient (ITF Free Font License, fontshare.com: self-hosting allowed, files used unmodified; see fonts/FFL.txt) */
@font-face { font-family: Sentient; font-style: normal; font-weight: 200 700; font-display: swap;
  src: url(/static/fonts/Sentient-Variable.woff2) format("woff2"); }
@font-face { font-family: Sentient; font-style: italic; font-weight: 200 700; font-display: swap;
  src: url(/static/fonts/Sentient-VariableItalic.woff2) format("woff2"); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--background); color: var(--foreground);
  font-family: var(--font-sans); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--link); }
a:hover { color: var(--brand-hover); }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 500; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted-foreground); }
.caption { font-size: 12px; line-height: 18px; color: var(--muted-foreground); }
.small { font-size: 14px; line-height: 20px; }
[hidden] { display: none !important; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 40px); }

/* App banner: a night-blue band above every website page (data-theme="dark" swaps the tokens) */
.app-banner { background: var(--background); color: var(--foreground); }
.app-banner-in { max-width: 1200px; margin: 0 auto; padding: 14px clamp(20px, 4vw, 40px); display: flex; align-items: center; gap: 16px; }
.app-banner img { width: 56px; height: 56px; border-radius: 13px; flex: none; }
.app-banner-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.app-banner-text strong { font-family: var(--font-heading); font-weight: 600; font-size: 20px; line-height: 26px; }
.app-banner-text span { font-size: 15px; line-height: 22px; color: var(--muted-foreground); }
/* Store buttons in the shape of the official badges: black, rounded, logo plus two lines */
.store-badges { display: flex; flex-wrap: wrap; gap: 10px; flex: none; }
.store-badge { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px 0 12px; border-radius: 10px; background: #000; color: #fff; border: 1px solid #5f5f5f; text-decoration: none; font-weight: 600; font-size: 17px; line-height: 1; white-space: nowrap; text-align: left; }
.store-badge:hover { color: #fff; background: #1c1c1c; }
.store-badge span { display: flex; flex-direction: column; gap: 2px; letter-spacing: -0.01em; }
.store-badge small { font-size: 10.5px; font-weight: 500; letter-spacing: 0.01em; }
.footer-brand .store-badges { margin: 4px 0; gap: 8px; }
.footer-brand .store-badge { height: 40px; padding: 0 12px 0 10px; gap: 6px; font-size: 15px; }
.footer-brand .store-badge svg { width: 18px; height: 18px; }
.footer-brand .store-badge small { font-size: 9.5px; }
/* Story pages already end with a padded shelf */
.story-text + .wrap .site-footer { margin-top: 0; }
@media (max-width: 599px) {
  .app-banner-in { padding: 12px 16px; gap: 12px; }
  .app-banner img { width: 44px; height: 44px; border-radius: 10px; }
  .app-banner-text strong { font-size: 15px; line-height: 20px; }
  .app-banner-text span { font-size: 13px; line-height: 18px; }
  .app-banner-text .more { display: none; }
  .app-banner-in { flex-wrap: wrap; }
  .app-banner-text { flex-basis: calc(100% - 56px); }
  .app-banner .store-badges { width: 100%; }
  .app-banner .store-badge { flex: 1; justify-content: center; height: 40px; font-size: 15px; }
}

/* Wordmark */
.wordmark { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; color: var(--foreground); text-decoration: none; white-space: nowrap; }
.wordmark:hover { color: var(--foreground); }
.wordmark span { color: var(--brand); }
/* Logo (web/logo.py): the crayon mark plus the name as outlines; font-size sets the mark's height */
.wordmark.logo { display: inline-flex; align-items: center; gap: 0.1em; font-size: 48px; line-height: 0; color: var(--foreground); }
.wordmark.logo img { width: 1em; height: 1em; flex-shrink: 0; }
.wordmark.logo svg { display: block; fill: currentColor; overflow: visible; }
.site-header .wordmark.logo { font-size: 52px; }
.site-footer .wordmark.logo { font-size: 40px; }
.app-top .wordmark.logo { font-size: 44px; }
.tabbar .wordmark-slot.logo { font-size: 44px; padding: 0; }
.tabbar .wordmark-slot.logo:hover { background: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--control-touch); padding: 0 18px; border-radius: var(--radius-button);
  border: 1px solid transparent; background: transparent; color: var(--foreground);
  font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}
.btn:hover { color: var(--foreground); background: var(--hover); }
.btn-lg { height: var(--control-xl); padding: 0 24px; font-size: 16px; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: var(--primary-hover); color: var(--primary-foreground); }
.btn-brand { background: var(--brand); color: var(--brand-foreground); box-shadow: var(--shadow-brand); }
.btn-brand:hover { background: var(--brand-hover); color: var(--brand-foreground); }
.btn-outline { border-color: var(--border-strong); }
.btn[aria-pressed="true"], .btn[aria-checked="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn svg { flex-shrink: 0; }

.icon-btn {
  width: var(--control-touch); height: var(--control-touch); border-radius: var(--radius-full);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border: 0; background: transparent; color: var(--foreground); text-decoration: none;
}
.icon-btn:hover { background: var(--hover); color: var(--foreground); }
.icon-btn.float { background: var(--surface-elevated); box-shadow: var(--shadow-menu); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: var(--radius-badge); background: var(--secondary); color: var(--foreground);
  font-family: var(--font-sans); font-size: 12px; font-weight: 500; letter-spacing: 0; white-space: nowrap;
}

/* Website header and footer */
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 20px 0; }
.site-header .wordmark { font-size: 22px; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.site-footer { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(0, 2fr) minmax(160px, 1fr); gap: 32px clamp(24px, 4vw, 64px); margin-top: clamp(56px, 7vw, 96px); padding: 40px 0 56px; border-top: 1px solid var(--border); font-size: 15px; color: var(--muted-foreground); }
.site-footer .wordmark { font-size: 18px; }
.footer-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.site-footer nav { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.site-footer nav:first-of-type { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); align-content: start; gap: 10px 24px; }
.site-footer nav:first-of-type h2 { grid-column: 1 / -1; }
.site-footer h2 { font-family: var(--font-sans); font-size: 13px; line-height: 20px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--foreground); margin-bottom: 4px; }
.site-footer nav a { color: var(--muted-foreground); text-decoration: none; }
.site-footer nav a:hover { color: var(--foreground); text-decoration: underline; }
@media (max-width: 799px) { .site-footer { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .site-header .nav-secondary { display: none; } .site-header .wordmark.logo { font-size: 40px; } }

/* Landing: a big title, then the whole library */
.intro { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; padding: clamp(20px, 5vw, 64px) 0 clamp(28px, 4vw, 56px); }
.intro h1 { max-width: 860px; font-size: clamp(38px, 6vw, 76px); line-height: 1.04; letter-spacing: -0.02em; }
.intro h1 em { color: var(--brand-text); }
.intro p { max-width: 560px; font-size: clamp(17px, 1.6vw, 19px); line-height: 1.6; color: var(--muted-foreground); }
.intro-small { padding-bottom: clamp(24px, 3vw, 40px); }
.intro-small h1 { font-size: clamp(34px, 5vw, 60px); }
.chips-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: var(--radius-full); border: 1px solid var(--border-strong); color: var(--foreground); font-size: 15px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.chip:hover { background: var(--hover); color: var(--foreground); }
.chip[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.story-collections { justify-content: flex-start; }
@media (max-width: 559px) { .chips-nav { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; margin: 8px -16px 0; padding: 0 16px; max-width: 100vw; align-self: stretch; } .chips-nav::-webkit-scrollbar { display: none; } .chip { height: 36px; padding: 0 14px; font-size: 14px; } }
.section { padding: clamp(64px, 8vw, 112px) 0 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 28px; }
.section-head h2 { font-size: clamp(30px, 3.4vw, 36px); line-height: 1.15; }
.covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); grid-auto-flow: dense; gap: clamp(24px, 3vw, 36px); }
@media (max-width: 559px) { .covers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; } }
.library + .library, .highlight + .library, .library + .highlight { margin-top: clamp(40px, 5vw, 64px); }
.features + .library { margin-top: 0; }
/* Highlight: one story across the whole width, the cover large and a strip of more scenes */
.highlight { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; gap: clamp(24px, 4vw, 56px);
  padding: clamp(12px, 1.6vw, 20px); padding-right: clamp(24px, 4vw, 56px); background: var(--surface-secondary);
  border-radius: calc(var(--radius-card) + clamp(12px, 1.6vw, 20px)); color: var(--foreground); text-decoration: none; }
.highlight:hover { color: var(--foreground); }
.hl-main img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-card); background: var(--surface-tertiary); display: block; }
.hl-body { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-width: 0; padding: 12px 0; }
.hl-body .title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.hl-body h2 { font-size: clamp(32px, 4vw, 52px); line-height: 1.08; letter-spacing: -0.01em; }
.hl-body .meta { font-size: 15px; color: var(--muted-foreground); }
.hl-body .summary { max-width: 560px; font-size: clamp(16px, 1.4vw, 18px); line-height: 1.6; color: var(--muted-foreground); }
.hl-body .btn { margin-top: 8px; pointer-events: none; }
.highlight:hover .btn-brand { background: var(--brand-hover); }
.hl-scenes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 1.4vw, 16px); width: 100%; margin-top: clamp(12px, 2vw, 28px); }
.hl-scenes img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-card); background: var(--surface-tertiary); display: block; }
@media (max-width: 799px) {
  .highlight { grid-template-columns: 1fr; padding: 10px 10px 20px; gap: 16px; }
  .hl-main img { aspect-ratio: 5 / 4; }
  .hl-body { padding: 0 8px; gap: 10px; }
  .hl-body h2 { font-size: 30px; }
  .hl-body .summary { font-size: 15px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  .hl-scenes { gap: 8px; margin-top: 8px; }
}
/* Features: a full-width night-blue band between the story rows (data-theme="dark" swaps the tokens) */
.features { margin: clamp(56px, 7vw, 96px) 0; padding: clamp(56px, 7vw, 96px) 0; background: var(--background); color: var(--foreground);
  box-shadow: 0 0 0 100vmax var(--background); clip-path: inset(0 -100vmax); }
.features h2 { font-size: clamp(30px, 3.4vw, 40px); line-height: 1.15; margin-bottom: clamp(28px, 4vw, 48px); }
.feature-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: clamp(28px, 4vw, 56px); }
.feature-icon { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: var(--radius-full); background: var(--secondary); color: var(--foreground); margin-bottom: 20px; }
.features h3 { font-size: 24px; line-height: 28px; margin-bottom: 8px; }
.features p { line-height: 1.6; color: var(--muted-foreground); }

/* Story card (cover + title) */
.card { display: flex; flex-direction: column; gap: 12px; color: var(--foreground); text-decoration: none; min-width: 0; }
.card:hover { color: var(--foreground); }
.card .cover { position: relative; }
.card .cover img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-card); background: var(--surface-tertiary); transition: transform var(--duration-enter) var(--ease-enter); }
.card:hover .cover img { transform: scale(1.01); }
.card .lock { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: var(--radius-full); background: var(--surface-elevated); color: var(--foreground); box-shadow: var(--shadow-menu); display: flex; align-items: center; justify-content: center; }
.card .cover .badge { position: absolute; top: 10px; left: 10px; background: var(--surface-elevated); box-shadow: var(--shadow-menu); }
.card .title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card .title { font-family: var(--font-heading); font-weight: 500; font-size: 22px; line-height: 28px; }
.card .meta { font-size: 14px; line-height: 20px; color: var(--muted-foreground); }
.card.soon .cover img { filter: saturate(0.85); opacity: 0.85; }
.card .body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card .play-disc { position: absolute; right: 10px; bottom: 10px; width: 44px; height: 44px; transition: transform var(--duration-fast); }
.card:hover .play-disc { transform: scale(1.06); background: var(--brand-hover); }
.card .summary { margin-top: 8px; font-size: 15px; line-height: 1.55; color: var(--muted-foreground); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 559px) {
  .covers .card .title { font-size: 17px; line-height: 22px; }
  .covers .card .meta { font-size: 13px; line-height: 18px; }
  .covers .card .play-disc { width: 38px; height: 38px; right: 8px; bottom: 8px; }
  /* An odd last card fills the row as a wide card: wider picture, title under it */
  .covers > .card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .covers > .card:last-child:nth-child(odd) .cover img { aspect-ratio: 4 / 3; }
  .covers > .card:last-child:nth-child(odd) .title { font-size: 20px; line-height: 26px; }
  .card .summary { font-size: 14px; -webkit-line-clamp: 4; }
}

/* App: library */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.app-main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 24px calc(110px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 28px; }
.app-top { display: flex; flex-direction: column; gap: 16px; }
.app-top .wordmark { font-size: 17px; }
.app-top h1 { font-size: 32px; line-height: 38px; }
.app-top p { margin: -8px 0 0; }
.app-top .chips-nav { justify-content: flex-start; margin-top: 0; }
@media (max-width: 559px) { .app-top .chips-nav { margin: 0 -24px; padding: 0 24px; } }
.continue { display: flex; flex-direction: column; gap: 12px; color: var(--foreground); text-decoration: none; max-width: 560px; }
.continue:hover { color: var(--foreground); }
.continue img { width: 100%; aspect-ratio: 342 / 250; object-fit: cover; object-position: center 60%; border-radius: var(--radius-card); background: var(--surface-tertiary); }
.continue .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.continue .name { font-family: var(--font-heading); font-weight: 500; font-size: 20px; line-height: 26px; }
.play-disc { width: 52px; height: 52px; border-radius: var(--radius-full); background: var(--brand); color: var(--brand-foreground); box-shadow: var(--shadow-brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.progress { height: 4px; background: var(--track); border-radius: var(--radius-full); overflow: hidden; }
.progress > div { height: 4px; background: var(--primary); width: 0; }
.shelf h2 { font-size: 18px; line-height: 26px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.shelf-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 14px; }
.shelf-row .card { gap: 8px; }
.shelf-row .card .play-disc { width: 38px; height: 38px; right: 8px; bottom: 8px; }
.shelf-row .card .title { font-size: 16px; line-height: 22px; }
.shelf-row .card .meta { font-size: 12px; line-height: 18px; }
.empty { display: flex; flex-direction: column; gap: 6px; padding: 32px 0; max-width: 420px; }
.empty h2 { font-size: 20px; line-height: 26px; }
.app-legal { padding: 24px 0 8px; }
.app-legal a { color: inherit; }
@media (min-width: 768px) {
  .shelf-row { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 28px; }
  .shelf-row .card .title { font-size: 20px; line-height: 26px; }
  .shelf-row .card .meta { font-size: 14px; line-height: 20px; }
  .app-top h1 { font-size: 40px; line-height: 46px; }
}

/* Tab bar (phone) and top nav (wide) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around; align-items: center;
  height: calc(70px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface-secondary); border-top: 1px solid var(--border);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 72px; min-height: var(--control-touch); color: var(--muted-foreground); font-size: 11px; font-weight: 500; text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--foreground); font-weight: 600; }
.tabbar .wordmark-slot { display: none; font-size: 20px; }
@media (min-width: 900px) {
  .tabbar { position: sticky; top: 0; bottom: auto; order: -1; height: calc(64px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(24px, calc((100vw - 1200px) / 2 + 24px)) 0; justify-content: flex-start; gap: 4px; background: var(--background); border-top: 0; border-bottom: 1px solid var(--border); }
  .tabbar .wordmark-slot { display: block; margin-right: auto; }
  .tabbar .wordmark-slot.logo { display: inline-flex; }
  .tabbar a { flex-direction: row; gap: 8px; font-size: 14px; min-width: 0; padding: 0 14px; border-radius: var(--radius-button); }
  .tabbar a:hover { background: var(--hover); color: var(--foreground); }
  .app-main { padding-top: 24px; padding-bottom: 64px; } /* the top nav already clears the status bar */
  .app-top .wordmark { display: none; }
}

/* Player */
.player { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; gap: 18px; padding: calc(14px + env(safe-area-inset-top)) 14px calc(30px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.stage { position: relative; flex-shrink: 0; }
.stage .frame { position: relative; width: 100%; aspect-ratio: 4 / 5; max-height: 58vh; max-height: 58dvh; border-radius: var(--radius-dialog); overflow: hidden; background: var(--surface-tertiary); }
/* The pictures sit side by side: swipe (or the arrows) to look through them; the story turns them with a crossfade */
.stage .track { position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; }
.stage .track::-webkit-scrollbar { display: none; }
.stage .track img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: center; scroll-snap-stop: always; }
.stage .fade { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; }
.stage .fade.go { transition: opacity 700ms var(--ease-move); }
.stage .nav { position: absolute; top: 50%; margin-top: -22px; color: var(--foreground); }
.stage .nav.prev { left: 12px; }
.stage .nav.next { right: 12px; }
.stage .nav[hidden] { display: none; }
@media (hover: none) { .stage .nav { display: none; } }
@media (hover: hover) {
  .stage .nav { opacity: 0; transition: opacity var(--duration-enter) var(--ease-enter); }
  .stage .frame:hover .nav, .stage .nav:focus-visible { opacity: 1; }
}
.stage .here { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); height: 40px; gap: 6px; padding: 0 16px 0 12px; background: var(--surface-elevated); box-shadow: var(--shadow-menu); border-radius: var(--radius-full); }
.stage .here:hover { background: var(--surface-elevated); }
.stage .here[hidden] { display: none; }
.stage .top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; }
.dots { display: flex; justify-content: center; gap: 2px; min-height: 24px; }
.dots button { width: 24px; height: 24px; border: 0; background: transparent; padding: 0; display: flex; align-items: center; justify-content: center; }
.dots span { display: block; height: 6px; width: 6px; border-radius: 3px; background: var(--track); transition: width var(--duration-enter) var(--ease-enter), background var(--duration-enter); }
.dots button[aria-current="true"] span { width: 18px; background: var(--brand); }
.player .heading { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.player h1 { font-size: 32px; line-height: 38px; }
.player .sub { font-size: 14px; line-height: 20px; color: var(--muted-foreground); }
.seek { display: flex; flex-direction: column; gap: 6px; padding: 0 10px; }
.times { display: flex; justify-content: space-between; font-size: 12px; line-height: 18px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: center; gap: 36px; }
.controls .skip { width: 52px; height: 52px; border-radius: var(--radius-control); }
.play { width: 72px; height: 72px; border-radius: var(--radius-full); border: 0; background: var(--brand); color: var(--brand-foreground); box-shadow: var(--shadow-brand); display: flex; align-items: center; justify-content: center; padding: 0; }
.play:hover { background: var(--brand-hover); }
.play .i-play, .play .i-pause { display: flex; }
.play .i-pause, .play.playing .i-play { display: none; }
.play.playing .i-pause { display: flex; }
/* The triangle's visual centre sits left of its box, so nudge it right */
.play .i-play svg, .play-disc svg { transform: translateX(6%); }
.play[aria-busy="true"] { opacity: 0.85; }
.chips { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.note { font-size: 14px; line-height: 20px; color: var(--muted-foreground); text-align: center; padding: 0 10px; }
.note .btn { margin-top: 10px; }

/* Range slider: ink fill, cream thumb */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; margin: 0; background: transparent; --p: 0%; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--primary) var(--p), var(--track) var(--p)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--primary); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; border: 0; background: var(--surface-elevated); box-shadow: var(--shadow-thumb), 0 0 0 1px var(--border-strong); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; border: 0; background: var(--surface-elevated); box-shadow: var(--shadow-thumb), 0 0 0 1px var(--border-strong); }
input[type="range"]:disabled { opacity: 0.5; }

/* Story text */
.story-text { max-width: 640px; margin: 0 auto; padding: 8px 24px 64px; scroll-margin-top: 16px; }
.story-text > .lead { font-size: 18px; line-height: 28px; margin-bottom: 8px; }
.story-text > .facts { font-size: 14px; line-height: 20px; color: var(--muted-foreground); margin-bottom: 40px; }
/* Collection pills belong to the intro, so keep them close to it and well clear of the text heading */
.story-text > .facts:has(+ .story-collections) { margin-bottom: 16px; }
.story-text > .story-collections { margin-top: 0; margin-bottom: 40px; }
.story-text h2 { font-size: 24px; line-height: 28px; margin-bottom: 4px; }
.story-text .attribution { font-size: 14px; line-height: 20px; color: var(--muted-foreground); margin-bottom: 24px; }
.story-text p { font-size: 16px; line-height: 28px; margin-bottom: 16px; }
.story-text .school { margin-top: 48px; padding-top: 40px; border-top: 1px solid var(--border); }
.story-text .school h3 { font-size: 18px; line-height: 24px; margin: 32px 0 8px; }
.story-text .school ul, .story-text .school ol { margin: 0 0 16px; padding-left: 24px; font-size: 16px; line-height: 28px; }
.story-text .school ul { list-style: disc; }
.story-text .school ol { list-style: decimal; }
.story-text .school li { margin-bottom: 8px; }
.story-text .related { margin-top: 48px; }
@media (min-width: 768px) { .story-text .related .shelf-row { grid-template-columns: repeat(3, 1fr); } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* Portrait tablets: one wide column, a bigger picture */
@media (min-width: 700px) and (orientation: portrait) {
  .player { max-width: 680px; gap: 22px; padding-top: calc(32px + env(safe-area-inset-top)); }
  .stage .frame { max-height: 60vh; max-height: 60dvh; }
  .player h1 { font-size: 40px; line-height: 46px; }
}

/* Wide screens and iPad on its side: illustration left, controls right */
@media (min-width: 900px) and (orientation: landscape) {
  .player { max-width: 1200px; display: grid; grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: auto 1fr; column-gap: 56px; row-gap: 0; padding: calc(32px + env(safe-area-inset-top)) 40px calc(32px + env(safe-area-inset-bottom)); align-items: start; }
  .stage { grid-row: 1 / span 2; }
  .stage .frame { max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); aspect-ratio: 4 / 5; }
  .panel { position: sticky; top: 32px; display: flex; flex-direction: column; gap: 22px; padding-top: 24px; }
  .player h1 { font-size: 40px; line-height: 46px; }
  .story-text { padding-top: 48px; }
}
@media (max-width: 899px), (orientation: portrait) { .panel { display: contents; } }

/* In the apps the page runs under the status bar: keep a strip of background behind it */
html[data-target="app"] body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; z-index: 30; height: env(safe-area-inset-top); background: var(--background); pointer-events: none; }

/* Printed books (demand test): banners under a story and on the home page, and the shop page /knjige/ */
.print-book { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: center; gap: clamp(20px, 4vw, 48px);
  margin: 48px 0 0; padding: clamp(16px, 2.4vw, 28px); background: var(--surface-secondary);
  border-radius: calc(var(--radius-card) + clamp(12px, 1.6vw, 20px)); }
.pb-collection { margin: clamp(48px, 6vw, 80px) 0 0; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.pb-pic img, .shop-card img, .shop-hero img { width: 100%; height: auto; display: block; border-radius: var(--radius-card); background: #f3eee6; }
.pb-body { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-width: 0; }
.story-text .print-book h2, .print-book h2, .shop-set h2 { font-size: clamp(24px, 2.6vw, 34px); line-height: 1.15; margin: 0; }
.story-text .print-book p, .print-book p, .shop-set p { font-size: 16px; line-height: 1.55; color: var(--muted-foreground); margin: 0; }
.pb-buy { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; margin-top: 4px; }
.pb-price { font-family: var(--font-heading); font-size: 28px; line-height: 34px; }
.pb-was { color: var(--muted-foreground); font-size: 16px; }
@media (max-width: 559px) {
  .print-book { grid-template-columns: 1fr; }
  .print-book:not(.pb-collection) .pb-pic { max-width: 200px; }
}
@media (max-width: 799px) { .pb-collection { grid-template-columns: 1fr; } }
.shop-hero { margin: 0 0 clamp(24px, 4vw, 40px); }
.shop-hero img { aspect-ratio: 1376 / 768; object-fit: cover; }
.shop-intro { max-width: 720px; }
.shop-intro h1 { font-size: clamp(36px, 5vw, 56px); line-height: 1.08; margin-bottom: 12px; }
.shop-intro .lead { font-size: clamp(16px, 1.5vw, 19px); line-height: 1.6; color: var(--muted-foreground); }
.shop-set { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; gap: clamp(20px, 4vw, 56px);
  margin: clamp(32px, 5vw, 56px) 0; padding: clamp(16px, 2.4vw, 28px); background: var(--surface-secondary);
  border-radius: calc(var(--radius-card) + clamp(12px, 1.6vw, 20px)); }
@media (max-width: 799px) { .shop-set { grid-template-columns: 1fr; } }
.shop-books h2 { font-size: clamp(28px, 3.2vw, 36px); line-height: 1.15; margin-bottom: 24px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: clamp(28px, 3vw, 40px) clamp(20px, 3vw, 36px); }
@media (max-width: 559px) { .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 14px; } .shop-card .pb-price { font-size: 22px; } }
.shop-card { display: flex; flex-direction: column; gap: 6px; scroll-margin-top: 24px; }
.shop-card h3 { font-size: 20px; line-height: 26px; margin-top: 8px; }
.shop-meta { font-size: 14px; color: var(--muted-foreground); }
.shop-buy { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.shop-listen { color: var(--muted-foreground); }
.shop-card:target img { box-shadow: 0 0 0 3px var(--brand); }
.print-form { display: flex; flex-direction: column; gap: 10px; }
.print-form input { height: var(--control-xl); padding: 0 18px; border-radius: var(--radius-button); border: 1px solid var(--input);
  background: var(--surface-elevated); color: var(--foreground); font: inherit; font-size: 16px; }
.print-form input:hover { border-color: var(--input-hover); }
.print-done { font-size: 16px; line-height: 24px; font-weight: 600; }

/* Sheets and bedtime */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--overlay); opacity: 0; transition: opacity var(--duration-enter) var(--ease-enter); }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-width: 520px; margin: 0 auto;
  background: var(--surface-elevated); color: var(--foreground); border-radius: var(--radius-dialog) var(--radius-dialog) 0 0;
  box-shadow: var(--shadow-float); padding: 24px 24px calc(28px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; transform: translateY(100%); transition: transform var(--duration-enter) var(--ease-enter);
}
.sheet.open { transform: none; }
.sheet h2 { font-size: 20px; line-height: 26px; }
.sheet .price { font-family: var(--font-heading); font-size: 28px; line-height: 34px; }
@media (min-width: 640px) { .sheet { bottom: 50%; border-radius: var(--radius-dialog); transform: translateY(60%); opacity: 0; transition: transform var(--duration-enter) var(--ease-enter), opacity var(--duration-enter); } .sheet.open { transform: translateY(50%); opacity: 1; } }

.night {
  position: fixed; inset: 0; z-index: 60; background: var(--background); color: var(--foreground);
  display: flex; flex-direction: column; align-items: center; padding: calc(14px + env(safe-area-inset-top)) 24px calc(36px + env(safe-area-inset-bottom));
  opacity: 0; pointer-events: none; transition: opacity 400ms var(--ease-move); overflow-y: auto;
}
.night.open { opacity: 1; pointer-events: auto; }
.night .bar { align-self: stretch; display: flex; justify-content: space-between; align-items: center; max-width: 560px; width: 100%; margin: 0 auto; }
.night .moon-img { width: min(260px, 60vw); aspect-ratio: 1; object-fit: cover; object-position: center 70%; border-radius: var(--radius-full); margin-top: clamp(16px, 5vh, 44px); opacity: 0.9; background: var(--surface-elevated); }
.night h2 { font-size: 36px; line-height: 42px; margin-top: 32px; text-align: center; }
.night .left { font-size: 14px; line-height: 20px; color: var(--muted-foreground); text-align: center; margin-top: 8px; }
.night .left b { color: var(--foreground); font-weight: 600; font-variant-numeric: tabular-nums; }
.night .timers { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 32px; }
.night .grow { flex: 1; min-height: 24px; }
.night .play { width: 68px; height: 68px; background: transparent; color: var(--foreground); border: 1px solid var(--border-strong); box-shadow: none; }
.night .hint { font-size: 12px; line-height: 18px; color: var(--muted-foreground); margin-top: 18px; text-align: center; }

/* Plain pages */
.prose { max-width: 680px; padding: 24px 0 72px; }
.prose h1 { font-size: clamp(32px, 4vw, 44px); line-height: 1.1; margin-bottom: 24px; }
.prose h2 { font-size: 22px; line-height: 28px; margin: 32px 0 8px; }
.prose p, .prose li { line-height: 1.7; color: var(--foreground); }
.prose p + p { margin-top: 12px; }
.prose a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.prose.about { margin: 0 auto; }
.about .lead { font-size: 20px; line-height: 1.5; color: var(--muted-foreground); margin-top: -8px; }
.about-pic { margin: 32px 0 8px; }
.about-pic img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-card); background: var(--surface-tertiary); }
.about h2 { font-size: 26px; line-height: 32px; margin-top: 40px; }

/* Home: questions parents ask, closed until tapped */
.faq { margin: clamp(56px, 7vw, 96px) 0 0; padding: 0; }
.faq h2 { font-size: clamp(26px, 3vw, 34px); line-height: 1.15; margin: 0 0 16px; }
.faq-item { border-top: 1px solid var(--border); }
.faq-item:last-child { border-bottom: 1px solid var(--border); }
.faq-item summary { cursor: pointer; list-style: none; padding: 16px 32px 16px 0; font-size: 18px; line-height: 1.4; font-weight: 600; position: relative; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 4px; top: 14px; font-size: 22px; font-weight: 400; color: var(--muted-foreground); }
.faq-item[open] summary::after { content: "–"; }
.faq-item p { margin: 0 0 16px; color: var(--muted-foreground); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* Gentler version | original: a two-part switch and the note for parents */
.version { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--track); }
.seg button { border: 0; background: transparent; color: var(--muted-foreground); font: inherit; font-size: 14px; font-weight: 500; height: 34px; padding: 0 16px; border-radius: 999px; cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--surface-elevated); color: var(--foreground); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg button:focus-visible { outline: 2px solid var(--ring, var(--primary)); outline-offset: 2px; }
