:root {
  --ink: #2b1055;
  --paper: #ffffff;
  --gilt: #ffd23f;
  --red: #ff3d7f;
  --pink: #ff3d7f;
  --orange: #ff8a3d;
  --teal: #00c2b8;
  --violet: #7b2ff7;
  --muted: #5d4a80;
  --panel: #ffffff;
  --field: #f4efff;
  --pop: linear-gradient(135deg, #ff3d7f 0%, #ff8a3d 100%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(135deg, #7b2ff7 0%, #f107a3 50%, #ff8a3d 100%) fixed;
  color: var(--ink);
  font-family: "Source Sans 3", system-ui, sans-serif;
}

body { padding-bottom: var(--banner-h, 0px); }

#app {
  position: relative;
  max-width: 920px;
  margin: 0 auto;
  padding: 1.5rem 1.2rem 3rem;
}

#phone-logout {
  position: fixed;
  top: max(0.7rem, env(safe-area-inset-top));
  right: max(0.7rem, env(safe-area-inset-right));
  z-index: 35;
  background: rgba(255, 255, 255, 0.92);
  color: var(--violet);
  border: 2px solid #ffffff;
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
}

body.phone-in #app {
  padding-top: 3.4rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gilt);
}

h1, h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  margin: 0;
}

h1 {
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  letter-spacing: -0.03em;
  color: #ffffff;
  text-shadow: 3px 3px 0 var(--violet), 6px 6px 0 rgba(43, 16, 85, 0.25);
}
h2 { color: var(--violet); }
h2 { font-size: 1.25rem; margin-bottom: 0.4rem; }

.lede, .hint, #login p, #home p, #cloud-note, #party-title {
  line-height: 1.45;
  color: var(--muted);
}

.lede, #cloud-note { color: #fff3fb; }

.lede { max-width: 40rem; margin: 0.6rem 0 1.4rem; }

.panel {
  background: var(--panel);
  border: 0;
  border-top: 6px solid var(--teal);
  border-radius: 1.1rem;
  box-shadow: 0 10px 30px rgba(43, 16, 85, 0.25);
  padding: 1.1rem 1.15rem 1.2rem;
  margin: 0 0 1rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: end;
}

label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
}

input {
  background: var(--field);
  color: var(--ink);
  border: 2px solid #d9cbff;
  border-radius: 0.55rem;
  padding: 0.55rem 0.7rem;
  font: inherit;
  min-width: 12rem;
}

button {
  font: inherit;
  font-weight: 700;
  background: var(--pop);
  color: #ffffff;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 4px 0 #c4245c;
  transition: transform 120ms ease, box-shadow 120ms ease;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
}

button:hover:not(:disabled) { transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #c4245c; }

button.ghost, #disconnect-btn, #change-folder-btn, #folder-back, #show-copy, #show-reset, #source-buttons button {
  background: #ffffff;
  color: var(--violet);
  border: 2px solid var(--violet);
  box-shadow: 0 4px 0 #d9cbff;
}

#source-buttons button { border-color: var(--teal); color: #008a83; box-shadow: 0 4px 0 #b3efeb; }

button:disabled { opacity: 0.5; cursor: default; }

#login, #home {
  background: var(--panel);
  border-top: 6px solid var(--gilt);
  box-shadow: 0 10px 30px rgba(43, 16, 85, 0.25);
  border-radius: 1.1rem;
  padding: 1.2rem;
}

#login h2, #home h2 { margin-bottom: 0.35rem; }
#home-phone { margin: 0 0 0.2rem; }

#login-phone-form, #login-code-form, #start-form, #new-folder-form, #text-form { margin-top: 0.8rem; }

#party-list {
  list-style: none;
  padding: 0;
  margin: 0.8rem 0 1rem;
  display: grid;
  gap: 0.5rem;
}

#party-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: center;
  background: var(--field);
  border-left: 5px solid var(--pink);
  border-radius: 0.7rem;
  padding: 0.7rem 0.8rem;
}

