*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #FFF4F8;
  --ink: #2B1B3A;
  --ink-deep: #120A19;
  --muted: #8A6F99;
  --card: #FFFFFF;
  --blush: #F3D5E3;
  --blush-soft: #FBE7F0;
  --pink: #FF5FA2;
  --pink-deep: #D63F82;
  --mint: #C9F7D8;
  --mint-deep: #7FD69C;
  --butter: #FFE9A8;
  --butter-deep: #E8C85A;
  --sky: #D9F2FF;
  --danger: #E0245E;
  --bubble: 20px 20px 20px 6px;
  --bubble-sent: 20px 20px 6px 20px;
}

html, body { background: var(--bg); color: var(--ink); }
body {
  font-family: Rubik, system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
}
/* soft candy blobs behind everything */
body::before, body::after {
  content: ''; position: fixed; border-radius: 50%; z-index: -1; pointer-events: none;
}
body::before { width: 340px; height: 340px; background: #FFD6E8; top: -150px; right: -120px; }
body::after { width: 260px; height: 260px; background: var(--sky); bottom: -90px; left: -120px; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* pressable "toy key" feel shared by buttons */
.press { box-shadow: 0 3px 0 var(--blush); transition: transform .08s, box-shadow .08s; }
.press:active { transform: translateY(3px); box-shadow: 0 0 0 var(--blush); }

.app { max-width: 1180px; margin: 0 auto; padding: 0 16px 36px; }

/* ---------- Top bar ---------- */
.topbar { padding: 16px 0 12px; }
.brand {
  display: block; width: fit-content; text-decoration: none;
  font-family: 'Bagel Fat One', Rubik, sans-serif;
  font-size: 34px; line-height: 1; letter-spacing: .01em; color: var(--ink);
}
.brand span { color: var(--pink); }
.hello {
  display: inline-block; margin-top: 8px;
  background: var(--card); border-radius: var(--bubble);
  padding: 7px 13px; font-size: 14px; box-shadow: 0 3px 0 var(--blush);
  animation: pop .5s cubic-bezier(.3,1.6,.5,1) .15s both;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.9); } }

/* ---------- Footer: parody note ---------- */
.foot { margin-top: 32px; text-align: center; color: var(--muted); font-size: 13px; }
.foot p { max-width: 420px; margin: 0 auto 6px; }
.foot a { color: var(--pink-deep); font-weight: 600; }

/* ---------- Layout ---------- */
.layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.layout > * { min-width: 0; }
@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(340px, 440px) 1fr; align-items: start; gap: 28px; }
  .stage { position: sticky; top: 12px; }
}

/* ---------- Stage ---------- */
.stage {
  background: var(--card);
  border-radius: 28px;
  padding: 14px 14px 12px;
  box-shadow: 0 6px 0 var(--blush);
}
.canvas-wrap {
  position: relative;
  display: flex; justify-content: center; align-items: center;
  height: min(56vh, 640px);
}
@media (min-width: 900px) { .canvas-wrap { height: min(74vh, 760px); } }
#preview {
  display: block; max-width: 100%; max-height: 100%;
  border-radius: 18px; cursor: pointer;
  box-shadow: 0 14px 34px -16px rgba(43, 27, 58, .45);
}
.big-play {
  position: absolute; inset: 0; margin: auto;
  width: 76px; height: 76px; border-radius: 50%;
  border: none; background: var(--pink);
  display: grid; place-items: center;
  box-shadow: 0 5px 0 var(--pink-deep), 0 14px 30px -8px rgba(214, 63, 130, .6);
  transition: opacity .2s, transform .2s;
}
.big-play svg { width: 32px; height: 32px; margin-left: 4px; fill: #fff; }
.big-play:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--pink-deep); }
.big-play.hidden { opacity: 0; transform: scale(.6); pointer-events: none; }

