/* Bedtime stories — static mockup. Colours, sizes and layout follow the original NiceGUI/Quasar app. */
:root {
  --page: rgb(111 90 205);
  --home: rgb(232 226 254);
  --card: rgb(82 61 180);
  --pink-title: rgb(208 141 215);
  --field: rgb(208 162 229);
  --yellow: #facc15;
  --pink: #f472b6;
  --purple: #c084fc;
  --green: #4ade80;
  --gray: #9ca3af;
  --fab: #9c27b0;
  --sun: rgb(255 209 102);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--page);
  color: #fff;
  font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.is-home { background: var(--home); }
button { font: inherit; cursor: pointer; }
.icon { width: 1.35em; height: 1.35em; fill: currentColor; flex: none; }

/* mockup ribbon (not in the original) */
.mockup-ribbon {
  position: relative; z-index: 40; display: block; width: fit-content; max-width: calc(100vw - 150px);
  margin: 14px auto 0; text-align: center;
  background: var(--sun); color: #3b2a8c; text-decoration: none;
  font-size: .8rem; font-weight: 600; letter-spacing: .01em; line-height: 1.35;
  padding: 6px 14px; border-radius: 999px; box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.mockup-ribbon:hover, .mockup-ribbon:focus-visible { background: #ffe08a; }
.mockup-ribbon b { text-transform: uppercase; letter-spacing: .12em; }
@media (max-width: 640px) { .mockup-ribbon { font-size: .72rem; padding: 6px 12px; } .mockup-ribbon span { display: none; } }
[hidden] { display: none !important; }

/* floating round buttons */
.fab {
  position: fixed; z-index: 50; width: 56px; height: 56px; border-radius: 50%;
  border: 0; background: var(--fab); color: #fff; display: grid; place-items: center;
  box-shadow: 0 3px 5px -1px rgba(0,0,0,.2), 0 6px 10px rgba(0,0,0,.14), 0 1px 18px rgba(0,0,0,.12);
}
.fab .icon { width: 26px; height: 26px; }
.fab-help { top: 12px; right: 12px; }
.fab-list { left: 12px; bottom: 12px; }

/* pill buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px; border: 0; color: #fff;
  border-radius: 999px; padding: 12px 24px; font-size: 1rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .02em; line-height: 1.5;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  transition: filter .15s, transform .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.97); }
.btn-yellow { background: var(--yellow); }
.btn-pink { background: var(--pink); }
.btn-purple { background: var(--purple); }
.btn-green { background: var(--green); }
.btn-gray { background: var(--gray); }
.btn-multiline { white-space: pre-line; text-align: center; }
.btn-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 8px 0 24px; }
@media (max-width: 767px) { .btn-row { flex-direction: column; align-items: center; } }

/* home */
.home { min-height: calc(100vh - 48px); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.home img { width: 100%; height: auto; max-width: 95vw; max-height: 95vh; object-fit: contain; border-radius: 1rem; }
.home-top {
  position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.9);
  border-radius: 999px; padding: 6px 16px 6px 6px; box-shadow: 0 6px 16px rgba(82,61,180,.12);
  color: #111; font-size: .95rem; white-space: nowrap;
}
.home-top .pill {
  background: var(--card); color: #fff; border-radius: 999px; padding: 2px 12px;
  font-size: .72rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
}
.home-ctas {
  position: absolute; bottom: 8vh; left: 10vw; right: 10vw; padding: 0 2rem;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
@media (max-width: 767px) {
  .home-top { display: none; }
  .home-ctas { flex-direction: column; justify-content: center; }
}

/* steps */
.step { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding-top: 12px; }
.step-strip { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; font-weight: 600; letter-spacing: .04em; margin-top: 8px; }
.step-strip small { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; opacity: .9; }
.step-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.35); display: inline-block; }
.step-dot.active { background: var(--sun); box-shadow: 0 0 0 4px rgba(255,209,102,.25); }
.step-dot.done { background: var(--pink-title); }
.step-arrow { opacity: .5; }
.help-hint { color: rgba(255,255,255,.85); font-size: .95rem; text-align: center; max-width: 720px; margin: 4px auto 0; line-height: 1.45; padding: 0 12px; }
.help-tip { color: rgba(255,255,255,.7); font-size: .8rem; text-align: center; margin: 4px 12px 12px; }
.tiles { width: 100%; display: flex; align-items: center; justify-content: center; flex: 1; }
.tile { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; position: relative; }
.tile button { border: 0; padding: 0; background: none; display: block; width: 100%; border-radius: .75rem; }
.tile img { width: 100%; height: auto; max-height: 70vh; object-fit: contain; display: block; border-radius: .75rem; transition: transform .15s; }
.tile button:hover img, .tile button:focus-visible img { transform: scale(1.05); }
.tile button:focus-visible { outline: 3px solid var(--sun); outline-offset: 4px; }
.pick-check {
  position: absolute; top: 8px; right: 12%; width: 30px; height: 30px; border-radius: 50%;
  background: var(--sun); color: var(--card); display: grid; place-items: center; font-weight: 800;
  box-shadow: 0 6px 16px rgba(0,0,0,.25);
}
.pick-chip {
  margin-top: 6px; background: rgba(82,61,180,.85); color: #fff; padding: 4px 12px; border-radius: 999px;
  font-size: .85rem; font-weight: 600; border: 1px solid var(--pink-title); box-shadow: 0 4px 14px rgba(0,0,0,.18);
  max-width: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pick-chip.empty { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: rgba(255,255,255,.75); font-style: italic; font-weight: 500; }
@media (max-width: 767px) {
  .tiles { flex-direction: column; }
  .tile img { max-height: 50vh; }
}

/* dialogs */
dialog {
  border: 0; padding: 0; background: transparent; color: #fff; width: fit-content; max-width: 95vw; max-height: 90vh;
}
dialog::backdrop { background: rgba(0,0,0,.4); }
.dlg { background: var(--card); border-radius: 1.5rem; padding: 2rem; display: flex; flex-direction: column; align-items: center; width: min(92vw, 480px); }
.dlg.dlg-wide { width: min(92vw, 760px); }
.dlg h2 { color: var(--pink-title); font-size: 1.5rem; font-weight: 400; margin: 0 0 .5rem; text-align: center; }
.dlg p.hint { color: rgba(255,255,255,.85); font-size: .875rem; margin: 0 0 .75rem; text-align: center; }
.dlg label { align-self: stretch; font-size: .8rem; color: rgba(255,255,255,.8); margin: 0 0 4px; }
.dlg input, .dlg select {
  width: 100%; background: var(--field); color: #222; border: 0; border-radius: .5rem;
  padding: 12px; font-size: 16px; margin-bottom: .5rem;
}
.dlg .small { color: rgba(255,255,255,.65); font-size: .75rem; font-style: italic; margin: 0 0 1rem; text-align: center; }
.dlg-actions { display: flex; gap: .5rem; }
.dlg-btn { border: 0; border-radius: 999px; padding: 8px 18px; font-weight: 600; text-transform: uppercase; font-size: .875rem; }
.dlg-btn.clear { background: #d1d5db; color: #1f2937; }
.dlg-btn.save { background: #1976d2; color: #fff; }
.dlg-howto { text-align: left; align-items: stretch; max-height: 88vh; overflow-y: auto; padding: 1.75rem; }
.dlg-howto .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.dlg-howto h2 { font-weight: 700; margin: 0; text-align: left; }
.dlg-howto .x { background: none; border: 0; color: #fff; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; }
.dlg-howto .body { line-height: 1.55; font-size: .95rem; overflow-wrap: break-word; }
.dlg-howto .body b.k { color: var(--sun); }
.dlg-howto .body ul { margin: 0 0 10px 18px; padding: 0; }
.dlg-howto .note { background: rgba(255,209,102,.15); border: 1px solid rgba(255,209,102,.5); border-radius: .75rem; padding: 10px 12px; margin: 10px 0; }
.dlg-howto .note a { color: var(--sun); }
.gotit { align-self: flex-end; margin-top: 1rem; background: var(--yellow); color: #4c1d95; border: 0; border-radius: 999px; padding: 8px 20px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }

/* summary popup */
.summary {
  position: fixed; z-index: 50; left: 80px; bottom: 20px; background: rgba(255,255,255,.92);
  border: 2px solid #7c3aed; border-radius: .75rem; padding: 1rem; color: #1f2937; font-size: .875rem;
  min-width: 240px; max-width: min(95vw - 90px, 340px); backdrop-filter: blur(6px);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.2);
}
.summary .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.summary strong { color: #6d28d9; font-size: 1rem; }
.summary .x { background: none; border: 0; color: #9c27b0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.summary div.row { padding: 1px 0; }

/* story */
.story { width: 90%; margin: 0 5%; min-height: calc(100vh - 48px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px 0 20px; }
.story-cols { display: flex; width: 100%; align-items: stretch; gap: 16px; }
.story-cols > div { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.story-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; padding: 0 4px; }
.story-title-row > div { display: flex; gap: 4px; }
.story-title-row h1 { font-size: 1.5rem; margin: 0; letter-spacing: .02em; }
.icon-btn { background: none; border: 0; color: #fff; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(255,255,255,.15); }
.story-panel { background: rgba(255,255,255,.8); border-radius: 1rem; box-shadow: 0 10px 15px -3px rgba(0,0,0,.1); padding: 1rem; min-height: 300px; max-height: 420px; overflow-y: auto; color: #111827; font-size: 1.125rem; line-height: 1.6; }
.story-panel h2 { font-size: 1.35rem; margin: 0 0 .75rem; }
.story-panel p { margin: 0 0 .9rem; }
.story-img { width: 100%; max-width: 450px; height: auto; aspect-ratio: 1; object-fit: contain; border-radius: .75rem; align-self: center; }
.disclaimer { font-size: .875rem; font-style: italic; text-align: center; max-width: 600px; margin: .5rem 0 .25rem; }
.skeleton { display: flex; flex-direction: column; gap: 10px; }
.skeleton .bar { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #ece8ff 0%, #d9d2ff 50%, #ece8ff 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton .s { width: 60%; } .skeleton .m { width: 85%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (max-width: 767px) { .story-cols { flex-direction: column; } }

/* "what happened here" (mockup only) */
.behind { width: 100%; max-width: 900px; margin-top: 1rem; background: rgba(40,26,110,.55); border: 1px dashed rgba(255,209,102,.7); border-radius: 1rem; padding: 1rem 1.25rem; }
.behind h2 { font-size: 1.05rem; margin: 0 0 .5rem; color: var(--sun); }
.behind p { margin: 0 0 .6rem; line-height: 1.5; font-size: .95rem; }
.behind a { color: var(--sun); }
.behind details { margin-top: .5rem; }
.behind summary { cursor: pointer; font-weight: 600; }
.behind pre { white-space: pre-wrap; word-break: break-word; background: rgba(0,0,0,.3); border-radius: .5rem; padding: .75rem; font-size: .82rem; line-height: 1.45; margin: .5rem 0 0; max-height: 320px; overflow: auto; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #21ba45; color: #fff; padding: 10px 18px; border-radius: 6px; z-index: 80; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.noscript { padding: 80px 20px; text-align: center; }
.noscript a { color: var(--sun); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
