@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("fonts/Inter-Medium.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 800; font-display: swap; src: url("fonts/Inter-ExtraBold.woff2") format("woff2"); }
@font-face { font-family: "Caveat"; font-weight: 600; font-display: swap; src: url("fonts/Caveat-SemiBold.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --party-night: #140a33;
  --party-deep: #090518;
  --party-blue: #2ea8ff;
  --party-orange: #ffa51f;
  --party-green: #22e05a;
  --party-pink: #ff3fa4;
  --party-violet: #a97bff;
  --text-strong: #ffffff;
  --text-soft: #d9d4f2;
  --text-faint: #a9a3cc;
  --card: rgba(255, 255, 255, 0.075);
  --card-border: rgba(255, 255, 255, 0.14);
  --party-gradient: linear-gradient(100deg, var(--party-orange), var(--party-pink) 62%, var(--party-violet));
  --page-gutter: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  background: linear-gradient(160deg, var(--party-night), var(--party-deep) 70%);
  background-attachment: fixed;
  color: var(--text-strong);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

h1, h2, p { margin: 0; overflow-wrap: anywhere; }
a { color: inherit; }

/* The moving lights behind the page. */
.party-sky { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.party-blob { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; filter: blur(70px); opacity: 0.34; will-change: transform; }
.party-blob-a { top: -35vmax; left: -25vmax; background: var(--party-pink); animation: drift-a 19s ease-in-out infinite alternate; }
.party-blob-b { top: 5vmax; right: -35vmax; background: var(--party-blue); animation: drift-b 23s ease-in-out infinite alternate; }
.party-blob-c { bottom: -45vmax; left: -5vmax; background: var(--party-orange); opacity: 0.22; animation: drift-c 27s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate(18vmax, 14vmax) scale(1.12); } }
@keyframes drift-b { to { transform: translate(-20vmax, 12vmax) scale(0.9); } }
@keyframes drift-c { to { transform: translate(14vmax, -14vmax) scale(1.1); } }

/* Loading and message screens. */
.status-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px var(--page-gutter);
  text-align: center;
}
.status-screen h1 { font-size: clamp(1.6rem, 6vw, 2.6rem); font-weight: 800; }
.status-screen p { max-width: 34em; color: var(--text-soft); font-size: 1.05rem; }
.status-screen .status-event { color: var(--party-orange); font-size: 1.15rem; font-weight: 800; }
.status-logo { width: 112px; height: 112px; border-radius: 26px; box-shadow: 0 10px 44px rgba(255, 63, 164, 0.4); }
.loading-ring, .button-ring {
  display: inline-block;
  border-radius: 50%;
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.25);
  border-top-color: var(--party-orange);
  animation: ring-turn 0.9s linear infinite;
}
.loading-ring { width: 44px; height: 44px; border-width: 4px; }
.button-ring { width: 16px; height: 16px; border-width: 2px; border-top-color: #fff; }
@keyframes ring-turn { to { transform: rotate(360deg); } }

/* The participant page. */
.event-layout {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 0 var(--page-gutter) calc(var(--dock-height, 0px) + 12px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* The header stays visible, because the current song is kept in the middle of the page. */
.event-header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-inline: calc(-1 * var(--page-gutter));
  padding: 10px var(--page-gutter);
  background: rgba(16, 8, 42, 0.93);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.event-logo { width: 44px; height: 44px; flex: none; border-radius: 11px; }
.event-heading { min-width: 0; flex: 1; }
.flyer-thumb {
  flex: none;
  width: 44px;
  height: 56px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  background: #120a2e;
  cursor: pointer;
}
.flyer-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.flyer-thumb:hover { border-color: #fff; }
.flyer-thumb:active { opacity: 0.75; }
.flyer-thumb:focus-visible, .flyer-large:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.flyer-large {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 12px auto 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 14px;
  background: transparent;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.flyer-large img { display: block; max-width: 100%; max-height: 62vh; max-height: 62dvh; }
.flyer-large:hover { filter: brightness(1.06); }
.flyer-large:active { filter: brightness(0.9); }
.flyer-dialog { max-width: 100vw; max-height: 100vh; max-height: 100dvh; padding: 0; border: 0; background: transparent; }
.flyer-dialog::backdrop { background: rgba(5, 2, 15, 0.9); }
.flyer-dialog-button { display: block; padding: 0; border: 0; background: transparent; cursor: pointer; }
.flyer-dialog-button img { display: block; max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; }
.event-heading h1 { font-size: clamp(1.15rem, 4.8vw, 1.6rem); font-weight: 800; line-height: 1.15; }
.event-date { margin-top: 2px; color: var(--text-soft); font-size: 0.85rem; }

.offline-notice {
  padding: 10px 14px;
  border: 1px solid rgba(255, 165, 31, 0.55);
  border-radius: 14px;
  background: rgba(255, 165, 31, 0.14);
  color: #ffe2b3;
  font-size: 0.95rem;
}

.hand-title { font-family: "Caveat", "Segoe Print", cursive; font-size: 1.75rem; font-weight: 600; line-height: 1.1; color: var(--party-orange); }

.now-card {
  position: relative;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 63, 164, 0.3), rgba(46, 168, 255, 0.24));
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 14px 50px rgba(255, 63, 164, 0.24);
}
.now-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.now-top .hand-title { color: #fff; }
.now-title { margin-top: 8px; font-size: clamp(1.5rem, 7vw, 2.4rem); font-weight: 800; line-height: 1.12; }
.now-artist { margin-top: 4px; font-size: clamp(1.05rem, 4.2vw, 1.3rem); color: var(--text-soft); }
.now-remaining { margin-top: 10px; font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff; }

.equalizer { display: flex; align-items: flex-end; gap: 4px; height: 26px; flex: none; }
.equalizer i { display: block; width: 5px; height: 5px; border-radius: 3px; background: var(--party-green); }
.equalizer.is-playing i { height: 100%; transform-origin: bottom; animation: equalizer-beat 0.86s ease-in-out infinite; }
.equalizer.is-playing i:nth-child(2) { animation-delay: -0.5s; background: var(--party-orange); }
.equalizer.is-playing i:nth-child(3) { animation-delay: -0.2s; background: var(--party-pink); }
.equalizer.is-playing i:nth-child(4) { animation-delay: -0.68s; background: var(--party-blue); }
.equalizer.is-playing i:nth-child(5) { animation-delay: -0.35s; background: var(--party-violet); }
@keyframes equalizer-beat { 0%, 100% { transform: scaleY(0.22); } 50% { transform: scaleY(1); } }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--tag-background, #3a3f55);
  color: var(--tag-foreground, #f9fbff);
  font-size: 0.8rem;
  line-height: 1.2;
}

.list-section { display: flex; flex-direction: column; gap: 8px; }
.list-empty { color: var(--text-faint); }
.song-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.song-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
}
.song-body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.song-body strong { font-weight: 800; overflow-wrap: anywhere; }
.song-artist { color: var(--text-soft); font-size: 0.93rem; overflow-wrap: anywhere; }
.song-body .tag-row { margin-top: 6px; }
.song-time { flex: none; color: var(--text-soft); font-size: 0.95rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.song-list-played .song-body strong { font-weight: 500; color: var(--text-soft); }

.event-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: center;
  padding-top: 8px;
  color: var(--text-faint);
  font-size: 0.85rem;
}
.event-footer a:hover { color: var(--text-strong); }

/* Buttons. */
.party-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--party-gradient);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.party-button svg { width: 22px; height: 22px; flex: none; fill: currentColor; }
.party-button:hover { filter: brightness(1.12); }
.party-button:active { transform: scale(0.97); filter: brightness(0.92); }
.party-button:focus-visible, .plain-button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.party-button:disabled { background: #57506f; color: #d7d3e8; cursor: default; filter: none; transform: none; }
.party-button-large { width: 100%; min-height: 58px; font-size: 1.15rem; border-radius: 18px; box-shadow: 0 10px 34px rgba(255, 63, 164, 0.5); }

.plain-button {
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: transparent;
  color: var(--text-strong);
  font: inherit;
  cursor: pointer;
}
.plain-button:hover { background: rgba(255, 255, 255, 0.1); }
.plain-button:active { background: rgba(255, 255, 255, 0.18); }

.wish-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 10px var(--page-gutter) calc(10px + env(safe-area-inset-bottom));
  background: rgba(16, 8, 42, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.wish-dock > * { max-width: 648px; margin-inline: auto; }
.wish-dock .party-button-large { display: flex; min-height: 50px; font-size: 1.05rem; }
.wish-dock .my-wishes { margin-top: 8px; max-height: 34vh; max-height: 34dvh; overflow-y: auto; }

/* The wish form. */
.wish-dialog {
  width: min(460px, calc(100vw - 2 * var(--page-gutter)));
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 22px;
  background: #1d1142;
  color: var(--text-strong);
}
.wish-dialog::backdrop { background: rgba(5, 2, 15, 0.72); }
.wish-tag-groups { display: flex; flex-direction: column; gap: 8px; max-height: 26vh; max-height: 26dvh; overflow-y: auto; font-weight: 500; }
.wish-tag-group { display: flex; flex-direction: column; gap: 4px; }
.wish-tag-group .tag-row { margin-top: 0; }
.wish-tag-heading { font-size: 0.8rem; color: var(--text-faint); }
.tag-option { min-height: 30px; border: 1px solid var(--tag-background, #3a3f55); background: transparent; color: var(--text-strong); font: inherit; font-size: 0.85rem; cursor: pointer; }
.tag-option:hover { background: rgba(255, 255, 255, 0.12); }
.tag-option:active { background: rgba(255, 255, 255, 0.2); }
.tag-option:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.tag-option[aria-pressed="true"] { background: var(--tag-background, #3a3f55); color: var(--tag-foreground, #f9fbff); font-weight: 800; }
.wish-dialog form { display: flex; flex-direction: column; gap: 12px; }
.wish-dialog-title { font-family: "Caveat", "Segoe Print", cursive; font-size: 2rem; font-weight: 600; line-height: 1.1; color: var(--party-orange); }
.form-field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; }
.form-field input, .chat-form textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  background: #120a2e;
  color: var(--text-strong);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
}
.form-field input::placeholder, .chat-form textarea::placeholder { color: var(--text-faint); }
.form-field input:focus, .chat-form textarea:focus { outline: 2px solid var(--party-orange); outline-offset: 0; border-color: transparent; }
.form-field input::selection, .chat-form textarea::selection { background: var(--party-orange); color: #17102f; }
.form-error { color: #ffc4c4; font-size: 0.95rem; }
.form-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }

/* The wishes of this participant with the chat. */
.my-wishes { display: flex; flex-direction: column; gap: 8px; }
.wish-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: none;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(34, 224, 90, 0.1);
  border: 1px solid rgba(34, 224, 90, 0.4);
}
.wish-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.wish-card-heading strong { min-width: 0; font-weight: 800; overflow-wrap: anywhere; }
.wish-received { flex: none; padding: 2px 10px; border-radius: 999px; background: var(--party-green); color: #06240f; font-size: 0.8rem; font-weight: 800; }
.chat-thread { display: flex; flex-direction: column; gap: 6px; }
.chat-bubble { display: flex; flex-direction: column; max-width: 88%; padding: 8px 12px; border-radius: 14px; overflow-wrap: anywhere; }
.chat-bubble-dj { align-self: flex-start; background: rgba(46, 168, 255, 0.28); border-end-start-radius: 4px; }
.chat-bubble-me { align-self: flex-end; background: rgba(255, 255, 255, 0.14); border-end-end-radius: 4px; }
.chat-author { font-size: 0.75rem; font-weight: 800; color: var(--text-soft); }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.chat-form textarea { resize: vertical; }

.party-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-height, 80px) + 10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  width: max-content;
  max-width: calc(100vw - 2 * var(--page-gutter));
  padding: 10px 16px;
  border-radius: 14px;
  background: #fff;
  color: #1b1038;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.confetti-canvas { display: none; position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
.confetti-canvas.is-active { display: block; }

/* The QR page for the second screen. */
.qr-page { overflow: hidden; }
.qr-layout {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 5vmin, 72px);
  padding: clamp(16px, 4vmin, 56px);
}
.qr-card {
  width: min(84vh, 56vw);
  width: min(84dvh, 56vw);
  padding: clamp(6px, 1.2vmin, 18px);
  border-radius: clamp(18px, 3.4vmin, 44px);
  background: #fff;
  box-shadow: 0 0 0 clamp(4px, 0.9vmin, 12px) rgba(255, 255, 255, 0.16), 0 18px 90px rgba(255, 63, 164, 0.55), 0 0 120px rgba(46, 168, 255, 0.35);
}
.qr-image { display: block; width: 100%; height: auto; }
.qr-copy { min-width: 0; display: flex; flex-direction: column; gap: clamp(6px, 1.6vmin, 20px); }
.qr-event-name { font-size: clamp(1.1rem, 3.2vmin, 2.8rem); font-weight: 800; color: var(--text-soft); }
.qr-headline {
  font-family: "Caveat", "Segoe Print", cursive;
  font-size: clamp(3rem, 15vmin, 11rem);
  font-weight: 600;
  line-height: 0.95;
  /* The gradient ends at the box, and the last letter of this font reaches beyond its own width. */
  padding: 0 0.2em 0.08em;
  background: var(--party-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.qr-text { font-size: clamp(1.1rem, 4vmin, 3.2rem); font-weight: 800; line-height: 1.2; }
.qr-address { font-size: clamp(0.95rem, 2.4vmin, 2rem); color: var(--text-soft); overflow-wrap: anywhere; }

.floating-notes { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.floating-notes svg { position: absolute; bottom: -14vmin; width: 10vmin; height: 10vmin; fill: rgba(255, 255, 255, 0.13); animation: note-rise 15s linear infinite; }
.floating-notes svg:nth-child(1) { inset-inline-end: 6%; }
.floating-notes svg:nth-child(2) { inset-inline-end: 22%; animation-delay: -6s; animation-duration: 19s; fill: rgba(255, 165, 31, 0.2); }
.floating-notes svg:nth-child(3) { inset-inline-end: 34%; animation-delay: -11s; animation-duration: 17s; fill: rgba(46, 168, 255, 0.22); }
.floating-notes svg:nth-child(4) { inset-inline-end: 12%; animation-delay: -3s; animation-duration: 21s; fill: rgba(255, 63, 164, 0.22); }
@keyframes note-rise { to { transform: translateY(-125vh) rotate(24deg); } }

@media (max-aspect-ratio: 1/1) {
  .qr-page { overflow: auto; }
  .qr-layout { grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: center; text-align: center; }
  .qr-card { width: min(92vw, 62vh); width: min(92vw, 62dvh); }
  .qr-copy { align-items: center; }
  .qr-headline { font-size: clamp(3rem, 16vmin, 9rem); }
}

@media (prefers-reduced-motion: reduce) {
  .party-blob, .floating-notes svg, .equalizer.is-playing i { animation: none; }
  .equalizer.is-playing i { transform: scaleY(0.6); }
  .party-button { transition: none; }
}
