:root {
  --bg: #4a2c6e;
  --panel: #5a3784;
  --panel-2: #6a4594;
  --line: #8a65b6;
  --text: #ffffff;
  --muted: #eadcff;
  --accent: #ff8fc8;
  --tip: #d8468f; /* the hover labels: white words on a deep pink */
  --accent-2: #d9b3ff;
  --radius: 14px;
  /* 3D buttons: each is a little raised key, lit from above (a bright top edge on a gradient
     face) and standing on a darker edge with a soft shadow. It lifts on hover, sinks when
     pressed, and the chosen one turns pink. */
  --key-face: linear-gradient(180deg, #8c64ba 0%, #704b9c 50%, #633f8f 100%);
  --key-face-hover: linear-gradient(180deg, #9870c6 0%, #7b55a8 50%, #6c479a 100%);
  --key-edge: #3d2162;
  --key-on-face: linear-gradient(180deg, #ffb2db 0%, #f383c9 42%, #b46ef0 100%);
  --key-on-edge: #8b3a9e;
  --key-gloss: inset 0 1px 0 rgba(255, 255, 255, .32), inset 0 -2px 0 rgba(0, 0, 0, .12);
  --key-up: var(--key-gloss), 0 3px 0 var(--key-edge), 0 5px 10px rgba(25, 5, 45, .35);
  --key-hover: var(--key-gloss), 0 4px 0 var(--key-edge), 0 8px 14px rgba(25, 5, 45, .4);
  --key-down: var(--key-gloss), 0 1px 0 var(--key-edge), 0 2px 4px rgba(25, 5, 45, .3);
  --key-on: var(--key-gloss), 0 3px 0 var(--key-on-edge), 0 6px 14px rgba(197, 108, 240, .45);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden;
  -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }

#app { display: grid; height: 100dvh; grid-template-columns: 1fr minmax(320px, 380px); }
/* Exploring: the game takes the whole screen. The customising panel and the top toolbar (the
   logo too) go away until Done; only the Explore controls stay. (!important: over the desktop
   and phone layouts' own columns and rows) */
#app.exploring { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: minmax(0, 1fr) !important; }
#app.exploring #panel, #app.exploring .panel-toggle, #app.exploring .panel-edge { display: none !important; }
/* exploring, the top toolbar keeps just the camera and My gallery */
#app.exploring #stageTools > :not([data-act="shot"]):not([data-act="gallery"]) { display: none !important; }
#stage { position: relative; min-width: 0; min-height: 0;
  background: radial-gradient(120% 90% at 50% 35%, #8a5cb8 0%, #5a3784 55%, #3a2058 100%); }
#view { width: 100%; height: 100%; display: block; touch-action: none; }

#loader { position: absolute; inset: 0; display: grid; place-content: center; gap: 10px;
  text-align: center; color: var(--muted); transition: opacity .4s, visibility 0s .4s; pointer-events: none; }
#loader.done { opacity: 0; visibility: hidden; }
#stage:has(#loader:not(.done)) .explore-bar { display: none; } /* (nothing to explore with until the pony's in) */
/* the loading screen covers the stage from the start, and once the pony is in, until it all runs smoothly */
#loader { background: radial-gradient(120% 90% at 50% 35%, #8a5cb8 0%, #5a3784 55%, #3a2058 100%); z-index: 5; }
#loader.settling .bar span { background: linear-gradient(90deg, #ff8fc8, #c56cf0, #ff8fc8); background-size: 200% 100%; animation: settle-shine 1s linear infinite; }
@keyframes settle-shine { from { background-position: 0 0; } to { background-position: -200% 0; } }
#loader .bar { width: 220px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
#loader p { margin: 0; font-weight: 700; letter-spacing: .02em; }
/* the pony itself, trotting along above the bar: a silhouette of the game's own pony, eight
   frames of one stride rendered from the model (images/loader-trot.png), played as a loop */
#loader .trot { width: 192px; height: 134px; justify-self: center; opacity: .9;
  background: url("../images/loader-trot.png") 0 0 / 800% 100% no-repeat; animation: trot-cycle .66s steps(8) infinite; }
@keyframes trot-cycle { to { background-position: 114.2857% 0; } } /* (eight frames along: 800% / 7 steps of travel) */
@media (prefers-reduced-motion: reduce) { #loader .trot { animation: none; } }
#loader .bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* --- Explore: the Explore and Refocus buttons (bottom left of the stage), the joystick and the keys hint */
.explore-bar { position: absolute; z-index: 4; left: 14px; bottom: max(16px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; }
.explore-btn { position: relative; display: flex; align-items: center; gap: 7px;
  height: 42px; padding: 0 16px 0 12px; border-radius: 21px; cursor: pointer; color: #fff; font-weight: 700;
  border: 1px solid rgba(255, 255, 255, .18); background: var(--key-face); box-shadow: var(--key-up); transition: transform .12s ease, box-shadow .12s ease; }
.explore-btn svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.explore-btn:hover { background: var(--key-face-hover); box-shadow: var(--key-hover); transform: translateY(-1px); }
.explore-btn:active { box-shadow: var(--key-down); transform: translateY(2px); }
/* the two Focus buttons beside it: small round keys, the focus mark with its number on a badge,
   and the game's name label popping up above on hover */
.focus-btn { position: relative; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border-radius: 50%; cursor: pointer; color: #fff;
  border: 1px solid rgba(255, 255, 255, .18); background: var(--key-face); box-shadow: var(--key-up); transition: transform .12s ease, box-shadow .12s ease; }
.focus-btn svg { width: 20px; height: 20px; fill: currentColor; }
.focus-btn > b { position: absolute; right: -3px; bottom: -3px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px;
  font: 800 10px/14px system-ui, sans-serif; text-align: center; color: #fff; background: var(--key-face);
  border: 1px solid rgba(255, 255, 255, .3); box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
.focus-btn:hover { background: var(--key-face-hover); box-shadow: var(--key-hover); transform: translateY(-1px); }
.focus-btn:active { box-shadow: var(--key-down); transform: translateY(2px); }
.explore-bar .tool-tip { top: auto; bottom: calc(100% + 9px); transform: translate(-50%, -3px); }
.explore-bar .tool-tip::after { bottom: auto; top: 100%; border-bottom-color: transparent; border-top-color: var(--tip); }
.explore-bar .has-tip:is(:hover, :focus-visible) .tool-tip { opacity: 1; transform: translate(-50%, 0); }
/* the camera switch (touch screens, while exploring): lit up while the camera stays put */
.cam-btn { display: none; }
@media (pointer: coarse) { #stage.exploring .cam-btn { display: grid; } }
.cam-btn.on { background: var(--key-on-face); border-color: rgba(255, 255, 255, .4); box-shadow: var(--key-on); }
.explore-btn.on { background: var(--key-on-face); border-color: rgba(255, 255, 255, .4); box-shadow: var(--key-on); text-shadow: 0 1px 2px rgba(80, 20, 90, .4); }
.joystick { position: absolute; z-index: 4; left: 18px; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 58px); width: 120px; height: 120px;
  border-radius: 50%; touch-action: none; display: none; place-items: center;
  background: radial-gradient(circle, rgba(255, 255, 255, .1), rgba(90, 55, 132, .35)); border: 2px solid rgba(255, 255, 255, .35);
  box-shadow: inset 0 2px 10px rgba(20, 0, 40, .4), 0 6px 18px rgba(20, 0, 40, .3); backdrop-filter: blur(3px); }
.joystick .knob { width: 50px; height: 50px; border-radius: 50%; pointer-events: none;
  background: var(--key-on-face); border: 2px solid #fff; box-shadow: var(--key-on); transition: transform .08s linear; }
.explore-hint { position: absolute; z-index: 4; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 7px 14px; border-radius: 999px; white-space: nowrap; font-size: 13px; color: #fff; pointer-events: none;
  background: #5a3784; border: 1px solid rgba(255, 255, 255, .22); box-shadow: 0 4px 14px rgba(30, 10, 50, .35); display: none; }
#stage.exploring .joystick { display: grid; }
/* the Walk / Trot switch and the Jump button: bottom right, Jump in the corner and the switch
   just above it, narrow and all the same width (flying they're Up over Down) */
.explore-pads { position: absolute; z-index: 4; right: 14px; bottom: max(16px, env(safe-area-inset-bottom)); display: none; flex-direction: column; gap: 10px; }
.explore-pads.flying { flex-direction: column-reverse; }
#stage.exploring .explore-pads { display: flex; }
/* with a mouse and keyboard they're not needed (T, Space, the arrows do it all): touch screens only */
@media (pointer: fine) { #stage.exploring .explore-pads { display: none; } }
.explore-pads button { display: flex; align-items: center; justify-content: center; gap: 5px; width: 84px; height: 44px; padding: 0 8px; border-radius: 22px; cursor: pointer; color: #fff;
  font-weight: 700; font-size: 13px; border: 1px solid rgba(255, 255, 255, .18); background: var(--key-face); box-shadow: var(--key-up);
  touch-action: manipulation; -webkit-user-select: none; user-select: none; transition: transform .1s ease, box-shadow .1s ease; }
.explore-pads button svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.explore-pads button:active { box-shadow: var(--key-down); transform: translateY(2px); }
.explore-pads button.on { background: var(--key-on-face); border-color: rgba(255, 255, 255, .4); box-shadow: var(--key-on); }
/* (only while the pony is being moved about: see explore.js) */
@media (pointer: fine) and (min-width: 761px) { #stage.exploring .explore-hint.show { display: block; } }

/* switching backdrops: a small frosted card with a glowing pink-to-violet bar */
.scene-loader { position: absolute; left: 50%; bottom: 18%; z-index: 3; width: min(260px, 70%); padding: 12px 16px 14px;
  border-radius: 18px; text-align: center; pointer-events: none; color: #fff;
  background: rgba(74, 44, 110, .78); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 12px 30px rgba(20, 0, 40, .45), inset 0 1px 0 rgba(255, 255, 255, .2);
  opacity: 0; transform: translate(-50%, 10px) scale(.96); transition: opacity .2s ease, transform .25s cubic-bezier(.2, .9, .3, 1.2); }
.scene-loader.on { opacity: 1; transform: translate(-50%, 0); }
.scene-loader p { margin: 0 0 9px; font-weight: 600; font-size: 14px; }
.scene-loader b { font-weight: 800; }
.sl-star { display: inline-block; color: #ffd1ea; animation: sl-spin 1.6s linear infinite; }
@keyframes sl-spin { to { transform: rotate(360deg); } }
.sl-bar { height: 10px; border-radius: 5px; overflow: hidden; background: rgba(30, 10, 55, .55); box-shadow: inset 0 1px 3px rgba(10, 0, 25, .55); }
.sl-bar span { position: relative; display: block; height: 100%; width: 0; border-radius: 5px; overflow: hidden;
  background: linear-gradient(90deg, #ff8fc8, #c56cf0 60%, #8f6cff); box-shadow: 0 0 10px rgba(255, 143, 200, .7); }
.sl-bar span::after { content: ""; position: absolute; inset: 0; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent); animation: sl-shine 1.1s ease-in-out infinite; }
@keyframes sl-shine { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .sl-star, .sl-bar span::after { animation: none; } }

/* the top toolbar runs the width of the stage: the logo and tools on the left, Share (and install) on the right */
#stageTools { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; gap: 8px; pointer-events: none; }
#stageTools > * { pointer-events: auto; }
#stageTools .share-fab { margin-left: auto; }
#stageTools button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18);
  background: var(--key-face); box-shadow: var(--key-up); cursor: pointer; font-size: 18px;
  transition: transform .12s ease, box-shadow .12s ease; }
#stageTools button:hover { background: var(--key-face-hover); box-shadow: var(--key-hover); transform: translateY(-1px); }
#stageTools button:active { box-shadow: var(--key-down); transform: translateY(2px); }

#stageTools button svg { width: 20px; height: 20px; fill: currentColor; display: block; margin: auto; }
/* the toolbar buttons' name labels, popping up underneath straight away */
#stageTools button.has-tip { position: relative; }
.tool-tip { position: absolute; left: 50%; top: calc(100% + 9px); z-index: 30; pointer-events: none; padding: 5px 11px; border-radius: 999px;
  white-space: nowrap; font: 700 12px/1.2 system-ui, sans-serif; background: var(--tip); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  opacity: 0; transform: translate(-50%, -3px) scale(.92); transition: transform .1s ease-out; }
.tool-tip::after { content: ""; position: absolute; left: 50%; bottom: 100%; margin-left: -5px; border: 5px solid transparent; border-bottom-color: var(--tip); }
#stageTools button.has-tip:is(:hover, :focus-visible) .tool-tip { opacity: 1; transform: translate(-50%, 0); }

/* --- share button: a glowing pill that fans out the apps on hover / tap */
.share-fab { position: relative; }
.share-fab .fab-main { width: auto !important; padding: 0 16px 0 12px; border-radius: 21px !important; display: flex; align-items: center; gap: 7px;
  border: 0 !important; color: #fff; font-weight: 700; letter-spacing: .02em;
  background: linear-gradient(135deg, #ff8fc8 0%, #c56cf0 55%, #7b6cff 100%) !important;
  box-shadow: var(--key-on) !important;
  transition: transform .18s ease, box-shadow .18s ease; }
.share-fab .fab-main svg { width: 18px; height: 18px; margin: 0; }
.share-fab .fab-main:hover, .share-fab.open .fab-main { transform: translateY(-1px) scale(1.04);
  box-shadow: var(--key-gloss), 0 4px 0 var(--key-on-edge), 0 8px 22px rgba(197, 108, 240, .7) !important; }
.share-fab .fab-main:active { transform: translateY(2px); box-shadow: var(--key-gloss), 0 1px 0 var(--key-on-edge) !important; }
.share-menu { position: absolute; top: 52px; right: 0; width: 292px; padding: 14px; border-radius: 18px; z-index: 20;
  background: rgba(74, 44, 110, .95); backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45); opacity: 0; transform: translateY(-8px) scale(.97); transform-origin: top right;
  pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.share-fab.open .share-menu { opacity: 1; transform: none; pointer-events: auto; }
@media (max-width: 560px) { /* phones: the menu spans the screen under the toolbar instead of running off its right edge */
  .share-menu { position: fixed; left: 12px; right: 12px; width: auto; max-width: 340px; margin: 0 auto;
    top: calc(max(12px, env(safe-area-inset-top)) + 52px); transform-origin: 50% 0; }
}
.share-menu p { margin: 0 0 10px; font-weight: 700; color: var(--text); text-align: center; }
/* app buttons: an even grid of four per row, spread edge to edge, so every row lines up with
   the same space on both sides (no ragged gap where they wrap) */
.share-row { display: grid; grid-template-columns: repeat(4, 38px); justify-content: space-between; row-gap: 12px; margin: 12px 4px 20px; }
.share-btn { width: 38px !important; height: 38px !important; border-radius: 50% !important; border: 0 !important; color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: transform .15s ease, filter .15s ease, box-shadow .15s ease; }
.share-btn { position: relative; }
.share-btn svg { width: 18px; height: 18px; fill: currentColor; }
/* each app's name pops up over its icon straight away, in the game's own label style */
.share-btn .tip { position: absolute; left: 50%; bottom: calc(100% + 7px); z-index: 5; pointer-events: none;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; font-size: 12px; font-weight: 700;
  background: var(--tip); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  opacity: 0; transform: translate(-50%, 3px) scale(.9); transition: transform .1s ease-out; }
.share-btn .tip::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -5px;
  border: 5px solid transparent; border-top-color: var(--tip); }
.share-btn:is(:hover, :focus-visible) .tip { opacity: 1; transform: translate(-50%, 0) scale(1); }
.share-btn:hover { transform: translateY(-3px); filter: brightness(1.1); box-shadow: 0 4px 12px rgba(0, 0, 0, .35); }
.share-fab.open .share-row .share-btn { animation: pop .28s both; }
.share-fab.open .share-row .share-btn:nth-child(2) { animation-delay: .03s; }
.share-fab.open .share-row .share-btn:nth-child(3) { animation-delay: .06s; }
.share-fab.open .share-row .share-btn:nth-child(4) { animation-delay: .09s; }
.share-fab.open .share-row .share-btn:nth-child(5) { animation-delay: .12s; }
.share-fab.open .share-row .share-btn:nth-child(6) { animation-delay: .15s; }
.share-fab.open .share-row .share-btn:nth-child(7) { animation-delay: .18s; }
.share-fab.open .share-row .share-btn:nth-child(8) { animation-delay: .21s; }
@keyframes pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
.share-whatsapp { background: #25d366 !important; } .share-facebook { background: #1877f2 !important; }
.share-x { background: #000 !important; } .share-pinterest { background: #e60023 !important; }
.share-reddit { background: #ff4500 !important; } .share-telegram { background: #26a5e4 !important; }
.share-email { background: #6b7280 !important; } .share-copy { background: #9a4cbc !important; }
/* the wide buttons (Install the app, Take a picture to share): centred in the menu, sized to
   their words with the same padding either side (all the same width), icon and words centred */
.share-wide { width: fit-content; min-width: 228px; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 22px; margin: 10px auto; border: 0; border-radius: 12px;
  color: #fff; font-weight: 600; cursor: pointer; text-align: center; background: linear-gradient(135deg, #ff8fc8, #c56cf0); }
.share-wide.alt { background: var(--panel-2); border: 1px solid var(--line); transition: background .18s ease, border-color .18s ease; }
.share-wide.alt:hover { background: linear-gradient(135deg, #ff8fc8, #c56cf0); border-color: transparent; filter: none; }
#stageTools .share-menu .share-wide.alt:hover { border-color: transparent; background: linear-gradient(135deg, #ff8fc8, #c56cf0); }
.share-wide svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.share-wide:hover { filter: brightness(1.08); }
/* menu buttons live inside the round stage toolbar: undo its circle styling */
#stageTools .share-menu .share-wide { width: fit-content; height: auto; border-radius: 12px; font-size: 14px; border: 0;
  background: var(--key-on-face); box-shadow: var(--key-gloss), 0 3px 0 var(--key-on-edge), 0 5px 10px rgba(25, 5, 45, .3); }
#stageTools .share-menu .share-wide.alt { border: 1px solid rgba(255, 255, 255, .16); background: var(--key-face); box-shadow: var(--key-up); }
#stageTools .share-menu .share-wide:active { transform: translateY(2px); }
#stageTools .share-menu .share-btn { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 3px 0 rgba(20, 0, 40, .45); }
#stageTools .share-menu .share-btn:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 0 rgba(20, 0, 40, .45), 0 6px 12px rgba(0, 0, 0, .3); }
#stageTools .share-menu .share-wide svg { margin: 0; }

/* --- the game's logo, first in the stage toolbar: the round pony badge, and the name in white
   beside it on two lines (STARLIGHT over PONY), no pill behind them */
#stageTools .game-logo { width: auto; height: 42px; display: flex; align-items: center; gap: 9px; padding: 0 6px 0 0;
  border-radius: 21px; border: 0; background: none; box-shadow: none; color: #fff; cursor: pointer; transition: transform .15s ease; }
#stageTools .game-logo:hover { transform: translateY(-1px); background: none; box-shadow: none; }
/* the logo: the trotting pony in white on the icon's pink-to-violet */
.game-logo .mark { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #fe95cc, #c47df0 50%, #7a67f5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3), 0 3px 10px rgba(40, 10, 70, .35); transition: box-shadow .15s ease; }
#stageTools .game-logo:hover .mark { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45), 0 4px 16px rgba(197, 108, 240, .6); }
.game-logo .mark img { width: 33px; height: auto; display: block; filter: drop-shadow(0 1px 1px rgba(70, 30, 120, .35)); }
.game-logo .name { display: flex; flex-direction: column; justify-content: center; gap: 1px; color: #fff; text-align: left;
  font: 800 14px/1 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(40, 10, 70, .55), 0 0 10px rgba(40, 10, 70, .35); }
.game-logo .name b { font-weight: 900; font-size: 15px; letter-spacing: .14em; }
@media (max-width: 560px) { /* phones: just the round pony badge */
  #stageTools .game-logo { width: 42px; padding: 0; justify-content: center; }
  .game-logo .name { display: none; }
}
/* the licence card */
.licence { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(40, 20, 60, .45); backdrop-filter: blur(4px); opacity: 0; transition: opacity .2s ease; }
.licence.on { opacity: 1; }
.lic-card { position: relative; width: min(360px, 100%); padding: 24px 22px 20px; border-radius: 22px; text-align: center;
  background: linear-gradient(180deg, #6e4a9a, #5a3784); border: 1px solid rgba(255, 255, 255, .15); box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  transform: translateY(14px) scale(.97); transition: transform .28s cubic-bezier(.2, .9, .3, 1.2); }
.licence.on .lic-card { transform: none; }
.lic-close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .12); cursor: pointer; display: grid; place-items: center; }
.lic-close svg { width: 16px; height: 16px; fill: #fff; }
.lic-icon { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 8px 22px rgba(255, 143, 200, .45); }
.lic-card h2 { margin: 12px 0 6px; font-size: 21px; }
.lic-line { margin: 0 0 10px; font-size: 15px; }
.lic-line a { color: #ffd1ea; font-weight: 700; }
.lic-small { margin: 0 0 16px; font-size: 12px; color: var(--muted); }
.lic-btn { display: inline-block; padding: 10px 20px; border-radius: 999px; color: #fff; font-weight: 700; text-decoration: none;
  background: linear-gradient(135deg, #ff8fc8, #c56cf0 55%, #7b6cff); box-shadow: 0 4px 14px rgba(197, 108, 240, .45); }

/* --- install button: a round app-badge with a soft pulse the first few times it shows */
#stageTools .install-fab { position: relative; border: 0; color: #fff;
  background: linear-gradient(#5a3784, #5a3784) padding-box, linear-gradient(135deg, #ff8fc8, #c56cf0, #7b6cff) border-box;
  border: 2px solid transparent; box-shadow: var(--key-gloss), 0 3px 0 var(--key-edge), 0 5px 14px rgba(123, 108, 255, .35);
  transition: transform .18s ease, box-shadow .18s ease; }
#stageTools .install-fab:hover { transform: translateY(-1px) scale(1.06); border-color: transparent;
  box-shadow: var(--key-gloss), 0 4px 0 var(--key-edge), 0 8px 20px rgba(197, 108, 240, .6); }
#stageTools .install-fab[hidden] { display: none; }
/* the last button on the right: its label opens leftwards, so it stays over the stage (not under the editor) */
#stageTools .install-fab .tool-tip { left: auto; right: -4px; transform: translateY(-3px) scale(.92); transform-origin: right top; }
#stageTools .install-fab.has-tip:is(:hover, :focus-visible) .tool-tip { transform: none; }
#stageTools .install-fab .tool-tip::after { left: auto; right: 18px; margin-left: 0; }
.install-fab::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 0 rgba(255, 143, 200, .6); animation: install-pulse 2.2s ease-out 1s 3; }
@keyframes install-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 143, 200, .6); } 100% { box-shadow: 0 0 0 14px rgba(255, 143, 200, 0); } }

/* --- the "add to home screen" guide: a card with an animated phone showing the steps */
.install-guide { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(40, 20, 60, .45); backdrop-filter: blur(4px); opacity: 0; transition: opacity .22s ease; }
.install-guide.on { opacity: 1; }
.ig-card { position: relative; width: min(360px, 100%); padding: 22px 22px 18px; border-radius: 22px; text-align: center;
  background: linear-gradient(180deg, #6e4a9a, #5a3784); border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5); transform: translateY(16px) scale(.97); transition: transform .3s cubic-bezier(.2, .9, .3, 1.2); }
.install-guide.on .ig-card { transform: none; }
.ig-close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .08); cursor: pointer; display: grid; place-items: center; }
.ig-close svg { width: 16px; height: 16px; fill: var(--muted); }
.ig-icon { width: 64px; height: 64px; border-radius: 15px; box-shadow: 0 8px 20px rgba(197, 108, 240, .45);
  animation: ig-bob 2.6s ease-in-out infinite; }
@keyframes ig-bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(3deg); } }
.ig-card h2 { margin: 10px 0 4px; font-size: 18px; }
.ig-lead { margin: 0 0 14px; color: var(--muted); }
.ig-steps { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: s; text-align: left; }
.ig-steps li { counter-increment: s; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px;
  color: var(--muted); transition: background .25s, color .25s; }
.ig-steps li::before { content: counter(s); flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--panel-2); color: var(--text); transition: background .25s; }
.ig-steps li.now { background: rgba(255, 143, 200, .12); color: var(--text); }
.ig-steps li.now::before { background: linear-gradient(135deg, #ff8fc8, #c56cf0); }
.ig-steps li svg { width: 18px; height: 18px; fill: var(--accent-2); vertical-align: -4px; margin-left: 2px; }

/* the little phone */
.ig-phone { width: 150px; height: 262px; margin: 0 auto; padding: 7px; border-radius: 28px; background: #0e0e14;
  box-shadow: 0 0 0 2px #8a65b6, 0 14px 30px rgba(0, 0, 0, .45); }
.ig-screen { position: relative; height: 100%; border-radius: 22px; overflow: hidden;
  background: linear-gradient(180deg, #fff 0%, #f4eefa 100%); }
.ig-page { padding: 26px 14px 0; text-align: left; }
.ig-page img { width: 42px; height: 42px; border-radius: 10px; display: block; margin-bottom: 10px; }
.ig-page i { display: block; height: 7px; margin: 6px 0; border-radius: 4px; background: #e2d8ee; }
.ig-page i:nth-child(3) { width: 70%; } .ig-page i:nth-child(4) { width: 85%; }
.ig-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 34px; display: flex; align-items: center; justify-content: space-around;
  background: rgba(246, 246, 250, .96); border-top: 1px solid #e3e3ea; }
.ig-bar span:not(.ig-share) { width: 16px; height: 4px; border-radius: 2px; background: #c9c9d6; }
.ig-share svg { width: 20px; height: 20px; fill: #2f7bf6; display: block; }
.ig-sheet { position: absolute; left: 6px; right: 6px; bottom: 6px; padding: 6px; border-radius: 14px; background: #f2f2f7;
  box-shadow: 0 -6px 18px rgba(0, 0, 0, .18); transform: translateY(115%); transition: transform .45s cubic-bezier(.2, .9, .3, 1); }
.ig-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 7px 8px; font-size: 9px; white-space: nowrap; color: #222;
  border-bottom: 1px solid #e2e2e8; }
.ig-row:last-child { border-bottom: 0; }
.ig-row svg { width: 14px; height: 14px; fill: #222; }
.ig-add { border-radius: 8px; transition: background .3s .5s; }
.ig-home { position: absolute; inset: 0; padding: 30px 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; align-content: start;
  background: linear-gradient(160deg, #7b6cff, #c56cf0 60%, #ff8fc8); opacity: 0; transition: opacity .4s; }
.ig-home i { aspect-ratio: 1; border-radius: 7px; background: rgba(255, 255, 255, .35); }
.ig-home b { position: relative; display: flex; flex-direction: column; align-items: center; transform: scale(0); }
.ig-home b img { width: 100%; border-radius: 7px; box-shadow: 0 3px 8px rgba(0, 0, 0, .3); }
.ig-home b em { margin-top: 2px; font-size: 6px; font-style: normal; color: #fff; white-space: nowrap; }
.ig-finger { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  background: rgba(255, 255, 255, .55); border: 2px solid rgba(47, 123, 246, .8); opacity: 0;
  transition: left .5s ease, top .5s ease, opacity .3s; }
/* step 0: the finger taps Share; 1: the sheet is up and Add to Home Screen is tapped; 2: the icon lands */
.ig-phone[data-step="0"] .ig-finger { left: 50%; top: calc(100% - 17px); opacity: 1; animation: ig-tap 1.3s ease .5s infinite; }
.ig-phone[data-step="1"] .ig-sheet { transform: none; }
.ig-phone[data-step="1"] .ig-add { background: rgba(47, 123, 246, .16); }
.ig-phone[data-step="1"] .ig-finger { left: 50%; top: calc(100% - 64px); opacity: 1; animation: ig-tap 1.3s ease .8s infinite; }
.ig-phone[data-step="2"] .ig-home { opacity: 1; }
.ig-phone[data-step="2"] .ig-home b { animation: ig-land .7s cubic-bezier(.2, 1.4, .4, 1) .35s both; }
.ig-phone[data-step="2"] .ig-home b::after { content: "✦"; position: absolute; top: -9px; right: -7px; color: #fff; font-size: 11px;
  animation: ig-twinkle 1s ease .9s both; }
@keyframes ig-tap { 0%, 100% { transform: scale(1); } 40% { transform: scale(.7); box-shadow: 0 0 0 8px rgba(47, 123, 246, .2); } }
@keyframes ig-land { from { transform: translateY(-40px) scale(0); } to { transform: none; } }
@keyframes ig-twinkle { from { opacity: 0; transform: scale(0) rotate(-40deg); } 60% { opacity: 1; transform: scale(1.3); } to { opacity: .9; transform: none; } }

/* where the real Share button is: the bottom toolbar in Safari on an iPhone, top right on an iPad
   and in Chrome on an iPhone (share-top) */
.ig-pointer { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; font-weight: 700; font-size: 13px;
  animation: ig-point 1.2s ease-in-out infinite; }
.ig-pointer svg { order: 2; width: 26px; height: 26px; fill: #fff; padding: 6px; border-radius: 50%; background: #2f7bf6;
  box-shadow: 0 0 0 6px rgba(47, 123, 246, .3); box-sizing: content-box; }
.ig-pointer::after { content: ""; order: 3; width: 0; height: 0; border: 9px solid transparent; border-top-color: #2f7bf6; border-bottom: 0; }
@keyframes ig-point { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }
.install-guide:is(.ipad, .share-top) .ig-pointer { left: auto; right: 70px; bottom: auto; top: max(10px, env(safe-area-inset-top)); flex-direction: column-reverse; transform: none; animation-name: ig-point-up; }
.install-guide.share-top .ig-pointer { right: 18px; }
.install-guide:is(.ipad, .share-top) .ig-pointer::after { order: 0; border-top-color: transparent; border: 9px solid transparent; border-bottom-color: #2f7bf6; border-top: 0; }
@keyframes ig-point-up { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
/* Android: Chrome's address bar is at the top, with its ⋮ menu dropping down from the right */
.install-guide.android .ig-top { top: 0; bottom: auto; justify-content: space-between; padding: 0 6px 0 10px;
  border-top: 0; border-bottom: 1px solid #e3e3ea; }
.install-guide.android .ig-url { width: 76%; height: 14px; border-radius: 7px; background: #ebe6f0; }
.install-guide.android .ig-dots svg { width: 16px; height: 16px; fill: #3c3c48; }
.install-guide.android .ig-page { padding-top: 46px; }
.install-guide.android .ig-sheet { top: 30px; right: 6px; left: auto; bottom: auto; width: 66%; padding: 4px; border-radius: 8px;
  background: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); transform: scale(.4); transform-origin: 100% 0; opacity: 0;
  transition: transform .35s cubic-bezier(.2, .9, .3, 1), opacity .25s; }
.install-guide.android .ig-row { border-bottom: 0; padding: 6px 8px; }
.install-guide.android .ig-phone[data-step="1"] .ig-sheet { transform: none; opacity: 1; }
.install-guide.android .ig-phone[data-step="0"] .ig-finger { left: calc(100% - 17px); top: 17px; }
.install-guide.android .ig-phone[data-step="1"] .ig-finger { left: 64%; top: 104px; }
.install-guide.android .ig-pointer { left: auto; right: 18px; bottom: auto; top: max(10px, env(safe-area-inset-top)); flex-direction: column-reverse; transform: none; animation-name: ig-point-up; }
.install-guide.android .ig-pointer svg { fill: #fff; }
.install-guide.android .ig-pointer::after { order: 0; border: 9px solid transparent; border-bottom-color: #2f7bf6; border-top: 0; }
.ig-steps li b svg { width: 14px; height: 14px; vertical-align: -2px; fill: var(--accent-2); }
@media (prefers-reduced-motion: reduce) {
  .ig-icon, .ig-pointer, .ig-finger, .install-fab::after { animation: none !important; }
}

/* --- the game's pop-up windows (the picture, My gallery): a raised 3D panel, lit along its top
   edge and standing on a thick darker base with a deep shadow, that tips up into view as it opens */
.win3d { background: linear-gradient(180deg, #7550a3 0%, #613d8e 55%, #55327f 100%); border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .32), inset 0 -3px 0 rgba(0, 0, 0, .16), 0 7px 0 #3d2162, 0 30px 60px rgba(10, 0, 30, .55);
  transform-origin: 50% 100%; animation: win3d-in .36s cubic-bezier(.2, .9, .3, 1.15) both; }
@keyframes win3d-in { from { opacity: 0; transform: perspective(900px) rotateX(16deg) translateY(26px) scale(.94); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .win3d { animation: none; } }

/* --- photo card */
#photo { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(10, 10, 20, .55); }
#photo[hidden] { display: none; }
.photo-card { width: min(420px, 100%); max-height: 100%; overflow-y: auto; padding: 16px; border-radius: 20px; } /* (the 3D look: .win3d) */
.photo-card header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.photo-card h2 { margin: 0; font-size: 18px; }
/* a round close button with its cross drawn dead centre (picture and gallery cards) */
.round-x { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; flex: none; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; }
.round-x svg { width: 18px; height: 18px; fill: currentColor; display: block; }
.round-x:hover { background: linear-gradient(135deg, #ff8fc8, #c56cf0); border-color: transparent; color: #fff; }
/* landscape / square / portrait */
.photo-shapes { display: flex; gap: 6px; margin-bottom: 10px; }
.photo-shapes button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 6px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: 600 12px/1 system-ui, sans-serif; cursor: pointer; }
.photo-shapes button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.photo-shapes button.on { background: linear-gradient(135deg, #ff8fc8, #c56cf0); border-color: transparent; color: #fff; }
.photo-frame { position: relative; aspect-ratio: 1; max-height: 56vh; margin: 0 auto; border-radius: 14px; overflow: hidden; background: var(--panel-2); }
.photo-frame img { width: 100%; height: 100%; display: block; object-fit: cover; }
.photo-frame img[hidden] { display: none; }

/* --- My Gallery: always the same size; a grid of frames (the pictures, a take-a-picture frame and
   empty ones waiting), or one picture seen big; a pony peeps over the top edge from behind it */
#gallery { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 124px 16px 16px; background: rgba(10, 10, 20, .55); }
#gallery[hidden] { display: none; }
.gallery-wrap { position: relative; width: min(820px, 100%); }
.gallery-peek { position: absolute; z-index: 0; left: 50%; top: -118px; width: 220px; aspect-ratio: 512 / 425; transform: translateX(-26%);
  background: linear-gradient(180deg, #ffffff 0%, #ffd9ee 45%); pointer-events: none;
  -webkit-mask: url(../images/peek-pony.png) top left / 100% auto no-repeat; mask: url(../images/peek-pony.png) top left / 100% auto no-repeat;
  filter: drop-shadow(0 4px 10px rgba(30, 10, 60, .4)); animation: peek-up .5s cubic-bezier(.2, .9, .3, 1.3) .25s both; }
@keyframes peek-up { from { transform: translate(-26%, 70px); } to { transform: translateX(-26%); } }
.gallery-card { position: relative; z-index: 1; height: min(620px, calc(100dvh - 110px)); display: flex; flex-direction: column;
  padding: 16px; border-radius: 20px; }
/* the header: the title on the left, the pictures dropdown dead centre, the close button on the right */
.gallery-card header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-bottom: 12px; flex: none; }
.gallery-card header .gh-end { justify-self: end; display: flex; align-items: center; gap: 8px; }
@media (max-width: 600px) {
  .gallery-card header { grid-template-columns: 1fr auto; grid-template-areas: "title close" "filter filter"; }
  .gallery-card header h2 { grid-area: title; } .gallery-card header .gh-end { grid-area: close; } .gallery-card header .gf { grid-area: filter; }
  #gallery.in-bin .gallery-card header .gf { display: none; } /* (no empty row where the dropdown was) */
}
.gallery-card h2 { margin: 0; font-size: 18px; }
.gallery-count { font-size: 13px; font-weight: 600; color: var(--muted); }
.gallery-body { flex: 1; min-height: 0; overflow-y: auto; }
.gallery-hint { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, .08); font-size: 13px; color: var(--muted); text-align: center; }
.gallery-hint[hidden] { display: none; }
/* the bin button beside the close button: a count of what's in it, and its name popping up under it */
.gallery-binbtn { position: relative; }
.gallery-binbtn.on { background: linear-gradient(135deg, #ff8fc8, #c56cf0); border-color: transparent; color: #fff; }
.gallery-binbtn .tool-tip { top: calc(100% + 9px); }
.gallery-binbtn:is(:hover, :focus-visible) .tool-tip { opacity: 1; transform: translate(-50%, 0); }
.gb-n { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center;
  border-radius: 999px; background: #d6457f; color: #fff; font: 800 10px/1 system-ui, sans-serif; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.gb-n[hidden] { display: none; }
#gallery.in-bin .gf { visibility: hidden; } /* (the dropdown is for the gallery, not the bin) */
/* the bin: pictures and categories, each with its own tab and its own "empty" */
.gallery-bin[hidden] { display: none; }
.gb-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.gb-top .share-wide { min-width: 0; margin: 0; padding: 8px 14px; font-size: 13px; }
.gb-tabs { display: flex; gap: 6px; margin-left: auto; }
.gb-tabs button { padding: 8px 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .16); background: var(--key-face); box-shadow: var(--key-up);
  color: #fff; font: 700 13px/1 system-ui, sans-serif; cursor: pointer; }
.gb-tabs button.on { background: var(--key-on-face); box-shadow: var(--key-on); border-color: rgba(255, 255, 255, .4); }
.gb-tabs small { margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, .2); font-size: 11px; }
.gb-tabs small:empty { display: none; }
.gb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; padding: 8px 10px; border-radius: 14px; background: rgba(255, 255, 255, .08); }
.gb-note { flex: 1 1 220px; margin: 0; font-size: 13px; line-height: 1.4; color: var(--muted); }
.gb-actions .share-wide { min-width: 0; margin: 0; padding: 8px 14px; font-size: 13px; }
.gb-actions .share-wide[hidden] { display: none; }
.gb-actions .share-wide.arm, .gb-row .share-wide.arm { background: #d6457f; border-color: transparent; }
.gb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .85; }
.gb-tile-bar { position: absolute; left: 6px; right: 6px; bottom: 6px; display: flex; gap: 6px; }
.gb-tile-bar button { flex: 1; min-width: 0; height: 30px; display: flex; align-items: center; justify-content: center; gap: 3px; padding: 0 4px; border: 0; border-radius: 10px;
  background: rgba(30, 10, 50, .72); color: #fff; font: 700 11.5px/1 system-ui, sans-serif; white-space: nowrap; cursor: pointer; }
.gb-tile-bar button svg { width: 15px; height: 15px; fill: currentColor; flex: none; }
.gb-tile-bar .gb-put:hover { background: linear-gradient(135deg, #ff8fc8, #c56cf0); }
.gb-tile-bar .gb-kill:hover, .gb-tile-bar .gb-kill.arm { background: #d6457f; }
.gb-rows { display: flex; flex-direction: column; gap: 8px; }
.gb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: rgba(255, 255, 255, .06); }
.gb-row b { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-row small { color: var(--muted); font-size: 12px; }
.gb-row .share-wide { min-width: 0; margin: 0; padding: 7px 12px; font-size: 13px; }
/* over a category's pictures: its name, then rename / delete it (alone, or with its pictures) */
.gallery-catbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 0 0 12px; padding: 8px; border-radius: 14px; background: rgba(255, 255, 255, .08); }
.gallery-catbar[hidden] { display: none; }
.gc-name { min-width: 0; display: flex; align-items: center; gap: 8px; margin-right: auto; padding: 0 6px; font-size: 15px; }
.gc-name svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.gc-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-catbar .gf-new { flex: 1 1 200px; margin: 0 auto 0 0; background: none; padding: 0; }
.gallery-catbar .gf-new:hover { background: none; }
.gallery-catbar .share-wide { min-width: 0; margin: 0; padding: 8px 14px; font-size: 13px; }
.gallery-catbar .share-wide[hidden] { display: none; }
.gallery-catbar .share-wide.arm { background: #d6457f; border-color: transparent; }
@media (max-width: 600px) { .gc-name { flex-basis: 100%; justify-content: center; margin-right: 0; } }
/* which pictures show (all, a pony's, a category's): a raised key that drops a menu, centred under it */
.gf { position: relative; justify-self: center; z-index: 5; }
.gf-btn { height: 40px; max-width: min(300px, 100%); display: flex; align-items: center; gap: 8px; padding: 0 12px 0 5px; border-radius: 20px; cursor: pointer;
  color: #fff; font: 700 14px/1 system-ui, sans-serif; border: 1px solid rgba(255, 255, 255, .2); background: var(--key-face); box-shadow: var(--key-up);
  transition: transform .12s ease, box-shadow .12s ease; }
.gf-btn:hover { background: var(--key-face-hover); box-shadow: var(--key-hover); transform: translateY(-1px); }
.gf-btn:active { box-shadow: var(--key-down); transform: translateY(2px); }
.gf-btn > svg { width: 18px; height: 18px; fill: currentColor; flex: none; transition: transform .15s ease; }
.gf-btn[aria-expanded="true"] > svg { transform: rotate(180deg); }
.gf-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gf-pic, .gf-ico { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; overflow: hidden; background: rgba(255, 255, 255, .14); }
.gf-pic svg, .gf-ico svg { width: 17px; height: 17px; fill: currentColor; }
.gf-pic img, .gf-ico img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gf-menu { position: absolute; left: 50%; top: calc(100% + 8px); width: 300px; max-width: calc(100vw - 48px); padding: 10px; border-radius: 16px; transform: translateX(-50%);
  background: linear-gradient(180deg, #7550a3, #5a3784); border: 1px solid rgba(255, 255, 255, .2); text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 5px 0 #3d2162, 0 18px 40px rgba(10, 0, 30, .5); animation: gf-in .2s ease both; }
@keyframes gf-in { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
.gf-menu[hidden] { display: none; }
.gf-menu > .gf-row, .gf-cats { margin-bottom: 4px; }
.gf-menu { max-height: min(430px, calc(100dvh - 220px)); overflow-y: auto; overflow-x: hidden; }
.gf-head { display: flex; align-items: center; justify-content: space-between; min-height: 34px; margin: 8px 2px 4px 6px; }
.gf-head h3 { margin: 0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.gf-add { background: var(--key-on-face); color: #fff; box-shadow: var(--key-on); } /* a small round + */
.gf-add:hover { background: var(--key-on-face); filter: brightness(1.08); }
.gf-cats { display: flex; flex-direction: column; gap: 4px; }
.gf-row { display: flex; align-items: center; gap: 2px; margin-bottom: 4px; padding: 3px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid transparent; }
.gf-cats .gf-row { margin-bottom: 0; }
.gf-row:hover { background: rgba(255, 255, 255, .12); }
.gf-row.on { border-color: var(--accent); background: rgba(255, 143, 200, .14); }
.gf-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 2px; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.gf-pick b { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gf-pick small { flex: none; min-width: 22px; padding: 2px 7px; border-radius: 999px; background: rgba(255, 255, 255, .14); font-size: 11px; font-weight: 700; text-align: center; }
.gf-row .pb-icon { width: 30px; height: 30px; }
.gf-row .pb-icon svg { width: 16px; height: 16px; }
.gf-row .pb-icon.arm { background: #d6457f; color: #fff; }
.gf-box { width: 24px; height: 24px; margin: 3px; flex: none; display: grid; place-items: center; border-radius: 7px; border: 2px solid rgba(255, 255, 255, .45); }
.gf-check.on .gf-box { border-color: transparent; background: var(--key-on-face); }
.gf-box svg { width: 16px; height: 16px; fill: #fff; }
.gf-new input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--accent); background: var(--panel-2); color: var(--text); font: 700 14px/1.2 system-ui, sans-serif; }
.gf-new input::placeholder { color: #ffc2e2; font-weight: 600; }
.gf-empty { margin: 2px 6px 4px; font-size: 12px; line-height: 1.45; color: var(--muted); }
/* a menu's icon buttons: the label pops up to the left of the button, so it stays inside the menu */
.gf-menu .has-tip { position: relative; }
.gf-menu .has-tip > .tool-tip { top: 50%; bottom: auto; left: auto; right: calc(100% + 8px); transform: translate(3px, -50%) scale(.92); }
.gf-menu .has-tip:is(:hover, :focus-visible) > .tool-tip { opacity: 1; transform: translate(0, -50%); }
.gf-menu .has-tip > .tool-tip::after { left: 100%; top: 50%; bottom: auto; margin: -5px 0 0; border-color: transparent; border-left-color: var(--tip); }
/* a picture's categories, from the big view: the same menu, opening upwards over the picture */
.gv-catwrap { position: relative; }
.gv-cats { top: auto; bottom: calc(100% + 10px); }
.gv-catn { min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: var(--key-on-face); font-size: 11px; }
.gv-catn[hidden] { display: none; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gallery-grid[hidden], .gallery-view[hidden] { display: none; }
.gallery-tile { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; }
.gallery-thumb { border: 1px solid var(--line); background: var(--panel-2); transition: transform .12s ease, box-shadow .12s ease; }
.gallery-thumb:hover { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--accent); }
.gt-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.gt-open img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* each picture's delete button, top right (press twice) */
.gt-del { position: absolute; top: 6px; right: 6px; height: 30px; min-width: 30px; padding: 0 7px; display: flex; align-items: center; gap: 4px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .25); background: rgba(40, 20, 60, .72); color: #fff; cursor: pointer;
  font: 700 11px/1 system-ui, sans-serif; opacity: .85; }
.gt-del svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.gt-del span { display: none; }
.gt-del:hover { opacity: 1; background: #d6457f; }
.gt-del.arm { opacity: 1; background: #d6457f; }
.gt-del.arm span { display: inline; }
/* the take-a-picture frame and the empty frames waiting for pictures (a pony outline in each) */
.gallery-take { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 10px; cursor: pointer;
  border: 0; color: #fff; font: 700 13px/1.25 system-ui, sans-serif; text-align: center;
  background: var(--key-on-face); box-shadow: var(--key-on); transition: transform .12s ease, box-shadow .12s ease; }
.gallery-take svg { width: 34px; height: 34px; fill: currentColor; }
.gallery-take:hover { transform: translateY(-2px); filter: brightness(1.06); }
.gallery-blank { border: 2px dashed rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .04); }
.gallery-blank::after { content: ""; position: absolute; inset: 22%; background: rgba(255, 255, 255, .13);
  -webkit-mask: url(../images/pose-trot.png) center / contain no-repeat; mask: url(../images/pose-trot.png) center / contain no-repeat; }
.gv-stage { position: relative; display: grid; place-items: center; border-radius: 14px; background: var(--panel-2); overflow: hidden; }
.gv-stage img { max-width: 100%; max-height: calc(min(620px, 100dvh - 110px) - 140px); display: block; }
.gv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; padding: 0; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); background: rgba(40, 20, 60, .7); color: #fff; cursor: pointer; }
.gv-nav:hover { background: linear-gradient(135deg, #ff8fc8, #c56cf0); }
.gv-nav svg { width: 22px; height: 22px; fill: currentColor; }
.gv-prev { left: 10px; } .gv-next { right: 10px; }
.gv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.gv-bar .share-wide { min-width: 0; margin: 0; padding: 8px 14px; }
.gv-bar .share-wide.arm { background: #d6457f; border-color: transparent; }
/* the picture's number and when it was taken, on its own line under the buttons, lined up with "Back to pictures" */
.gv-when { margin: 8px 4px 0; text-align: left; font-size: 12px; color: var(--muted); }
/* Share and the rest sit to the right; Share opens the apps above it, like Categories */
.gv-sharewrap { position: relative; margin-left: auto; }
.gv-sharemenu { top: auto; bottom: calc(100% + 10px); width: 340px; }
.gv-sharemenu .share-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 4px 0 6px; }
.gv-sharemenu .share-row[hidden] { display: none; }
.gv-sharemenu .pic-compose { margin-top: 4px; }
.photo-busy { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.photo-busy[hidden] { display: none; }
/* one row of round icon buttons (download, save to gallery, copy), then the share apps in one row */
.pic-actions { display: flex; justify-content: center; gap: 14px; margin: 14px 0 4px; }
.pic-btn { width: 44px !important; height: 44px !important; background: var(--key-face); box-shadow: var(--key-up); border: 1px solid rgba(255, 255, 255, .16) !important; }
.pic-btn svg { width: 20px; height: 20px; }
.pic-btn:hover { background: var(--key-face-hover); box-shadow: var(--key-hover); }
.pic-btn:active { box-shadow: var(--key-down); transform: translateY(2px); }
.pic-btn.done { background: var(--key-on-face); box-shadow: var(--key-on); }
.photo-tools .share-row { display: flex; justify-content: center; gap: 10px; margin: 10px 0 12px; flex-wrap: nowrap; }
.photo-tools .share-row .share-btn { width: 34px !important; height: 34px !important; flex: none; }
.photo-tools .share-row .share-btn svg { width: 16px; height: 16px; }
.photo-link { display: flex; gap: 8px; }
.photo-link input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font-size: 12px; }
.photo-link .btn { margin: 0; }
.note { color: var(--muted); font-size: 12px; margin: 0 0 10px; }

#toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; padding: 10px 16px; border-radius: 12px; background: #9a4cbc; color: #fff;
  font-weight: 600; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

#panel { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--panel);
  border-left: 1px solid var(--line); }

/* --- desktop: the editor's width follows a drag on its left edge (--panel-w, see layout.js),
   and the − button bottom right of the stage hides it for a full-screen pony */
.panel-edge, .panel-toggle { display: none; }
@media (orientation: landscape) and (min-width: 761px) {
  #app { grid-template-columns: minmax(0, 1fr) var(--panel-w, minmax(320px, 380px)); transition: grid-template-columns .28s ease; }
  #app.resizing { transition: none; cursor: col-resize; user-select: none; }
  #app.panel-hidden { grid-template-columns: minmax(0, 1fr) 0; }
  #app.panel-hidden #panel { visibility: hidden; border: 0; }
  .panel-edge { display: block; position: absolute; z-index: 8; top: 0; bottom: 0; left: -6px; width: 12px; cursor: col-resize; touch-action: none; }
  .panel-edge span { position: absolute; top: 50%; left: 3px; width: 6px; height: 56px; margin-top: -28px; border-radius: 3px;
    background: var(--line); box-shadow: 0 0 0 2px var(--panel); transition: background .15s ease, height .15s ease, margin .15s ease; }
  .panel-edge:hover span, #app.resizing .panel-edge span { height: 80px; margin-top: -40px; background: linear-gradient(180deg, #ff8fc8, #c56cf0); }
  .panel-toggle { display: flex; align-items: center; gap: 7px; position: absolute; z-index: 4; bottom: max(16px, env(safe-area-inset-bottom)); right: 16px;
    height: 42px; min-width: 42px; padding: 0 9px; justify-content: center; border-radius: 21px; cursor: pointer; color: #fff; font-weight: 700;
    border: 1px solid rgba(255, 255, 255, .18); background: var(--key-face); box-shadow: var(--key-up);
    transition: transform .12s ease, box-shadow .12s ease; }
  .panel-toggle svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
  .panel-toggle:hover { background: var(--key-face-hover); box-shadow: var(--key-hover); transform: translateY(-1px); }
  .panel-toggle:active { box-shadow: var(--key-down); transform: translateY(2px); }
  .panel-toggle.open-editor { padding: 0 16px 0 12px; background: var(--key-on-face); border-color: rgba(255, 255, 255, .4); box-shadow: var(--key-on);
    text-shadow: 0 1px 2px rgba(80, 20, 90, .4); }
  /* its label pops up above straight away */
  .panel-toggle .tip { position: absolute; right: 0; bottom: calc(100% + 8px); padding: 4px 10px; border-radius: 999px; white-space: nowrap;
    font-size: 12px; background: var(--tip); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); pointer-events: none;
    opacity: 0; transform: translateY(3px); transition: transform .1s ease-out; }
  .panel-toggle .tip::after { content: ""; position: absolute; right: 16px; top: 100%; border: 5px solid transparent; border-top-color: var(--tip); }
  .panel-toggle:is(:hover, :focus-visible) .tip { opacity: 1; transform: none; }
}
#grip { display: none; }
/* the main tabs: round-cornered 3D icon keys; the chosen one turns pink and shows its name,
   the others' names pop up underneath (.tab-tip) on hover or a finger's hold / slide */
#tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 12px 14px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(197, 108, 240, .1), transparent); }
#tabs button { position: relative; flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 7px;
  min-width: 44px; height: 42px; padding: 0 10px; border-radius: 13px; cursor: pointer; white-space: nowrap;
  font-weight: 700; letter-spacing: .01em; color: #fff; border: 1px solid rgba(255, 255, 255, .16);
  background: var(--key-face); box-shadow: var(--key-up); -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  transition: transform .12s ease, box-shadow .12s ease, background .2s ease; }
#tabs button svg { width: 22px; height: 22px; flex: none; fill: currentColor; filter: drop-shadow(0 1px 1px rgba(40, 10, 70, .45)); }
/* a tab whose picture is a pony silhouette image (the Pose tab's trotting pony), tinted like the icons */
#tabs .tab-pic { width: 26px; height: 22px; flex: none; background: currentColor; filter: drop-shadow(0 1px 1px rgba(40, 10, 70, .45));
  -webkit-mask: var(--pic) center / contain no-repeat; mask: var(--pic) center / contain no-repeat; }
#tabs .tab-pic.pose-trot { --pic: url(../images/pose-trot.png); }
#tabs .tab-name { display: none; }
#tabs button:hover { background: var(--key-face-hover); box-shadow: var(--key-hover); transform: translateY(-1px); }
#tabs button:active { box-shadow: var(--key-down); transform: translateY(2px); }
#tabs button.on { flex-grow: 2; background: var(--key-on-face); border-color: rgba(255, 255, 255, .4); box-shadow: var(--key-on);
  text-shadow: 0 1px 2px rgba(80, 20, 90, .4); }
#tabs button.on .tab-name { display: inline; }
#tabs button.peek { background: var(--key-face-hover); transform: translateY(-2px); }
/* the floating name under a tab icon */
.tab-tip { position: absolute; z-index: 6; pointer-events: none; padding: 5px 11px; border-radius: 999px; white-space: nowrap;
  font-size: 12px; font-weight: 700; background: var(--tip); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  opacity: 0; transform: translate(-50%, -6px) scale(.85); transform-origin: 50% 0;
  transition: opacity .14s ease, transform .22s cubic-bezier(.2, .9, .3, 1.35); }
.tab-tip::after { content: ""; position: absolute; left: 50%; bottom: 100%; margin-left: -5px; border: 5px solid transparent; border-bottom-color: var(--tip); }
.tab-tip.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* "Light up pony": the heading with its moon-to-sun dial beside it */
.light-dial { display: flex; align-items: center; gap: 12px; }
.light-dial h3 { margin: 0; flex: none; }
.light-dial .dial { flex: 1; display: flex; align-items: center; gap: 8px; }
.light-dial .dial-end svg { width: 18px; height: 18px; display: block; }
.light-dial .dial-end.dark svg { fill: #d8c4f2; }
.light-dial .dial-end.bright svg { fill: #ffd86b; filter: drop-shadow(0 0 4px rgba(255, 216, 107, .6)); }
.light-dial input[type=range] { flex: 1; min-width: 0; }
#pages { flex: 1; overflow-y: auto; padding: 14px 16px 24px; overscroll-behavior: contain; }
.page { display: none; }
.page.on { display: block; }

.group { margin-bottom: 18px; }
.group h3:empty { display: none; }
/* section buttons inside a tab: a sunken tray, the chosen section a raised pink key in it */
.subtabs { display: flex; gap: 5px; padding: 5px 5px 7px; margin-bottom: 16px; border-radius: 14px; background: #4b2b70;
  box-shadow: inset 0 2px 5px rgba(20, 0, 40, .45), inset 0 -1px 0 rgba(255, 255, 255, .08); }
.subtabs button { flex: 1; padding: 7px 6px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted);
  font-weight: 600; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, background .15s ease; }
.subtabs button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.subtabs button.on { background: var(--key-on-face); border-color: rgba(255, 255, 255, .35); color: #fff; box-shadow: var(--key-on);
  text-shadow: 0 1px 2px rgba(80, 20, 90, .4); }
.subtabs button:active { transform: translateY(1px); }
/* icon section buttons (e.g. the Head tab): the name pops up like the chip labels */
.subtabs.icons button { position: relative; display: grid; place-items: center; padding: 8px 6px; }
.subtabs.icons button svg { width: 22px; height: 22px; fill: currentColor; transition: transform .15s ease; }
.subtabs.icons button:hover svg { transform: scale(1.12); }
.subtabs.icons button.on svg { filter: drop-shadow(0 1px 1px rgba(80, 20, 90, .45)); }
/* the section bar sits at the top of the scrolling panel, so its labels pop up underneath */
.subtabs.icons .tip { bottom: auto !important; top: calc(100% + 8px); transform-origin: 50% 0; }
.subtabs.icons .tip::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--tip); }
.subpage { display: none; }
.subpage.on { display: block; }
.group h3 { margin: 0 0 10px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.row { display: grid; grid-template-columns: 110px 1fr 46px; align-items: center; gap: 10px; margin: 8px 0; }
.row label { color: var(--text); font-weight: 600; }
.row output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }

/* sliders: a pink-filled track (--fill is set from the value) and a round, easy-to-grab thumb.
   Up-and-down swipes that start on a slider scroll the panel instead of moving it. */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent;
  cursor: pointer; touch-action: pan-y; --fill: 50%; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, #ff8fc8, #c56cf0) 0 / var(--fill) 100% no-repeat, var(--line); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: linear-gradient(90deg, #ff8fc8, #c56cf0); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
  background: #fff; border: 3px solid #ff8fc8; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid #ff8fc8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
input[type=range]:focus-visible { outline: none; }
/* touch screens: the dials don't take a finger themselves (it would jump to wherever it landed,
   even on its way to scrolling); ui.js moves them on a tap or a sideways slide, and a finger
   going up or down from one scrolls the options */
@media (pointer: coarse) {
  input[type=range] { pointer-events: none; }
  .row:has(input[type=range]), .dial { touch-action: pan-y; }
}
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(255, 143, 200, .35); }

/* colour fields: the label on top; underneath, one row: the swatches (a "pick your own" pen
   circle first) sliding between arrows, and on the right, in line with them, the chosen colour
   (a circle) and its hex code */
.colorField { position: relative; margin: 12px 0 16px; }
.cf-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cf-head label:first-child { flex: 1; font-weight: 700; font-size: 14px; color: var(--text); }
.cf-body { display: flex; align-items: center; gap: 12px; }
.cf-body .cf-strip { flex: 1; min-width: 0; }
.cf-pick { display: flex; align-items: center; gap: 8px; flex: none; }
.cf-current { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; flex: none;
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.cf-hex { width: 78px; padding: 7px 9px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2);
  text-transform: uppercase; font: 600 13px/1 ui-monospace, monospace; color: var(--text); }
.cf-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cf-strip { display: flex; align-items: center; gap: 6px; }
/* (on a wide screen the swatches wrap onto as many lines as they need, the chosen colour centred
   beside them; on phones they're one sliding row between arrows, below) */
.cf-swatches { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; padding: 4px; }
.cf-swatches > * { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); transition: transform .12s ease; }
.cf-swatches > *:hover { transform: scale(1.1); }
.cf-swatches button.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px #fff; }
.cf-custom { display: grid; place-items: center; background: conic-gradient(#ff8fc8, #ffd86b, #8fe3a8, #8fc7ff, #c56cf0, #ff8fc8); }
.cf-custom svg { width: 16px; height: 16px; fill: #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); }
/* bold round arrows for sliding rows: a pink-to-violet button, white chevron, a soft glow */
.arrow-btn { flex: none; width: 34px; height: 34px; padding: 0; border: 2px solid #fff; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: linear-gradient(135deg, #ff8fc8, #c56cf0 60%, #7b6cff);
  box-shadow: var(--key-gloss), 0 3px 0 var(--key-on-edge), 0 5px 10px rgba(60, 20, 90, .45), 0 0 0 3px rgba(255, 143, 200, .25);
  transition: transform .12s ease, box-shadow .12s ease, opacity .2s ease; }
.arrow-btn svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 1px 1px rgba(80, 20, 90, .5)); }
.arrow-btn:hover { transform: translateY(-1px) scale(1.08); }
.arrow-btn:active { transform: translateY(2px); box-shadow: var(--key-gloss), 0 1px 0 var(--key-on-edge), 0 0 0 3px rgba(255, 143, 200, .25); }
.arrow-btn:disabled { opacity: .35; cursor: default; transform: none; filter: grayscale(.5); }
.arrow-btn[hidden] { display: none; }
.cf-arrow { display: none; }
/* the tab row's arrows sit over its ends */
.tabbar { position: relative; }

/* --- the pony bar, above the tabs: [picture | name ✎ | ▾]  [Save]  [New], and My ponies dropping down */
.pony-bar { position: relative; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 12px 12px 0; }
.pb-pill { flex: 1; min-width: 0; height: 52px; display: flex; align-items: center; gap: 4px; padding: 0 4px 0 4px; border-radius: 23px;
  background: var(--key-face); border: 1px solid rgba(255, 255, 255, .16); box-shadow: var(--key-up); }
.pb-pic { width: 44px; height: 44px; flex: none; padding: 0; border-radius: 50%; border: 0; cursor: pointer; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(135deg, #fe95cc, #c47df0 50%, #7a67f5); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.pb-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pb-pic img[hidden] { display: none; }
.pb-pic:has(img[hidden])::after { content: ""; width: 28px; height: 24px; background: #fff;
  -webkit-mask: url(../images/pose-trot.png) center / contain no-repeat; mask: url(../images/pose-trot.png) center / contain no-repeat; }
.pb-name { flex: 1; min-width: 0; height: 36px; padding: 0 8px; border: 0; border-radius: 10px; background: transparent; color: #fff;
  font: 800 16px/1 system-ui, sans-serif; letter-spacing: .01em; }
.pb-name::placeholder { color: #ffc2e3; opacity: 1; font-weight: 700; } /* "Name your pony": light pink */
.pb-name:focus { outline: none; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 2px #ffc2e3; }
.pb-pen, .pb-caret, .pb-icon { width: 34px; height: 34px; flex: none; padding: 0; display: grid; place-items: center; border-radius: 50%; border: 0;
  background: transparent; color: #ffd6ec; cursor: pointer; }
.pb-pen svg, .pb-caret svg, .pb-icon svg { width: 18px; height: 18px; fill: currentColor; }
.pb-pen:hover, .pb-caret:hover, .pb-icon:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.pb-caret[aria-expanded="true"] svg { transform: rotate(180deg); }
.pony-bar .has-tip { position: relative; }
.pony-bar .has-tip:is(:hover, :focus-visible) > .tool-tip { opacity: 1; transform: translate(-50%, 0); }
.pb-menu .has-tip > .tool-tip { top: auto; bottom: calc(100% + 8px); }
.pb-menu .has-tip > .tool-tip::after { bottom: auto; top: 100%; border-bottom-color: transparent; border-top-color: var(--tip); }
.pb-key { height: 52px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 23px; cursor: pointer; color: #fff;
  font: 700 13px/1 system-ui, sans-serif; border: 1px solid rgba(255, 255, 255, .16); background: var(--key-face); box-shadow: var(--key-up);
  transition: transform .12s ease, box-shadow .12s ease; }
.pb-key svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.pb-key:hover { background: var(--key-face-hover); box-shadow: var(--key-hover); transform: translateY(-1px); }
.pb-key:active { box-shadow: var(--key-down); transform: translateY(2px); }
.pb-save { background: var(--key-on-face); box-shadow: var(--key-on); border-color: rgba(255, 255, 255, .4); }
.pb-save:hover { background: var(--key-on-face); filter: brightness(1.06); box-shadow: var(--key-on); }
@media (max-width: 420px) { .pb-key span { display: none; } .pb-key { width: 52px; padding: 0; justify-content: center; } }
/* My ponies, dropped down under the bar */
.pb-menu { position: absolute; left: 12px; right: 12px; top: calc(100% + 8px); padding: 10px; border-radius: 16px;
  background: linear-gradient(180deg, #7550a3, #5a3784); border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 5px 0 #3d2162, 0 18px 40px rgba(10, 0, 30, .5); animation: win3d-in .25s ease both; }
.pb-menu[hidden] { display: none; }
.pb-menu-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 8px 4px; }
.pb-menu-title { margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.pb-menu-new { background: var(--key-on-face); color: #fff; box-shadow: var(--key-on); } /* a small round + */
.pb-menu-new:hover { background: var(--key-on-face); filter: brightness(1.08); }
.pb-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; overflow-x: hidden; }
/* inside the list, a row button's label sits to its left (inside the list, so it never makes it scroll sideways) */
.pb-list .has-tip > .tool-tip { top: 50%; bottom: auto; left: auto; right: calc(100% + 8px); transform: translate(3px, -50%) scale(.92); }
.pony-bar .pb-list .has-tip:is(:hover, :focus-visible) > .tool-tip { transform: translate(0, -50%); }
.pb-list .has-tip > .tool-tip::after { left: 100%; top: 50%; bottom: auto; margin: -5px 0 0; border-color: transparent; border-left-color: var(--tip); }
.pb-empty { margin: 4px; font-size: 13px; color: var(--muted); }
.pb-row { display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid transparent; }
.pb-row.on { border-color: var(--accent); background: rgba(255, 143, 200, .14); }
.pb-row-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 2px; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.pb-row-pic { width: 56px; height: 56px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .2); overflow: hidden; background: rgba(255, 255, 255, .1); }
.pb-row-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pb-row-text { min-width: 0; display: flex; flex-direction: column; }
.pb-row-text b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-row-text small { font-size: 11px; color: var(--muted); }
.pb-row-name { flex: 1; min-width: 0; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--accent); background: var(--panel-2); color: var(--text); font: 700 14px/1.2 system-ui, sans-serif; }
.pb-icon.arm { background: #d6457f; color: #fff; }
.tab-arrow { position: absolute; top: 50%; z-index: 3; margin-top: -17px; }
.tab-arrow.prev { left: 6px; }
.tab-arrow.next { right: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips { padding-bottom: 4px; } /* room for the keys' raised edge */
.chips button { padding: 7px 12px; border-radius: 11px; border: 1px solid rgba(255, 255, 255, .16); background: var(--key-face);
  box-shadow: var(--key-up); font-weight: 600; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, background .15s ease; }
.chips button:hover { background: var(--key-face-hover); box-shadow: var(--key-hover); transform: translateY(-1px); }
.chips button:active { box-shadow: var(--key-down); transform: translateY(2px); }
.chips button.on { background: var(--key-on-face); border-color: rgba(255, 255, 255, .4); color: #fff; box-shadow: var(--key-on);
  text-shadow: 0 1px 2px rgba(80, 20, 90, .4); }
.chips.pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.chips.pics button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; font-size: 12px; }
.chips.pics img { width: 56px; height: 56px; border-radius: 8px; background: #ececf4; object-fit: cover; }

/* icon-only picture buttons: the name pops up above the icon on hover, focus or a tap */
.group h3 .chosen { margin-left: 8px; color: var(--accent); font-weight: 600; text-transform: none; letter-spacing: 0; }
.group h3 .chosen::before { content: "· "; color: var(--muted); }
.chips.icons { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); }
.chips.icons button { position: relative; padding: 5px; }
.chips.icons button:hover { transform: translateY(-2px); }
.chips.icons button.on { padding: 4px; border: 2px solid #fff; }
.chips.icons img { width: 100%; height: auto; aspect-ratio: 1; background: radial-gradient(circle at 50% 40%, #f4f4fa, #dcdcea); }
:is(.chips, .subtabs).icons .tip {
  position: absolute; left: 50%; bottom: calc(100% + 6px); z-index: 5; pointer-events: none;
  padding: 5px 10px; border-radius: 999px; white-space: nowrap; font-size: 12px; font-weight: 600;
  background: var(--tip); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  opacity: 0; transform: translate(-50%, 6px) scale(0.85); transform-origin: 50% 100%;
  margin-left: var(--shift, 0px); /* slid back inside the panel at a row's ends (keepTipIn) */
  transition: opacity 0.14s ease, transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.35);
}
:is(.chips, .subtabs).icons .tip::after { /* little pointer under the label, kept over the icon */
  content: ""; position: absolute; left: calc(50% - var(--shift, 0px)); top: 100%; margin-left: -5px;
  border: 5px solid transparent; border-top-color: var(--tip);
}
:is(.chips, .subtabs).icons button:is(:hover, :focus-visible, .tap, .peek) .tip {
  opacity: 1; transform: translate(-50%, 0) scale(1);
}
/* touch: holding or sliding a finger along a row peeks at the labels (see touchPeek in
   ui.js); sideways slides belong to the row, up-and-down still scrolls the panel */
:is(.chips, .subtabs).icons { touch-action: pan-y; -webkit-user-select: none; user-select: none; }
:is(.chips, .subtabs).icons button { -webkit-touch-callout: none; }
.chips.icons img { pointer-events: none; -webkit-user-drag: none; }
.chips.icons button.peek { transform: translateY(-3px) scale(1.06); background: var(--key-face-hover); }
@media (pointer: coarse) { /* lift the label clear of the fingertip */
  :is(.chips, .subtabs).icons .tip { bottom: calc(100% + 14px); font-size: 13px; padding: 6px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .chips.icons button, :is(.chips, .subtabs).icons .tip { transition: none; }
}
/* --- "coming soon" options: dimmed, a pink ribbon across the corner, and a frosty badge with
   the date instead of the name */
.chips.icons button.soon { cursor: default; }
.chips.icons button.soon img { filter: grayscale(.55) brightness(.92); opacity: .75; }
.chips.icons button.soon:hover { transform: none; }
.soon-ribbon { position: absolute; top: 7px; right: -4px; padding: 2px 7px; border-radius: 6px 0 0 6px; font-size: 10px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase; color: #fff; background: linear-gradient(135deg, #ff8fc8, #c56cf0);
  box-shadow: 0 2px 6px rgba(40, 10, 70, .45); pointer-events: none; }
:is(.chips, .subtabs).icons .tip.soon-tip { white-space: normal; width: max-content; max-width: 190px; text-align: center; line-height: 1.3;
  padding: 7px 12px; border-radius: 12px; color: #23305e; font-weight: 700;
  background: linear-gradient(180deg, #ffffff, #d9efff); box-shadow: 0 8px 22px rgba(20, 30, 80, .4), inset 0 0 0 1px rgba(255, 255, 255, .8); }
:is(.chips, .subtabs).icons .tip.soon-tip::after { border-top-color: #d9efff; }
/* an option that needs something first (Fly needs wings): dimmed, with a ribbon saying what */
.chips.icons button.needs img { filter: grayscale(.5) brightness(.95); opacity: .7; }
:is(.chips, .subtabs).icons .tip.needs-tip { white-space: normal; width: max-content; max-width: 180px; text-align: center; line-height: 1.3;
  padding: 7px 12px; border-radius: 12px; font-weight: 700; color: #3a1030; background: linear-gradient(180deg, #ffe3f2, #ffb3db); }
:is(.chips, .subtabs).icons .tip.needs-tip::after { border-top-color: #ffb3db; }

/* --- the Events tab's drop-down, under the tab */
.event-menu { position: absolute; z-index: 7; width: 220px; padding: 6px; border-radius: 16px;
  background: rgba(74, 44, 110, .97); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 16px 36px rgba(20, 0, 40, .5); opacity: 0; pointer-events: none; transform: translateY(-6px) scale(.97);
  transform-origin: 50% 0; transition: opacity .14s ease, transform .18s cubic-bezier(.2, .9, .3, 1.2); }
.event-menu.show { opacity: 1; pointer-events: auto; transform: none; }
.event-menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 11px;
  background: transparent; color: #fff; text-align: left; cursor: pointer; }
.event-menu button:hover:not(.soon) { background: var(--key-on-face); box-shadow: var(--key-on); }
.event-menu button.soon { cursor: default; opacity: .7; }
.em-emoji { font-size: 22px; line-height: 1; }
.em-text { display: flex; flex-direction: column; }
.em-text b { font-size: 14px; }
.em-text small { font-size: 11px; color: var(--muted); }

/* --- the Events page: which events there are, then a banner for the one that's on */
.event-pills { display: flex; gap: 8px; margin-bottom: 14px; padding-bottom: 4px; }
.event-pills button { flex: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 6px; padding: 8px 10px;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, .16); background: var(--key-face); box-shadow: var(--key-up); font-weight: 700; cursor: default; }
.event-pills button.on { background: var(--key-on-face); border-color: rgba(255, 255, 255, .4); box-shadow: var(--key-on); }
.event-pills button.soon { opacity: .75; }
.event-pills em { flex-basis: 100%; text-align: center; font-size: 11px; font-style: normal; font-weight: 600; color: var(--muted); }
.event-banner { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 14px 16px; border-radius: 16px; overflow: hidden; position: relative;
  border: 1px solid rgba(255, 255, 255, .14); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 6px 18px rgba(20, 0, 40, .35); }
.event-banner.halloween { background: radial-gradient(120% 140% at 85% 0%, #ff9a3c 0%, #b04c96 38%, #3a1458 75%); }
.event-banner h2 { margin: 0; font-size: 20px; text-shadow: 0 2px 6px rgba(40, 0, 40, .5); }
.event-banner p { margin: 2px 0 0; font-size: 13px; color: #ffe6f2; }
.eb-emoji { font-size: 38px; filter: drop-shadow(0 3px 6px rgba(40, 0, 20, .5)); animation: eb-bob 2.4s ease-in-out infinite; }
@keyframes eb-bob { 0%, 100% { transform: rotate(-6deg); } 50% { transform: translateY(-3px) rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .eb-emoji { animation: none; } }

textarea { width: 100%; min-height: 90px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); padding: 8px; font: 12px/1.4 ui-monospace, monospace; color: var(--text); resize: vertical; }
/* short free text, e.g. the gravestone's words */
textarea.textline { min-height: 0; font: 600 14px/1.35 Georgia, serif; text-align: center; resize: none; padding: 10px; }
.btn { padding: 9px 14px; border-radius: 11px; border: 1px solid rgba(255, 255, 255, .16); background: var(--key-face);
  box-shadow: var(--key-up); color: #fff; font-weight: 600; cursor: pointer; margin: 8px 6px 4px 0;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease; }
.btn:hover { background: var(--key-face-hover); box-shadow: var(--key-hover); transform: translateY(-1px); }
.btn:active { box-shadow: var(--key-down); transform: translateY(2px); }
.btn.small { padding: 6px 10px; margin: 0; font-size: 12px; border-radius: 9px; }
.btn.arm { background: #d6457f; } /* asking "Sure?" */
.btn[disabled] { opacity: .5; cursor: default; transform: none; box-shadow: var(--key-up); }

/* My ponies (save slots): name + save, then a card for each saved pony */
.slot-new { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.slot-new .btn { margin: 0; }
.slot-name { flex: 1 1 150px; min-width: 0; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: 600 14px/1.2 system-ui, sans-serif; }
.slot-name:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.group > .pony-name { width: 100%; } /* (the name box at the top of Body) */
.slot-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.slot { display: grid; grid-template-columns: 56px minmax(0, 1fr); grid-template-areas: "pic title" "pic actions"; column-gap: 12px; row-gap: 6px;
  align-items: center; padding: 8px 10px 8px 8px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.slot.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.slot-pic { grid-area: pic; width: 56px; height: 56px; border-radius: 12px; object-fit: contain;
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, .22), rgba(255, 255, 255, .04) 70%); }
.slot-title { grid-area: title; min-width: 0; }
.slot-title b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-title small { color: var(--muted); font-size: 11px; }
.slot-title .slot-name { width: 100%; padding: 5px 8px; }
.slot-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 6px; }

/* --- scroll bars: a rounded pink-to-violet bar in a sunken purple groove */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { margin: 6px; border-radius: 999px; background: rgba(40, 14, 70, .45);
  box-shadow: inset 0 1px 3px rgba(10, 0, 25, .5); }
::-webkit-scrollbar-thumb { border-radius: 999px; border: 2px solid transparent; background-clip: padding-box;
  background-color: #e07fd0; background-image: linear-gradient(90deg, #ffc4e4 0%, #f383c9 45%, #b46ef0 100%); }
::-webkit-scrollbar-thumb:hover { background-image: linear-gradient(90deg, #ffd6ec 0%, #ff96d4 45%, #c486ff 100%); }
::-webkit-scrollbar-thumb:active { background-image: linear-gradient(90deg, #f383c9, #b46ef0); }
::-webkit-scrollbar-corner { background: transparent; }
/* Firefox draws its own bar: just colour it */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: #f383c9 rgba(40, 14, 70, .45); }
}

/* Portrait: stage on top, panel as a bottom sheet */
@media (orientation: portrait), (max-width: 760px) {
  #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  #panel { min-width: 0; border-left: 0; border-top: 1px solid var(--line); height: 46dvh;
    border-radius: var(--radius) var(--radius) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  /* the sheet's top: round arrows to make it taller or shorter (see layout.js); right down there's
     only the up one, right up only the down one, centred on its own */
  #grip { display: flex; justify-content: center; gap: 14px; padding: 6px 0 0; margin-bottom: -6px; touch-action: none; }
  .sheet-arrow { width: 30px; height: 30px; padding: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: #fff;
    border: 1px solid rgba(255, 255, 255, .22); background: linear-gradient(180deg, #7550a3, #5a3784); box-shadow: 0 2px 6px rgba(10, 0, 25, .35);
    transition: transform .1s ease; }
  .sheet-arrow svg { width: 20px; height: 20px; fill: currentColor; }
  .sheet-arrow:active { transform: scale(.9); }
  #app.sheet-down .sheet-arrow[data-way="-1"], #app.sheet-tall .sheet-arrow[data-way="1"] { display: none; }
  /* swiped down (see layout.js): just the grip and the tabs showing, the stage taking the rest */
  #panel { transition: height .28s ease; }
  #app.sheet-down #panel { height: var(--sheet-low, 76px); overflow: hidden; }
  /* pulled right up: the editor takes most of the screen, the pony shown smaller in the strip above
     (the Explore bar steps aside: there's no room, and the editor is what's in use) */
  #app.sheet-tall #panel { height: var(--sheet-high, 76dvh); }
  #app.sheet-tall .explore-bar { display: none; }
  #app.sheet-dragging #panel { transition: none; }
  /* while it moves, the picture's surface stays put (see resize() in main.js): pinned to the top */
  #app:is(.sheet-dragging, .sheet-settling) #stage { overflow: hidden; }
  #app:is(.sheet-dragging, .sheet-settling) #view { position: absolute; top: 0; left: 0; }
  /* the top row is a handle: the phone mustn't take a swipe on it as a scroll (that cancels the
     drag); its menus still scroll */
  .tabbar { touch-action: none; }
  .tabbar .pb-menu { touch-action: pan-y; }
  #tabs { touch-action: pan-x; }
  #tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #tabs::-webkit-scrollbar { display: none; }
  #tabs button { flex: 0 0 auto; }
  .row { grid-template-columns: 96px 1fr 40px; }
}

/* phones and tablets: room for fingers. Sliders get space above and below so a thumb lands
   on the one it meant, a bigger handle, and the colour swatches become one sliding row
   with arrows either side */
@media (pointer: coarse), (max-width: 760px) {
  .row { margin: 4px 0; padding: 10px 0; }
  .row label { font-size: 15px; }
  input[type=range] { height: 40px; }
  input[type=range]::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -10px; }
  input[type=range]::-moz-range-thumb { width: 20px; height: 20px; }
  .group { margin-bottom: 22px; }
  .group h3 { font-size: 13px; color: var(--text); opacity: .85; }
  .colorField { margin: 14px 0 22px; }
  .cf-head { margin-bottom: 14px; gap: 12px; }
  .cf-head label:first-child { font-size: 16px; }
  .cf-current { width: 38px; height: 38px; }
  .cf-arrow { display: grid; }
  #tabs { scroll-padding-inline: 48px; } /* a chosen tab never hides under an arrow */
  .cf-swatches { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 10px; }
  .cf-swatches::-webkit-scrollbar { display: none; }
  .cf-swatches > * { width: 36px; height: 36px; scroll-snap-align: start; }
}

/* Short landscape phones: slimmer panel */
@media (orientation: landscape) and (max-height: 500px) {
  #app { grid-template-columns: 1fr 300px; }
  #tabs { padding: 8px; gap: 4px; }
  #tabs button { height: 34px; min-width: 38px; padding: 0 8px; font-size: 12px; }
  #tabs button svg { width: 19px; height: 19px; }
  #pages { padding: 10px 12px; }
}
.gallery-catbar .has-tip { position: relative; }
.gallery-catbar .has-tip:is(:hover, :focus-visible) > .tool-tip { opacity: 1; transform: translate(-50%, 0); }

/* --- sending a picture to an app: the message first, ready to change, then Send picture */
.pic-compose { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, .08); }
.pic-compose[hidden] { display: none; }
.pc-head { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.pc-app { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.pc-app svg { width: 18px; height: 18px; fill: currentColor; }
.pc-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.pic-compose textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 70px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--accent); background: var(--panel-2); color: var(--text); font: 600 15px/1.4 system-ui, sans-serif; }
.pc-note { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.pc-note[hidden] { display: none; }
.pc-btns { display: flex; justify-content: flex-end; gap: 8px; }
.pc-btns .share-wide { min-width: 0; margin: 0; padding: 9px 16px; }
.photo-link[hidden], .photo-tools[hidden] { display: none; }

.pic-actions[hidden], .pic-share .share-row[hidden] { display: none; }

/* --- the graphics card was reset: a note over the stage while the picture comes back (and a
   reload button if it doesn't) */
.gfx-note { position: fixed; left: 50%; top: 50%; z-index: 95; transform: translate(-50%, -50%); max-width: min(360px, calc(100vw - 32px));
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 20px; border-radius: 16px; text-align: center;
  background: linear-gradient(180deg, #7550a3, #5a3784); border: 1px solid rgba(255, 255, 255, .2); color: #fff; font-weight: 700;
  box-shadow: 0 5px 0 #3d2162, 0 18px 40px rgba(10, 0, 30, .5); }
.gfx-note[hidden] { display: none; }

/* --- narrow phones: the stage's top bar fits in one row (buttons never squeeze below a
   comfortable tap size; Share becomes a round icon like the rest), and the pony's name box
   has room for "Name your pony" */
#stageTools > button, #stageTools > .share-fab { flex: none; }
@media (max-width: 420px) {
  .share-fab .fab-main { width: 42px !important; padding: 0 !important; justify-content: center; }
  .share-fab .fab-main span { display: none; }
  .pb-pen, .pb-caret { width: 28px; }
  .pb-name { padding: 0 4px; font-size: 14px; }
  .pb-pill { gap: 2px; }
  .pb-pic { width: 40px; height: 40px; }
}

/* --- touch screens: a full-screen button at the right end of the stage's toolbar (not in the
   installed app, see mountFullscreen), and no reset-camera button (the views do that job) */
.fullscreen-fab { display: none !important; }
#stageTools .fullscreen-fab .tool-tip { left: auto; right: -4px; transform: translateY(-3px) scale(.92); transform-origin: right top; }
#stageTools .fullscreen-fab.has-tip:is(:hover, :focus-visible) .tool-tip { transform: none; }
#stageTools .fullscreen-fab .tool-tip::after { left: auto; right: 18px; margin-left: 0; }
@media (pointer: coarse), (max-width: 760px) {
  #stageTools .fullscreen-fab { display: block !important; }
  #stageTools [data-act="reset-view"] { display: none; }
}

/* --- phones: the editor's top row is the Pony Design menu (left) and a smaller pony bar (right);
   the tab row folds away into that menu, which unfolds down over the settings */
.design-btn, .design-menu { display: none; }
@media (orientation: portrait), (max-width: 760px) {
  .tabbar { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px; border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(197, 108, 240, .1), transparent); }
  #tabs, .tabbar .tab-arrow, .tabbar .tab-tip, .tabbar .event-menu { display: none !important; }

  /* Pony Design: the open section's icon, "Pony Design" over its name, and a + that turns to x */
  .design-btn { flex: none; display: flex; align-items: center; gap: 6px; height: 46px; padding: 0 7px 0 5px; border-radius: 15px; cursor: pointer;
    color: #fff; text-align: left; border: 1px solid rgba(255, 255, 255, .18); background: var(--key-face); box-shadow: var(--key-up);
    transition: transform .12s ease, box-shadow .12s ease, background .2s ease; -webkit-user-select: none; user-select: none; }
  .design-btn:active { box-shadow: var(--key-down); transform: translateY(2px); }
  .design-btn.open { background: var(--key-on-face); border-color: rgba(255, 255, 255, .4); box-shadow: var(--key-on); }
  .db-icon { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .14); }
  .db-icon svg { width: 18px; height: 18px; fill: currentColor; }
  .db-icon .tab-name { display: none; }
  .db-text { display: flex; flex-direction: column; line-height: 1.15; }
  .db-text b { font: 800 12.5px/1.15 system-ui, sans-serif; white-space: nowrap; }
  .db-now { font-size: 11px; font-weight: 700; color: #ffc2e3; white-space: nowrap; }
  .design-btn.open .db-now { color: #fff; }
  .db-plus { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--key-on-face);
    box-shadow: 0 1px 3px rgba(40, 10, 70, .4); transition: transform .25s ease; }
  .db-plus svg { width: 14px; height: 14px; fill: #fff; }
  .design-btn.open .db-plus { transform: rotate(135deg); background: rgba(255, 255, 255, .25); }

  /* the pony bar: small, tucked into the right of the row (its My ponies list still drops down
     the full width, under the row) */
  .tabbar .pony-bar { position: static; flex: 1; min-width: 0; justify-content: flex-end; gap: 4px; padding: 0; }
  .tabbar .pb-pill { flex: 1 1 auto; max-width: 190px; min-width: 0; height: 40px; gap: 2px; padding: 0 3px; border-radius: 20px; }
  .tabbar .pb-pic { width: 30px; height: 30px; }
  .tabbar .pb-pen, .tabbar .pb-caret { display: none; } /* (the avatar opens My ponies; the name box is tapped to rename) */
  .tabbar .pb-name { width: 6.2em; flex: 1 1 auto; min-width: 0; height: 32px; padding: 0 2px; font-size: 13px; }
  .tabbar .pb-key { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 50%; }
  .tabbar .pb-key span { display: none; }
  .tabbar .pb-menu { left: 10px; right: 10px; top: calc(100% + 6px); }

  /* the menu: every section, its icon over its name, four to a row; it unfolds from the top */
  .design-menu { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-content: start; gap: 6px; position: absolute; z-index: 30;
    left: 10px; right: 10px; bottom: 10px; overflow-y: auto; padding: 10px; border-radius: 16px;
    background: linear-gradient(180deg, #7550a3, #5a3784); border: 1px solid rgba(255, 255, 255, .2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 5px 0 #3d2162, 0 18px 40px rgba(10, 0, 30, .5);
    opacity: 0; transform: translateY(-8px) scaleY(.6); transform-origin: 50% 0; transition: opacity .22s ease, transform .24s cubic-bezier(.2, .9, .3, 1.1); }
  .design-menu[hidden] { display: none; }
  .design-menu.open { opacity: 1; transform: none; }
  .design-menu button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 60px; padding: 6px 2px; border-radius: 13px; cursor: pointer;
    color: #fff; text-align: center; font: 700 11.5px/1.15 system-ui, sans-serif; border: 1px solid rgba(255, 255, 255, .16);
    background: var(--key-face); box-shadow: var(--key-up);
    opacity: 0; transform: translateY(-6px); transition: opacity .2s ease, transform .2s ease, background .2s ease; transition-delay: calc(var(--i) * 18ms); }
  .design-menu.open button { opacity: 1; transform: none; }
  .design-menu button:active { box-shadow: var(--key-down); transform: translateY(2px); }
  .design-menu button.on { background: var(--key-on-face); border-color: rgba(255, 255, 255, .4); box-shadow: var(--key-on); }
  .design-menu button svg { width: 22px; height: 22px; flex: none; fill: currentColor; filter: drop-shadow(0 1px 1px rgba(40, 10, 70, .45)); }
  .design-menu .tab-name { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .design-menu .tab-pic, .db-icon .tab-pic { width: 26px; height: 22px; flex: none; background: currentColor;
    -webkit-mask: var(--pic) center / contain no-repeat; mask: var(--pic) center / contain no-repeat; }
  .db-icon .tab-pic { width: 22px; height: 18px; }
  .design-menu .tab-pic.pose-trot, .db-icon .tab-pic.pose-trot { --pic: url(../images/pose-trot.png); }
}

/* --- the colour rows: the chosen colour and the pen are buttons opening the game's own picker */
.cf-current, .cf-custom { border: 0; padding: 0; }
/* phones: no colour code in the row (it's in the picker, with a copy button), so more colours fit */
@media (pointer: coarse), (max-width: 760px) {
  .cf-hex { display: none; }
}

/* --- the game's own colour picker (colourpicker.js): a shade square and a rainbow strip to drag
   round, the colour's code with Copy, and Done. On a phone it sits along the bottom over the
   editor; elsewhere beside the colour it was opened from. No dark backdrop: the pony stays in view */
.cp-card { position: fixed; z-index: 96; width: 300px; max-width: calc(100vw - 16px); box-sizing: border-box; padding: 12px 14px 14px;
  border-radius: 18px; display: flex; flex-direction: column; gap: 12px; touch-action: none; }
.cp-card[hidden] { display: none; }
.cp-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cp-title { font: 800 15px/1.2 system-ui, sans-serif; color: #fff; }
.cp-card .round-x { width: 32px; height: 32px; }
.cp-sv { position: relative; height: 170px; border-radius: 12px; cursor: crosshair; touch-action: none; outline: none;
  background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, var(--hue, red));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.cp-hue { position: relative; height: 28px; border-radius: 14px; cursor: pointer; touch-action: none; outline: none;
  background: linear-gradient(to right, #f00 0%, #ff0 16.7%, #0f0 33.3%, #0ff 50%, #00f 66.7%, #f0f 83.3%, #f00 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.cp-thumb { position: absolute; width: 26px; height: 26px; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none;
  border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 3px 8px rgba(0, 0, 0, .4); box-sizing: border-box; }
.cp-hue .cp-thumb { top: 50%; width: 30px; height: 30px; }
.cp-sv:focus-visible, .cp-hue:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.cp-row { display: flex; align-items: center; gap: 8px; }
.cp-swatch { width: 38px; height: 38px; flex: none; border-radius: 50%; box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.cp-hex { flex: 1; min-width: 0; height: 38px; box-sizing: border-box; padding: 0 10px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: 700 15px/1 ui-monospace, monospace; text-transform: uppercase; }
.cp-copy, .cp-done { height: 38px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 12px; cursor: pointer;
  color: #fff; font: 700 13px/1 system-ui, sans-serif; border: 1px solid rgba(255, 255, 255, .18); background: var(--key-face); box-shadow: var(--key-up); }
.cp-copy svg { width: 16px; height: 16px; fill: currentColor; }
.cp-done { background: var(--key-on-face); box-shadow: var(--key-on); border-color: rgba(255, 255, 255, .4); }
.cp-copy:active, .cp-done:active { transform: translateY(2px); box-shadow: var(--key-down); }
@media (orientation: portrait), (max-width: 760px) {
  .cp-card { width: auto; max-width: 480px; margin: 0 auto; }
  .cp-sv { height: 190px; }
}

/* Explore only where there's somewhere to explore: not in the solid, gradient or spotlight studios */
#app.no-explore .explore-btn { display: none; }