#party-list .meta {
  display: grid;
  gap: 0.15rem;
}

#party-list .meta strong { font-size: 1.05rem; }
#party-list .meta span { color: var(--muted); font-size: 0.88rem; }

#back-parties {
  background: rgba(255, 255, 255, 0.92);
  color: var(--violet);
  border: 2px solid #ffffff;
  box-shadow: none;
  margin-bottom: 0.7rem;
}

#party-title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.6rem;
  color: #ffffff;
  text-shadow: 2px 2px 0 var(--violet);
  margin: 0 0 0.35rem;
}

#share-card, #show-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
}

#qr, #show-qr {
  width: 11rem;
  height: 11rem;
  background: #ffffff;
  border: 4px solid var(--gilt);
  border-radius: 0.8rem;
  padding: 0.4rem;
}

#join-url, #show-url {
  word-break: break-all;
  font-weight: 700;
  color: var(--violet);
  margin: 0 0 0.4rem;
}

#folder-list, #wall-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0.8rem;
  display: grid;
  gap: 0.45rem;
}

#folder-list li, #source-buttons button {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

#folder-list button, #wall-list img {
  width: 100%;
}

#wall-list {
  grid-template-columns: repeat(auto-fill, minmax(7.2rem, 1fr));
}

#wall-list img {
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 0.5rem;
  background: var(--field);
  border: 3px solid #ffffff;
  box-shadow: 0 3px 10px rgba(43, 16, 85, 0.2);
}

.banner-error, #toast, #cam-toast {
  background: #ffe1ea;
  color: #a3003f;
  border: 2px solid var(--pink);
  padding: 0.7rem 0.9rem;
  border-radius: 0.6rem;
}

.camera-page #cam-error {
  position: fixed;
  left: 0.8rem;
  right: 0.8rem;
  top: 4.2rem;
  z-index: 12;
}

#toast, #cam-toast {
  background: var(--violet);
  color: #ffffff;
  border: 0;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(43, 16, 85, 0.35);
  position: fixed;
  left: 50%;
  bottom: calc(5.5rem + var(--banner-h, 0px));
  transform: translateX(-50%);
  z-index: 20;
}

#login[hidden], #home[hidden], #host[hidden], .panel[hidden], #oauth-error[hidden],
#toast[hidden], #cam-error[hidden], #cam-toast[hidden], #qr[hidden],
#no-sources[hidden], #folders[hidden], #disconnect-btn[hidden],
#change-folder-btn[hidden], #show-qr[hidden], #show-top[hidden], #folder-back[hidden], #folder-use-current[hidden], #folder-top-hint[hidden], #cloud-status[hidden], #source-buttons[hidden],
#folder-empty[hidden], #wall-empty[hidden], #login-code-form[hidden],
#party-empty[hidden], #phone-logout[hidden] {
  display: none !important;
}

.camera-page {
  position: relative;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
  background: #120428;
}

#cam-mast {
  position: fixed;
  top: max(0.55rem, env(safe-area-inset-top));
  left: max(0.8rem, env(safe-area-inset-left));
  right: 5.5rem;
  z-index: 6;
  padding: 0;
  pointer-events: none;
  text-shadow: 0 1px 8px #000;
}
#cam-name { font-size: 1.25rem; color: #ffffff; text-shadow: 2px 2px 0 var(--pink); }

#viewfinder {
  position: fixed;
  inset: 0;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  background: #000;
}

#preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

#flash.pop { animation: pop 180ms ease; }

@keyframes pop {
  from { opacity: 0.95; }
  to { opacity: 0; }
}

#cam-bar {
  position: fixed;
  z-index: 8;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  left: 0;
  right: 0;
  bottom: var(--banner-h, 0px);
  top: auto;
  padding: 0.7rem 1rem calc(0.9rem + env(safe-area-inset-bottom));
  pointer-events: none;
}

#cam-bar > * {
  pointer-events: auto;
  width: auto;
  flex: 0 0 auto;
}