.transport { display: flex; align-items: center; gap: 10px; padding-top: 12px; }
.icon-btn {
  width: 46px; height: 46px; border-radius: 50%; flex: none; border: none;
  background: var(--pink); display: grid; place-items: center;
  box-shadow: 0 4px 0 var(--pink-deep);
  transition: transform .08s, box-shadow .08s;
}
.icon-btn svg { width: 22px; height: 22px; fill: #fff; }
.icon-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--pink-deep); }
.icon-btn.soft { width: 38px; height: 38px; background: var(--blush-soft); box-shadow: 0 3px 0 var(--blush); }
.icon-btn.soft svg { width: 18px; height: 18px; fill: var(--ink); }
.icon-btn.soft:active { box-shadow: 0 0 0 var(--blush); }

/* per-message progress: one segment per message, width ∝ its share of the timeline */
.reel { position: relative; flex: 1; height: 30px; display: flex; align-items: center; }
.segs { display: flex; gap: 4px; width: 100%; height: 10px; }
.segs i { position: relative; flex: 1 1 0; min-width: 3px; border-radius: 6px; background: var(--blush); overflow: hidden; }
.segs i b { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--pink); border-radius: 6px; }
.segs i.mine b { background: var(--mint-deep); }
.scrub { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; margin: 0; }
.clock { font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 500; color: var(--muted); min-width: 70px; text-align: right; }

