:root {
  --bg: #2a1830;
  --panel: rgba(255, 240, 248, 0.96);
  --panel-ink: #4a2a3c;
  --text: #fff8ef;
  --muted: #f0c8dc;
  --accent: #ff7eb6;
  --gold: #ffd56a;
  --line: rgba(255, 248, 239, 0.14);
  --shadow: 0 16px 40px rgba(40, 10, 30, 0.35);
  --radius: 20px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background:
    radial-gradient(900px 500px at 12% -8%, #ff8ec8 0%, transparent 55%),
    radial-gradient(800px 480px at 95% 8%, #8b6cff 0%, transparent 50%),
    radial-gradient(700px 420px at 50% 100%, #ffb34755 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding:
    calc(8px + var(--safe-top))
    calc(10px + var(--safe-right))
    calc(10px + var(--safe-bottom))
    calc(10px + var(--safe-left));
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  min-height: 48px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(255, 126, 182, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.brand-text {
  display: grid;
  gap: 0;
  min-width: 0;
}

.brand-title {
  font-weight: 800;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
  flex-shrink: 0;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  transition: transform 0.12s ease;
  touch-action: manipulation;
}

.btn-icon {
  width: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.6;
}

.btn-grok {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding-left: 0.55rem;
  padding-right: 0.75rem;
}

.btn-grok-logo {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: block;
}

.btn-grok-label {
  font-size: 0.85rem;
}

.btn-reset-pose {
  width: 100%;
  min-height: 40px;
  font-size: 0.82rem;
  margin-top: 4px;
}

.pose-tools-section {
  padding-top: 2px;
}

.pose-tip {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  opacity: 0.78;
  line-height: 1.35;
}

.rail-label.row-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.rail-label.row-label .btn.tiny {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
  min-height: 36px;
  padding: 0.3rem 0.65rem;
}

.btn.primary {
  background: linear-gradient(145deg, #ff9ec8, #ff6aa8);
  color: #4a1230;
  box-shadow: 0 8px 18px rgba(255, 106, 168, 0.4);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.wide {
  width: 100%;
}

.btn.tiny {
  min-height: 34px;
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
}

.mode-bar {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.mode-btn {
  flex: 1;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-radius: 999px;
  padding: 0.55rem 0.6rem;
  font: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  min-height: 40px;
}

.mode-btn.active {
  background: linear-gradient(145deg, #ff9ec8, #c4a8ff);
  color: #3b1530;
  border-color: #fff;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 10px;
  min-height: 0;
}

.stage-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 340px;
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 3px solid rgba(255, 255, 255, 0.45);
}

.stage-scene {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  border-radius: inherit;
  transition: filter 0.25s ease;
}

.stage-bg {
  position: absolute;
  inset: 0;
  background-color: #1a1428;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.stage-frame {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  border-radius: inherit;
}

/* Photo-booth frames (CSS layer; compose paints matching overlays) */
.stage-frame.frame-polaroid {
  box-shadow:
    inset 0 0 0 14px #fff,
    inset 0 -42px 0 0 #fff;
}
.stage-frame.frame-polaroid::after {
  content: "Kiko Dress-Up ✨";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(74, 18, 48, 0.55);
  letter-spacing: 0.02em;
}
.stage-frame.frame-gold {
  box-shadow:
    inset 0 0 0 10px #e8c547,
    inset 0 0 0 14px #fff8dc;
}
.stage-frame.frame-hearts {
  box-shadow: inset 0 0 0 6px rgba(255, 106, 168, 0.85);
  background:
    radial-gradient(circle at 8% 8%, transparent 0 12px, transparent 13px),
    radial-gradient(circle at 92% 8%, transparent 0 12px, transparent 13px);
}
.stage-frame.frame-hearts::before,
.stage-frame.frame-hearts::after {
  content: "💕";
  position: absolute;
  font-size: 1.1rem;
  line-height: 1;
}
.stage-frame.frame-hearts::before {
  top: 6px;
  left: 8px;
}
.stage-frame.frame-hearts::after {
  top: 6px;
  right: 8px;
}
.stage-frame.frame-sparkle {
  box-shadow: inset 0 0 0 5px rgba(255, 213, 106, 0.9);
}
.stage-frame.frame-sparkle::before {
  content: "✨";
  position: absolute;
  top: 6px;
  left: 10px;
  font-size: 1rem;
}
.stage-frame.frame-sparkle::after {
  content: "✨";
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 1rem;
}
.stage-frame.frame-neon {
  box-shadow:
    inset 0 0 0 4px #e9d5ff,
    inset 0 0 18px 2px rgba(192, 132, 252, 0.65),
    0 0 16px rgba(167, 139, 250, 0.45);
}
.stage-frame.frame-film {
  box-shadow:
    inset 0 28px 0 #111,
    inset 0 -28px 0 #111;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.chip {
  border: 2px solid rgba(255, 106, 168, 0.2);
  background: #fff;
  color: #4a1230;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  min-height: 34px;
  cursor: pointer;
}
.chip.on {
  border-color: #ff6aa8;
  background: linear-gradient(145deg, #ffe4f1, #f3e8ff);
  box-shadow: 0 0 0 2px rgba(255, 106, 168, 0.25);
}

.looks-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  max-height: 140px;
  overflow: auto;
}

.looks-empty {
  margin: 0;
  font-size: 0.78rem;
  opacity: 0.75;
  line-height: 1.35;
}

.look-chip {
  display: flex;
  gap: 4px;
  align-items: stretch;
}

.look-load {
  flex: 1;
  text-align: left;
  border: 2px solid rgba(124, 58, 237, 0.2);
  background: #fff;
  color: #4a1230;
  border-radius: 12px;
  padding: 0.45rem 0.65rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
}
.look-load:active {
  transform: scale(0.98);
}

.look-del {
  width: 40px;
  border: 0;
  border-radius: 12px;
  background: #f3e8ef;
  color: #9d174d;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
}

.figures {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.figures.free-pose {
  pointer-events: none;
}

.figure-slot {
  position: absolute;
  height: 72%;
  width: auto;
  aspect-ratio: 3 / 4;
  transform-origin: center center;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  border-radius: 12px;
  will-change: transform, left, top;
}

.figure-slot:active {
  cursor: grabbing;
}

.figure-slot.active {
  outline: 3px solid rgba(255, 106, 168, 0.85);
  outline-offset: 4px;
  z-index: 2;
}

.figure {
  position: relative;
  width: 100%;
  height: 100%;
  animation: figure-breathe 3s ease-in-out infinite;
  transform-origin: center 70%;
  will-change: transform;
}

/* Pause idle bob while drag/pinch is active so it does not fight pose transform */
.figure.gesture-active {
  animation-play-state: paused;
}

@keyframes figure-breathe {
  0%,
  100% {
    transform: scaleY(1) scaleX(1);
  }
  50% {
    transform: scaleY(1.025) scaleX(0.99);
  }
}

/* Happy squash-and-stretch on true tap */
.figure.happy-bounce {
  animation: happy-bounce 0.5s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes happy-bounce {
  0% {
    transform: scale(1, 1);
  }
  18% {
    transform: scale(1.12, 0.88);
  }
  40% {
    transform: scale(0.92, 1.1);
  }
  62% {
    transform: scale(1.06, 0.96);
  }
  82% {
    transform: scale(0.98, 1.02);
  }
  100% {
    transform: scale(1, 1);
  }
}

/* Equip: bouncy scale-in on new overlay layer */
.layer.layer-equip {
  animation: layer-equip 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transform-origin: center center;
}

@keyframes layer-equip {
  0% {
    transform: scale(0.35);
    opacity: 0.4;
  }
  55% {
    transform: scale(1.12);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Tap reaction particles (hearts / sparkles) */
.tap-particle {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  font-size: 1.1rem;
  line-height: 1;
  animation: tap-particle-fly 0.7s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes tap-particle-fly {
  0% {
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -48px))) scale(1.15);
    opacity: 0;
  }
}

/* Confetti burst over the stage */
.confetti-burst {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  opacity: 0.95;
  animation: confetti-fall linear forwards;
  will-change: transform, opacity;
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--drift, 20px), 110vh, 0) rotate(var(--spin, 360deg));
    opacity: 0;
  }
}

/* Text stickers only: small one-finger rotate when selected.
   Solid black so it reads on light BGs / white sticker halos. */
.text-sticker .rotate-handle,
.text-sticker .text-rotate {
  position: absolute;
  right: -14px;
  top: -14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #fff;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1;
  touch-action: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  z-index: 5;
  padding: 0;
  display: grid;
  place-items: center;
  background: #111;
  cursor: grab;
}

/* Rail A+/A−/rotate for selected text & stickers — black, high contrast */
.btn.text-tool-btn {
  background: #111;
  color: #fff;
  border: 1px solid #111;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  min-width: 40px;
  font-weight: 800;
}

.btn.text-tool-btn:active {
  background: #000;
  transform: scale(0.96);
}

.char-base,
.char-head {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  border-radius: 8px;
}

.char-head {
  z-index: 3;
}

.layers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.layers-under {
  z-index: 2;
}

.layers-over {
  z-index: 4;
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.layer svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.texts {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.text-sticker {
  position: absolute;
  pointer-events: auto;
  cursor: grab;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  max-width: 90%;
  padding: 0.2rem 0.45rem;
  border-radius: 10px;
  text-shadow:
    0 0 4px #fff,
    0 0 8px #fff,
    1px 1px 0 #fff,
    -1px -1px 0 #fff,
    1px -1px 0 #fff,
    -1px 1px 0 #fff;
  touch-action: none;
  line-height: 1.15;
  user-select: none;
  -webkit-user-select: none;
}

.text-sticker .text-label {
  display: inline-block;
  min-width: 1ch;
  outline: none;
}

.text-sticker.selected {
  outline: 2px dashed rgba(255, 106, 168, 0.9);
  outline-offset: 4px;
  background: rgba(255, 255, 255, 0.2);
}

.text-sticker.editing,
.text-sticker .text-label.editing {
  cursor: text;
  touch-action: manipulation;
  user-select: text;
  -webkit-user-select: text;
  background: rgba(255, 255, 255, 0.55);
  outline: 2px solid #ff6aa8;
  outline-offset: 3px;
  border-radius: 8px;
}

.text-sticker:active {
  cursor: grabbing;
}

.text-edit-input {
  flex: 1 1 100%;
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  border: 2px solid #f9a8d4;
  background: #fff;
  color: #4a1230;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  box-sizing: border-box;
}

.text-edit-input:focus {
  outline: none;
  border-color: #ff6aa8;
  box-shadow: 0 0 0 3px rgba(255, 106, 168, 0.25);
}

.hint,
.save-status {
  margin: 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
  min-height: 1.15em;
}

.save-status.flash {
  color: var(--gold);
  font-weight: 700;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  background: var(--panel);
  color: var(--panel-ink);
  border-radius: calc(var(--radius) + 4px);
  padding: 10px;
  box-shadow: var(--shadow);
  border: 2px solid rgba(255, 255, 255, 0.55);
}

.rail-section {
  flex-shrink: 0;
}

.rail-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
  margin-bottom: 4px;
}

.sticker-tray {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.sticker-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 1.45rem;
  line-height: 1;
  border: 2px solid transparent;
  border-radius: 12px;
  background: linear-gradient(160deg, #fff, #fff5fb);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.sticker-btn:active {
  transform: scale(0.94);
  border-color: #ff9ec8;
}

.bg-row,
.who-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.bg-chip {
  flex: 0 0 auto;
  width: 52px;
  height: 68px;
  border-radius: 12px;
  border: 3px solid transparent;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  background-color: #ddd;
  padding: 0;
}

.bg-chip.on {
  border-color: #ff6aa8;
  box-shadow: 0 0 0 2px rgba(255, 106, 168, 0.35);
}

.who-btn {
  flex: 1;
  border: 2px solid transparent;
  background: #ffe8f2;
  border-radius: 999px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  min-height: 38px;
  color: var(--panel-ink);
}

.who-btn.on {
  background: linear-gradient(145deg, #ff9ec8, #c4a8ff);
  border-color: #fff;
}

.cats {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  flex-shrink: 0;
}

.cat {
  flex: 0 0 auto;
  border: 2px solid transparent;
  background: #ffe8f2;
  color: var(--panel-ink);
  border-radius: 999px;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-weight: 800;
  font-size: 0.78rem;
  cursor: pointer;
  min-height: 40px;
  white-space: nowrap;
}

.cat.active {
  background: linear-gradient(145deg, #ff9ec8, #c4a8ff);
  border-color: #fff;
  box-shadow: 0 6px 14px rgba(255, 126, 182, 0.35);
}

.items {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.item {
  position: relative;
  border: 3px solid transparent;
  background: linear-gradient(160deg, #fff, #fff5fb);
  border-radius: 16px;
  padding: 8px 6px 10px;
  cursor: pointer;
  display: grid;
  gap: 4px;
  justify-items: center;
  min-height: 100px;
  box-shadow: 0 4px 12px rgba(90, 40, 70, 0.08);
}

.item:active {
  transform: scale(0.96);
}

.item.on {
  border-color: #ff6aa8;
  box-shadow: 0 0 0 3px rgba(255, 106, 168, 0.25);
  background: linear-gradient(160deg, #fff0f7, #efe8ff);
}

.item-preview {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
}

.item-preview svg {
  width: 60px;
  height: 60px;
  overflow: visible;
}

.item-name {
  font-size: 0.74rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
}

.item .check {
  position: absolute;
  top: 5px;
  right: 7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ff6aa8;
  color: white;
  font-size: 0.7rem;
  display: none;
  place-items: center;
  font-weight: 900;
}

.item.on .check {
  display: grid;
}

.none-item {
  grid-column: 1 / -1;
  min-height: 48px;
  background: #f3e8ef;
}

.text-tools {
  display: grid;
  gap: 6px;
}

.text-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  padding: 0;
}

.swatch.on {
  outline: 2px solid #ff6aa8;
  outline-offset: 2px;
}

@media (max-width: 820px), (orientation: portrait) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 44vh) minmax(240px, 1fr);
  }

  .stage {
    min-height: 260px;
  }

  .items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rail {
    padding: 12px;
  }
}

@media (max-width: 700px) {
  .btn-grok-label {
    display: none;
  }

  .btn-grok {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .brand-title {
    font-size: 0.9rem;
  }
}

@media (max-width: 520px) {
  .items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mode-btn {
    font-size: 0.78rem;
    padding: 0.45rem 0.4rem;
    min-height: 44px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .hint {
    display: none;
  }

  .stage {
    min-height: 180px;
  }

  .topbar {
    min-height: 44px;
  }
}

/* ---------- Fashion Show ---------- */

.show-theme-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 158, 200, 0.95), rgba(196, 168, 255, 0.95));
  color: #3b1530;
  box-shadow: 0 6px 18px rgba(255, 106, 168, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.65);
  flex-shrink: 0;
}

.show-theme-banner[hidden] {
  display: none !important;
}

.show-theme-label {
  font-weight: 800;
  font-size: 0.92rem;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}

.show-start-btn {
  min-height: 56px !important;
  padding: 0.7rem 1.1rem !important;
  font-size: 0.95rem !important;
  flex: 0 0 auto;
}

.show-quit-btn {
  min-width: 48px;
  min-height: 48px !important;
  padding: 0.35rem 0.7rem !important;
  font-size: 1.35rem !important;
  line-height: 1;
  flex: 0 0 auto;
}

html.show-overlay-open,
body.show-overlay-open {
  overflow: hidden !important;
  touch-action: none;
}

/* Runway: poster fills the screen (rail / topbar / banner hidden) */
html.runway-fullscreen,
body.runway-fullscreen {
  overflow: hidden !important;
  touch-action: none;
  background: #0a0612;
}

body.runway-fullscreen #app {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: block;
  min-height: 100dvh;
  background: #0a0612;
}

body.runway-fullscreen .topbar,
body.runway-fullscreen .mode-bar,
body.runway-fullscreen .rail,
body.runway-fullscreen .hint,
body.runway-fullscreen .save-status,
body.runway-fullscreen .show-theme-banner {
  display: none !important;
}

body.runway-fullscreen .layout {
  display: block;
  position: absolute;
  inset: 0;
  gap: 0;
  min-height: 0;
  height: 100%;
}

body.runway-fullscreen .stage-wrap {
  position: absolute;
  inset: 0;
  display: block;
  min-height: 0;
  height: 100%;
  gap: 0;
}

body.runway-fullscreen .stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
  flex: none;
}

.show-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(12px + var(--safe-top))
    calc(14px + var(--safe-right))
    calc(12px + var(--safe-bottom))
    calc(14px + var(--safe-left));
  background: rgba(42, 16, 48, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow: hidden;
  overscroll-behavior: none;
}

.show-theme-card,
.show-finale-panel {
  width: min(100%, 420px);
  max-height: min(92dvh, 640px);
  overflow: auto;
  text-align: center;
  padding: 1.6rem 1.4rem 1.5rem;
  border-radius: 28px;
  background:
    radial-gradient(circle at 20% 0%, #ffe0f0 0%, transparent 55%),
    radial-gradient(circle at 90% 100%, #e0d4ff 0%, transparent 50%),
    linear-gradient(165deg, #fff8fc, #f3e8ff);
  color: #3b1530;
  box-shadow:
    0 24px 60px rgba(40, 10, 40, 0.45),
    0 0 0 3px rgba(255, 255, 255, 0.55);
  animation: show-card-in 0.45s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.show-theme-emoji {
  font-size: clamp(3.2rem, 12vw, 4.5rem);
  line-height: 1;
  margin-bottom: 0.35rem;
  filter: drop-shadow(0 6px 12px rgba(255, 106, 168, 0.35));
}

.show-theme-title {
  margin: 0.15rem 0 0.2rem;
  font-size: clamp(1.55rem, 6vw, 2.1rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #ff4d9a, #8b5cf6, #ff8a3d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.show-theme-sub {
  margin: 0 0 1.15rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #7c3aed;
}

/* ── Animate → Grok Imagine guide (iOS-safe) ── */
.animate-guide-card {
  text-align: left;
}

.animate-guide-card .show-theme-title,
.animate-guide-card .show-theme-emoji {
  text-align: center;
}

.animate-guide-warn,
.animate-guide-status {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
}

.animate-guide-warn,
.animate-guide-status.warn {
  background: rgba(255, 77, 154, 0.12);
  border: 1px solid rgba(255, 77, 154, 0.35);
  color: #9d174d;
}

.animate-guide-status.ok {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #047857;
}

.animate-guide-preview {
  display: block;
  width: 100%;
  max-height: 28vh;
  object-fit: contain;
  border-radius: 16px;
  margin: 0 0 0.75rem;
  background: #1a1428;
  box-shadow: 0 8px 24px rgba(40, 10, 40, 0.2);
}

.animate-guide-steps {
  margin: 0 0 0.75rem;
  padding-left: 1.25rem;
  font-size: 0.92rem;
  font-weight: 650;
  color: #3b1530;
  line-height: 1.45;
}

.animate-guide-steps li {
  margin-bottom: 0.35rem;
}

.animate-guide-prompt {
  margin: 0 0 0.9rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: rgba(124, 58, 237, 0.08);
  border: 1px dashed rgba(124, 58, 237, 0.35);
  font-size: 0.78rem;
  font-weight: 600;
  color: #5b21b6;
  line-height: 1.35;
  user-select: text;
  -webkit-user-select: text;
}

.animate-guide-actions {
  display: grid;
  gap: 8px;
}

.animate-guide-actions .show-big-btn {
  max-width: none;
}

.show-big-btn {
  min-height: 56px !important;
  padding: 0.85rem 1.35rem !important;
  font-size: 1.05rem !important;
  border-radius: 999px !important;
  width: 100%;
  max-width: 320px;
}

.show-theme-card .show-big-btn {
  background: linear-gradient(145deg, #ff9ec8, #c4a8ff) !important;
  color: #3b1530 !important;
  box-shadow: 0 10px 24px rgba(196, 168, 255, 0.45);
}

.show-finale-actions {
  display: grid;
  gap: 10px;
  justify-items: center;
  margin-top: 0.35rem;
}

.show-finale-actions .btn.ghost {
  background: rgba(255, 255, 255, 0.75);
  color: #4a2a3c;
  border: 2px solid rgba(255, 106, 168, 0.35);
}

.show-stars {
  display: flex;
  justify-content: center;
  gap: clamp(6px, 2vw, 12px);
  margin-bottom: 0.85rem;
  min-height: 2.6rem;
}

.show-star {
  font-size: clamp(1.8rem, 7vw, 2.5rem);
  line-height: 1;
  opacity: 0;
  transform: scale(0.2) translateY(18px);
  filter: drop-shadow(0 4px 10px rgba(255, 200, 80, 0.55));
}

.show-star.pop-in {
  animation: show-star-pop 0.55s cubic-bezier(0.34, 1.55, 0.64, 1) forwards;
}

.show-praise {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 5.5vw, 1.85rem);
  font-weight: 900;
  line-height: 1.2;
  color: #ff4d9a;
}

.show-finale-theme {
  margin: 0 0 1.1rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #7c3aed;
}

/* Camera flash: full-screen white pulse with slight random offset */
.show-flash {
  position: fixed;
  inset: -8%;
  z-index: 190;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.92);
  transform: translate(var(--flash-x, 0), var(--flash-y, 0));
  opacity: 0;
  animation: show-cam-flash 0.28s ease-out both;
}

/* Strut: child wrapper so .figure-slot pose transform is not fought */
.strut-inner {
  width: 100%;
  height: 100%;
  transform-origin: center 70%;
  will-change: transform;
}

.strut-inner.strutting {
  animation: fashion-strut 4s ease-in-out both;
}

@keyframes fashion-strut {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  8% {
    transform: translate(6%, -4%) rotate(-4deg);
  }
  16% {
    transform: translate(14%, 0) rotate(3deg);
  }
  24% {
    transform: translate(22%, -5%) rotate(-3deg);
  }
  32% {
    transform: translate(30%, 0) rotate(4deg);
  }
  40% {
    transform: translate(36%, -3%) rotate(-2deg);
  }
  48% {
    transform: translate(28%, 0) rotate(3deg);
  }
  56% {
    transform: translate(12%, -4%) rotate(-4deg);
  }
  64% {
    transform: translate(-8%, 0) rotate(3deg);
  }
  72% {
    transform: translate(-22%, -5%) rotate(-3deg);
  }
  80% {
    transform: translate(-30%, 0) rotate(4deg);
  }
  88% {
    transform: translate(-14%, -3%) rotate(-2deg);
  }
  94% {
    transform: translate(-4%, 0) rotate(2deg);
  }
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
}

@keyframes show-card-in {
  0% {
    opacity: 0;
    transform: scale(0.82) translateY(18px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes show-star-pop {
  0% {
    opacity: 0;
    transform: scale(0.2) translateY(18px) rotate(-20deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.18) translateY(-4px) rotate(8deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0) rotate(0deg);
  }
}

@keyframes show-cam-flash {
  0% {
    opacity: 0;
  }
  15% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .strut-inner.strutting {
    animation: none;
  }

  .show-flash {
    display: none;
  }

  .show-theme-card,
  .show-finale-panel {
    animation: none;
  }

  .show-star.pop-in {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

@media (orientation: landscape) and (max-height: 480px) {
  .show-theme-card,
  .show-finale-panel {
    padding: 1rem 1.1rem;
    max-height: 88dvh;
  }

  .show-theme-emoji {
    font-size: 2.4rem;
  }

  .show-theme-title {
    font-size: 1.35rem;
  }

  .show-stars {
    min-height: 2rem;
    margin-bottom: 0.4rem;
  }

  .show-star {
    font-size: 1.5rem;
  }

  .show-praise {
    font-size: 1.2rem;
  }
}