#flip-btn {
  background: rgba(123, 47, 247, 0.75);
  color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: none;
  min-width: 5.4rem;
}

#cam-count {
  margin: 0;
  min-width: 2rem;
  text-align: center;
  color: var(--gilt);
  font-weight: 700;
  text-shadow: 0 1px 6px #000;
}

#shutter {
  width: 4.6rem;
  height: 4.6rem;
  min-width: 4.6rem;
  min-height: 4.6rem;
  border-radius: 50%;
  background: var(--pop);
  border: 5px solid #ffffff;
  box-shadow: 0 0 0 4px var(--pink), 0 0 24px rgba(255, 61, 127, 0.8);
  padding: 0;
}

#shutter:active { transform: scale(0.94); }

@media (orientation: landscape) {
  #cam-mast { right: 6.5rem; }
  #cam-bar {
    left: auto;
    right: 0;
    top: 0;
    bottom: var(--banner-h, 0px);
    flex-direction: column;
    padding: 1rem calc(0.85rem + env(safe-area-inset-right)) 1rem 0.7rem;
  }
}

@media (max-width: 720px) {
  #share-card, #show-card { grid-template-columns: 1fr; }
  #qr, #show-qr { width: 13rem; height: 13rem; }
  input, .panel button, .panel .button-link, #start-btn, #login button { width: 100%; }
  .row { align-items: stretch; }
}

#cloud-status {
  margin: 0 0 0.8rem;
  line-height: 1.45;
}

#cloud-status strong { color: var(--pink); }

a.button-link {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  background: var(--pop);
  color: #ffffff;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  box-shadow: 0 4px 0 #c4245c;
}

#show-card .hint { margin: 0.7rem 0 0; font-size: 0.88rem; }

/* ---------- Live slideshow ---------- */

.show-page {
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at 20% 20%, #7b2ff7 0%, #2b1055 55%, #12052a 100%);
  color: #ffffff;
}

#stage { position: fixed; inset: 0; }

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.1s ease;
  overflow: hidden;
}

.slide.on { opacity: 1; }

.slide-bg {
  position: absolute;
  inset: -6%;
  background-size: cover;
  background-position: center;
  filter: blur(36px) saturate(1.5) brightness(0.6);
}

.slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 40px rgba(0, 0, 0, 0.5));
}

.slide.on img { animation: drift 9s ease-out forwards; }

@keyframes drift {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}

#show-empty {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 2rem;
  z-index: 3;
}

#show-empty h1 { font-size: clamp(2.6rem, 8vw, 5.5rem); }
#show-empty p:last-child { font-size: clamp(1.1rem, 2.6vw, 1.6rem); color: #ffe3f4; }

#show-mast {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  max-width: min(70vw, 40rem);
  text-align: center;
  z-index: 4;
  padding: 0.55rem 1rem 0.6rem;
  border-radius: 1rem;
  background: rgba(43, 16, 85, 0.55);
  backdrop-filter: blur(8px);
}

#show-name { font-size: clamp(1.2rem, 2.8vw, 2rem); text-shadow: 2px 2px 0 var(--pink); }
#show-count { margin: 0.1rem 0 0; color: var(--gilt); font-weight: 700; }

#show-new {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1.2rem, env(safe-area-inset-right));
  z-index: 4;
  margin: 0;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  background: var(--pop);
  font-weight: 700;
  font-size: clamp(1rem, 2.2vw, 1.4rem);
  box-shadow: 0 0 24px rgba(255, 61, 127, 0.8);
  animation: bounce-in 500ms cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes bounce-in {
  from { transform: scale(0.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

#show-join {
  position: fixed;
  right: max(1.2rem, env(safe-area-inset-right));
  bottom: calc(max(1.2rem, env(safe-area-inset-bottom)) + var(--banner-h, 0px));
  z-index: 4;
  width: clamp(6.5rem, 13vw, 10rem);
  padding: 0.5rem 0.5rem 0.4rem;
  border-radius: 1rem;
  background: #ffffff;
  border-top: 5px solid var(--teal);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  text-align: center;
}

#show-join img { width: 100%; display: block; }
#show-join p { margin: 0.25rem 0 0; color: var(--violet); font-weight: 700; font-size: 0.85rem; }

#show-fs {
  position: fixed;
  left: max(1.2rem, env(safe-area-inset-left));
  bottom: calc(max(1.2rem, env(safe-area-inset-bottom)) + var(--banner-h, 0px));
  z-index: 5;
  transition: opacity 400ms ease;
}

body.idle #show-fs { opacity: 0; pointer-events: none; }
body.idle { cursor: none; }

#show-empty[hidden], #show-new[hidden], #show-join[hidden], #show-fs[hidden] {
  display: none !important;
}