/* ---------- Tabs: chat bubbles, the active one is "sent" ---------- */
.tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  position: sticky; top: 0; z-index: 5;
  padding: 8px 0 10px; background: var(--bg);
}
@media (max-width: 899px) { .tabs { top: env(safe-area-inset-top); } }
.tab {
  border: none; background: var(--card); padding: 11px 6px;
  border-radius: var(--bubble); font-weight: 600; font-size: 15px;
  box-shadow: 0 3px 0 var(--blush);
  transition: transform .08s, box-shadow .08s, border-radius .2s;
}
.tab:active { transform: translateY(3px); box-shadow: none; }
.tab.active { background: var(--ink); color: #fff; border-radius: var(--bubble-sent); box-shadow: 0 3px 0 var(--ink-deep); }

.panel { display: none; padding-top: 6px; }
.panel.active { display: block; animation: pop .35s cubic-bezier(.3,1.4,.5,1) both; }

.card {
  background: var(--card); border-radius: 24px; padding: 16px;
  margin-bottom: 14px; box-shadow: 0 5px 0 var(--blush);
}
.card h3 { font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 10px; }
.hint code { background: var(--blush-soft); padding: 1px 6px; border-radius: 6px; color: var(--ink); font-size: 12.5px; }

.examples { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 2px 16px 8px; }
.examples::-webkit-scrollbar { display: none; }
.ex {
  flex: none; border: none; background: var(--blush-soft);
  border-radius: var(--bubble); padding: 10px 14px; text-align: left; min-width: 150px;
  box-shadow: 0 3px 0 var(--blush); transition: transform .08s, box-shadow .08s;
}
.ex:active { transform: translateY(3px); box-shadow: none; }
.ex b { display: block; font-size: 15px; font-weight: 600; }
.ex span { font-size: 12.5px; color: var(--muted); }
.ex.active { background: var(--mint); box-shadow: 0 3px 0 var(--mint-deep); border-radius: var(--bubble-sent); }

textarea {
  width: 100%; min-height: 220px; resize: vertical;
  background: var(--bg); border: 2px solid var(--blush); border-radius: 18px;
  padding: 12px 14px; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13.5px; line-height: 1.55;
}
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--pink); }
button:focus-visible, a:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.field { flex: 1 1 140px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field select {
  background: var(--bg); border: 2px solid var(--blush); border-radius: 14px;
  padding: 9px 12px; width: 100%; min-height: 44px; appearance: none; -webkit-appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23FF5FA2' stroke-width='2.2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}

/* ---------- Choice pills ---------- */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button {
  border: none; background: var(--blush-soft);
  padding: 9px 14px; border-radius: 16px; font-weight: 600; font-size: 14.5px;
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px;
  box-shadow: 0 3px 0 var(--blush); transition: transform .08s, box-shadow .08s, background .15s;
}
.seg button:active { transform: translateY(3px); box-shadow: none; }
.seg button.active { background: var(--mint); box-shadow: 0 3px 0 var(--mint-deep); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.seg .dot { width: 18px; height: 18px; border-radius: 6px; flex: none; }

/* speed as tilted stickers */
.seg.stickers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.seg.stickers button { justify-content: center; flex-direction: column; gap: 0; padding: 8px 4px; border-radius: 16px; font-size: 13.5px; line-height: 1.2; }
.seg.stickers button .e { font-size: 20px; }
.seg.stickers button:nth-child(1) { transform: rotate(-2deg); }
.seg.stickers button:nth-child(2) { transform: rotate(1.5deg); }
.seg.stickers button:nth-child(3) { transform: rotate(-1deg); }
.seg.stickers button:nth-child(4) { transform: rotate(2deg); }
.seg.stickers button:active { transform: translateY(3px); }
.seg.stickers button.active { background: var(--butter); box-shadow: 0 3px 0 var(--butter-deep); }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.sw { width: 40px; height: 40px; border-radius: 14px 14px 14px 4px; border: 3px solid #fff; box-shadow: 0 3px 0 var(--blush); }
.sw.active { outline: 3px solid var(--ink); outline-offset: 1px; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; font-weight: 500; }
.toggle input { appearance: none; -webkit-appearance: none; width: 52px; height: 30px; border-radius: 20px; background: var(--blush); position: relative; transition: background .2s; flex: none; cursor: pointer; }
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 0 rgba(43,27,58,.15); transition: transform .25s cubic-bezier(.3,1.6,.5,1); }
.toggle input:checked { background: var(--pink); }
.toggle input:checked::after { transform: translateX(22px); }
.toggle + .toggle { border-top: 2px dashed var(--blush-soft); margin-top: 8px; padding-top: 12px; }

/* ---------- Export ---------- */
.cta {
  width: 100%; border: none; padding: 16px;
  border-radius: 24px 24px 24px 8px;
  background: var(--pink); color: #fff;
  font-family: 'Bagel Fat One', Rubik, sans-serif; font-size: 22px; letter-spacing: .02em;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 6px 0 var(--pink-deep);
  transition: transform .08s, box-shadow .08s;
}
.cta:active { transform: translateY(6px); box-shadow: 0 0 0 var(--pink-deep); }
.cta:disabled { opacity: .55; }
.ghost {
  border: none; background: var(--blush-soft);
  border-radius: 18px; padding: 13px 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; color: var(--ink); flex: 1;
  box-shadow: 0 3px 0 var(--blush);
}
.ghost svg { width: 18px; height: 18px; fill: currentColor; }
.ghost.primary { background: var(--mint); box-shadow: 0 3px 0 var(--mint-deep); }

.progress { margin-top: 16px; display: none; }
.progress.show { display: block; }
.bar { height: 14px; border-radius: 10px; background: var(--blush); overflow: hidden; }
.bar i {
  display: block; height: 100%; width: 0; border-radius: 10px;
  background: repeating-linear-gradient(-45deg, var(--pink) 0 10px, #FF86BA 10px 20px);
  background-size: 28px 28px; animation: stripes .6s linear infinite; transition: width .15s;
}
@keyframes stripes { to { background-position: 28px 0; } }
.progress-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 13px; color: var(--muted); }
.link-btn { background: none; border: none; color: var(--danger); font-weight: 600; font-size: 13px; }

.result { display: none; margin-top: 16px; }
.result.show { display: block; animation: pop .4s cubic-bezier(.3,1.5,.5,1) both; }
.result-media { background: var(--card); border-radius: 24px; padding: 12px; display: flex; justify-content: center; box-shadow: 0 5px 0 var(--blush); }
.result-media img, .result-media video { max-height: 50vh; max-width: 100%; border-radius: 14px; display: block; }
.result-meta { font-size: 13px; color: var(--muted); margin: 10px 4px; }
.result-actions { display: flex; gap: 10px; }

.error { color: var(--danger); font-size: 13.5px; margin-top: 12px; display: none; }
.error.show { display: block; }

.who { display: flex; flex-wrap: wrap; gap: 8px; }
.who button {
  border: none; background: var(--blush-soft); border-radius: var(--bubble);
  padding: 8px 14px; font-size: 14.5px; font-weight: 500; box-shadow: 0 3px 0 var(--blush);
}
.who button.active { background: var(--ink); color: #fff; font-weight: 600; border-radius: var(--bubble-sent); box-shadow: 0 3px 0 var(--ink-deep); }

.stats { font-size: 13px; color: var(--muted); margin-top: 8px; font-weight: 500; }

.rec-canvas { position: fixed; left: -10000px; top: 0; pointer-events: none; }

/* ---------- Sideways rows (examples, library tags): arrows + wheel + drag with a mouse ---------- */
.hs { position: relative; min-width: 0; }
.hs-examples { margin: 0 -16px; }
.hs-libTags { flex: none; }
.hs-btn { display: none; }
@media (hover: hover) and (pointer: fine) {
  .hs-btn {
    display: grid; place-items: center; position: absolute; top: 50%; z-index: 1;
    width: 34px; height: 34px; margin-top: -19px; border: none; border-radius: 50%;
    background: var(--card); box-shadow: 0 3px 0 var(--blush), 0 4px 14px rgba(43,27,58,.16);
    transition: transform .08s, box-shadow .08s;
  }
  .hs-btn[hidden] { display: none; }
  .hs-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--blush); }
  .hs-btn.prev { left: 6px; }
  .hs-btn.next { right: 6px; }
  .hs-btn svg { width: 22px; height: 22px; fill: var(--ink); }
}
.dragging, .dragging * { cursor: grabbing !important; user-select: none; }

/* ---------- Library ---------- */
.lib-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 12px; }
.lib-open {
  border: none; background: var(--ink); color: #fff; border-radius: var(--bubble-sent);
  padding: 12px 16px; font-weight: 600; font-size: 15px; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  box-shadow: 0 3px 0 var(--ink-deep); transition: transform .08s, box-shadow .08s;
}
.lib-open small { font-weight: 500; opacity: .7; font-size: 13px; }
.lib-open:active, .dice:active { transform: translateY(3px); box-shadow: none; }
.watch-link {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--pink); color: #fff; text-decoration: none; border-radius: var(--bubble-sent);
  padding: 12px 16px; font-weight: 600; font-size: 15px; box-shadow: 0 3px 0 var(--pink-deep); transition: transform .08s, box-shadow .08s;
}
.watch-link small { font-weight: 500; opacity: .85; font-size: 13px; }
.watch-link:active { transform: translateY(3px); box-shadow: none; }
.dice {
  border: none; background: var(--butter); border-radius: 18px; padding: 0 16px;
  font-size: 22px; box-shadow: 0 3px 0 var(--butter-deep); transition: transform .08s, box-shadow .08s;
}

