@font-face {
  font-family: "Bagel Fat One";
  src: url("../assets/fonts/bagel-fat-one-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("../assets/fonts/space-grotesk-latin-variable.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

/* Toptext's look, "bubble pop": midnight navy, sherbet and sky gradients, glossy pills that press in,
   and speech bubbles everywhere. Tactile like the rest of retrac.space, but its own thing. */
:root {
  color-scheme: dark;
  --bg: #0b0d1f;
  --fg: #f4f6ff;
  --muted: #9aa0c8;
  --line: rgba(180, 190, 255, .12);
  --panel: #151937;
  --panel-deep: #0e1130;
  --raised: #242a62;
  --raised-hi: #2d3476;
  --raised-side: #10133a;
  --ink: #160f2e;
  --coral: #ff6f61;
  --tangerine: #ffad42;
  --lemon: #ffe066;
  --sky: #4cc9ff;
  --indigo: #7b7bff;
  --pink: #ff6fb5;
  --sherbet: linear-gradient(135deg, #ffbe5c 0%, #ff7a5c 50%, #ff5fa8 100%);
  --skyline: linear-gradient(135deg, #7be6ff 0%, #4c9dff 55%, #7b6bff 100%);
  --rim: linear-gradient(140deg, rgba(255, 150, 110, .55), rgba(123, 123, 255, .12) 45%, rgba(76, 201, 255, .45));
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --display: "Titan One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: Outfit, system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--fg);
  font-family: var(--body);
  line-height: 1.45;
  background: linear-gradient(180deg, #0d1028 0%, var(--bg) 40rem);
}

/* Slow, soft glows drifting behind everything. */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora span {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .32;
  animation: aurora 26s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { left: -14vmax; top: -18vmax; background: #ff6f61; }
.aurora span:nth-child(2) { right: -16vmax; top: -10vmax; background: #4c9dff; animation-delay: -9s; animation-duration: 31s; }
.aurora span:nth-child(3) { left: 30%; bottom: -30vmax; background: #7b6bff; opacity: .22; animation-delay: -17s; }
@keyframes aurora {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(6vmax, 4vmax) scale(1.15); }
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
kbd {
  display: inline-block;
  min-width: 1.8em;
  padding: 0 .45em;
  border-radius: 7px;
  font: inherit;
  font-size: .8em;
  font-weight: 700;
  line-height: 1.65;
  text-align: center;
  color: var(--fg);
  background: linear-gradient(180deg, #343b85, #262c66);
  box-shadow: 0 3px 0 var(--raised-side), inset 0 1px 0 rgba(255, 255, 255, .18);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Shared glossy pill controls ---------- */
.tool, .pillbtn, .chip, .toggle, .minibtn, .sizebtn, .fontbtn, .layoutbtn, .stk, .mini-emoji button {
  border: 0;
  color: var(--fg);
  background: linear-gradient(180deg, #2f3678 0%, #232961 100%);
  box-shadow: 0 4px 0 var(--raised-side), inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -2px 0 rgba(0, 0, 0, .15);
  transition: transform .09s var(--ease), box-shadow .09s var(--ease), filter .15s, background .15s, color .15s;
}
:is(.tool, .pillbtn, .chip, .toggle, .minibtn, .sizebtn, .fontbtn, .layoutbtn, .stk, .mini-emoji button):hover:not(:disabled) { filter: brightness(1.18); }
:is(.tool, .pillbtn, .minibtn, .sizebtn, .stk, .mini-emoji button, .chip, .toggle, .fontbtn, .layoutbtn):active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--raised-side), inset 0 1px 0 rgba(255, 255, 255, .16);
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px var(--gutter) 0;
}
.topbar__logo { display: block; flex: none; line-height: 0; transition: transform .25s var(--ease); }
.topbar__logo:hover { transform: translateY(-2px); }
.topbar__logo img { width: 168px; height: auto; }
.topbar__actions { display: flex; gap: 10px; }

.pillbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: .9375rem;
  font-weight: 600;
}
.pillbtn__count {
  min-width: 22px;
  padding: 0 7px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--sherbet);
  font-size: .8125rem;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.pillbtn--stack.is-bumped .pillbtn__count { animation: bump .55s var(--spring); }
@keyframes bump { 40% { transform: scale(1.6) translateY(-3px); } }
@media (max-width: 560px) {
  .topbar__logo img { width: 132px; }
  .pillbtn span:not(.pillbtn__count) { display: none; }
  #shortcutsOpen { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(26px, 4.5vw, 54px) 0 clamp(28px, 4vw, 44px);
  overflow: hidden;
  text-align: center;
}
.title {
  position: relative;
  z-index: 1;
  padding-inline: var(--gutter);
  font-family: var(--display);
  font-weight: 400;
}
.title__art { display: block; white-space: nowrap; line-height: 1.05; font-size: clamp(3.6rem, 16vw, 9rem); letter-spacing: .01em; }

/* A dark copy of each letter is extruded downward, then a glossy gradient copy sits on top. */
.letter {
  position: relative;
  display: inline-block;
  color: var(--d);
  text-shadow:
    0 .015em 0 var(--d), 0 .03em 0 var(--d), 0 .045em 0 var(--d), 0 .06em 0 var(--d), 0 .075em 0 var(--d),
    0 .16em .16em rgba(4, 5, 24, .6);
  transform-origin: 50% 100%;
  animation: squish 3s var(--ease) infinite;
  animation-delay: calc(var(--i) * .11s);
  cursor: default;
}
.letter::after {
  content: attr(data-ch);
  position: absolute;
  left: 0;
  top: 0;
  color: transparent;
  text-shadow: none;
  background: linear-gradient(180deg, #ffffff 4%, var(--c1) 26%, var(--c2) 80%);
  -webkit-background-clip: text;
  background-clip: text;
}
.letter.is-boing { animation: boing .7s var(--spring); }
@keyframes squish {
  0%, 30%, 100% { transform: translateY(0) scale(1, 1); }
  10% { transform: translateY(-.1em) scale(.95, 1.06); }
  20% { transform: translateY(0) scale(1.07, .93); }
}
@keyframes boing {
  0% { transform: scale(1); }
  30% { transform: translateY(-.22em) scale(.88, 1.14) rotate(-4deg); }
  60% { transform: translateY(0) scale(1.12, .88); }
  100% { transform: scale(1); }
}

/* Caption ideas typing out in a speech bubble. */
.typer { position: relative; z-index: 1; margin-top: clamp(14px, 2.4vw, 22px); padding-inline: var(--gutter); }
.typer__bubble {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(640px, 100%);
  min-height: 46px;
  padding: 8px 20px 8px 8px;
  border-radius: 999px 999px 999px 8px;
  background: rgba(21, 25, 55, .82);
  box-shadow: inset 0 0 0 1.5px rgba(150, 165, 255, .2), 0 14px 30px rgba(3, 4, 20, .5);
  backdrop-filter: blur(10px);
  font-size: clamp(.95rem, 2vw, 1.1rem);
  font-weight: 600;
  text-align: left;
}
.typer__label {
  flex: none;
  padding: 4px 11px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--sherbet);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.typer__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.typer__caret {
  flex: none;
  width: 3px;
  height: 1.2em;
  margin-left: -6px;
  border-radius: 2px;
  background: var(--sky);
  box-shadow: 0 0 10px var(--sky);
  animation: caret 1s steps(2, start) infinite;
}
@keyframes caret { to { visibility: hidden; } }

.hero__tag {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  padding-inline: var(--gutter);
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
}
.hero__tag em {
  font-style: normal;
  font-weight: 800;
  background: var(--sherbet);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero__badge {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  padding: 5px 14px 5px 5px;
  border-radius: 999px;
  color: #d9e6ff;
  background: rgba(76, 157, 255, .12);
  box-shadow: inset 0 0 0 1px rgba(76, 201, 255, .3);
  font-size: .875rem;
  font-weight: 600;
}
.hero__badge span {
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--skyline);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.hero__floaters { position: absolute; inset: 0; pointer-events: none; }
.floater {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font-size: var(--s);
  line-height: 1;
  filter: drop-shadow(0 8px 10px rgba(3, 4, 20, .55));
  animation: drift var(--t) ease-in-out infinite;
  animation-delay: var(--w);
}
.floater--tag, .floater--bubble {
  padding: .5em .85em;
  border-radius: 1.2em 1.2em 1.2em .25em;
  font-family: var(--body);
  font-weight: 800;
  letter-spacing: .02em;
  filter: none;
  box-shadow: 0 .3em 0 rgba(0, 0, 0, .25), 0 .8em 1.4em rgba(3, 4, 20, .45), inset 0 .12em 0 rgba(255, 255, 255, .45);
}
.floater--tag { color: #06233a; background: var(--skyline); }
.floater--bubble { color: var(--ink); background: var(--sherbet); }
@keyframes drift {
  0%, 100% { transform: translate(0, 0) rotate(var(--r0)); }
  33% { transform: translate(9px, -18px) rotate(calc(var(--r0) + 8deg)); }
  66% { transform: translate(-7px, -8px) rotate(calc(var(--r0) - 6deg)); }
}
@media (max-width: 720px) { .floater--tag, .floater--bubble { display: none; } }

/* ---------- Big glossy pill buttons ---------- */
.key3d {
  --top: #39418f;
  --bot: #262c66;
  --lip: #121540;
  --key-ink: var(--fg);
  --travel: 6px;
  position: relative;
  display: inline-flex;
  padding: 0 0 var(--travel);
  border: 0;
  border-radius: 999px;
  background: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.key3d::before {
  content: "";
  position: absolute;
  inset: var(--travel) 0 0;
  border-radius: 999px;
  background: var(--lip);
  box-shadow: 0 10px 22px rgba(3, 4, 20, .5);
  transition: box-shadow .1s;
}
.key3d__face {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  overflow: hidden;
  color: var(--key-ink);
  background: linear-gradient(180deg, var(--top), var(--bot));
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .45), inset 0 -3px 0 rgba(0, 0, 0, .12);
  font-weight: 700;
  white-space: nowrap;
  transition: transform .09s var(--ease), filter .15s;
}
/* The shine. */
.key3d__face::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 3px;
  height: 42%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.key3d:hover:not(:disabled) .key3d__face { filter: brightness(1.08) saturate(1.1); transform: translateY(-1px); }
.key3d:active:not(:disabled) .key3d__face, .key3d.is-pressed .key3d__face { transform: translateY(calc(var(--travel) - 1px)); }
.key3d:active:not(:disabled)::before { box-shadow: 0 3px 6px rgba(3, 4, 20, .5); }
.key3d:disabled { opacity: .4; }
.key3d .ico { width: 19px; height: 19px; }
.key3d--primary { --top: #ffc061; --bot: #ff5f7e; --lip: #b02f52; --key-ink: #2b0b16; }
.key3d--mint { --top: #8beaff; --bot: #3e95ff; --lip: #1d4fae; --key-ink: #04203a; }
.key3d--blue { --top: #fff4a3; --bot: #ffc53a; --lip: #b08108; --key-ink: #3a2600; }
.key3d--quiet { --top: #39418f; --bot: #262c66; --lip: #121540; }
.key3d--small { --travel: 4px; }
.key3d--small .key3d__face { height: 38px; padding: 0 15px; gap: 7px; font-size: .9375rem; }
.key3d--small .ico { width: 16px; height: 16px; }
.key3d--big { --travel: 8px; }
.key3d--big .key3d__face { height: 62px; padding: 0 34px; font-family: var(--display); font-weight: 400; font-size: 1.35rem; letter-spacing: .01em; }
.key3d--big .ico { width: 24px; height: 24px; stroke-width: 2.6; }

/* ---------- Studio layout ---------- */
.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  align-items: start;
  gap: 22px;
  width: min(1340px, 100%);
  margin: 0 auto;
  padding: 0 var(--gutter) 40px;
}
@media (min-width: 1001px) and (min-height: 640px) {
  .stagecol { position: sticky; top: 14px; }
}
@media (max-width: 1000px) {
  .studio { grid-template-columns: minmax(0, 1fr); }
}
.stagecol { display: grid; gap: 16px; min-width: 0; }

/* Glass panels with a sherbet-to-sky rim. */
.toolbar, .exportbar, .panel {
  border: 1.5px solid transparent;
  background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--rim) border-box;
  box-shadow: 0 24px 50px rgba(3, 4, 20, .55), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 14px;
  border-radius: 999px;
}
@media (max-width: 640px) { .toolbar { border-radius: 26px; } }
.toolbar__group { display: flex; gap: 8px; }
.tool {
  display: inline-grid;
  place-items: center;
  grid-auto-flow: column;
  gap: 7px;
  min-width: 42px;
  height: 42px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: .9375rem;
  font-weight: 600;
}
.tool:disabled { opacity: .35; }
.tool--label { padding: 0 15px; }
.tool--dice { color: #3a2600; background: linear-gradient(180deg, #fff4a3, #ffc53a); box-shadow: 0 4px 0 #b08108, inset 0 1.5px 0 rgba(255, 255, 255, .6); }
.tool--dice:active:not(:disabled) { box-shadow: 0 1px 0 #b08108, inset 0 1.5px 0 rgba(255, 255, 255, .6); }
.tool--dice.is-rolling .ico { animation: roll .6s var(--spring); }
@keyframes roll { to { transform: rotate(360deg) scale(1.15); } }
@media (max-width: 480px) { .tool--label span { display: none; } }

/* ---------- Stage: a spotlight ---------- */
.stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(340px, 52vh, 620px);
  padding: clamp(16px, 3vw, 34px);
  border-radius: 32px;
  background:
    radial-gradient(60% 55% at 50% 40%, rgba(123, 123, 255, .22), transparent 70%),
    radial-gradient(circle at 50% 40%, #1a1f52 0%, #10133a 55%, #0a0c26 100%);
  box-shadow: inset 0 3px 18px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(150, 165, 255, .1), 0 1px 0 rgba(255, 255, 255, .06);
  overflow: hidden;
  isolation: isolate;
}
/* A floor reflection under the picture. */
.stage::after {
  content: "";
  position: absolute;
  left: 15%;
  right: 15%;
  bottom: -60px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 111, 97, .18), transparent);
  pointer-events: none;
  z-index: -1;
}
.stage.is-dragover { box-shadow: inset 0 0 0 3px var(--sky), inset 0 0 50px rgba(76, 201, 255, .3); }

.board {
  position: relative;
  line-height: 0;
  max-width: 100%;
  animation: land .6s var(--spring);
}
@keyframes land {
  from { opacity: 0; transform: translateY(26px) scale(.9); }
}
.board canvas {
  display: block;
  border-radius: 8px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .08),
    0 26px 50px rgba(3, 4, 20, .65),
    0 0 90px rgba(255, 111, 97, .14);
  background: repeating-conic-gradient(#ddd 0% 25%, #fff 0% 50%) 0 0 / 20px 20px;
}
.board.is-pop { animation: pop .45s var(--spring); }
@keyframes pop { 35% { transform: scale(1.03, .97); } 65% { transform: scale(.99, 1.02); } }

.overlay { position: absolute; inset: 0; touch-action: none; cursor: default; }
.overlay.is-hover { cursor: move; }
.guide { position: absolute; background: var(--pink); box-shadow: 0 0 10px var(--pink); pointer-events: none; }
.guide--v { top: 0; bottom: 0; left: 50%; width: 1.5px; }
.guide--h { left: 0; right: 0; top: 50%; height: 1.5px; }

.sel {
  position: absolute;
  left: 0;
  top: 0;
  border: 2px solid var(--sky);
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(3, 4, 20, .5), 0 0 22px rgba(76, 201, 255, .5), inset 0 0 0 1px rgba(3, 4, 20, .35);
  pointer-events: none;
  transform-origin: center;
}
.sel__handle {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #cfe9ff);
  box-shadow: 0 0 0 3px var(--sky), 0 3px 8px rgba(3, 4, 20, .6);
  pointer-events: auto;
  touch-action: none;
}
.sel__handle::after { content: ""; position: absolute; inset: -10px; }
.sel__handle--scale { right: -10px; bottom: -10px; cursor: nwse-resize; }
.sel__handle--rot {
  left: 50%;
  top: -44px;
  margin-left: -9px;
  cursor: grab;
  background: radial-gradient(circle at 35% 30%, #fff7c2, #ffd23f);
  box-shadow: 0 0 0 3px #ffad42, 0 3px 8px rgba(3, 4, 20, .6);
}
.sel__handle--rot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 19px;
  width: 2px;
  height: 22px;
  margin-left: -1px;
  background: var(--sky);
}
.sel__handle--wr, .sel__handle--wl { top: 50%; width: 10px; height: 26px; margin-top: -13px; border-radius: 6px; cursor: ew-resize; }
.sel__handle--wr { right: -6px; }
.sel__handle--wl { left: -6px; }
.sel[data-type="sticker"] .sel__handle--wr,
.sel[data-type="sticker"] .sel__handle--wl,
.sel[data-type="picture"] .sel__handle--wr,
.sel[data-type="picture"] .sel__handle--wl { display: none; }
.sel__del {
  position: absolute;
  left: -14px;
  top: -14px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(180deg, #ff8a7d, #ff4d5e);
  box-shadow: 0 3px 0 #a3203a, 0 4px 10px rgba(3, 4, 20, .6), inset 0 1px 0 rgba(255, 255, 255, .5);
  pointer-events: auto;
}
.sel__del .ico { width: 13px; height: 13px; stroke-width: 3.2; }
.sel.is-small .sel__handle--wr, .sel.is-small .sel__handle--wl { display: none; }

.stage__busy {
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--sherbet);
  box-shadow: 0 4px 0 #b02f52, 0 12px 24px rgba(3, 4, 20, .5), inset 0 1.5px 0 rgba(255, 255, 255, .5);
  font-weight: 800;
  font-size: .875rem;
  transform: translateX(-50%);
  animation: dropin .35s var(--spring);
}
@keyframes dropin { from { opacity: 0; transform: translate(-50%, -16px) scale(.8); } }

.stage__drop {
  position: absolute;
  inset: 12px;
  z-index: 6;
  display: grid;
  place-items: center;
  border: 3px dashed var(--sky);
  border-radius: 24px;
  background: rgba(76, 157, 255, .14);
  backdrop-filter: blur(4px);
  font-family: var(--display);
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  pointer-events: none;
}

/* Boot */
.stage__boot { display: grid; justify-items: center; gap: 20px; color: var(--muted); font-weight: 600; }
.boot__letters { display: flex; gap: 10px; font-family: var(--display); font-size: 3rem; line-height: 1; }
.boot__letters span {
  display: grid;
  place-items: center;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  color: var(--ink);
  background: var(--g);
  box-shadow: 0 .12em 0 var(--d), 0 .3em .4em rgba(3, 4, 20, .5), inset 0 .06em 0 rgba(255, 255, 255, .6);
  animation: squish 1.1s var(--ease) infinite;
  transform-origin: 50% 100%;
}
.boot__letters span:nth-child(1) { --g: var(--sherbet); --d: #b02f52; }
.boot__letters span:nth-child(2) { --g: linear-gradient(180deg, #fff4a3, #ffc53a); --d: #b08108; animation-delay: .14s; }
.boot__letters span:nth-child(3) { --g: var(--skyline); --d: #1d4fae; animation-delay: .28s; }

/* Empty */
.stage__empty { display: grid; justify-items: center; text-align: center; gap: 10px; max-width: 470px; animation: land .5s var(--spring); }
.empty__art { position: relative; width: 236px; height: 140px; margin-bottom: 14px; }
.empty__card {
  position: absolute;
  display: grid;
  place-items: center;
  width: 106px;
  height: 92px;
  border-radius: 30px 30px 30px 8px;
  font-size: 2.8rem;
  box-shadow: 0 7px 0 var(--d), 0 18px 28px rgba(3, 4, 20, .55), inset 0 2px 0 rgba(255, 255, 255, .55);
  animation: float 4.2s ease-in-out infinite;
}
.empty__card--a { left: 0; top: 22px; --d: #1d4fae; background: var(--skyline); --r0: -10deg; }
.empty__card--b { left: 64px; top: 0; z-index: 2; --d: #b08108; background: linear-gradient(180deg, #fff4a3, #ffc53a); --r0: 3deg; animation-delay: -1.3s; }
.empty__card--c { right: 0; top: 24px; --d: #b02f52; background: var(--sherbet); --r0: 10deg; animation-delay: -2.6s; }
.empty__card--c b { font-family: Impact, Anton, sans-serif; font-weight: 400; font-size: 1.15rem; color: #fff; -webkit-text-stroke: 3px #000; paint-order: stroke fill; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(var(--r0)); }
  50% { transform: translateY(-11px) rotate(calc(var(--r0) * -.5)); }
}
.empty__title { font-family: var(--display); font-weight: 400; font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.1; }
.empty__text { color: var(--muted); }
.empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 12px; }

/* Export bar */
.exportbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 30px;
}
.exportbar__more { display: flex; flex-wrap: wrap; gap: 10px; margin-left: auto; }
@media (max-width: 640px) {
  .exportbar #download { flex: 1 1 100%; }
  .exportbar__more { margin-left: 0; }
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--panel-deep);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .06);
}
.segmented button {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
  font-size: .875rem;
  transition: background .15s, color .15s, box-shadow .15s;
}
.segmented button:hover { color: var(--fg); }
.segmented button[aria-checked="true"] {
  color: #04203a;
  background: var(--skyline);
  box-shadow: 0 2px 0 #1d4fae, inset 0 1px 0 rgba(255, 255, 255, .5);
}
.segmented--icons button { min-width: 40px; padding: 0 9px; }

/* ---------- Panel ---------- */
.panel {
  min-width: 0;
  padding: 14px;
  border-radius: 30px;
}

/* Tabs: a track with a glossy thumb that slides to the open tab. */
.tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 14px;
  padding: 5px;
  border-radius: 22px;
  background: var(--panel-deep);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .06);
}
.tabs__thumb {
  position: absolute;
  left: 5px;
  top: 5px;
  bottom: 5px;
  width: calc((100% - 10px) / 5);
  border-radius: 17px;
  background: var(--sherbet);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .3), 0 8px 18px rgba(255, 111, 97, .3), inset 0 1.5px 0 rgba(255, 255, 255, .55);
  transform: translateX(calc(var(--tab, 0) * 100%));
  transition: transform .45s var(--spring), background .3s;
}
.tabs:has([data-tab="words"][aria-selected="true"]) .tabs__thumb { background: var(--skyline); box-shadow: 0 3px 0 rgba(0, 0, 0, .3), 0 8px 18px rgba(76, 157, 255, .35), inset 0 1.5px 0 rgba(255, 255, 255, .55); }
.tabs:has([data-tab="stickers"][aria-selected="true"]) .tabs__thumb { background: linear-gradient(135deg, #fff4a3, #ffc53a); box-shadow: 0 3px 0 rgba(0, 0, 0, .3), 0 8px 18px rgba(255, 197, 58, .3), inset 0 1.5px 0 rgba(255, 255, 255, .6); }
.tabs:has([data-tab="effects"][aria-selected="true"]) .tabs__thumb { background: linear-gradient(135deg, #c3a8ff, #7b6bff 60%, #5a5ae6); box-shadow: 0 3px 0 rgba(0, 0, 0, .3), 0 8px 18px rgba(123, 107, 255, .35), inset 0 1.5px 0 rgba(255, 255, 255, .5); }
.tabs:has([data-tab="layout"][aria-selected="true"]) .tabs__thumb { background: linear-gradient(135deg, #ffb3d6, #ff6fb5 60%, #e24c94); box-shadow: 0 3px 0 rgba(0, 0, 0, .3), 0 8px 18px rgba(255, 111, 181, .3), inset 0 1.5px 0 rgba(255, 255, 255, .5); }
.tab {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 9px 2px 8px;
  border: 0;
  border-radius: 17px;
  color: var(--muted);
  background: none;
  font-size: .75rem;
  font-weight: 700;
  transition: color .2s;
}
.tab:hover { color: var(--fg); }
.tab .ico { width: 20px; height: 20px; transition: transform .35s var(--spring); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"] .ico { transform: translateY(-1px) scale(1.12); }
.tab[data-tab="words"][aria-selected="true"] { color: #04203a; }
.tab[data-tab="effects"][aria-selected="true"], .tab[data-tab="layout"][aria-selected="true"] { color: #fff; }

.tabpanel { display: grid; gap: 14px; animation: panelin .3s var(--ease); }
@keyframes panelin { from { opacity: 0; transform: translateY(8px); } }

.panel__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  font-size: .8125rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg);
}
.panel__heading span { color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; font-size: .8125rem; }

.row { display: flex; align-items: center; gap: 10px; }
.row--wrap { flex-wrap: wrap; }

.dropzone {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 100%;
  padding: 22px 14px;
  border: 2px dashed rgba(255, 150, 110, .5);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(255, 122, 92, .1), rgba(123, 107, 255, .08));
  transition: border-color .15s, transform .25s var(--spring), background .15s;
}
.dropzone:hover { border-color: var(--coral); transform: translateY(-2px) scale(1.01); background: linear-gradient(160deg, rgba(255, 122, 92, .16), rgba(123, 107, 255, .12)); }
.dropzone .ico { width: 34px; height: 34px; color: var(--coral); margin-bottom: 4px; }
.dropzone__title { font-family: var(--display); font-size: 1.2rem; }
.dropzone__text { color: var(--muted); font-size: .875rem; }

.linkbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: none;
  font-size: .875rem;
  font-weight: 600;
}
.linkbtn:hover { color: var(--fg); background: rgba(150, 165, 255, .08); }
.linkbtn .ico { width: 16px; height: 16px; }
.linkbtn--inline { padding: 2px 8px; letter-spacing: 0; text-transform: none; font-size: .8125rem; }

/* Starters */
.starters { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.starter {
  position: relative;
  display: grid;
  gap: 7px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  perspective: 600px;
}
.starter__thumb {
  position: relative;
  display: block;
  aspect-ratio: 1;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 6px 0 #070920, 0 12px 20px rgba(3, 4, 20, .5), inset 0 0 0 1px rgba(255, 255, 255, .12);
  transition: transform .35s var(--spring), box-shadow .2s;
}
.starter__thumb canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
.starter__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, .35), transparent 40%);
  opacity: .5;
  transition: opacity .2s;
}
.starter:hover .starter__thumb { transform: translateY(-5px) rotateX(10deg) scale(1.05); box-shadow: 0 10px 0 #070920, 0 18px 28px rgba(3, 4, 20, .55), 0 0 0 2px var(--coral); }
.starter:hover .starter__thumb::after { opacity: 1; }
.starter:active .starter__thumb { transform: translateY(3px) scale(.97); box-shadow: 0 2px 0 #070920; }
.starter__label { font-size: .8125rem; font-weight: 700; color: var(--muted); padding-left: 4px; }
.starter:hover .starter__label { color: var(--fg); }

/* Blank */
.blank { display: grid; gap: 12px; }
.blank__sizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sizebtn {
  display: grid;
  justify-items: center;
  align-content: end;
  gap: 6px;
  height: 80px;
  padding: 8px 4px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
}
.sizebtn:hover { color: var(--fg); }
.sizebtn i { display: block; border-radius: 5px; background: var(--blank, #fff); box-shadow: 0 3px 0 rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .5); }

/* Swatches: little gumdrops */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  position: relative;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .2), inset 0 -3px 4px rgba(0, 0, 0, .18);
  transition: transform .2s var(--spring), box-shadow .15s;
}
.swatch::after {
  content: "";
  position: absolute;
  left: 22%;
  top: 12%;
  width: 40%;
  height: 28%;
  border-radius: 50%;
  background: rgba(255, 255, 255, .5);
  filter: blur(.5px);
  pointer-events: none;
}
.swatch:hover { transform: translateY(-2px) scale(1.12); }
.swatch[aria-pressed="true"] { transform: scale(1.06); box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--sky), 0 3px 0 rgba(0, 0, 0, .45); }
.swatch--custom {
  overflow: hidden;
  background: conic-gradient(#ff6f61, #ffad42, #ffe066, #6be27a, #4cc9ff, #7b7bff, #ff6fb5, #ff6f61);
}
.swatch--custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.swatches--small .swatch { width: 26px; height: 26px; }
.swatch--none { background: #1c2150; }
.swatch--none::after { left: 18%; right: 18%; top: 50%; width: auto; height: 2.5px; border-radius: 2px; background: var(--coral); filter: none; transform: rotate(-45deg); }

/* Fields */
.field { display: grid; gap: 8px; }
.field__label { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
textarea {
  width: 100%;
  min-height: 70px;
  padding: 13px 16px;
  border: 0;
  border-radius: 20px;
  background: var(--panel-deep);
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, .65), 0 1px 0 rgba(255, 255, 255, .06);
  font-size: 1rem;
  font-weight: 600;
  resize: vertical;
  outline: none;
  transition: box-shadow .15s;
}
textarea:focus { box-shadow: inset 0 2px 7px rgba(0, 0, 0, .65), 0 0 0 2px var(--sky), 0 0 18px rgba(76, 201, 255, .3); }
textarea::placeholder { color: var(--muted); }

.fonts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-height: 176px; overflow-y: auto; padding: 2px 4px 6px 2px; scrollbar-width: thin; }
.fontbtn {
  display: grid;
  place-items: center;
  height: 48px;
  padding: 0 4px;
  border-radius: 16px;
  font-size: 1.05rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
}
.fontbtn[aria-pressed="true"] { color: #04203a; background: var(--skyline); box-shadow: 0 2px 0 #1d4fae, inset 0 1.5px 0 rgba(255, 255, 255, .5); transform: translateY(2px); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 8px; }
.chips--scroll::-webkit-scrollbar { display: none; }
.chip, .toggle, .minibtn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
}
.minibtn .ico, .toggle .ico { width: 16px; height: 16px; }
.chip[aria-pressed="true"], .toggle[aria-pressed="true"] {
  color: var(--ink);
  background: var(--chip, var(--skyline));
  box-shadow: 0 1px 0 rgba(0, 0, 0, .35), inset 0 1.5px 0 rgba(255, 255, 255, .5);
  transform: translateY(3px);
}
.toggle { --chip: linear-gradient(180deg, #fff4a3, #ffc53a); }
.minibtn--danger { color: #ffb0a8; }
.minibtn--danger:hover { color: #fff; background: linear-gradient(180deg, #ff8a7d, #ff4d5e); }

/* Sliders */
.sliders { display: grid; gap: 11px; }
.slider { display: grid; grid-template-columns: 82px 1fr 44px; align-items: center; gap: 10px; font-size: .875rem; font-weight: 600; color: var(--muted); }
.slider output { font-variant-numeric: tabular-nums; text-align: right; color: var(--fg); font-size: .8125rem; }
.slider.is-hot span { color: var(--tangerine); }
input[type="range"] {
  --fill: 50%;
  width: 100%;
  height: 22px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #7be6ff, #4c9dff calc(var(--fill) * .6), #7b6bff var(--fill), #0a0c26 var(--fill));
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 255, 255, .06);
}
input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #7be6ff, #4c9dff calc(var(--fill) * .6), #7b6bff var(--fill), #0a0c26 var(--fill));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #dfe6ff);
  box-shadow: 0 3px 0 #3a4290, 0 5px 10px rgba(3, 4, 20, .6);
  transition: transform .2s var(--spring);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.2); }
input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #dfe6ff);
  box-shadow: 0 3px 0 #3a4290, 0 5px 10px rgba(3, 4, 20, .6);
}
.slider.is-hot input::-webkit-slider-runnable-track { background: linear-gradient(90deg, #ffe066, #ff7a5c var(--fill), #0a0c26 var(--fill)); }
.slider.is-hot input::-moz-range-track { background: linear-gradient(90deg, #ffe066, #ff7a5c var(--fill), #0a0c26 var(--fill)); }

/* Layers list */
.layers { display: grid; gap: 8px; list-style: none; }
.layer {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 6px;
  border-radius: 20px;
  background: var(--panel-deep);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .25s var(--spring);
  animation: layerin .35s var(--spring) backwards;
}
@keyframes layerin { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
.layer:hover { background: #131740; }
.layer.is-selected { background: rgba(76, 157, 255, .12); box-shadow: inset 0 0 0 2px var(--sky), 0 0 18px rgba(76, 201, 255, .2); }
.layer.is-hidden .layer__name { opacity: .4; text-decoration: line-through; }
.layer__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(180deg, #343c85, #262c66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15);
  font-size: 1.15rem;
  overflow: hidden;
}
.layer__icon img { width: 100%; height: 100%; object-fit: cover; }
.layer__icon b { font-family: Impact, Anton, sans-serif; font-weight: 400; font-size: .95rem; color: #fff; -webkit-text-stroke: 3px #000; paint-order: stroke fill; }
.layer__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .9375rem; }
.layer__btns { display: flex; gap: 2px; }
.layer__btns button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: none;
}
.layer__btns button:hover:not(:disabled) { color: var(--fg); background: var(--raised); }
.layer__btns button:disabled { opacity: .25; }
.layer__btns .ico { width: 15px; height: 15px; }
.layers__empty { color: var(--muted); font-size: .875rem; padding: 8px 4px; }

.inspector {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 24px;
  background: var(--panel-deep);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 2px 12px rgba(0, 0, 0, .4);
  animation: panelin .25s var(--ease);
}
.insp { display: grid; gap: 14px; }
.inspector:not([data-type="text"]) .insp[data-for="text"],
.inspector:not([data-type="sticker"]) .insp[data-for="sticker"],
.inspector[data-type="text"] .insp[data-for="graphic"] { display: none; }

.mini-emoji { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-emoji button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
}
.mini-emoji button:hover { transform: scale(1.15) rotate(-8deg); }

/* Stickers: bubbles */
.stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 10px; }
.stk {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 1.75rem;
  line-height: 1;
  animation: stkin .45s var(--spring) backwards;
  animation-delay: calc(var(--i) * 12ms);
}
@keyframes stkin { from { opacity: 0; transform: scale(.3); } }
.stk:hover { transform: translateY(-3px) scale(1.12) rotate(-8deg); }

/* Effects */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.preset {
  display: grid;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  font-size: .8125rem;
  font-weight: 700;
  color: var(--muted);
}
.preset__thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 20px;
  overflow: hidden;
  background: var(--raised);
  box-shadow: 0 5px 0 #070920, inset 0 0 0 1px rgba(255, 255, 255, .1);
  font-size: 2rem;
  transition: transform .3s var(--spring), box-shadow .15s;
}
.preset__thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.preset__thumb em {
  position: absolute;
  right: 6px;
  bottom: 6px;
  font-style: normal;
  font-size: 1rem;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .6));
}
.preset:hover { color: var(--fg); }
.preset:hover .preset__thumb { transform: translateY(-3px) scale(1.04); }
.preset[aria-pressed="true"] { color: var(--fg); }
.preset[aria-pressed="true"] .preset__thumb { box-shadow: 0 0 0 3px var(--indigo), 0 5px 0 #070920, 0 0 24px rgba(123, 107, 255, .5); }

/* Layouts */
.layouts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.layoutbtn {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 22px;
  text-align: left;
}
.layoutbtn[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(135deg, #ffb3d6, #ff6fb5 60%, #e24c94);
  box-shadow: 0 1px 0 #93295c, inset 0 1.5px 0 rgba(255, 255, 255, .5);
  transform: translateY(3px);
}
.layoutbtn b { display: block; font-size: .9375rem; }
.layoutbtn small { display: block; font-size: .75rem; color: var(--muted); line-height: 1.25; }
.layoutbtn[aria-pressed="true"] small { color: rgba(255, 255, 255, .85); }
.mini {
  position: relative;
  display: grid;
  width: 54px;
  height: 54px;
  padding: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
  overflow: hidden;
}
.mini i { display: block; background: linear-gradient(135deg, #4cc9ff, #7b6bff); }
.mini s {
  position: absolute;
  left: 18%;
  right: 18%;
  height: 4px;
  border-radius: 2px;
  background: #000;
  text-decoration: none;
}
.mini--classic s { background: #fff; box-shadow: 0 0 0 1.5px #000; }
.mini--free i { height: 100%; }

.framectl { display: grid; gap: 12px; }

/* ---------- Footer ---------- */
.footer {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 24px var(--gutter) 40px;
  color: var(--muted);
  font-size: .875rem;
  text-align: center;
}
.footer a { color: var(--fg); text-underline-offset: 3px; text-decoration-color: var(--coral); }

/* ---------- Dialogs ---------- */
.sheet {
  width: min(880px, calc(100vw - 24px));
  max-height: min(84vh, 900px);
  margin: auto;
  padding: 22px;
  border: 1.5px solid transparent;
  border-radius: 32px;
  color: var(--fg);
  background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--rim) border-box;
  box-shadow: 0 30px 80px rgba(3, 4, 20, .75);
}
.sheet[open] { animation: sheetin .45s var(--spring); }
@keyframes sheetin { from { opacity: 0; transform: translateY(30px) scale(.94); } }
.sheet::backdrop { background: rgba(6, 7, 22, .7); backdrop-filter: blur(8px); }
.sheet--small { width: min(440px, calc(100vw - 24px)); }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet__head h2 { font-family: var(--display); font-weight: 400; font-size: 1.8rem; }
.sheet__sub { margin: 4px 0 18px; color: var(--muted); }

.stackgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.stackitem { position: relative; display: grid; gap: 8px; animation: stkin .45s var(--spring) backwards; animation-delay: calc(var(--i) * 30ms); }
.stackitem__open {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 20px;
  overflow: hidden;
  background: var(--panel-deep);
  box-shadow: 0 6px 0 #070920, inset 0 0 0 1px var(--line);
  aspect-ratio: 1;
  transition: transform .3s var(--spring), box-shadow .15s;
}
.stackitem__open:hover { transform: translateY(-4px) scale(1.03); box-shadow: 0 10px 0 #070920, 0 0 0 2px var(--sky); }
.stackitem__open img { display: block; width: 100%; height: 100%; object-fit: contain; }
.stackitem__row { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 4px; font-size: .8125rem; color: var(--muted); }
.stackitem__row div { display: flex; gap: 2px; }
.stackitem__row button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 50%; color: var(--muted); background: none; }
.stackitem__row button:hover { color: #fff; background: #ff4d5e; }
.stackitem__row .ico { width: 15px; height: 15px; }
.stack__empty { padding: 30px 0; color: var(--muted); text-align: center; }

.keys { display: grid; grid-template-columns: auto 1fr; gap: 12px 16px; align-items: center; margin-top: 16px; }
.keys dt { white-space: nowrap; }
.keys dd { color: var(--muted); }

/* ---------- Export animation ---------- */
.cooking {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(6, 7, 22, .72);
  backdrop-filter: blur(10px);
  animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0; } }
.cooking__card {
  display: grid;
  justify-items: center;
  gap: 18px;
  width: min(360px, 100%);
  padding: 28px 24px 24px;
  border: 1.5px solid transparent;
  border-radius: 34px;
  background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--rim) border-box;
  box-shadow: 0 30px 80px rgba(3, 4, 20, .75);
  animation: sheetin .45s var(--spring);
}
.cooking__print { position: relative; width: 210px; height: 200px; overflow: hidden; }
.cooking__slot {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 2;
  height: 40px;
  border-radius: 999px;
  background: var(--sherbet);
  box-shadow: 0 6px 0 #b02f52, 0 14px 22px rgba(3, 4, 20, .5), inset 0 2px 0 rgba(255, 255, 255, .55);
}
.cooking__slot::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 9px;
  height: 7px;
  border-radius: 999px;
  background: #4a0f22;
  box-shadow: inset 0 2px 3px #000;
}
.cooking__paper {
  position: absolute;
  left: 28px;
  top: 30px;
  width: 154px;
  height: 154px;
  object-fit: cover;
  border: 6px solid #fff;
  border-bottom-width: 18px;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 12px 22px rgba(3, 4, 20, .5);
  transform: translateY(calc(-100% * (1 - var(--p, 0)))) rotate(calc((1 - var(--p, 0)) * 3deg));
}
.cooking__line { min-height: 1.5em; font-weight: 700; text-align: center; animation: panelin .3s var(--ease); }
.cooking__bar { width: 100%; height: 14px; border-radius: 999px; background: var(--panel-deep); box-shadow: inset 0 2px 5px rgba(0, 0, 0, .8); overflow: hidden; }
.cooking__bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #7be6ff, #7b6bff, #ff6fb5, #ffad42, #7be6ff);
  background-size: 200% 100%;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .5);
  animation: shimmer 1.4s linear infinite;
  transition: width .2s linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Toasts: speech bubbles ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 300;
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(460px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: 999px;
  color: var(--ink);
  background: #f4f6ff;
  box-shadow: 0 5px 0 #a5acd6, 0 16px 34px rgba(3, 4, 20, .55);
  font-weight: 700;
  pointer-events: auto;
  animation: toastin .45s var(--spring);
}
.toast::after {
  content: "";
  position: absolute;
  right: 30px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-radius: 0 0 4px 0;
  background: inherit;
  transform: rotate(45deg);
  z-index: -1;
}
.toast.is-leaving { animation: toastout .25s var(--ease) forwards; }
.toast button { padding: 5px 12px; border: 0; border-radius: 999px; color: #04203a; background: var(--skyline); font-weight: 800; font-size: .875rem; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); }
.toast--error { color: #fff; background: #ff5a6a; box-shadow: 0 5px 0 #a3203a, 0 16px 34px rgba(3, 4, 20, .55); }
@keyframes toastin { from { opacity: 0; transform: translateY(24px) scale(.7); } }
@keyframes toastout { to { opacity: 0; transform: translateY(12px) scale(.9); } }

.confetti { position: fixed; inset: 0; z-index: 400; width: 100vw; height: 100vh; pointer-events: none; }

.noscript { padding: 20px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