#party-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  margin: 0 0 0.35rem;
}

#party-head #party-title { margin: 0; }

#show-top {
  font-size: 1.05rem;
  padding: 0.75rem 1.3rem;
  background: linear-gradient(135deg, #00c2b8 0%, #7b2ff7 100%);
  box-shadow: 0 4px 0 #4a1a9e, 0 0 20px rgba(0, 194, 184, 0.5);
}

/* ---------- How it works animations ---------- */

#how { margin: 1.6rem 0 0; }

.how-title {
  color: #ffffff;
  font-size: 1.5rem;
  margin: 0 0 0.8rem;
  text-shadow: 2px 2px 0 var(--violet);
}

.demo-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.demos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
}

.demo {
  --dur: 12s;
  margin: 0;
  background: #ffffff;
  border-radius: 1.1rem;
  border-top: 6px solid var(--teal);
  box-shadow: 0 10px 30px rgba(43, 16, 85, 0.25);
  padding: 0.9rem 1rem 1rem;
}

.demo + .demo { border-top-color: var(--gilt); }

.demo-tag {
  display: inline-block;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
  background: var(--pop);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}

.demo svg {
  display: block;
  width: 100%;
  height: auto;
  margin: 0.6rem 0 0.4rem;
  background: linear-gradient(160deg, #f4efff 0%, #ffe9f3 100%);
  border-radius: 0.8rem;
}

.demo svg * { transform-box: fill-box; transform-origin: center; }

.demo .t-title { font: 700 7px "Source Sans 3", system-ui, sans-serif; fill: var(--violet); }
.demo .t-btn { font: 700 6.5px "Source Sans 3", system-ui, sans-serif; fill: #ffffff; }

.demo-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 0.3rem;
}

.demo-steps li {
  counter-increment: step;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.5rem;
  border-radius: 0.6rem;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
  animation: d-step var(--dur) linear infinite;
  animation-delay: calc(var(--d) - var(--dur));
}

.demo-steps li::before {
  content: counter(step);
  flex: 0 0 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--violet);
  background: var(--field);
}

@keyframes d-step {
  0%, 24% { background: var(--field); color: var(--ink); }
  25%, 100% { background: transparent; color: var(--muted); }
}

/* Every scene and its moving parts run on the same 12s loop, offset by --d. */
.demo .scene,
.demo .scene * {
  animation-duration: var(--dur);
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
  animation-delay: calc(var(--d) - var(--dur));
}

.demo .scene { opacity: 0; animation-name: d-scene; animation-timing-function: linear; }

@keyframes d-scene {
  0% { opacity: 0; }
  2%, 23% { opacity: 1; }
  25%, 100% { opacity: 0; }
}

.demo .d-tap { opacity: 0; animation-name: d-tap; }
@keyframes d-tap {
  0%, 5% { opacity: 0; transform: scale(0.4); }
  7% { opacity: 1; transform: scale(0.6); }
  13%, 100% { opacity: 0; transform: scale(2.4); }
}

.demo .d-fade-out { animation-name: d-fade-out; }
@keyframes d-fade-out {
  0%, 8% { opacity: 1; transform: scale(1); }
  9% { transform: scale(0.9); }
  12%, 100% { opacity: 0; transform: scale(0.9); }
}