body.sheet-open { overflow: hidden; }
.sheet {
  position: fixed; inset: 0; z-index: 50; display: none;
  background: rgba(43, 27, 58, .35);
}
.sheet.open { display: block; }
.sheet-panel {
  position: absolute; inset: 0; margin: 0 auto; max-width: 760px;
  background: var(--bg); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
  animation: slideUp .35s cubic-bezier(.2,1.2,.4,1) both;
}
@media (min-width: 800px) { .sheet-panel { inset: 24px auto; left: 0; right: 0; border-radius: 28px; overflow: hidden; box-shadow: 0 30px 80px -20px rgba(43,27,58,.5); } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { padding: 14px 16px 10px; display: flex; align-items: center; gap: 10px; }
.sheet-head h2 { font-family: 'Bagel Fat One', Rubik, sans-serif; font-weight: 400; font-size: 26px; line-height: 1; flex: 1; }
.sheet-head h2 span { color: var(--pink); }
.sheet-close {
  width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--card);
  font-size: 20px; line-height: 1; box-shadow: 0 3px 0 var(--blush);
}
.lib-search { margin: 0 16px; position: relative; }
.lib-search input {
  width: 100%; border: 2px solid var(--blush); background: var(--card); border-radius: 18px;
  padding: 11px 14px 11px 40px; font-size: 16px; min-height: 46px;
}
.lib-search input:focus { outline: none; border-color: var(--pink); }
.lib-search::before { content: '🔍'; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 16px; }
.lib-tags { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 12px 16px 10px; flex: none; }
.lib-tags::-webkit-scrollbar { display: none; }
.lib-tag {
  flex: none; border: none; background: var(--card); border-radius: var(--bubble);
  padding: 8px 12px; font-weight: 600; font-size: 14px; white-space: nowrap;
  box-shadow: 0 3px 0 var(--blush);
}
.lib-tag small { color: var(--muted); font-weight: 500; margin-left: 3px; }
.lib-tag.active { background: var(--ink); color: #fff; border-radius: var(--bubble-sent); box-shadow: 0 3px 0 var(--ink-deep); }
.lib-tag.active small { color: rgba(255,255,255,.65); }
.lib-count { padding: 0 18px 8px; font-size: 13px; color: var(--muted); font-weight: 500; }
.lib-list { flex: 1; overflow-y: auto; padding: 4px 16px calc(24px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
@media (min-width: 600px) { .lib-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lib-card {
  border: none; text-align: left; background: var(--card); border-radius: 22px 22px 22px 8px;
  padding: 13px 14px; box-shadow: 0 4px 0 var(--blush); display: flex; flex-direction: column; gap: 7px;
  transition: transform .08s, box-shadow .08s;
}
.lib-card:active { transform: translateY(4px); box-shadow: none; }
.lib-card .top { display: flex; align-items: center; gap: 8px; }
.lib-card .top i { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.lib-card b { font-size: 15.5px; font-weight: 600; line-height: 1.25; }
.lib-card .peek { font-size: 13px; color: var(--muted); line-height: 1.4; min-width: 0; }
.lib-card .peek div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-card .peek em { font-style: normal; color: var(--ink); font-weight: 500; }
.lib-card .chips { display: flex; flex-wrap: wrap; gap: 5px; }
.lib-card .chips span { font-size: 11.5px; background: var(--blush-soft); border-radius: 8px; padding: 2px 7px; color: var(--ink); }
.lib-empty { text-align: center; color: var(--muted); padding: 40px 10px; grid-column: 1 / -1; }
.lib-loading { text-align: center; color: var(--muted); padding: 40px; grid-column: 1 / -1; }

/* ---------- Below the app: what it is, links to the search pages, FAQ ---------- */
.about { max-width: 760px; margin: 44px auto 0; }
.about h1 { font-family: 'Bagel Fat One', Rubik, sans-serif; font-weight: 400; font-size: clamp(30px, 6vw, 42px); line-height: 1.05; }
.about h1 em { font-style: normal; color: var(--pink); }
.about h2 { font-family: 'Bagel Fat One', Rubik, sans-serif; font-weight: 400; font-size: 22px; line-height: 1.1; margin: 28px 0 12px; }
.about-lede { font-size: 16px; margin-top: 12px; }
.about code { font-size: .92em; background: var(--blush-soft); border-radius: 6px; padding: 1px 5px; }
.about-steps { list-style: none; counter-reset: s; display: grid; gap: 10px; }
.about-steps li { counter-increment: s; background: var(--card); border-radius: var(--bubble); padding: 11px 14px 11px 50px; position: relative; box-shadow: 0 3px 0 var(--blush); }
.about-steps li::before { content: counter(s); position: absolute; left: 12px; top: 10px; width: 26px; height: 26px; border-radius: 50%; background: var(--butter); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.about-links { display: flex; flex-wrap: wrap; gap: 8px; }
.about-links a { text-decoration: none; color: var(--ink); background: var(--card); border-radius: var(--bubble); padding: 8px 13px; font-weight: 500; font-size: 14.5px; box-shadow: 0 3px 0 var(--blush); }
.about-links a.all { background: var(--mint); box-shadow: 0 3px 0 var(--mint-deep); }
.about details { background: var(--card); border-radius: 18px; padding: 12px 16px; box-shadow: 0 3px 0 var(--blush); margin-bottom: 10px; }
.about summary { font-weight: 600; cursor: pointer; }
.about details p { margin-top: 8px; color: var(--muted); }

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

/* Spacing helpers (no inline style attributes: the Content-Security-Policy forbids them) */
.mt12 { margin-top: 12px; }
.gap12 { height: 12px; }
.gap10 { height: 10px; }

/* "Ook in het Nederlands →": offers the page in the visitor's own language (initLangBar in i18n.js) */
.langbar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; background: var(--butter); font-size: 14px; font-weight: 600; }
.langbar a { color: var(--ink); }
.langbar button { border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer; padding: 2px 6px; }
