/* The "Huninn" font is added by reel.js once it has downloaded (one download for the page and the reel). */

:root {
  --sky-0: #f4fbff;
  --sky-1: #e6f5fe;
  --sky-2: #d7eefb;
  --line: #d3e8f6;
  --blue: #4aa6e0;
  --deep: #2c84c6;
  --ink: #23476a;
  --muted: #6f8ea8;
  --pink: #ffb3cc;
  --pink-deep: #ee7fa8;
  --brown: #6b4434;
  --yellow: #ffe07a;
  --danger: #d9506f;
  --ok: #4fb985;
  --card: #ffffff;
  --shadow: 0 6px 18px rgba(44, 132, 198, 0.10), 0 1px 3px rgba(44, 132, 198, 0.10);
  --shadow-lg: 0 18px 50px rgba(20, 70, 120, 0.25);
  --radius: 20px;
  --tile-w: 132px;
  --head-h: 112px;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--head-h) - var(--head-hide, 0px) + 12px); }
body {
  margin: 0;
  font-family: "Huninn", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--ink);
  /* a cotton-candy sky: white dots, and pink and lilac glows in the blue */
  background:
    radial-gradient(circle at 12px 12px, rgba(255, 255, 255, 0.85) 3px, transparent 3.5px) 0 0 / 48px 48px,
    radial-gradient(55vw 45vh at 100% 35%, rgba(255, 205, 225, 0.42), transparent) fixed,
    radial-gradient(50vw 45vh at 0 85%, rgba(220, 205, 255, 0.36), transparent) fixed,
    linear-gradient(180deg, #bfe4fa 0, var(--sky-1) 420px, var(--sky-0) 100%) fixed;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(74, 166, 224, 0.55); outline-offset: 2px; }
input, textarea { caret-color: var(--blue); }
small { font-size: 12.5px; }

/* ---------------------------------------------------------------- top bar + timeline */

.topbar {
  position: sticky; top: calc(-1 * var(--head-hide, 0px)); z-index: 20;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar, .timeline-row { max-width: 1680px; margin: 0 auto; padding-left: 22px; padding-right: 22px; }
.bar { display: flex; align-items: center; gap: 16px; padding-top: 8px; padding-bottom: 2px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand-cinna { height: 46px; width: auto; filter: drop-shadow(0 3px 4px rgba(44, 132, 198, 0.25)); }
.brand h1 { margin: 0; font-size: 21px; color: var(--deep); letter-spacing: 0.5px; white-space: nowrap; }
.brand p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.lang-btn {
  height: 32px; min-width: 52px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 999px; cursor: pointer;
  background: #fff; color: var(--deep); font-size: 14px; transition: background 0.12s, border-color 0.12s;
}
.lang-btn:hover { background: var(--sky-1); border-color: var(--blue); }
.history { display: flex; gap: 2px; }
.icon-btn {
  width: 36px; height: 36px; border: 0; border-radius: 50%; cursor: pointer; background: transparent;
  color: var(--deep); font-size: 19px; line-height: 1; transition: background 0.12s;
}
.icon-btn:hover:not(:disabled) { background: var(--sky-1); }
.icon-btn:disabled { color: #b9d3e6; cursor: default; }
.save-state { font-size: 12.5px; color: var(--muted); min-width: 64px; text-align: right; }

.timeline-row { display: flex; align-items: flex-end; gap: 12px; padding-top: 4px; padding-bottom: 9px; }
.timeline-wrap { position: relative; flex: 1; padding-top: 28px; min-width: 0; }
.timeline { display: flex; gap: 3px; height: 30px; }
.seg {
  position: relative; flex-basis: 0; min-width: 20px; border: 0; padding: 0 4px; cursor: pointer;
  border-radius: 8px; color: #fff; font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center; gap: 4px; overflow: hidden;
  transition: filter 0.12s, transform 0.12s, box-shadow 0.12s;
}
.seg:hover { filter: brightness(1.06); transform: translateY(-1px); }
.seg { white-space: nowrap; }
.seg .seg-s { font-size: 11px; opacity: 0.85; }
.seg.narrow .seg-s, .seg .seg-sh, .seg.tiny .seg-l { display: none; }
.seg.tiny .seg-sh { display: inline; }
.seg-hook { background: linear-gradient(180deg, #ffa9c6, var(--pink-deep)); }
.seg-m0 { background: linear-gradient(180deg, #62b6ec, #3d9bd9); }
.seg-m1 { background: linear-gradient(180deg, #4fa6e2, #2f88c9); }
.seg-ph { background: #fff; color: #8ec5ea; box-shadow: inset 0 0 0 2px #cbe6f7; }
.seg-end { background: linear-gradient(180deg, #b7a8f0, #8a7be0); }
.seg.active { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--deep); z-index: 1; }
.seg.bad::after {
  content: "!"; position: absolute; top: 2px; right: 2px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--danger); color: #fff; font-size: 10px; line-height: 13px; text-align: center;
}
.rider {
  position: absolute; top: 0; left: 0; height: 30px; width: auto; transform: translateX(-50%);
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1); pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(44, 132, 198, 0.3));
}
.rider.hop { animation: hop 0.35s ease-out; }
@keyframes hop { 40% { top: -10px; } }
.total {
  flex: none; padding: 6px 12px; border-radius: 999px; background: var(--sky-1); color: var(--deep);
  font-size: 15px; font-variant-numeric: tabular-nums;
}

.btn {
  border: 0; cursor: pointer; border-radius: 999px; padding: 9px 16px; position: relative;
  background: #fff; color: var(--deep); font-size: 15px; white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: 0 0 0 1.5px var(--line), 0 2px 4px rgba(44, 132, 198, 0.08);
  transition: transform 0.22s cubic-bezier(0.3, 1.7, 0.5, 1), box-shadow 0.12s, background 0.12s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 0 0 1.5px var(--blue), var(--shadow); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.95); transition-duration: 0.06s; }   /* a squish, then a bounce back */
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #5db7ef, var(--deep)); color: #fff; box-shadow: 0 3px 0 #1f6aa3, var(--shadow); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 3px 0 #1f6aa3, 0 8px 20px rgba(44, 132, 198, 0.35); }
.btn.pink { background: linear-gradient(180deg, #ffa3c2, var(--pink-deep)); color: #fff; box-shadow: 0 3px 0 #c95c86; }
.btn.ghost { box-shadow: none; background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--sky-1); box-shadow: none; }
.btn.small { padding: 5px 11px; font-size: 13.5px; }
.btn.big { padding: 14px 30px; font-size: 18px; }
.btn.danger { color: var(--danger); }
.btn.danger:hover:not(:disabled) { box-shadow: 0 0 0 1.5px var(--danger); }
.issue-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #fff; color: var(--danger);
  font-size: 12.5px; line-height: 20px; text-align: center;
}

.menu-wrap { position: relative; }
/* the ⋯ menu: a card that pops out of the button, with a speech-bubble tail pointing back at it */
.menu {
  position: absolute; right: -6px; top: calc(100% + 12px); z-index: 30; width: 344px; padding: 0 10px 10px;
  background: #fff; border-radius: 22px; box-shadow: 0 0 0 2px var(--sky-2), 0 22px 50px rgba(20, 70, 120, 0.28);
  transform-origin: calc(100% - 22px) -10px; animation: menu-pop 0.26s cubic-bezier(0.3, 1.45, 0.6, 1);
}
.menu::before {
  content: ""; position: absolute; right: 16px; top: -7px; width: 16px; height: 16px; border-radius: 3px; transform: rotate(45deg);
  background: #e3f3fe; box-shadow: -2px -2px 0 0 var(--sky-2);
}
@keyframes menu-pop { from { transform: scale(0.85) translateY(-6px); opacity: 0; } }
.menu-head {
  position: relative; display: flex; align-items: center; gap: 8px; margin: 0 -10px 8px; padding: 10px 16px; border-radius: 22px 22px 0 0;
  background:
    radial-gradient(circle at 9px 9px, rgba(255, 255, 255, 0.9) 2px, transparent 2.5px) 0 0 / 22px 22px,
    linear-gradient(#e3f3fe, #f2faff);
}
.menu-head img { width: 34px; height: auto; }
.menu-head b { font-weight: normal; font-size: 16px; color: var(--deep); }
.mi { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.mi .fill { fill: currentColor; }
.menu-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding: 4px 6px 8px; }
.menu-label .mi { width: 17px; height: 17px; color: var(--blue); }
.menu-durs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 0 4px; }
.dur-chip {
  height: 36px; border: 0; border-radius: 12px; cursor: pointer; background: var(--sky-0); color: var(--deep); font-size: 14.5px;
  font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 1.5px var(--line); transition: background 0.12s, box-shadow 0.12s, transform 0.12s;
}
.dur-chip:hover { background: var(--sky-1); box-shadow: inset 0 0 0 1.5px var(--blue); }
.dur-chip:active { transform: scale(0.94); }
.dur-chip.on { background: linear-gradient(180deg, #5db7ef, var(--deep)); color: #fff; box-shadow: 0 2px 0 #1f6aa3; }
.menu-acts { display: flex; flex-direction: column; gap: 2px; margin: 12px 0 0; padding-top: 10px; border-top: 1.5px dashed var(--line); }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 8px; border-radius: 14px; color: var(--ink); transition: background 0.12s;
}
.menu-item:hover { background: var(--sky-0); }
.mi-tile { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: none; border-radius: 12px; }
.mi-tile.sky { background: #dcf0fd; color: var(--deep); }
.mi-tile.mint { background: #d9f3e6; color: #2f9a68; }
.mi-tile.pink { background: #ffe1ea; color: var(--danger); }
.mi-tile.lilac { background: #ebe5fb; color: #7a68d6; }
.menu-item[href] { text-decoration: none; }
.mi-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mi-text b { font-weight: normal; font-size: 15px; }
.mi-text small { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.menu-item.danger .mi-text b { color: var(--danger); }
.menu-item.danger:hover { background: #fff4f7; }
.menu-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding: 10px 6px 0;
  border-top: 1.5px dashed var(--line);
}
.menu-local { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.menu-local .mi { width: 15px; height: 15px; }
.menu-credit {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; text-decoration: none;
  background: linear-gradient(180deg, #8b9cf0, #6276d6); color: #fff; font-size: 13px; transition: background 0.12s;   /* night-sky periwinkle, not GitHub black */
}
.menu-credit:hover { background: linear-gradient(180deg, #8193ea, #586cce); }
.menu-credit img { width: 24px; height: 24px; border-radius: 50%; box-shadow: 0 0 0 1.5px #fff; }

/* ---------------------------------------------------------------- layout */

.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px;
  max-width: 1680px; margin: 0 auto; padding: 20px 22px 12px;
}
.editor { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@keyframes bob { 50% { transform: translateY(-10px); } }

/* the loading screen (index.html #boot): Cinnamoroll runs along the bar while the font and art download */
.boot {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px;
  background:
    radial-gradient(circle at 12px 12px, rgba(255, 255, 255, 0.85) 3px, transparent 3.5px) 0 0 / 48px 48px,
    linear-gradient(180deg, #bfe4fa 0, var(--sky-1) 420px, var(--sky-0) 100%);
  transition: opacity 0.35s, visibility 0s 0.35s;
}
.boot.done { opacity: 0; visibility: hidden; }
.boot-card {
  width: min(380px, 100%); padding: 30px 24px 24px; border-radius: 28px; background: #fff; text-align: center;
  box-shadow: 0 0 0 3px var(--sky-2), var(--shadow-lg);
  animation: fade 0.3s 0.25s both;   /* a quick (cached) load is over before the card shows */
}
.boot-track {
  position: relative; height: 14px; margin-top: 48px; border-radius: 999px; background: var(--sky-1);
  box-shadow: inset 0 1px 2px rgba(44, 132, 198, 0.2);
}
.boot-fill {
  position: absolute; inset: 0 auto 0 0; width: calc(var(--boot, 0) * 100%); border-radius: inherit;
  background: linear-gradient(180deg, #5db7ef, var(--deep)); transition: width 0.2s linear;
}
.boot-cinna {   /* travels the bar's length minus its own width, so the end of the fill is always under it */
  position: absolute; bottom: 7px; left: calc(var(--boot, 0) * (100% - 76px)); width: 76px; height: auto;
  transition: left 0.2s linear; filter: drop-shadow(0 2px 2px rgba(44, 132, 198, 0.3));
  animation: boot-run 0.35s ease-in-out infinite alternate;
}
@keyframes boot-run { to { transform: translateY(-4px); } }
.boot-title { margin: 16px 0 6px; font-size: 18px; color: var(--deep); }
.boot-title b { font-weight: normal; font-variant-numeric: tabular-nums; margin-left: 4px; }
.boot-note { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.boot-note span { display: block; text-wrap: balance; word-break: keep-all; }   /* break the Chinese at its comma */
#boot-bytes { font-variant-numeric: tabular-nums; }
.boot .btn { margin-top: 16px; }
.boot.failed .boot-track, .boot.failed .boot-title b { display: none; }
.boot.failed .boot-title { color: var(--danger); }
@media (prefers-reduced-motion: reduce) {
  .boot-cinna { animation: none; }
}

.side {
  position: sticky; top: calc(var(--head-h) + 16px); align-self: start;
  max-height: calc(100vh - var(--head-h) - 32px); display: flex; flex-direction: column;
  background: rgba(255, 255, 255, 0.94); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
/* the panel's tabs: a pill switch; the open one is a white bubble (icons as in the phone's dock) */
.tabs {
  display: flex; margin: 10px 10px 0; padding: 4px; gap: 4px; border-radius: 999px; background: var(--sky-1);
  box-shadow: inset 0 1px 3px rgba(44, 132, 198, 0.14);
}
.tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: none; cursor: pointer;
  padding: 8px 10px; font-size: 15px; color: var(--muted); border-radius: 999px;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s cubic-bezier(0.3, 1.7, 0.5, 1);
}
.tab .i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab .i .fill { fill: currentColor; }
.tab:hover { color: var(--deep); }
.tab:active { transform: scale(0.95); transition-duration: 0.06s; }
.tab.active { background: #fff; color: var(--deep); box-shadow: 0 2px 6px rgba(44, 132, 198, 0.2); }
.tab.active .i .tint { fill: rgba(255, 179, 204, 0.55); }
.tab .count { font-size: 12px; background: var(--sky-1); padding: 1px 7px; border-radius: 999px; }
.side-pane { padding: 16px; overflow-y: auto; }

@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; max-height: none; }
}
@media (max-width: 820px) {
  :root { --head-h: 150px; }
  .bar { flex-wrap: wrap; padding-left: 16px; padding-right: 16px; }
  .timeline-row { padding-left: 16px; padding-right: 16px; }
  .top-actions { width: 100%; flex-wrap: wrap; }
  .brand p, .save-state { display: none; }
  .layout { padding: 16px; }
  .seg .seg-s { display: none; }
}

/* ---------------------------------------------------------------- lanes (opening, months, ending) */

.lane {
  --accent: #bfe3f8;
  display: grid; grid-template-columns: 220px minmax(0, 1fr);
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  transition: box-shadow 0.2s;
}
.rail {
  position: relative; padding: 16px; display: flex; flex-direction: column; gap: 6px;
  background: color-mix(in srgb, var(--accent) 26%, #fff);
}
.rail h2 { margin: 0; font-size: 19px; color: var(--deep); }
.rail-hint { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.rail .rail-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.rail-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.month-badge {
  width: 50px; height: 50px; flex: none; border-radius: 50%; background: var(--blue); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05;
  box-shadow: 0 0 0 3px #fff, 0 2px 8px rgba(44, 132, 198, 0.3);
}
.month-badge b { font-size: 17px; font-weight: normal; }
.month-badge small { font-size: 11px; letter-spacing: 0.5px; }
.ph-month .month-badge { background: #fff; color: #8ec5ea; box-shadow: 0 0 0 3px #d7eefb; }
.month-meta { font-size: 13px; color: var(--muted); line-height: 1.4; }
.month-meta b { display: block; font-size: 17px; color: var(--deep); font-weight: normal; }
.rail input.title-input {
  width: calc(100% + 8px); margin-left: -8px; padding: 4px 8px; border: 1.5px dashed transparent; border-radius: 10px;
  background: transparent; outline: none; box-shadow: none; transition: background 0.12s, border-color 0.12s;
}
.rail input.title-input:hover { background: rgba(255, 255, 255, 0.7); border-color: #b9dbf0; }
.rail input.title-input:focus { background: #fff; border: 1.5px solid var(--blue); box-shadow: 0 0 0 3px rgba(74, 166, 224, 0.18); }
.rail input.title-input.zh { font-size: 18px; color: var(--deep); }
.rail input.title-input.sub { font-size: 14px; color: var(--muted); }
.month-fx { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.month-fx select { flex: 1; padding: 4px 8px; border-radius: 10px; font-size: 13px; color: var(--deep); background: rgba(255, 255, 255, 0.7); }
.lane-issue { font-size: 13px; color: var(--danger); line-height: 1.45; }
.lane-issue:empty { display: none; }
.lane-body { padding: 18px 18px 16px; min-width: 0; }

@media (max-width: 820px) {
  .lane { grid-template-columns: minmax(0, 1fr); }
}

.flash { animation: flash 1.3s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px var(--pink-deep), var(--shadow); } }

/* ---------------------------------------------------------------- tiles */

.tiles { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.tile {
  position: relative; width: var(--tile-w); flex: none; cursor: pointer;
  background: #fff; border-radius: 12px; padding: 7px 7px 0;
  box-shadow: 0 0 0 1px var(--line), 0 4px 10px rgba(44, 132, 198, 0.12);
  transition: transform 0.14s, box-shadow 0.14s;
}
.tile:hover { transform: translateY(-3px) rotate(-0.6deg); box-shadow: 0 0 0 1.5px var(--blue), 0 10px 22px rgba(44, 132, 198, 0.2); }
.tile.bad { box-shadow: 0 0 0 2.5px var(--danger), 0 4px 10px rgba(217, 80, 111, 0.2); }
.tile.dragging { opacity: 0.35; }
.tiles .tile { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }   /* press and hold carries the card */
.touch-ghost {
  position: fixed; z-index: 120; margin: 0; pointer-events: none; transition: none;
  transform: rotate(-4deg) scale(1.06); box-shadow: 0 0 0 2px var(--blue), 0 18px 36px rgba(20, 70, 120, 0.3);
}
.tile.drop-before::before, .tile.drop-after::after {
  content: ""; position: absolute; top: 4px; bottom: 4px; width: 4px; border-radius: 4px; background: var(--pink-deep);
}
.tile.drop-before::before { left: -10px; }
.tile.drop-after::after { right: -10px; }
.tile .tape {
  position: absolute; top: -9px; left: 50%; width: 56px; height: 18px; transform: translateX(-50%) rotate(-4deg);
  opacity: 0.92; border-radius: 2px; z-index: 2;
  background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.45) 0 5px, transparent 5px 11px);
}
.tile .strip { display: flex; align-items: center; justify-content: space-between; height: 28px; font-size: 12.5px; color: #79b6df; }
.tile .flag {
  position: absolute; top: 12px; left: 12px; z-index: 2; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  background: rgba(0, 0, 0, 0.55); color: #fff;
}
.tile .dur {
  position: absolute; top: 12px; right: 12px; z-index: 3; display: flex; align-items: center;
  border-radius: 999px; background: var(--deep); color: #fff; font-size: 12px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.tile .dur .v { padding: 2px 8px; font-variant-numeric: tabular-nums; }
.tile .dur button {
  width: 0; padding: 0; overflow: hidden; border: 0; background: transparent; color: #fff; cursor: pointer;
  font-size: 15px; line-height: 20px; transition: width 0.12s;
}
.tile:hover .dur button, .tile:focus-visible .dur button { width: 22px; }
.tile .dur button:hover { background: rgba(255, 255, 255, 0.2); border-radius: 999px; }
.tile .star {
  position: absolute; right: -8px; top: 42px; z-index: 3; width: 32px; height: 32px;
  background: var(--yellow); color: var(--brown); font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  clip-path: polygon(50% 0, 61% 18%, 82% 10%, 80% 32%, 100% 40%, 85% 56%, 96% 76%, 74% 79%, 68% 100%, 50% 88%, 32% 100%, 26% 79%, 4% 76%, 15% 56%, 0 40%, 20% 32%, 18% 10%, 39% 18%);
}
.tile .fx {
  position: absolute; left: 13px; bottom: 41px; z-index: 3; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.92); box-shadow: 0 1px 5px rgba(40, 90, 140, 0.25); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.tile .issue-dot {
  position: absolute; left: -7px; top: -7px; z-index: 4; width: 22px; height: 22px; border-radius: 50%;
  background: var(--danger); color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px #fff;
}

.crop { position: relative; overflow: hidden; aspect-ratio: 4 / 5; border-radius: 8px; background: var(--sky-1); }
.crop img { position: absolute; max-width: none; }
.crop.fallback img { position: static; width: 100%; height: 100%; object-fit: cover; }

.placeholder-art {
  aspect-ratio: 4 / 5; border-radius: 8px; box-shadow: inset 0 0 0 1.5px #d7eefb;   /* a soft slot; dashes are for "add" */
  background: linear-gradient(#e4f4fd, #f6fbff);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--deep); text-align: center; padding: 8px;
}
.placeholder-art .q { font-size: 40px; color: var(--blue); line-height: 1; }
.placeholder-art .h { font-size: 14px; }
.placeholder-art small { color: var(--muted); }

.fan { position: relative; aspect-ratio: 4 / 5; border-radius: 8px; overflow: hidden; background: #51bae7; }
.fan img {
  position: absolute; width: 58%; left: 21%; top: 16%; border-radius: 5px; box-shadow: 0 3px 8px rgba(0, 40, 80, 0.3);
  transform: translateX(calc(var(--k) * 34%)) rotate(calc(var(--k) * 9deg));
}
.tile.opener { cursor: default; }
.tile.opener:hover { transform: none; box-shadow: 0 0 0 1px var(--line), 0 4px 10px rgba(44, 132, 198, 0.12); }
.tile.opener .flag { background: rgba(255, 255, 255, 0.92); color: var(--deep); }

.tile.add { display: flex; flex-direction: column; gap: 8px; padding: 0; background: transparent; box-shadow: none; cursor: default; }
.tile.add:hover { transform: none; box-shadow: none; }
.add-main {
  aspect-ratio: 4 / 5; width: 100%; margin-top: 7px; border-radius: 12px; border: 2.5px dashed #9dd0f0; background: rgba(255, 255, 255, 0.6);
  color: var(--blue); font-size: 15px; cursor: pointer; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; transition: background 0.12s, border-color 0.12s;
}
.add-main:hover { background: #fff; border-color: var(--blue); }
.add-main .plus { font-size: 34px; line-height: 1; }
.add-main small { color: var(--muted); }
.add-sub { border: 0; background: none; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: underline dotted; }
.add-sub:hover { color: var(--deep); }

.hook-tiles .tile { width: calc(var(--tile-w) - 6px); }

/* ending */
.ending { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.stats-table { display: grid; grid-template-columns: 76px minmax(90px, 1fr) minmax(110px, 1.3fr); gap: 7px 8px; flex: 1; min-width: 300px; max-width: 520px; }
.stats-table .th { font-size: 12.5px; color: var(--muted); padding-left: 4px; }
.stats-table input { text-align: left; }
.stats-table input.num { text-align: right; font-size: 18px; color: var(--deep); }
.handle-field { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.handle-field input { color: #4aa6e0; }
.labeled { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }

input[type="text"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 7px 11px; background: #fff;
  outline: none; transition: border-color 0.12s, box-shadow 0.12s; min-width: 0;
}
input[type="text"]:focus, input[type="number"]:focus, input[type="date"]:focus, input[type="search"]:focus, textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74, 166, 224, 0.18);
}
input.bad { border-color: var(--danger); }

/* sliders */
input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 8px; border-radius: 999px; cursor: pointer; outline-offset: 4px;
  background: linear-gradient(90deg, var(--blue) var(--p, 0%), var(--sky-2) var(--p, 0%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid var(--blue); box-shadow: 0 2px 6px rgba(44, 132, 198, 0.35);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--blue);
}

/* ---------------------------------------------------------------- side: preview & renders */

.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.pane-head h3 { margin: 0; font-size: 16px; color: var(--deep); }

.phone {
  width: 100%; max-width: 300px; margin: 0 auto; aspect-ratio: 9 / 16; border-radius: 26px; overflow: hidden;
  background: var(--sky-1); border: 7px solid #fff; box-shadow: var(--shadow-lg); position: relative;
}
.phone > img, .phone video { width: 100%; height: 100%; object-fit: cover; }
.phone .caption {
  position: absolute; left: 10px; bottom: 10px; padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.9); font-size: 12.5px;
}
.phone.empty-phone {
  background:
    radial-gradient(circle at 10px 10px, rgba(255, 255, 255, 0.8) 2.5px, transparent 3px) 0 0 / 32px 32px,
    linear-gradient(#a6daf7, #ebf8ff);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 20px; text-align: center; color: var(--deep);
}
.phone.empty-phone > img { width: auto; height: 130px; object-fit: contain; animation: bob 2.4s ease-in-out infinite; }
.phone.empty-phone p { margin: 0; font-size: 16px; }
.phone.empty-phone small { color: var(--muted); }
.phone.loading::after {
  content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, 0.55);
}
.phone .spin {
  position: absolute; left: 50%; top: 50%; z-index: 2; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  border: 5px solid var(--sky-2); border-top-color: var(--blue); animation: spin 0.9s linear infinite;
}
.spinner {
  width: 46px; height: 46px; margin: 20px auto 10px; border-radius: 50%;
  border: 5px solid var(--sky-2); border-top-color: var(--blue); animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; padding: 26px 10px; }
.empty .big { font-size: 42px; display: block; margin-bottom: 6px; }
.empty img { height: 90px; margin: 0 auto 8px; }

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.board figure { margin: 0; cursor: zoom-in; }
.board img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 10px; box-shadow: var(--shadow); transition: transform 0.12s; }
.board figure:hover img { transform: translateY(-2px); }
.board figcaption { font-size: 12px; color: var(--muted); text-align: center; margin-top: 4px; }

.job { background: var(--sky-1); border-radius: 16px; padding: 14px; margin-bottom: 16px; }
.job .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.bar-track { height: 12px; border-radius: 999px; background: #fff; overflow: hidden; margin: 10px 0 6px; }
.bar-track > div {
  height: 100%; border-radius: 999px; transition: width 0.4s;
  background: repeating-linear-gradient(-45deg, var(--blue) 0 10px, #6fc0f2 10px 20px);
  animation: stripes 1s linear infinite; background-size: 28px 28px;
}
@keyframes stripes { to { background-position: 28px 0; } }
.job.error { background: #fff0f3; }
.job pre { white-space: pre-wrap; font-size: 11.5px; max-height: 180px; overflow: auto; margin: 8px 0 0; color: #8a3b52; }

.ex-intro { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.ex-cover {
  flex: none; width: 92px; height: auto; aspect-ratio: 9 / 16; border-radius: 12px; background: var(--sky-1);
  box-shadow: 0 0 0 3px #fff, 0 6px 16px rgba(44, 132, 198, 0.22);
}
.ex-what { min-width: 0; }
.ex-what b { display: block; margin-bottom: 4px; font-weight: normal; font-size: 18px; color: var(--deep); }
.ex-what .ex-spec { margin: 0 0 6px; }
.ex-what .help { margin: 0; }
.ex-tips { margin: 16px 0 0; padding-left: 20px; font-size: 13.5px; line-height: 1.65; color: var(--muted); }
.ex-tips li + li { margin-top: 4px; }
.render { border-radius: 16px; box-shadow: 0 0 0 1px var(--line); padding: 12px; margin: 16px 0 12px; background: #fff; }
.render-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; }
.render .when { font-weight: normal; font-size: 15px; color: var(--deep); }
.render .meta { margin: 0; font-size: 12.5px; color: var(--muted); }
.render .links { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.render .links .btn { flex: 1 1 auto; justify-content: center; }
.render .help { margin: 8px 0 0; }
.render video {
  display: block; width: auto; max-width: 100%; height: auto; max-height: min(520px, 52vh); aspect-ratio: 9 / 16;
  margin: 12px auto 8px; border-radius: 12px; background: #cfe9f9;
}

/* ---------------------------------------------------------------- modals */

.backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(23, 62, 98, 0.45); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade 0.15s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: 24px; box-shadow: var(--shadow-lg); width: min(1180px, 100%);
  max-height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden;
  animation: pop 0.18s cubic-bezier(0.3, 1.4, 0.6, 1);
}
.backdrop:has(.modal:not(.narrow)) { align-items: flex-start; padding-top: max(20px, 4vh); }   /* big dialogs don't jump as they resize */
.modal.still { animation: none; }
.backdrop:has(.modal.still) { animation: none; }
.modal.narrow { width: min(480px, 100%); }
@keyframes pop { from { transform: scale(0.94); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 14px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 19px; color: var(--deep); flex: 1; min-width: 0; }
.modal-body { padding: 18px 20px; overflow: auto; flex: 1; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); }
.modal-foot:empty { display: none; }
.spacer { flex: 1; }
.x { border: 0; background: var(--sky-1); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 15px; color: var(--deep); flex: none; }
.x:hover { background: var(--sky-2); }
.nav { display: flex; gap: 4px; }

/* card editor */
.edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
@media (max-width: 900px) { .edit-grid { grid-template-columns: minmax(0, 1fr); } }
.left-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.segmented { display: inline-flex; align-self: center; background: var(--sky-1); border-radius: 999px; padding: 4px; gap: 2px; }
.segmented button {
  border: 0; background: none; border-radius: 999px; padding: 6px 16px; cursor: pointer; color: var(--muted); font-size: 14px;
}
.segmented button.on { background: #fff; color: var(--deep); box-shadow: 0 1px 4px rgba(44, 132, 198, 0.2); }
.stage-wrap {
  border-radius: 18px; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 300px;
  background: repeating-conic-gradient(#eaf5fc 0 25%, #f6fbff 0 50%) 0 0 / 22px 22px;
}
.stage-clip { overflow: hidden; border-radius: 6px; max-width: 100%; }
.stage { position: relative; touch-action: none; cursor: crosshair; user-select: none; max-width: 100%; }
.stage img, .stage video { max-height: 56vh; max-width: 100%; display: block; border-radius: 6px; }
.crop-rect {
  position: absolute; border: 3px solid #fff; border-radius: 6px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(18, 50, 82, 0.5), inset 0 0 0 1px rgba(44, 132, 198, 0.6);
}
.crop-rect::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; background: var(--pink-deep); box-shadow: 0 0 0 3px #fff;
}
.stage-hint { font-size: 13px; color: var(--muted); text-align: center; }
.vctrl { display: flex; align-items: center; gap: 8px; width: 100%; flex-wrap: wrap; }
.vctrl input[type="range"] { flex: 1; min-width: 160px; }
.vctrl .time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); min-width: 86px; }
.reel { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.reel .phone { max-width: none; width: auto; height: min(56vh, 560px); }
.reel .reel-status { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.reel .reel-status.stale { color: var(--pink-deep); }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > .label { font-size: 13px; color: var(--muted); }
.field .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.field-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.help { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.help.warn { color: var(--danger); }
.file-name { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; height: 38px; }
.stepper button { border: 0; background: var(--sky-1); width: 36px; height: 100%; cursor: pointer; font-size: 18px; color: var(--deep); }
.stepper button:hover { background: var(--sky-2); }
.stepper span { min-width: 58px; text-align: center; font-size: 16px; color: var(--deep); font-variant-numeric: tabular-nums; }
.durs { display: flex; gap: 4px; }
.durs button {
  flex: 1; border: 0; border-radius: 999px; padding: 5px 0; background: var(--sky-1); cursor: pointer; font-size: 12.5px; color: var(--deep);
}
.durs button.on, .durs button:hover { background: var(--blue); color: #fff; }
.fx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fx-chips button {
  border: 0; border-radius: 999px; padding: 5px 11px; background: var(--sky-1); cursor: pointer; font-size: 13px; color: var(--deep);
}
.fx-chips button.on, .fx-chips button:hover { background: var(--blue); color: #fff; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.switch input { width: 18px; height: 18px; accent-color: var(--pink-deep); }

/* picker */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chips button {
  border: 0; border-radius: 999px; padding: 5px 10px; background: var(--sky-1); cursor: pointer; font-size: 13.5px; color: var(--deep);
}
.chips button:hover { background: var(--sky-2); }
.chips button.on { background: var(--blue); color: #fff; }
.filters input[type="search"] { border-radius: 999px; min-width: 180px; flex: 1; }
.drop-hint {
  border: 2.5px dashed #9dd0f0; border-radius: 16px; padding: 12px; text-align: center; color: var(--muted);
  margin-bottom: 16px; font-size: 14px; background: var(--sky-0);
}
.modal.dragover .drop-hint { border-color: var(--pink-deep); background: #fff4f8; color: var(--pink-deep); }
.post { margin-bottom: 18px; }
.post-head { display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; margin-bottom: 8px; }
.post-head .d { color: var(--deep); white-space: nowrap; }
.post-head .c { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-head .tag { background: var(--pink); color: #fff; border-radius: 999px; padding: 0 8px; font-size: 12px; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.file {
  position: relative; aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden; cursor: pointer; border: 0; padding: 0;
  background: var(--sky-1); box-shadow: 0 0 0 1px var(--line); transition: transform 0.12s, box-shadow 0.12s;
}
.file img { width: 100%; height: 100%; object-fit: cover; }
.file:hover { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--blue); }
.file.on { box-shadow: 0 0 0 4px var(--pink-deep); }
.file .n {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--pink-deep); color: #fff; font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.file .v, .file .used {
  position: absolute; left: 6px; bottom: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px;
  background: rgba(0, 0, 0, 0.55); color: #fff;
}
.file .used { left: auto; right: 6px; top: 6px; bottom: auto; background: rgba(255, 255, 255, 0.92); color: var(--deep); }
.file.on .used { display: none; }

/* lightbox */
.lightbox .modal-body { display: flex; align-items: center; justify-content: center; gap: 10px; }
.lightbox .modal-body img { max-height: calc(100vh - 190px); max-width: 100%; border-radius: 16px; box-shadow: var(--shadow); }
.lightbox { width: auto; max-width: calc(100vw - 40px); }

/* issues */
.issue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.issue-list li {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: #fff3f6;
}
.issue-list li div { flex: 1; font-size: 14px; line-height: 1.45; }
.issue-list li b { display: block; color: var(--danger); font-weight: normal; }

/* toasts */
.toasts {
  position: fixed; left: 16px; right: 16px; bottom: 22px; z-index: 80; pointer-events: none;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: #fff; border-radius: 16px; padding: 12px 18px; box-shadow: var(--shadow-lg); font-size: 14.5px;
  max-width: min(640px, 100%); white-space: pre-line; line-height: 1.5; animation: pop 0.2s;
  border-left: 5px solid var(--blue);
}
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }

/* ---------------------------------------------------------------- browser edition */

.player-phone { max-width: 320px; cursor: pointer; }
.player-canvas { width: 100%; height: 100%; display: block; }
.player-controls { display: flex; align-items: center; gap: 8px; margin: 12px auto 4px; max-width: 340px; }
.player-controls input[type="range"] { flex: 1; min-width: 80px; }
.player-controls .time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 78px; text-align: right; }
.side .pane-head { margin-top: 10px; }
.board canvas { width: 100%; aspect-ratio: 9 / 16; border-radius: 10px; box-shadow: var(--shadow); display: block; transition: transform 0.12s; }
.board figure:hover canvas { transform: translateY(-2px); }
.reel .phone { max-width: none; width: auto; height: min(56vh, 560px); }
.reel-canvas { width: 100%; height: 100%; display: block; }
.lane.filedrop { box-shadow: 0 0 0 3px var(--pink-deep), var(--shadow); }
.lane.filedrop .lane-body { background: #fff4f8; }
.export-shield {
  position: fixed; inset: 0; z-index: 95; background: rgba(23, 62, 98, 0.35); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
}
.export-shield > div {
  background: #fff; border-radius: 24px; padding: 24px 32px; box-shadow: var(--shadow-lg); text-align: center; color: var(--deep);
}
.export-shield img { height: 110px; margin: 0 auto 8px; animation: bob 1s ease-in-out infinite; }
.export-shield small { display: block; max-width: 260px; margin: 8px auto 12px; color: var(--muted); line-height: 1.5; }
.filters .btn.primary { margin-right: 6px; }

/* sample reel: first-visit welcome, the note above the lanes, the picker tag */
.welcome .modal-body { text-align: center; }
.welcome-art { position: relative; height: 128px; }
.welcome-cinna { position: relative; z-index: 1; height: 120px; margin: 0 auto; animation: bob 2.4s ease-in-out infinite; }
/* the @cinnamorollfans drawings fanned out behind him, like photos pinned to a board */
.welcome-pic {
  position: absolute; left: 50%; top: 10px; width: 78px; height: 92px; object-fit: cover; object-position: top;
  border: 4px solid #fff; border-bottom-width: 12px; border-radius: 6px; box-shadow: 0 6px 14px rgba(44, 132, 198, 0.2);
  transform: translateX(calc(-50% + var(--k) * 92px)) rotate(calc(var(--k) * 9deg)) translateY(calc(var(--k) * var(--k) * 8px));
  animation: fade 0.4s backwards;
}
.welcome-lead { margin: 6px 0 16px; line-height: 1.65; }
.choices { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.choice {
  display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; border-radius: 16px; cursor: pointer;
  font: inherit; color: var(--ink); background: var(--sky-0); border: 1.5px solid var(--line); transition: transform 0.12s, box-shadow 0.12s;
}
.choice:hover { transform: translateY(-1px); box-shadow: 0 0 0 1.5px var(--blue), var(--shadow); }
.choice b { font-size: 17px; font-weight: normal; color: var(--deep); }
.choice small { font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.choice.primary { background: linear-gradient(180deg, #5db7ef, var(--deep)); border-color: transparent; box-shadow: 0 3px 0 #1f6aa3, var(--shadow); }
.choice.primary b, .choice.primary small { color: #fff; }
.choice.primary small { opacity: 0.92; }
.sample-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius);
  background: #fff4f8; box-shadow: 0 0 0 1.5px var(--pink), var(--shadow);
}
.sample-banner img { width: 44px; height: auto; flex: none; }
.sample-banner p { margin: 0; flex: 1; min-width: 0; font-size: 14px; line-height: 1.55; }
.sample-banner b { font-weight: normal; color: var(--pink-deep); }
.sample-banner .btn { flex: none; }
@media (max-width: 600px) {
  .sample-banner { flex-wrap: wrap; }
  .sample-banner p { flex-basis: calc(100% - 56px); }
  .sample-banner .btn { margin-left: auto; }
}
.file .sample-tag {
  position: absolute; left: 6px; top: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px;
  background: var(--pink-deep); color: #fff;
}

.move-row select { flex: 1; min-width: 0; }
.ex-spec { margin: 0 0 12px; font-size: 13.5px; color: var(--deep); font-variant-numeric: tabular-nums; }
@media (pointer: coarse) { .kbd-hint { display: none; } }

/* phones: a header that leaves room for the reel, three cards per row, the player fits on screen */
@media (max-width: 600px) {
  .bar { row-gap: 6px; column-gap: 8px; }
  .brand h1 { font-size: 18px; line-height: 24px; }
  .top-actions { gap: 4px; }
  .lang-btn { min-width: 0; height: 30px; padding: 0 10px; font-size: 13px; }
  .icon-btn { width: 32px; height: 32px; font-size: 17px; }
  .top-actions .btn { padding: 7px 12px; font-size: 14px; }
  .top-actions .play-btn { margin-left: auto; }
  .menu { position: fixed; left: 12px; right: 12px; top: 54px; width: auto; transform-origin: calc(100% - 28px) -10px; }
  .menu::before { right: 26px; }
  /* the timeline becomes a strip of thumb-sized buttons that scrolls sideways */
  .timeline-row { gap: 8px; align-items: center; padding-top: 2px; padding-bottom: 6px; }
  .timeline-wrap { padding: 30px 6px 5px; margin: 0 -6px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  .timeline-wrap::-webkit-scrollbar { display: none; }
  .timeline-wrap { mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent); }   /* faded edges: it scrolls */
  .rider { top: 6px; height: 26px; }   /* inside the scrolling strip, so it rides along with it */
  .rider.hop { animation: hop-strip 0.35s ease-out; }
  @keyframes hop-strip { 40% { top: 0; } }
  .timeline { gap: 6px; height: 36px; width: max-content; }
  .seg { flex: none !important; min-width: 46px; padding: 0 12px; font-size: 14px; border-radius: 12px; }
  .seg .seg-l, .seg.tiny .seg-l { display: inline; }
  .seg .seg-sh, .seg.tiny .seg-sh, .seg .seg-s { display: none; }
  .seg.bad::after { top: 1px; right: 1px; }
  /* level with the month buttons (the strip has room for the rider above them), not with the strip's middle */
  .total { align-self: flex-end; display: flex; align-items: center; height: 36px; margin-bottom: 5px; padding: 0 10px; border-radius: 12px; font-size: 13px; }
  .tiles { gap: 12px 10px; }
  .tiles .tile, .hook-tiles .tile, .tiles .sleeper { width: calc((100% - 20px) / 3); }
}
@media (max-width: 380px) {
  .top-actions .btn { padding: 7px 9px; }
  .icon-btn { width: 30px; }
}
@media (max-width: 600px) {
  /* the card editor and the picker: a sheet that fills the screen from the bottom, not a small floating window */
  .backdrop:has(.modal:not(.narrow)) { align-items: flex-end; padding: 8px 0 0; }
  .modal:not(.narrow) {
    height: calc(100vh - 8px); height: calc(100dvh - 8px); max-height: none; border-radius: 22px 22px 0 0;
    animation: sheet-up 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .modal.still { animation: none; }
  .modal:not(.narrow) .modal-head { padding: 12px 14px 12px 18px; }
  .modal:not(.narrow) .modal-body { padding: 14px 16px; }
  .modal:not(.narrow) .modal-foot { padding: 10px 16px max(12px, env(safe-area-inset-bottom, 0px)); }
  .stage img, .stage video { max-height: 46vh; }
  /* picker: three or four to a row, and each row of filter chips scrolls sideways instead of wrapping */
  .filters { padding: 10px 16px; }
  .filters .chips { flex-wrap: nowrap; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .filters .chips::-webkit-scrollbar { display: none; }
  .filters .chips button { flex: none; }
  .files { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
}
@keyframes sheet-up { from { transform: translateY(48px); opacity: 0; } }
@media (pointer: coarse) {   /* iPhones zoom the page in on any text field under 16px */
  input[type="text"], input[type="number"], input[type="date"], input[type="search"], select, textarea { font-size: 16px; }
  .rail input.title-input.sub { font-size: 16px; }
}

/* back to top: a bubble with Cinnamoroll in it. Everything pops (no fades); on a tap Cinnamoroll shoots up off
   the screen while the bubble pops away */
.totop {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px) + var(--toast-h, 0px)); z-index: 40;
  transition: bottom 0.25s cubic-bezier(0.3, 1.3, 0.5, 1);
  width: 64px; height: 64px; border: 0; padding: 0; background: none; cursor: pointer; pointer-events: none;
}
.totop.show { pointer-events: auto; }
.totop::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 2px var(--sky-2), var(--shadow-lg);
}
.totop::before, .totop-cinna, .totop-label { transform: scale(0); transition: transform 0.24s cubic-bezier(0.5, -0.7, 0.7, 0.4); }
/* margins put the tilted drawing (not its box) in the middle of the space above the label */
.totop-cinna { position: absolute; left: 50%; top: 50%; width: 46px; margin: -22px 0 0 -22px; }
.totop-cinna img { display: block; width: 100%; height: auto; transform: rotate(-38deg); transition: transform 0.2s; }
.totop-label {
  position: absolute; left: 50%; bottom: 5px; margin-left: -18px; width: 36px; text-align: center;
  border-radius: 999px; background: var(--blue); color: #fff; font-size: 10.5px; line-height: 15px; letter-spacing: 0.5px;
}
.totop.show::before { transform: scale(1); transition: transform 0.34s cubic-bezier(0.3, 1.6, 0.6, 1); }
.totop.show .totop-cinna { transform: scale(1); transition: transform 0.38s 0.06s cubic-bezier(0.3, 1.8, 0.6, 1); }
.totop.show .totop-label { transform: scale(1); transition: transform 0.3s 0.14s cubic-bezier(0.3, 1.6, 0.6, 1); }
.totop.show:hover .totop-cinna img { transform: rotate(-38deg) translate(4px, -5px); }
.totop.show:active::before { transform: scale(0.92); transition-duration: 0.1s; }
/* a little crouch, then straight up and out of sight */
.totop.launch .totop-cinna { transform: translateY(-110vh); transition: transform 0.75s cubic-bezier(0.55, -0.025, 0.9, 0.35); }
@media (max-width: 600px) {
  .totop { right: 14px; width: 56px; height: 56px; }
  .totop-cinna { width: 38px; margin: -20px 0 0 -18px; }
}
@media (prefers-reduced-motion: reduce) {
  .totop::before, .totop-cinna, .totop-label { transition: none !important; }
}

/* who made it: Cinnamoroll sits on a bank of clouds at the foot of the page, above the maker's card */
.credit {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  margin-top: 64px; padding: 30px 16px calc(34px + env(safe-area-inset-bottom, 0px)); font-size: 13px; color: var(--muted);
  background:
    radial-gradient(circle at 12px 12px, rgba(206, 234, 252, 0.9) 2.5px, transparent 3px) 0 0 / 30px 30px,
    linear-gradient(rgba(255, 255, 255, 0.95), rgba(240, 249, 255, 0.95));
}
.credit::before {   /* its top edge: cloud puffs */
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 16px; pointer-events: none;
  background: radial-gradient(circle 16px at 50% 100%, rgba(255, 255, 255, 0.95) 15.5px, transparent 16px) 0 0 / 32px 16px repeat-x;
}
.credit-cinna {
  position: absolute; left: 50%; top: -66px; width: 96px; height: auto; margin-left: -48px; pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(44, 132, 198, 0.25)); animation: bob 2.6s ease-in-out infinite;
}
.credit-lead { margin: 0; font-size: 14.5px; color: var(--deep); }
.credit-art .credit-lead::before, .credit-art .credit-lead::after { content: "♡"; margin: 0 8px; color: var(--pink-deep); }
.maker {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; width: min(100%, 380px);
  padding: 18px 16px 14px; border-radius: 22px; background: #fff; color: var(--ink); text-align: left; text-decoration: none;
  box-shadow: 0 0 0 2px var(--sky-2), 0 10px 26px rgba(44, 132, 198, 0.16); transition: transform 0.15s, box-shadow 0.15s;
}
.maker::before {   /* washi tape, like the photo cards */
  content: ""; position: absolute; top: -10px; left: 50%; width: 74px; height: 20px; margin-left: -37px; border-radius: 2px;
  transform: rotate(-3deg); background: #ffd0df repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.45) 0 5px, transparent 5px 11px);
}
.maker:hover { transform: translateY(-2px) rotate(-0.5deg); box-shadow: 0 0 0 2px var(--blue), 0 14px 30px rgba(44, 132, 198, 0.24); }
.maker-avatar { width: 64px; height: 64px; flex: none; border-radius: 50%; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--blue); }
.maker-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.maker-who b { font-weight: normal; font-size: 21px; line-height: 1.15; color: var(--deep); }
.maker-who small { font-size: 14px; color: var(--muted); }
.maker-cta {
  flex: 1 1 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px; border-radius: 999px;
  background: linear-gradient(180deg, #8b9cf0, #6276d6); box-shadow: 0 3px 0 #4c5db5; color: #fff; font-size: 15px;   /* a candy button like the pink Instagram one */
  transition: background 0.15s;
}
.maker-cta::after { content: "→"; transition: transform 0.15s; }
.maker:hover .maker-cta { background: linear-gradient(180deg, #8193ea, #586cce); }
.maker:hover .maker-cta::after { transform: translateX(3px); }
/* the small print: the notices in a row (wrapping on a phone), each on a little cloud */
.credit-fine {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 14px; margin: 4px 0 0; padding: 0; list-style: none;
  font-size: 12.5px; line-height: 1.6;
}
.credit-fine li { text-wrap: balance; }   /* a long notice wraps into even lines, not one word left on its own */
.credit-fine li::before { content: "☁︎"; margin-right: 5px; color: #9dd0f0; }
/* the way to the About page, under the two cards: a candy button like theirs */
.credit-about { margin-top: 4px; }
.credit-about .i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.credit-about .i .fill { fill: currentColor; stroke: none; }
.gh { flex: none; }
svg.ig { flex: none; fill: none; stroke: currentColor; stroke-width: 2; }
svg.ig .dot { fill: currentColor; stroke: none; }
/* @cinnamorollfans (the illustrations, on Instagram) next to the maker */
.makers { display: flex; flex-wrap: wrap; justify-content: center; gap: 26px 24px; width: 100%; margin-top: 4px; }
.maker.ig::before { background-color: #bfe3f8; transform: rotate(2deg); }
.maker.ig .maker-avatar { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--pink-deep); }
.maker.ig .maker-cta { background: linear-gradient(180deg, #ffa3c2, var(--pink-deep)); box-shadow: 0 3px 0 #c95c86; }
.maker.ig:hover { box-shadow: 0 0 0 2px var(--pink-deep), 0 14px 30px rgba(238, 127, 168, 0.25); }
.maker.ig:hover .maker-cta { background: linear-gradient(180deg, #ff97ba, #e56e9a); }
/* a few of the @cinnamorollfans drawings, pinned in a row; each opens its post */
.credit-art { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; margin-top: 14px; }
.credit-art-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px 14px; max-width: 760px; }
.credit-art-row a {
  position: relative; display: block; width: 104px; padding: 5px 5px 14px; border-radius: 9px; background: #fff;
  transform: rotate(var(--tilt, 0deg)); box-shadow: 0 0 0 1.5px var(--sky-2), 0 6px 14px rgba(44, 132, 198, 0.16); transition: transform 0.18s;
}
.credit-art-row a::before {   /* tape */
  content: ""; position: absolute; top: -6px; left: 50%; width: 40px; height: 12px; margin-left: -20px; border-radius: 2px; transform: rotate(-3deg);
  background: var(--tape) repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.45) 0 4px, transparent 4px 9px);
}
.credit-art-row a:hover, .credit-art-row a:focus-visible { transform: rotate(0deg) translateY(-3px) scale(1.06); }
.credit-art-row img { width: 100%; height: 94px; object-fit: cover; object-position: top; border-radius: 5px; }
@media (max-width: 600px) { .credit-art-row a { width: 88px; } .credit-art-row img { height: 80px; } }

/* ---------------------------------------------------------------- preview player */

.pv { display: flex; flex-direction: column; gap: 8px; }
/* sized from the panel's height, so the whole phone fits without the panel scrolling */
.pv .player-phone {
  position: relative; max-width: none; margin: 0 auto; cursor: pointer;
  width: min(100%, 360px, calc((100vh - var(--head-h) - 250px) * 9 / 16)); min-width: 180px;
}
.pv-big {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.9); box-shadow: 0 8px 26px rgba(20, 70, 120, 0.32); pointer-events: none;
  display: flex; align-items: center; justify-content: center; transition: transform 0.18s, opacity 0.18s;
}
.pv-big::before {
  content: ""; margin-left: 7px; border-style: solid; border-width: 15px 0 15px 24px;
  border-color: transparent transparent transparent var(--deep);
}
.pv .player-phone:hover .pv-big { transform: scale(1.07); }
.pv.playing .pv-big { opacity: 0; transform: scale(0.6); }
.pv-now { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 2px; margin-top: 4px; }
.pv-sec { font-size: 14.5px; color: var(--deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pv-now .time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.scrub { position: relative; height: 22px; }
.scrub-segs { position: absolute; left: 0; right: 0; top: 7px; height: 8px; display: flex; gap: 2px; border-radius: 999px; overflow: hidden; }
.scrub-segs i { display: block; min-width: 2px; }
.scrub-segs .seg-ph { box-shadow: none; background: #d8ecf9; }
.scrub-rest { position: absolute; right: 0; top: 7px; height: 8px; background: rgba(255, 255, 255, 0.6); border-radius: 0 999px 999px 0; pointer-events: none; }
.scrub input[type="range"] { position: absolute; inset: 0; width: 100%; height: 22px; margin: 0; background: transparent; }
.pv-controls { display: flex; align-items: center; gap: 4px; }
.pv-controls .play-btn { min-width: 96px; justify-content: center; }
.pv-controls .icon-btn { font-size: 18px; }
.pv-close { display: none; }
.board-hint { margin: 0 0 12px; }

/* full screen: the player over everything */
.pv.theater {
  position: fixed; inset: 0; z-index: 60; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(14, 38, 64, 0.94); backdrop-filter: blur(6px); justify-content: center; align-items: center;
}
.pv.theater .player-phone { width: min(100%, 520px, calc((100svh - 150px) * 9 / 16)); }
.pv.theater .pv-now, .pv.theater .scrub, .pv.theater .pv-controls { width: min(100%, 520px, calc((100svh - 150px) * 9 / 16 + 120px)); }
.pv.theater .pv-sec { color: #fff; }
.pv.theater .pv-now .time { color: rgba(255, 255, 255, 0.75); }
.pv.theater .scrub-rest { background: rgba(14, 38, 64, 0.55); }
.pv.theater .icon-btn { color: #fff; }
.pv.theater .icon-btn:hover { background: rgba(255, 255, 255, 0.14); }
.pv.theater .pv-close { display: inline-flex; align-items: center; justify-content: center; }
body.theater-open { overflow: hidden; }
body.theater-open .side { z-index: 70; }   /* the panel is sticky (its own layer): lift it over the header */

/* ---------------------------------------------------------------- phones & small windows: bottom bar + sheets
   Below 1180px the side panel doesn't fit next to the editor. Instead of sitting at the bottom of a long page, it
   becomes a sheet that slides up over the editor, opened from a bar that's always at the bottom of the screen. */

:root { --dock-h: 0px; }
.dock, .sheet-head { display: none; }

@media (max-width: 1180px) {
  /* a floating capsule, clear of the iPhone home bar; --dock-h is the space it takes from the bottom */
  :root { --dock-gap: max(10px, env(safe-area-inset-bottom, 0px)); --dock-h: calc(64px + var(--dock-gap)); }

  /* Play and Export live in the bottom bar, so the header fits on one row again */
  .top-actions .play-btn, #export-btn { display: none; }
  .top-actions { width: auto; margin-left: auto; flex-wrap: nowrap; }

  .dock {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; z-index: 46;
    left: 50%; bottom: var(--dock-gap); transform: translateX(-50%); width: min(calc(100% - 20px), 440px); height: 64px; padding: 6px;
    border-radius: 24px;
  }
  /* the bar's surface is its own layer, so Cinnamoroll can hide behind it */
  .dock::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
    box-shadow: 0 0 0 1px rgba(44, 132, 198, 0.12), 0 12px 32px rgba(20, 70, 120, 0.18), 0 2px 6px rgba(20, 70, 120, 0.08);
  }
  .dock-peek {
    position: absolute; z-index: -1; left: 6px; top: -26px; width: calc((100% - 12px) / 4); height: 44px; pointer-events: none;
    object-fit: contain; object-position: 50% 0; filter: drop-shadow(0 -1px 2px rgba(44, 132, 198, 0.25));
    transform: translateX(calc(var(--i, 0) * 100%)); transition: transform 0.34s 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .dock-peek.hop { animation: peek-hop 0.66s ease-in-out; }
  @keyframes peek-hop { 0% { translate: 0 0; } 22%, 64% { translate: 0 36px; } 82% { translate: 0 -4px; } 100% { translate: 0 0; } }
  /* one highlight that slides (with a little spring) to whichever button is on */
  .dock-ind {
    position: absolute; top: 6px; bottom: 6px; left: 6px; width: calc((100% - 12px) / 4); pointer-events: none;
    transform: translateX(calc(var(--i, 0) * 100%)); transition: transform 0.4s cubic-bezier(0.3, 1.3, 0.5, 1);
  }
  .dock-ind::before {
    content: ""; position: absolute; inset: 0 3px; border-radius: 18px;
    background: linear-gradient(180deg, #eef8ff, #dcf0fc); box-shadow: inset 0 0 0 1px rgba(74, 166, 224, 0.2);
  }
  .dock-btn {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0;
    border: 0; padding: 0; border-radius: 18px; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
    color: var(--muted); font: inherit; font-size: 11.5px; line-height: 1; letter-spacing: 0.5px; transition: color 0.2s;
  }
  .dock-btn .i {
    width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
    transition: transform 0.15s;
  }
  .dock-btn .i .fill { fill: currentColor; }
  .dock-btn .l { white-space: nowrap; }
  .dock-btn:hover:not(.on) { color: var(--ink); }
  .dock-btn:active .i { transform: scale(0.86); }
  .dock-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
  .dock-btn.on { color: var(--deep); }
  .dock-btn.on .i { stroke-width: 2.1; animation: dock-pop 0.45s cubic-bezier(0.3, 1.7, 0.5, 1); }
  .dock-btn.on .i .tint { fill: rgba(74, 166, 224, 0.2); }
  @keyframes dock-pop { from { transform: translateY(3px) scale(0.75); } }
  .dock-badge {
    position: absolute; top: 3px; left: calc(50% + 5px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px #fff;
  }

  .side {
    position: fixed; left: 0; right: 0; top: 0; bottom: 0; z-index: 45; max-height: none;   /* the bar floats over its foot */
    align-self: stretch;   /* the desktop panel's align-self: start would shrink a fixed box to its content */
    border-radius: 0; box-shadow: none; background: var(--sky-0);
    transform: translateY(100%); visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s 0.3s;
  }
  body.sheet-open { overflow: hidden; }
  body.sheet-open .side { transform: none; visibility: visible; transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .side .tabs { display: none; }
  .sheet-head {
    display: flex; align-items: center; gap: 8px; position: relative; flex: none;
    padding: 14px 10px 8px 18px; background: #fff; border-bottom: 1px solid var(--line);
  }
  .sheet-head h2 { flex: 1; margin: 0; font-size: 17px; color: var(--deep); }
  .sheet-grip { position: absolute; left: 50%; top: 5px; width: 38px; height: 4px; margin-left: -19px; border-radius: 999px; background: var(--line); }
  .side-pane { flex: 1; min-height: 0; padding-bottom: calc(var(--dock-h) + 16px); }
  .pv .player-phone { width: min(100%, 420px, calc((100svh - var(--dock-h) - 230px) * 9 / 16)); }

  .layout { padding-bottom: 24px; }
  .credit { padding-bottom: calc(var(--dock-h) + 82px); }   /* the small print ends above the TOP button (56px, 14px up) */
  .totop { bottom: calc(var(--dock-h) + 14px + var(--toast-h, 0px)); }
  .toasts { bottom: calc(var(--dock-h) + 12px); }
}
@media (prefers-reduced-motion: reduce) {
  .dock-ind, .dock-btn.on .i { transition: none; animation: none; }
}

/* ---------------------------------------------------------------- Cinnamoroll's sky: the character layer
   A cloud-edged header with clouds drifting through it, Cinnamoroll to pat, plush stitching and cloud stickers on
   the cards, candy-gloss buttons, notes from Cinnamoroll, and the sparkles and party drawn by js/charm.js. */

::selection { background: #c9e8fc; color: var(--ink); }   /* his sky blue */
html { scrollbar-color: #a9d6f3 transparent; }

/* header: a band of sky */
.topbar {
  border-bottom: 0;
  background:
    radial-gradient(circle at 14px 14px, rgba(255, 255, 255, 0.75) 2px, transparent 2.5px) 0 0 / 34px 34px,
    linear-gradient(180deg, rgba(196, 231, 252, 0.95), rgba(234, 247, 255, 0.95));
}
.topbar::after {   /* its bottom edge is a row of cloud puffs */
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 12px; pointer-events: none;
  background: rgba(234, 247, 255, 0.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  -webkit-mask: radial-gradient(circle 12px at 50% 0, #000 11.5px, transparent 12px) 0 0 / 24px 12px repeat-x;
  mask: radial-gradient(circle 12px at 50% 0, #000 11.5px, transparent 12px) 0 0 / 24px 12px repeat-x;
}
.topbar::before {   /* a soft rim under each puff */
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 14px; pointer-events: none; background: rgba(44, 132, 198, 0.13);
  -webkit-mask: radial-gradient(circle 12px at 50% 2px, #000 11.5px, transparent 12px) 0 0 / 24px 14px repeat-x;
  mask: radial-gradient(circle 12px at 50% 2px, #000 11.5px, transparent 12px) 0 0 / 24px 14px repeat-x;
}
.topbar-sky { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.bar, .timeline-row { position: relative; }   /* in front of the clouds */
.topbar-sky img {
  position: absolute; left: 0; height: auto; opacity: 0.85; will-change: transform;
  animation: drift linear infinite;
}
@keyframes drift { from { transform: translateX(-180px); } to { transform: translateX(calc(100vw + 20px)); } }
.topbar-sky img:nth-child(1) { width: 120px; top: -8px; animation-duration: 95s; animation-delay: -20s; }
.topbar-sky img:nth-child(2) { width: 70px; top: 40px; animation-duration: 70s; animation-delay: -52s; opacity: 0.7; }
.topbar-sky img:nth-child(3) { width: 96px; top: 66px; animation-duration: 120s; animation-delay: -85s; }
.topbar-sky img:nth-child(4) { width: 60px; top: 10px; animation-duration: 80s; animation-delay: -8s; opacity: 0.6; }
.topbar-sky img:nth-child(5) { width: 140px; top: 50px; animation-duration: 140s; animation-delay: -40s; opacity: 0.75; }
.topbar-sky i {   /* twinkles */
  position: absolute; width: 11px; height: 11px; background: #fff; opacity: 0;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: twinkle 3.4s ease-in-out infinite;
}
.topbar-sky i:nth-of-type(1) { left: 24%; top: 12px; animation-delay: -0.3s; }
.topbar-sky i:nth-of-type(2) { left: 41%; top: 34px; animation-delay: -1.5s; background: #fff2a8; }
.topbar-sky i:nth-of-type(3) { left: 55%; top: 10px; animation-delay: -2.4s; width: 8px; height: 8px; }
.topbar-sky i:nth-of-type(4) { left: 67%; top: 42px; animation-delay: -0.9s; background: #ffd9e6; }
.topbar-sky i:nth-of-type(5) { left: 12%; top: 46px; animation-delay: -2.9s; width: 8px; height: 8px; background: #fff2a8; }
.topbar-sky i:nth-of-type(6) { left: 86%; top: 8px; animation-delay: -1.9s; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(0.4); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }

/* the title: a sticker */
.brand { position: relative; }
.brand h1 {
  text-shadow: 2px 0 #fff, -2px 0 #fff, 0 2px #fff, 0 -2px #fff, 1.5px 1.5px #fff, -1.5px 1.5px #fff, 1.5px -1.5px #fff,
    -1.5px -1.5px #fff, 0 4px 8px rgba(44, 132, 198, 0.35);
}

/* Cinnamoroll next to the title: pat him */
.mascot {
  flex: none; position: relative; width: 56px; height: 46px; padding: 0; border: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; animation: mascot-idle 3.6s ease-in-out infinite;
}
.mascot img {
  width: 100%; height: 100%; object-fit: contain; transition: transform 0.2s;
  filter: drop-shadow(0 3px 4px rgba(44, 132, 198, 0.3));
}
.mascot:hover img { transform: rotate(-6deg) scale(1.06); }
.mascot:focus-visible { outline-offset: 0; border-radius: 12px; }
@keyframes mascot-idle { 50% { transform: translateY(-3px); } }
.mascot.patted { animation: pat 0.55s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes pat {
  25% { transform: translateY(4px) scale(1.18, 0.82); }
  55% { transform: translateY(-6px) scale(0.92, 1.1) rotate(-5deg); }
  80% { transform: rotate(4deg); }
}
.mascot-say {
  position: absolute; left: 0; top: calc(100% + 10px); z-index: 31; white-space: nowrap; pointer-events: none;
  padding: 8px 14px; border-radius: 16px; background: #fff; color: var(--deep); font-size: 14px; line-height: 1.4;
  box-shadow: 0 0 0 2px var(--sky-2), 0 8px 20px rgba(20, 70, 120, 0.18);
  transform: scale(0); transform-origin: 26px -8px; transition: transform 0.2s cubic-bezier(0.5, -0.5, 0.7, 0.4);
}
.mascot-say::before {
  content: ""; position: absolute; left: 20px; top: -9px; border: 9px solid transparent; border-top: 0; border-bottom-color: #fff;
  filter: drop-shadow(0 -2px 0 var(--sky-2));
}
.mascot-say.show { transform: scale(1); transition: transform 0.32s cubic-bezier(0.3, 1.6, 0.5, 1); }

/* timeline: candy segments */
.seg-hook, .seg-m0, .seg-m1, .seg-end { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.32), inset 0 -2px 0 rgba(0, 40, 90, 0.08); }

/* buttons: a gloss on the candy */
.btn.primary::before, .btn.pink::before, .choice.primary::before {
  content: ""; position: absolute; left: 14%; right: 14%; top: 2px; height: 42%; border-radius: 999px; pointer-events: none;
  background: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
}
.choice { position: relative; }
.choice.primary::before { left: 4%; right: 4%; top: 3px; height: 16px; background: linear-gradient(rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0)); }

/* lanes: plush stitching round the label (not round the cards, which have frames of their own), a cloud sticker
   on the month badge, empty cards wait on a cloud */
.lane { position: relative; }
.rail::after {
  content: ""; position: absolute; inset: 6px; border-radius: calc(var(--radius) - 8px); pointer-events: none;
  border: 2px dashed color-mix(in srgb, var(--accent) 75%, #fff);
}
.month-badge { position: relative; }
.month-badge::after {
  content: ""; position: absolute; right: -13px; bottom: -5px; width: 30px; height: 18px;
  background: url("assets/cloud_icon.png") center / contain no-repeat;
  filter: drop-shadow(1.5px 0 #fff) drop-shadow(-1.5px 0 #fff) drop-shadow(0 1.5px #fff) drop-shadow(0 -1.5px #fff);
}
.placeholder-art .q {
  display: flex; align-items: center; justify-content: center; width: 78px; height: 47px; padding-top: 6px;
  background: url("assets/cloud_ph.png") center / contain no-repeat; font-size: 24px;
}

/* notes from Cinnamoroll */
.toast {
  display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 10px; border-left: 0; border-radius: 20px;
  box-shadow: 0 0 0 2px var(--sky-2), 0 12px 32px rgba(20, 70, 120, 0.22);
  animation: toast-in 0.4s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.toast.ok { box-shadow: 0 0 0 2px #bfe8d3, 0 12px 32px rgba(20, 70, 120, 0.22); }
.toast.error { box-shadow: 0 0 0 2px #ffc2d2, 0 12px 32px rgba(20, 70, 120, 0.22); }
.toast-cinna { width: 44px; height: auto; flex: none; margin: -16px 0 -6px; animation: toast-hop 0.5s 0.15s ease-out backwards; }
.toast-msg { min-width: 0; }
@media (max-width: 600px) {
  .toasts { left: 12px; right: 12px; }
  .toast { width: 100%; padding: 10px 16px 10px 10px; font-size: 15px; }
}
@keyframes toast-in { from { transform: translateY(18px) scale(0.9); opacity: 0; } }
@keyframes toast-hop { from { transform: translateY(10px) rotate(-12deg); } 60% { transform: translateY(-5px) rotate(4deg); } }

/* welcome: a patch of sky to land in */
.welcome .modal-head { background: #e2f3fe; border-bottom: 0; }
.welcome .modal-body { position: relative; background: linear-gradient(#e2f3fe, #fff 190px); }
.welcome .modal-body::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 170px; pointer-events: none;
  background:
    url("assets/cloud_3.png") left 7% top 22px / 80px auto no-repeat,
    url("assets/cloud_5.png") right 8% top 74px / 62px auto no-repeat,
    radial-gradient(circle at 10px 10px, rgba(255, 255, 255, 0.95) 2.5px, transparent 3px) 0 0 / 26px 26px;
  -webkit-mask: linear-gradient(#000 45%, transparent); mask: linear-gradient(#000 45%, transparent);
}

/* export in progress: Cinnamoroll in his own little sky */
.export-shield > div {
  background:
    radial-gradient(circle at 10px 10px, rgba(255, 255, 255, 0.9) 2.5px, transparent 3px) 0 0 / 26px 26px,
    linear-gradient(#cdeafc, #fff 85%);
  box-shadow: 0 0 0 4px #fff, var(--shadow-lg);
}

/* The @cinnamorollfans mood drawings: the crying one on error notes, the fussy one over the list of missing cards, the melting one
   while exporting (the party shows the one jumping for joy) */
.toast-cinna.mood { width: 60px; margin: -10px 0 -4px; }
.mood-note { display: flex; align-items: center; gap: 12px; margin: -4px 0 12px; }
.mood-note img { width: 96px; height: auto; flex: none; animation: fuss 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
.mood-note p { margin: 0; font-size: 17px; color: var(--deep); }
@keyframes fuss { 50% { transform: rotate(-3deg) scale(1.03); } }
.export-shield img.mood { height: auto; width: 150px; animation: melt 2.2s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes melt { 50% { transform: scale(1.06, 0.92); } }

/* an empty month: Cinnamoroll lying flat next to the "add" card (only while the month has no photos) */
.sleeper { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: var(--tile-w); flex: none; }
.lane.ph-month .sleeper { display: flex; }
.sleeper img { width: 100%; height: auto; animation: breathe 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes breathe { 50% { transform: scale(1.025, 0.97); } }
.sleeper-say {
  position: relative; padding: 5px 10px; border-radius: 12px; background: #fff; color: var(--muted); font-size: 12.5px; line-height: 1.4;
  text-align: center; box-shadow: 0 0 0 1.5px var(--line);
}
.sleeper-say::before {
  content: ""; position: absolute; left: 50%; top: -6px; margin-left: -6px; border: 6px solid transparent; border-top: 0;
  border-bottom-color: #fff; filter: drop-shadow(0 -1.5px 0 var(--line));
}

/* a month with photos gets a ✓ stamp on its badge, popped on when its first photo arrives */
.month-stamp {
  position: absolute; left: -9px; top: -9px; z-index: 1; width: 22px; height: 22px; border-radius: 50%; display: none;
  background: var(--ok); color: #fff; font-size: 13px; line-height: 22px; text-align: center; box-shadow: 0 0 0 2.5px #fff;
}
.lane:not(.ph-month) .month-stamp { display: block; }
.lane.stamp-in .month-stamp { animation: stamp 0.55s cubic-bezier(0.3, 1.8, 0.5, 1); }
@keyframes stamp { from { transform: scale(2.4) rotate(-30deg); opacity: 0; } }
/* ...and its part of the timeline shines (--age keeps the sweep going across re-renders) */
.seg.shine::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.85) 50%, transparent 70%) -150% 0 / 250% 100% no-repeat;
  animation: shine 1.4s ease-out both; animation-delay: var(--age);
}
@keyframes shine { to { background-position: 150% 0; } }

/* how much of the year has photos: Cinnamoroll runs along the bar */
.progress {
  --p: 0; display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: var(--radius); background: #fff;
  box-shadow: var(--shadow);
}
.progress-text { flex: none; font-size: 14px; color: var(--deep); }
.progress-track { position: relative; flex: 1; height: 12px; border-radius: 999px; background: var(--sky-1); margin: 0 24px; }   /* room for him at 0 and 12 */
.progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p) * 100%); border-radius: inherit;
  --stripes: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.38) 0 5px, transparent 5px 10px);   /* candy stripes */
  background: var(--stripes), linear-gradient(90deg, #8ccff5, var(--blue)); transition: width 0.6s cubic-bezier(0.3, 1.2, 0.5, 1);
}
.progress-track::after {   /* where he's running to: a heart at the end */
  content: ""; position: absolute; right: -19px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; background: var(--pink-deep);
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 21s-7.5-4.6-9.6-9.2C.9 8.4 3 4.5 6.7 4.5c2.1 0 3.6 1.1 4.6 2.6.9-1.5 2.4-2.6 4.6-2.6 3.7 0 5.8 3.9 4.3 7.3C19.5 16.4 12 21 12 21z'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 21s-7.5-4.6-9.6-9.2C.9 8.4 3 4.5 6.7 4.5c2.1 0 3.6 1.1 4.6 2.6.9-1.5 2.4-2.6 4.6-2.6 3.7 0 5.8 3.9 4.3 7.3C19.5 16.4 12 21 12 21z'/></svg>") center / contain no-repeat;
}
.progress-cinna {
  position: absolute; left: calc(var(--p) * 100%); top: 50%; width: 42px; height: auto; transform: translate(-50%, -62%);
  transition: left 0.6s cubic-bezier(0.3, 1.2, 0.5, 1); filter: drop-shadow(0 2px 2px rgba(44, 132, 198, 0.3));
}
.progress-cinna.hop { animation: progress-hop 0.6s ease-out; }
@keyframes progress-hop { 40% { transform: translate(-50%, -110%) rotate(-8deg); } }
.progress.done { background: linear-gradient(90deg, #fff8e0, #fff); box-shadow: 0 0 0 2px var(--yellow), var(--shadow); }
.progress.done .progress-fill { background: var(--stripes), linear-gradient(90deg, #ffd36b, #ffb3cc); }
@media (max-width: 600px) {   /* the bar gets a line of its own under the words */
  .progress { flex-wrap: wrap; gap: 6px 12px; padding: 10px 16px 12px; }
  .progress-text { font-size: 13.5px; }
  .progress-track { flex: 1 1 100%; margin: 10px 22px 0; }
}

/* a new card drops into its month and gets its tape slapped on */
.tile.arrive { animation: arrive 0.6s cubic-bezier(0.3, 1.5, 0.5, 1) backwards; animation-delay: var(--d, 0ms); }
.tile.arrive .tape { animation: tape-slap 0.35s ease-out backwards; animation-delay: calc(var(--d, 0ms) + 0.4s); }
@keyframes arrive { from { transform: translateY(-70px) rotate(-10deg) scale(0.55); opacity: 0; } }
@keyframes tape-slap { from { transform: translateX(-50%) rotate(-18deg) scale(1.7); opacity: 0; } }
/* a removed card floats off on a cloud (a copy, in the fx layer) */
.float-away { position: absolute; margin: 0; pointer-events: none; }
.float-cloud { position: absolute; left: -12%; right: -12%; bottom: -26px; width: 124%; height: auto; }
/* the card carried by touch has Cinnamoroll riding on it */
.ghost-rider { position: absolute; left: -16px; top: -26px; width: 52px; height: auto; transform: rotate(-12deg); }

/* the time of year (js/season.js): things drifting through the header's sky, and a hat for the mascot */
.season-layer { position: absolute; inset: 0; }
.season-item { position: absolute; left: var(--x); display: block; width: calc(26px * var(--s)); opacity: 0.8; }
.season-item svg { display: block; width: 100%; height: auto; }
.season-item.drift { left: 0; top: calc(8px + var(--s) * 30px); animation: drift calc(70s / var(--s)) linear infinite; animation-delay: var(--d); }
.season-item.fly { left: 0; top: 14px; width: calc(38px * var(--s)); animation: drift 26s linear infinite; animation-delay: var(--d); }
/* only the wings flap (round the shoulder; the mirrored wing turns the other way by itself), and the bat bobs up on each downstroke */
.season-item.fly .wing { transform-box: fill-box; transform-origin: 100% 60%; animation: flap 0.45s ease-in-out infinite alternate; }
.season-item.fly svg { animation: bat-bob 0.45s ease-in-out infinite alternate; }
@keyframes flap { from { transform: rotate(-16deg); } to { transform: rotate(20deg); } }
@keyframes bat-bob { from { translate: 0 -1.5px; } to { translate: 0 1px; } }
.season-item.fall {
  top: -20px; width: calc(14px * var(--s)); opacity: 0.95; animation: fall calc(7s / var(--s)) linear infinite; animation-delay: var(--d);
  filter: drop-shadow(0 0 1.5px rgba(74, 166, 224, 0.9));   /* white snow on a pale sky needs an edge */
}
@keyframes fall { to { transform: translate(18px, 150px) rotate(180deg); } }
.season-item.rise { top: 100%; width: calc(18px * var(--s)); animation: rise calc(16s / var(--s)) linear infinite; animation-delay: var(--d); }
@keyframes rise { to { transform: translate(-14px, -190px); } }
.season-item.pop { top: calc(6px + var(--s) * 40px); width: calc(16px * var(--s)); opacity: 0; animation: twinkle 2.6s ease-in-out infinite; animation-delay: var(--d); }
.mascot-hat { position: absolute; left: 28%; top: -14%; width: 48%; pointer-events: none; transform: rotate(-12deg); }   /* on his head, inside the header */
.mascot-hat svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 1px 1px rgba(44, 132, 198, 0.3)); }
.mascot-hat.birthday, .mascot-hat.newyear { left: 40%; top: -22%; width: 30%; transform: rotate(14deg); }
.mascot.seasonal { width: 66px; }   /* the @cinnamorollfans drawing is wider than him (ears out, a basket): about as tall this way */

/* sparkles, the fly-by and the party (js/charm.js) */
.fx-layer { position: fixed; inset: 0; z-index: 120; pointer-events: none; overflow: hidden; }
.fx { position: absolute; display: block; }
.fx svg { display: block; width: 100%; height: 100%; fill: currentColor; overflow: visible; }
.fx-cloud svg { stroke: #9fd3f5; stroke-width: 1.8; }
.flyer { position: absolute; left: 0; top: 0; height: auto; filter: drop-shadow(0 10px 12px rgba(20, 70, 120, 0.25)); }
.party {
  position: fixed; inset: 0; z-index: 110; pointer-events: none; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.92), rgba(214, 238, 253, 0.7) 32%, rgba(20, 70, 120, 0.18) 75%);
  animation: fade 0.3s; transition: opacity 0.35s;
}
.party.bye { opacity: 0; }
.party-card { text-align: center; animation: party-in 0.6s cubic-bezier(0.3, 1.6, 0.5, 1); }
.party-card img {
  width: min(220px, 50vw); height: auto; margin: 0 auto; filter: drop-shadow(0 12px 18px rgba(20, 70, 120, 0.3));
  animation: bob 1.2s 0.6s ease-in-out infinite;
}
.party-card p {
  display: inline-block; margin: 8px 0 0; padding: 10px 24px; border-radius: 999px; background: #fff; color: var(--deep); font-size: 20px;
  box-shadow: 0 0 0 3px var(--pink), var(--shadow-lg);
}
@keyframes party-in { from { transform: translateY(60px) scale(0.3); opacity: 0; } }

.brand > div { min-width: 0; }
.brand h1 { overflow: hidden; text-overflow: ellipsis; padding: 2px; margin: -2px; }   /* room for the sticker outline */
@media (max-width: 600px) {
  .bar { column-gap: 6px; }
  .brand { gap: 4px; }
  .brand h1 { font-size: 17px; }
  .mascot { width: 38px; height: 34px; }
  .mascot.seasonal { width: 46px; }
  .mascot-say { font-size: 13.5px; }
}
.brand-reel { color: var(--pink-deep); }   /* Cinnamo + Reel: the roll is a reel */
@media (max-width: 340px) { .mascot { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .topbar-sky img, .mascot, .mascot.patted, .toast, .toast-cinna, .dock-peek.hop, .credit-cinna { animation: none; }
  .season-item, .season-item svg, .season-item .wing, .sleeper img, .mood-note img, .export-shield img.mood, .tile.arrive, .tile.arrive .tape, .seg.shine::before,
  .lane.stamp-in .month-stamp, .progress-cinna.hop { animation: none; }
  .season-item.fall, .season-item.pop { opacity: 0.7; }
  .season-item.rise { top: 40%; }
  .topbar-sky i { animation: none; opacity: 0.7; }
}