.demo .d-ready { opacity: 0; animation-name: d-ready; }
@keyframes d-ready {
  0%, 11% { opacity: 0; transform: scale(0.3); }
  14% { opacity: 1; transform: scale(1.15); }
  16%, 100% { opacity: 1; transform: scale(1); }
}

.demo .d-conf { opacity: 0; animation-name: d-conf; }
@keyframes d-conf {
  0%, 10% { opacity: 0; transform: translate(0, 0) rotate(0); }
  11% { opacity: 1; }
  21%, 100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(200deg); }
}

.demo .d-swap-a { animation-name: d-swap-a; animation-timing-function: linear; }
.demo .d-swap-b { opacity: 0; animation-name: d-swap-b; animation-timing-function: linear; }
@keyframes d-swap-a {
  0%, 11% { opacity: 1; }
  13%, 100% { opacity: 0; }
}
@keyframes d-swap-b {
  0%, 11% { opacity: 0; }
  13%, 100% { opacity: 1; }
}

.demo .d-slide-in { animation-name: d-slide-in; }
@keyframes d-slide-in {
  0% { opacity: 0; transform: translate(70px, 10px); }
  7%, 100% { opacity: 1; transform: translate(0, 0); }
}

.demo .d-beam { opacity: 0; animation-name: d-beam; animation-timing-function: steps(1); }
@keyframes d-beam {
  0%, 7% { opacity: 0; }
  8%, 11% { opacity: 1; }
  12% { opacity: 0.2; }
  13%, 100% { opacity: 1; }
}

.demo .d-scan {
  animation: d-scan 1s ease-in-out infinite alternate;
}
@keyframes d-scan {
  from { transform: translateY(0); }
  to { transform: translateY(48px); }
}

.demo .d-flash { opacity: 0; animation-name: d-flash; }
@keyframes d-flash {
  0%, 9% { opacity: 0; }
  10% { opacity: 1; }
  13%, 100% { opacity: 0; }
}

.demo .d-fly { opacity: 0; animation-name: d-fly; animation-timing-function: ease-in-out; }
@keyframes d-fly {
  0%, 10% { opacity: 0; transform: translate(var(--fx), var(--fy)) scale(0.35); }
  11% { opacity: 1; transform: translate(var(--fx), var(--fy)) scale(0.35); }
  18%, 100% { opacity: 1; transform: translate(0, 0) scale(1); }
}

.demo .d-fly-2 { opacity: 0; animation-name: d-fly-2; animation-timing-function: ease-in-out; }
@keyframes d-fly-2 {
  0%, 13% { opacity: 0; transform: translate(var(--fx), var(--fy)) scale(0.6); }
  14% { opacity: 1; transform: translate(var(--fx), var(--fy)) scale(0.6); }
  20%, 100% { opacity: 1; transform: translate(0, 0) scale(1); }
}

.demo .d-cloud-in { opacity: 0; animation-name: d-cloud-in; }
@keyframes d-cloud-in {
  0%, 11% { opacity: 0; transform: scale(0.5); }
  14%, 18% { opacity: 1; transform: scale(1); }
  20% { transform: scale(1.12); }
  22%, 100% { opacity: 1; transform: scale(1); }
}

.demo .d-pop { opacity: 0; animation-name: d-pop; }
@keyframes d-pop {
  0%, 17% { opacity: 0; transform: scale(0.2); }
  19% { opacity: 1; transform: scale(1.25); }
  21%, 100% { opacity: 1; transform: scale(1); }
}

.demo .d-print-1 { animation-name: d-print-1; }
.demo .d-print-2 { animation-name: d-print-2; }
@keyframes d-print-1 {
  0%, 3% { transform: translateY(46px); }
  10%, 100% { transform: translateY(0); }
}
@keyframes d-print-2 {
  0%, 11% { transform: translateY(46px); }
  18%, 100% { transform: translateY(0); }
}

.demo .d-blink { animation: d-blink 0.6s steps(2) infinite; }
@keyframes d-blink { 50% { opacity: 0.2; } }

.demo .d-drop-1, .demo .d-drop-2, .demo .d-drop-3 { opacity: 0; animation-timing-function: cubic-bezier(0.3, 1.5, 0.6, 1); }
.demo .d-drop-1 { animation-name: d-drop-1; }
.demo .d-drop-2 { animation-name: d-drop-2; }
.demo .d-drop-3 { animation-name: d-drop-3; }
@keyframes d-drop-1 {
  0%, 2% { opacity: 0; transform: translateY(-80px); }
  3% { opacity: 1; }
  8%, 100% { opacity: 1; transform: translateY(0); }
}
@keyframes d-drop-2 {
  0%, 7% { opacity: 0; transform: translateY(-80px); }
  8% { opacity: 1; }
  13%, 100% { opacity: 1; transform: translateY(0); }
}
@keyframes d-drop-3 {
  0%, 12% { opacity: 0; transform: translateY(-80px); }
  13% { opacity: 1; }
  18%, 100% { opacity: 1; transform: translateY(0); }
}

#how[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .demo .scene, .demo .scene *, .demo-steps li { animation: none !important; }
  .demo .scene { opacity: 0; }
  .demo .scene:last-of-type { opacity: 1; }
  .demo .scene:last-of-type .d-fly,
  .demo .scene:last-of-type .d-fly-2,
  .demo .scene:last-of-type .d-cloud-in,
  .demo .scene:last-of-type .d-pop,
  .demo .scene:last-of-type .d-slide-in,
  .demo .scene:last-of-type .d-beam { opacity: 1; }
}

.party-actions { display: flex; gap: 0.45rem; flex: 0 0 auto; }

button.danger {
  background: #ffffff;
  color: #c4245c;
  border: 2px solid #ff3d7f;
  box-shadow: 0 4px 0 #ffd0e0;
}

@media (max-width: 720px) {
  #party-list li { flex-wrap: wrap; }
  .party-actions { width: 100%; }
  .party-actions button { flex: 1; }
}

/* ---------- Footer and legal pages ---------- */

.site-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.4rem;
  margin: 2.2rem 0 0;
  padding: 1rem 0 0;
  border-top: 2px solid rgba(255, 255, 255, 0.35);
  font-size: 0.92rem;
}

.site-foot a { color: #ffffff; font-weight: 700; text-decoration: none; }
.site-foot a:hover, .site-foot a[aria-current="page"] { text-decoration: underline; text-underline-offset: 3px; }

.back-home { color: var(--gilt); text-decoration: none; }
.back-home:hover { text-decoration: underline; }

.legal {
  background: #ffffff;
  border-radius: 1.1rem;
  border-top: 6px solid var(--teal);
  box-shadow: 0 10px 30px rgba(43, 16, 85, 0.25);
  padding: 1.3rem 1.4rem 1.6rem;
  line-height: 1.6;
  color: var(--ink);
  max-width: 46rem;
}

.legal h2 { margin: 1.6rem 0 0.4rem; }
.legal h3 { margin: 1rem 0 0.3rem; font-size: 1.02rem; color: var(--pink); }
.legal p, .legal ul { margin: 0 0 0.8rem; }
.legal ul { padding-left: 1.3rem; }
.legal li { margin: 0.3rem 0; }
.legal a { color: var(--violet); font-weight: 700; }

#print-cards { margin-top: 0.8rem; }

/* ---------- Printable QR card sheet ---------- */

.print-page #print-controls { max-width: 920px; margin: 0 auto; padding: 1.5rem 1.2rem 0.5rem; }
.print-page #print-controls h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); }
.print-page #print-warn { margin: 0 0 1rem; }

.print-row { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; margin-bottom: 1.2rem; }

.seg { display: inline-flex; background: rgba(255, 255, 255, 0.92); border-radius: 999px; padding: 0.25rem; gap: 0.2rem; }
.seg button { background: transparent; color: var(--violet); box-shadow: none; padding: 0.5rem 0.9rem; }
.seg button[aria-pressed="true"] { background: var(--violet); color: #ffffff; }

#sheet-wrap { max-width: 920px; margin: 0 auto 3rem; padding: 0 1.2rem; overflow: hidden; }

#sheet {
  --cols: 2;
  --rows: 3;
  --qr: 1.45in;
  --head: 24pt;
  --blurb: 12pt;
  --party: 11pt;
  width: 7.4in;
  height: 9.9in;
  margin: 0 auto;
  padding: 0;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(43, 16, 85, 0.35);
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-template-rows: repeat(var(--rows), 1fr);
  transform-origin: top left;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

#sheet.per-4 { --cols: 2; --rows: 2; --qr: 2.6in; --head: 34pt; --blurb: 15pt; --party: 13pt; }
#sheet.per-9 { --cols: 3; --rows: 3; --qr: 1.35in; --head: 19pt; --blurb: 10pt; --party: 9pt; }

.qr-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  gap: 0.05in;
  padding: 0.16in 0.18in 0.12in;
  min-height: 0;
  text-align: center;
  color: #2b1055;
  border-right: 1.5px dashed #b9a6e0;
  border-bottom: 1.5px dashed #b9a6e0;
  overflow: hidden;
}

/* Thin color band on each card so they look festive on the table. */
.qr-card::before {
  content: "";
  position: absolute;
  inset: 0.09in 0.09in auto;
  height: 0.07in;
  border-radius: 999px;
  background: linear-gradient(90deg, #7b2ff7, #ff3d7f, #ff8a3d, #ffd23f);
}

.qr-card-party {
  margin: 0.06in 0 0;
  font-size: var(--party);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ff3d7f;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-card-head {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: var(--head);
  line-height: 1;
  color: #7b2ff7;
}

.qr-card-code {
  width: var(--qr);
  height: var(--qr);
  border: 0.05in solid #ffd23f;
  border-radius: 0.1in;
  background: #ffffff;
}

.qr-card-blurb {
  margin: 0;
  max-width: 3.1in;
  font-size: var(--blurb);
  font-weight: 700;
  line-height: 1.25;
}

.qr-card-foot { margin: 0; font-size: calc(var(--blurb) * 0.72); color: #5d4a80; }

@media print {
  @page { margin: 0.4in; }
  html, body.print-page { background: #ffffff !important; }
  #print-controls, #debug-banner { display: none !important; }
  body { padding-bottom: 0 !important; }
  #sheet-wrap { max-width: none; margin: 0; padding: 0; height: auto !important; }
  #sheet { box-shadow: none; transform: none !important; margin: 0; }
}

#print-warn[hidden] { display: none !important; }

/* ---------- Debug-mode banner ---------- */

#debug-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom));
  background: #ffd23f;
  color: #2b1055;
  border-top: 3px solid #2b1055;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.3;
  text-align: center;
}

/* ---------- Folder chooser ---------- */

#folder-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.35rem;
  margin: 0.3rem 0 0.7rem;
  padding: 0.5rem 0.7rem;
  background: var(--field);
  border-radius: 0.7rem;
  color: var(--ink);
  font-size: 0.95rem;
  word-break: break-word;
}

#folder-crumb strong { color: var(--violet); }
.crumb-sep { color: #b9a6e0; }

.panel button.crumb {
  width: auto;
  background: transparent;
  color: var(--violet);
  box-shadow: none;
  padding: 0.15rem 0.3rem;
  border-radius: 0.4rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#folder-actions { margin: 0 0 0.6rem; }
#folder-actions:not(:has(button:not([hidden]))) { display: none; }
#folder-use-current { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#folder-list li > button:first-child {
  text-align: left;
  border-radius: 1.1rem;
  word-break: break-word;
}
#folder-list li > button:first-child { flex: 1 1 auto; }
#folder-list li > button:last-child { flex: 0 0 auto; width: auto; }
