@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Unbounded:wght@500;700&display=swap");

:root {
  --bg: #f8f6f2;
  --ink: #1f1e1c;
  --muted: #6b645d;
  --accent: #ff5b3d;
  --accent-2: #2f9fff;
  --overlay-strength: 0.55;
  --card-opacity: 1;
  --sticker-opacity: 0.24;
  --card: #ffffff;
  --stroke: #e8e2db;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.2);
  --radius: 24px;
  --radius-lg: 28px;
  --topbar-height: 72px;
  --topbar-padding: 12px;
  --topbar-gap: 16px;
  --topbar-total: calc(var(--topbar-height) + (var(--topbar-padding) * 2) + var(--topbar-gap));
}

* {
  box-sizing: border-box;
}

::selection {
  background: #1f1e1c;
  color: #ffffff;
}

::-moz-selection {
  background: #1f1e1c;
  color: #ffffff;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: #f8f9ff;
  background: url("home-bg.png"), 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(47, 159, 255, 0.15), transparent),
    radial-gradient(ellipse 60% 50% at 50% 120%, rgba(255, 91, 61, 0.12), transparent),
    linear-gradient(180deg, #0a1220 0%, #0f1a2e 50%, #1a2438 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

/* Overlay removed for better visibility */

body.modal-open {
  overflow: hidden;
}

.app {
  max-width: 100%;
  margin: 0;
  padding: 0 0 0;
  position: relative;
  z-index: 1;
}

.topbar {
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  backdrop-filter: none;
  z-index: 200;
  border-bottom: 1px solid transparent;
  color: #ffffff;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, backdrop-filter 0.3s ease;
  padding: 16px 20px;
  box-sizing: border-box;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0 auto;
  width: 100%;
  max-width: 100%;
  background: transparent;
}

.brand {
  flex-shrink: 0;
}

.mode-toggle {
  flex-shrink: 0;
}

/* Default state - transparent header with white text */
.topbar .brand {
  color: #ffffff;
}

.topbar .mode-toggle {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
}

.topbar .tab {
  color: rgba(255, 255, 255, 0.8);
}

.topbar .tab.active {
  background: #ffffff;
  color: #1f1e1c;
}

/* Scrolled state - white background */
.topbar.scrolled {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(31, 30, 28, 0.08);
}

.topbar.scrolled .brand {
  color: var(--ink);
}

.topbar.scrolled .mode-toggle {
  background: #ffffff;
  border-color: var(--stroke);
  backdrop-filter: none;
}

.topbar.scrolled .tab {
  color: var(--muted);
}

.topbar.scrolled .tab.active {
  background: #1f1e1c;
  color: #ffffff;
}


.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Unbounded", sans-serif;
  font-size: 18px;
  white-space: nowrap;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.brand:hover {
  opacity: 0.8;
}

.brand .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 91, 61, 0.2);
  flex-shrink: 0;
}

.footer-brand .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(255, 91, 61, 0.25), 0 2px 8px rgba(255, 91, 61, 0.4);
  flex-shrink: 0;
}

.mode-toggle {
  display: inline-flex;
  background: #ffffff;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 6px;
  gap: 6px;
  width: auto;
  justify-content: center;
}

.tab {
  border: none;
  background: transparent;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
  flex: 0 0 auto;
  text-align: center;
  transition: all 0.2s ease;
  position: relative;
}

.tab.active {
  background: #1f1e1c;
  color: #ffffff;
}

.tab.locked {
  opacity: 0.5;
  cursor: not-allowed;
  position: relative;
}

.tab.locked::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="%236b645d" fill-rule="evenodd" d="M5.25 10.055V8a6.75 6.75 0 0 1 13.5 0v2.055c1.115.083 1.84.293 2.371.824C22 11.757 22 13.172 22 16s0 4.243-.879 5.121C20.243 22 18.828 22 16 22H8c-2.828 0-4.243 0-5.121-.879C2 20.243 2 18.828 2 16s0-4.243.879-5.121c.53-.531 1.256-.741 2.371-.824M6.75 8a5.25 5.25 0 0 1 10.5 0v2.004Q16.676 9.999 16 10H8q-.677-.001-1.25.004z" clip-rule="evenodd"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: text-bottom;
  position: relative;
  top: 1px;
}

.tab.locked:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Unlock animation (when tab becomes unlocked) */
.tab.unlocking::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="%2310b981" d="M6.75 8a5.25 5.25 0 0 1 10.335-1.313a.75.75 0 0 0 1.452-.374A6.75 6.75 0 0 0 5.25 8v2.055c-1.115.083-1.84.293-2.371.824C2 11.757 2 13.172 2 16s0 4.243.879 5.121C3.757 22 5.172 22 8 22h8c2.828 0 4.243 0 5.121-.879C22 20.243 22 18.828 22 16s0-4.243-.879-5.121C20.243 10 18.828 10 16 10H8q-.677-.001-1.25.004z"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: text-bottom;
  position: relative;
  top: 1px;
  animation: unlockPulse 0.6s ease;
}

@keyframes unlockPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Mobile No button behavior animations */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
  20%, 40%, 60%, 80% { transform: translateX(8px); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-20px) scaleY(1.1); }
  50% { transform: translateY(0) scaleY(0.9); }
  75% { transform: translateY(-10px); }
}

/* Mobile behavior button states */
.player-card button.warning {
  background: #fbbf24 !important;
  color: #1f1e1c !important;
  border-color: #f59e0b !important;
}

.player-card button.sad {
  background: #f87171 !important;
  color: white !important;
  border-color: #ef4444 !important;
}

.player-card button.holding {
  background: #a3a3a3 !important;
  color: white !important;
}

.player-card button.sliding {
  background: #60a5fa !important;
  color: white !important;
  border-color: #3b82f6 !important;
}

.player-card button.melting {
  background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%) !important;
  color: white !important;
}

.player-card button.ghosting {
  background: rgba(200, 200, 200, 0.3) !important;
  color: #999 !important;
  border-color: rgba(200, 200, 200, 0.5) !important;
}

main {
  display: block;
  padding: 140px 20px 40px;
}

.site-footer {
  position: relative;
  margin: 48px 0 0;
  width: 100%;
  background: linear-gradient(120deg, #0f2b56 0%, #1b2b64 38%, #6b2a5f 72%, #1f3f73 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 44px 20px 36px;
  box-shadow: none;
  box-sizing: border-box;
  overflow: hidden;
}

.site-footer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 18% 15%, rgba(255, 255, 255, 0.08), transparent 50%),
    radial-gradient(circle at 82% 75%, rgba(255, 255, 255, 0.12), transparent 45%);
  opacity: 0.5;
  pointer-events: none;
}

.site-footer > * {
  position: relative;
  z-index: 1;
}

.footer-inner {
  display: grid;
  gap: 28px;
  text-align: left;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0;
}

.footer-main {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(240px, 1fr) minmax(240px, 1fr);
  align-items: center;
}

.footer-brand-block {
  display: grid;
  gap: 12px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  font-family: "Unbounded", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.footer-brand-block p {
  margin: 0;
  max-width: 260px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  line-height: 1.5;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}

.site-footer p {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.footer-social {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.footer-credit {
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.footer-credit a {
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 91, 61, 0.55);
  padding-bottom: 1px;
  transition: all 0.25s ease;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.footer-credit a:hover {
  color: #ffffff;
  border-bottom-color: var(--accent);
  text-shadow: 0 2px 8px rgba(255, 91, 61, 0.4);
}

.footer-note {
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.panel-head {
  margin-bottom: 32px;
}

.panel-head h1 {
  margin: 0 0 12px;
  font-size: 42px;
  font-family: "Unbounded", sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.panel-head p {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 17px;
  line-height: 1.6;
  max-width: 600px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}

#creator {
  position: relative;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

/* Creator layout (mobile-first): one section at a time, with bottom navigation. */
.creator-layout {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

.creator-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  perspective: 1200px;
}

.creator-panel .card {
  flex: 1;
}

/* Two columns on medium screens */
@media (min-width: 768px) and (max-width: 1199px) {
  .creator-layout {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    align-items: stretch;
  }
}

/* Two columns side by side on larger screens */
@media (min-width: 1200px) {
  .creator-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    align-items: stretch;
  }
  
  .creator-panel {
    display: flex;
    flex-direction: column;
  }
}

.details {
  border-top: 2px solid rgba(0, 0, 0, 0.06);
  padding-top: 16px;
  margin-top: 16px;
}

.details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  transition: color 0.2s ease;
}

.details summary:hover {
  color: #1f1e1c;
}

.details summary::-webkit-details-marker {
  display: none;
}

.details summary:after {
  content: "›";
  font-size: 24px;
  font-weight: 400;
  color: #999;
  transform: rotate(90deg);
  transition: transform 0.2s ease, color 0.2s ease;
  display: inline-block;
}

.details[open] summary:after {
  transform: rotate(-90deg);
  color: #1f1e1c;
}

.section {
  border-top: 1px solid var(--stroke);
  padding-top: 14px;
  display: grid;
  gap: 10px;
}

.section h3 {
  margin: 0;
  font-size: 15px;
}

.profile-box {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.profile-box strong {
  color: var(--ink);
  font-size: 15px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #1f1e1c;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}

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

.list {
  display: grid;
  gap: 6px;
}

.list-item {
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.list-item button {
  border: none;
  background: #1f1e1c;
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.analytics {
  display: grid;
  gap: 10px;
}

.analytics .analytics-hero {
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 10px 30px rgba(32, 24, 10, 0.06);
  display: grid;
  gap: 8px;
}

.analytics .analytics-hero .mood {
  font-family: "Unbounded", sans-serif;
  font-size: 16px;
}

.analytics .analytics-hero .sub {
  color: var(--muted);
  font-size: 12px;
}

.analytics .analytics-hero .meter {
  height: 10px;
  border-radius: 999px;
  background: rgba(31, 30, 28, 0.08);
  overflow: hidden;
}

.analytics .analytics-hero .meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.analytics .tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.analytics .tile {
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 12px 14px;
  background: #fff;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.analytics .tile span {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

.analytics .tile strong {
  font-size: 20px;
}

.analytics .micro {
  border: 1px dashed var(--stroke);
  border-radius: 18px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
  display: grid;
  gap: 6px;
}

.analytics .micro strong {
  color: var(--ink);
}

.analytics .bars {
  display: grid;
  gap: 8px;
}

.analytics .bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.analytics .bar-label {
  color: var(--muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics .bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(31, 30, 28, 0.08);
  overflow: hidden;
}

.analytics .bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.analytics .bar-val {
  font-weight: 700;
  color: var(--ink);
}

.full {
  width: 100%;
}

.creator-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  background: rgba(248, 246, 242, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--stroke);
  z-index: 15;
}

.creator-nav-btn {
  border: 1px solid var(--stroke);
  background: #fff;
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
  text-align: center;
}

.creator-nav-btn.active {
  background: #1f1e1c;
  border-color: #1f1e1c;
  color: #fff;
}

/* Player lock removed - always unlocked */

.card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 
    0 4px 24px rgba(0, 0, 0, 0.08),
    0 16px 48px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  color: var(--ink);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Creator instruction */
.creator-instruction {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 16px;
  text-align: center;
}

#creatorMainCard {
  will-change: transform, opacity;
  transition: opacity 0.22s ease, transform 0.26s ease;
}

#creatorMainCard.flip-out {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

#creatorMainCard.flip-out:hover {
  transform: translateY(8px);
}

#creator[data-section="setup"] .creator-section[data-section="surprise"] {
  display: none;
}

#creator[data-section="surprise"] .creator-section[data-section="setup"] {
  display: none;
}

/* Show both behavior fields in all sections */

.section-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 28px;
  padding: 14px 20px;
  border-radius: 999px;
  background: rgba(247, 243, 240, 0.9);
  border: 1px solid rgba(20, 10, 0, 0.08);
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #b0a79f;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

.progress-step:hover {
  color: var(--ink);
  transform: scale(1.02);
}

.progress-step:hover .progress-dot {
  transform: scale(1.1);
}

.progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #d9d0c7;
  box-shadow: 0 0 0 4px rgba(217, 208, 199, 0.35);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.progress-line {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(217, 208, 199, 0.5), rgba(217, 208, 199, 0.2));
  position: relative;
  overflow: hidden;
}

.progress-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 153, 0, 0.8), rgba(255, 110, 64, 0.9));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.85s ease;
}

#creator.progressing.progress-to-surprise .progress-line::after {
  transform: scaleX(1);
  transform-origin: left;
}

#creator.progressing.progress-to-setup .progress-line::after {
  transform: scaleX(1);
  transform-origin: right;
}

/* Keep progress bar filled when in surprise section */
#creator[data-section="surprise"] .progress-line::after {
  transform: scaleX(1);
  transform-origin: left;
}

#creator[data-section="setup"] .progress-step[data-step="setup"],
#creator[data-section="surprise"] .progress-step[data-step="surprise"] {
  color: #2f251b;
}

#creator[data-section="setup"] .progress-step[data-step="setup"] .progress-dot,
#creator[data-section="surprise"] .progress-step[data-step="surprise"] .progress-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.18);
}

#creator[data-section="setup"] .progress-step[data-step="surprise"] .progress-dot,
#creator[data-section="surprise"] .progress-step[data-step="setup"] .progress-dot {
  background: #d9d0c7;
  box-shadow: 0 0 0 3px rgba(217, 208, 199, 0.3);
}

.creator-section .reveal-item {
  opacity: 0;
  transform: translateY(10px);
}

.creator-section.reveal-active .reveal-item {
  animation: revealItem 0.38s ease forwards;
  animation-delay: var(--reveal-delay, 0s);
}

@keyframes revealItem {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.card h2 {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0a0a0a;
}

.card-description {
  margin: -8px 0 24px;
  color: #888;
  font-size: 13px;
  line-height: 1.5;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

label {
  font-weight: 600;
  font-size: 13px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field-hint {
  font-size: 12px;
  color: #999;
  margin: -4px 0 12px 0;
  line-height: 1.5;
}

input,
textarea,
select {
  border-radius: 16px;
  border: 2px solid #e8e8e8;
  padding: 14px 16px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  color: var(--ink);
  background: #ffffff;
  transition: all 0.2s ease;
}

select {
  appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="%23666" d="M4 6l4 4 4-4z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
  cursor: pointer;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #1f1e1c;
  outline: none;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: #e8e8e8;
  border-radius: 999px;
  height: 6px;
  outline: none;
  padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1f1e1c;
  cursor: pointer;
  transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1f1e1c;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.2);
}

input[type="range"].playing {
  background: linear-gradient(to right, #1f1e1c 0%, #1f1e1c var(--progress, 0%), #e8e8e8 var(--progress, 0%), #e8e8e8 100%);
  pointer-events: none;
}

input[type="range"].playing::-webkit-slider-thumb {
  background: #1f1e1c;
  box-shadow: 0 0 8px rgba(31, 30, 28, 0.3);
}

input[type="range"].playing::-moz-range-thumb {
  background: #1f1e1c;
  box-shadow: 0 0 8px rgba(31, 30, 28, 0.3);
}

/* Music preset buttons */
.music-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.music-preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #f8f8f8;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 70px;
}

.music-preset:hover {
  background: #f0f0f0;
  border-color: #e0e0e0;
}

.music-preset.active {
  background: #fff0f5;
  border-color: #ff6b9d;
}

.preset-icon {
  font-size: 24px;
  line-height: 1;
}

.preset-name {
  font-size: 11px;
  font-weight: 500;
  color: #666;
  white-space: nowrap;
}

.music-preset.active .preset-name {
  color: #1f1e1c;
}

.custom-music-url {
  margin-top: 12px;
}

.custom-music-url input {
  width: 100%;
}

.music-controls-box {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  background: #f8f8f8;
  border-radius: 10px;
  margin-top: 12px;
  border: 1px solid #e8e8e8;
  flex-wrap: nowrap;
}

.music-slider {
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 1;
  margin-top: 0;
  min-width: 200px;
}

.slider-label {
  font-size: 12px;
  color: #888;
  text-transform: none;
  min-width: 70px;
  font-weight: 500;
  white-space: nowrap;
}

.slider-value {
  font-size: 13px;
  color: #555;
  min-width: 50px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Music Preview Button */
.music-preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  min-width: fit-content;
}

.music-preview-btn svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.music-preview-btn:hover svg {
  transform: scale(1.1);
}

.music-preview-btn.playing .play-icon {
  display: none;
}

.music-preview-btn.playing .pause-icon {
  display: block !important;
}

@media (max-width: 640px) {
  .card {
    padding: 24px;
  }
  
  .field {
    margin-bottom: 20px;
  }
  
  .backgrounds,
  .success-stickers {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
  }
  
  .emoji-chips {
    gap: 8px;
  }
  
  .music-presets {
    gap: 6px;
  }
  
  .music-preset {
    padding: 10px 12px;
    min-width: 60px;
  }
  
  .preset-icon {
    font-size: 20px;
  }
  
  .preset-name {
    font-size: 10px;
  }
  
  .music-controls-box {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    flex-wrap: wrap;
  }
  
  .music-slider {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
  }
  
  .site-footer {
    padding: 36px 16px 28px;
  }
  
  .footer-brand {
    font-size: 18px;
  }

  .footer-main {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .footer-brand-block p {
    font-size: 13px;
    max-width: 100%;
  }

  .footer-social {
    justify-items: start;
  }
  
  .slider-label {
    min-width: auto;
  }
  
  .music-preview-btn {
    width: 100%;
    justify-content: center;
  }
}

.success-stickers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 16px;
}

.success-stickers .bg-item {
  min-height: 80px;
}

.success-stickers .bg-item.active {
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

.add-sticker-btn {
  border: 2px dashed #e8e8e8 !important;
  background: transparent !important;
  background-image: none !important;
}

.add-sticker-btn:hover {
  border-color: #1f1e1c !important;
  background: rgba(0, 0, 0, 0.02) !important;
}

/* Hidden music players */
.success-player {
  position: fixed;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.success-player iframe {
  border: none;
  width: 1px;
  height: 1px;
}

.template-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.emoji-row {
  display: grid;
  gap: 8px;
}

.emoji-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.behavior-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#noBehaviorMobileField {
  margin-top: 8px;
}

.behavior-chip {
  border: 2px solid #e8e8e8;
  background: #fff;
  border-radius: 14px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  color: #555;
  text-transform: capitalize;
}

.behavior-chip:hover {
  border-color: #1f1e1c;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.behavior-chip.active {
  border-color: #1f1e1c;
  background: #1f1e1c;
  color: #fff;
}

.emoji-chip {
  border: 2px solid #e8e8e8;
  background: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s ease;
}

.emoji-chip:hover {
  border-color: #1f1e1c;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#fallStickersChips .emoji-chip:not(.add) {
  position: relative;
  cursor: pointer;
}

#fallStickersChips .emoji-chip:not(.add):hover {
  opacity: 0.6;
  transform: scale(0.95);
}

#fallStickersChips .emoji-chip:not(.add):hover::after {
  content: "✕";
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff5b3d;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  line-height: 22px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.emoji-chip.active {
  border-color: #1f1e1c;
  background: rgba(31, 30, 28, 0.08);
  box-shadow: none;
  transform: scale(1.05);
}

.emoji-chip.add {
  border: 2px dashed #b8b8b8;
  font-weight: 700;
  min-width: 44px;
  text-align: center;
  color: #666;
  font-size: 20px;
  transition: all 0.2s ease;
}

.emoji-chip.add:hover {
  border-color: var(--accent);
  background: rgba(255, 91, 61, 0.05);
  color: var(--accent);
  transform: scale(1.05);
}

.toggle {
  display: inline-flex;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 6px;
}

.toggle-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}

.toggle-btn.active {
  background: #1f1e1c;
  color: #fff;
}

.template-row.scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 6px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.template-row.scroll::-webkit-scrollbar {
  display: none;
}

.pill {
  border: 2px solid #e8e8e8;
  border-radius: 999px;
  padding: 10px 18px;
  background: #ffffff;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.pill:hover {
  border-color: #1f1e1c;
  background: #f8f8f8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

button.primary {
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, #ff7a5f 100%);
  color: #fff;
  padding: 14px 28px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(255, 91, 61, 0.3);
}

button.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 91, 61, 0.4);
}

button.primary:active {
  transform: translateY(0);
}

button.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button.share-btn svg {
  flex-shrink: 0;
}

/* Desktop: show "Copy Link" and copy icon */
button.share-btn .desktop-text,
button.share-btn .desktop-icon {
  display: inline;
}

button.share-btn .mobile-text,
button.share-btn .mobile-icon {
  display: none;
}

/* Mobile: show "Share the Game" and share icon */
@media (max-width: 768px) {
  button.share-btn .desktop-text,
  button.share-btn .desktop-icon {
    display: none;
  }
  
  button.share-btn .mobile-text,
  button.share-btn .mobile-icon {
    display: inline;
  }
}

button.ghost {
  border: 2px solid #e0e0e0;
  border-radius: 999px;
  background: #fff;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  touch-action: manipulation;
  color: var(--ink);
  transition: all 0.2s ease;
}

button.ghost:hover {
  border-color: #1f1e1c;
  background: #f8f8f8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

button.ghost.copied {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
  transform: scale(1.02);
}

.copy-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.copy-check svg {
  width: 18px;
  height: 18px;
}

button.ghost.copied:hover {
  background: #059669;
  border-color: #059669;
  transform: scale(1.02);
}

button.secondary {
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  touch-action: manipulation;
  color: var(--ink);
  transition: all 0.2s ease;
}

button.secondary:hover {
  background: rgba(31, 30, 28, 0.05);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

button.secondary:active {
  transform: translateY(0);
}

button.small {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
}

/* Paywall removed - always unlocked */

.hidden {
  display: none !important;
}

.preview {
  min-height: 380px;
  border-radius: 20px;
  border: 2px solid rgba(0, 0, 0, 0.06);
  background: linear-gradient(135deg, #f8f8f8 0%, #ffffff 100%);
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 100%;
  box-shadow: 
    inset 0 2px 8px rgba(0, 0, 0, 0.04),
    0 2px 12px rgba(0, 0, 0, 0.04);
  margin-bottom: 20px;
}

.preview-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.preview-device-toggle {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.04);
  padding: 3px;
  border-radius: 8px;
}

.device-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: #999;
  transition: all 0.2s ease;
}

.device-btn:hover {
  color: #666;
  background: rgba(0, 0, 0, 0.05);
}

.device-btn.active {
  background: #ffffff;
  color: #1f1e1c;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.device-btn svg {
  width: 16px;
  height: 16px;
}

/* Mobile preview mode styling */
.player-shell.mobile-preview {
  max-width: 320px;
  margin: 0 auto;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 24px;
  overflow: hidden;
}

.player-shell.mobile-preview .player-card {
  padding: 24px;
  border-radius: 20px;
}

.preview-mode-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #7a6f66;
  box-shadow: none;
}

.preview-mode-indicator.is-surprise {
  color: #0f9d6a;
  border-color: rgba(16, 185, 129, 0.18);
  background: rgba(16, 185, 129, 0.08);
}

.preview-mode-indicator.is-setup {
  color: #7a6f66;
  border-color: rgba(122, 111, 102, 0.14);
  background: rgba(0, 0, 0, 0.04);
}

.preview .player-card,
.player-shell .player-card {
  width: min(400px, 100%);
  min-height: 260px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 32px;
  padding: 36px;
  text-align: center;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 20px 60px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  display: grid;
  gap: 12px;
  color: var(--ink);
}

.preview .player-shell {
  width: 100%;
  min-height: 100%;
  border: none;
  box-shadow: none;
  border-radius: 16px;
}

.preview .player-shell .content {
  min-height: 100%;
}

.player-shell {
  min-height: 70vh;
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

#player .player-shell {
  min-height: 75vh;
}

#player {
  position: relative;
}

.player-shell .layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.4s ease;
}

/* Ensure GIF displays properly in success state */
.player-shell.success-active .layer {
  background-size: cover;
  background-position: center center;
  image-rendering: auto;
}

.player-shell .sticker-layer {
  position: absolute;
  inset: 0;
  background-size: 140px 140px;
  background-repeat: repeat;
  opacity: var(--sticker-opacity);
  pointer-events: none;
}

.player-shell .overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(255, 255, 255, var(--overlay-strength)), rgba(255, 255, 255, 0.18));
  backdrop-filter: blur(8px);
  transition: opacity 0.4s ease, backdrop-filter 0.4s ease, background 0.4s ease;
}

/* When showing success state, make overlay very subtle to show GIF clearly */
.player-shell.success-active .overlay {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.25) 100%);
  backdrop-filter: none;
  opacity: 1;
}

/* Success state: card becomes a compact floating sheet */
.player-shell.success-active .player-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 
    0 -4px 32px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  min-height: auto;
  padding: 28px 32px;
  border-radius: 24px;
  width: min(360px, 90%);
}

.player-shell.success-active .player-card .card-title {
  font-size: 22px;
  margin-bottom: 8px;
}

/* Mobile-specific: card floats at bottom like a sheet */
@media (max-width: 768px) {
  .player-shell.success-active .overlay {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.3) 100%);
  }
  
  .player-shell.success-active .content {
    place-items: end center;
    padding: 16px;
    padding-bottom: 24px;
  }
  
  .player-shell.success-active .player-card {
    background: rgba(255, 255, 255, 0.97);
    padding: 20px 24px;
    width: min(320px, 85%);
    border-radius: 20px;
    box-shadow: 
      0 -8px 40px rgba(0, 0, 0, 0.15),
      0 0 0 1px rgba(255, 255, 255, 0.7) inset;
  }
  
  .player-shell.success-active .player-card .sticker {
    font-size: 36px;
  }
  
  .player-shell.success-active .player-card .card-title {
    font-size: 18px;
    line-height: 1.3;
  }
}

/* Tablet: slight bottom positioning */
@media (min-width: 769px) and (max-width: 1024px) {
  .player-shell.success-active .content {
    place-items: end center;
    padding-bottom: 48px;
  }
}

.player-shell .content {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 70vh;
  padding: 24px;
}

.player-card h3 {
  margin: 0 0 12px;
  font-family: "Unbounded", sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Success preview state */
.player-card.success-preview {
  position: relative;
  min-height: 260px;
  justify-content: center;
}

.player-card.success-preview h3 {
  font-size: 24px;
  margin-bottom: 8px;
}

.player-card.success-preview .sticker.success-sticker {
  font-size: 48px;
  animation: bounceIn 0.5s ease;
}

.player-card.success-preview .fall-stickers-hint {
  pointer-events: none;
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.player-card p {
  margin: 0 0 20px;
  color: #666;
  font-size: 16px;
  line-height: 1.6;
}

.player-card .card-title {
  font-size: 32px;
  margin-bottom: 16px;
  line-height: 1.2;
}

.player-card .card-question {
  font-size: 19px;
  margin-top: 12px;
  color: #333;
}

.answer-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  min-height: 72px;
  padding: 10px 12px;
  overflow: hidden;
}

.answer-row.stack {
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px 12px;
}

.answer-row.dodge-mode {
  min-height: 140px;
  padding: 20px 12px;
}

.answer-row.yes-grow-mode {
  overflow: visible;
  min-height: 96px;
}

.answer-row.yes-grow-mode .playloop-btn.yes {
  transform-origin: center;
}

.playloop-btn {
  min-width: 110px;
  padding: 10px 16px;
  border-radius: 16px;
  border: 2px solid #e0e0e0;
  background: #ffffff;
  font-weight: 600;
  font-size: 15px;
  color: #1f1e1c;
  cursor: pointer;
  transition: all 0.3s ease;
}

.playloop-btn:hover {
  background: #f8f8f8;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
  border-color: #1f1e1c;
}

.playloop-btn.yes {
  background: linear-gradient(135deg, #1f1e1c 0%, #2a2828 100%);
  color: #fff;
  border-color: #1f1e1c;
  box-shadow: 0 4px 16px rgba(31, 30, 28, 0.2);
}

.playloop-btn.yes:hover {
  box-shadow: 0 6px 20px rgba(31, 30, 28, 0.3);
  transform: translateY(-2px);
}

.playloop-btn.no {
  position: relative;
}

.playloop-btn.no.softened {
  background: linear-gradient(135deg, #1f1e1c 0%, #2a2828 100%);
  color: #fff;
  border-color: #1f1e1c;
  box-shadow: 0 4px 16px rgba(31, 30, 28, 0.2);
}

.answer-row.stack .playloop-btn {
  width: min(360px, 90%);
  height: 60px;
  font-size: 17px;
  font-weight: 700;
  border-radius: 18px;
}

.answer-row.stack .playloop-btn.no {
  width: min(360px, 90%);
  height: 60px;
  font-size: 17px;
  background: #ffffff;
}

.playloop-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.fake-no {
  pointer-events: auto;
  opacity: 0.95;
}

.answer-row.dodge-mode .playloop-btn.no {
  position: relative;
  z-index: 2;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.no-floating-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.no-floating-layer .no-floating {
  position: absolute;
  pointer-events: auto;
}

.no-placeholder {
  width: min(360px, 90%);
  height: 60px;
}

.helper-note {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.helper-note strong {
  color: var(--ink);
}

.helper-note input {
  border-radius: 8px;
  border: 1px solid var(--stroke);
  padding: 8px 10px;
  font-size: 13px;
}


.countdown {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.emotion {
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.sticker {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 12px;
}

.success-sticker {
  animation: successPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes successPop {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(10deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.backgrounds {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 100%;
}

.bg-item {
  border-radius: 16px;
  height: 80px;
  width: 100%;
  min-width: 0;
  background-size: cover;
  background-position: center;
  border: 3px solid rgba(255, 255, 255, 0.5);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.bg-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  border-color: rgba(255, 255, 255, 0.8);
}

.bg-item.active {
  border-color: #1f1e1c;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.bg-item .bg-emoji {
  display: none;
}

.bg-item .bg-label {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 12px);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1f1e1c;
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.center {
  bottom: 50%;
  right: 50%;
  transform: translate(50%, 50%);
}

.toast.center.show {
  bottom: 50%;
  right: 50%;
  transform: translate(50%, 50%);
}

/* Create Prompt - shown after completing challenge */
.create-prompt {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
  padding: 20px 28px;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.create-prompt.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.create-prompt-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.create-prompt-content p {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.create-prompt-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, #ff7a5f 100%);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(255, 91, 61, 0.3);
}

.create-prompt-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 91, 61, 0.4);
}

.create-prompt-btn svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 768px) {
  .create-prompt {
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    transform: translateX(0) translateY(100px);
    padding: 16px 20px;
  }
  
  .create-prompt.show {
    transform: translateX(0) translateY(0);
  }
  
  .create-prompt-content {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  
  .create-prompt-btn {
    width: 100%;
    justify-content: center;
  }
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(19, 17, 15, 0.45);
  backdrop-filter: blur(12px);
  z-index: 10000;
  padding: 20px;
}

.modal.show {
  display: flex;
  animation: fadeIn 0.2s ease;
}

/* Hide copy modal - using inline button feedback instead */
#copyModal {
  display: none !important;
}

.modal.show .modal-card {
  animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  padding: 28px;
  width: min(420px, 90vw);
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.25),
    0 8px 32px rgba(0, 0, 0, 0.15);
  display: grid;
  gap: 16px;
  color: var(--ink);
  backdrop-filter: blur(20px);
}

.modal-card h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0a0a0a;
}

.modal-card p {
  margin: 0;
  color: #666;
  line-height: 1.6;
}

.modal-link {
  display: grid;
  gap: 8px;
}

.modal-link input {
  font-size: 16px; /* Prevents zoom on iOS */
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  background: #f8f8f8;
  user-select: all;
  -webkit-user-select: all;
}

.emoji-picker-card {
  width: min(540px, 95vw);
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.emoji-categories {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.emoji-categories::-webkit-scrollbar {
  display: none;
}

.emoji-cat-btn {
  border: 2px solid #e8e8e8;
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.emoji-cat-btn:hover {
  border-color: #1f1e1c;
  background: #f8f8f8;
}

.emoji-cat-btn.active {
  border-color: #1f1e1c;
  background: #1f1e1c;
  color: #fff;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  background: #f5f5f5;
  border-radius: 16px;
  margin-bottom: 16px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.emoji-grid::-webkit-scrollbar {
  display: none;
}

.emoji-item {
  font-size: 32px;
  padding: 8px;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
}

.emoji-item:hover {
  background: rgba(31, 30, 28, 0.08);
  transform: scale(1.1);
}

/* Sticker Picker Modal */
.sticker-picker-card {
  width: min(480px, 92vw);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.sticker-picker-desc {
  color: #888;
  font-size: 14px;
  margin: -4px 0 16px 0;
}

.sticker-input {
  display: none; /* Hidden - removed URL input */
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 12px;
}

.sticker-input label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: #6b645d;
}

.sticker-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.sticker-input-row input {
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  padding: 12px 14px;
  font-size: 14px;
  width: 100%;
}

.sticker-input-row button.primary {
  padding: 10px 18px;
  font-size: 14px;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(255, 91, 61, 0.24);
}

.sticker-input-row button.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sticker-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #a09a95;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sticker-divider::before,
.sticker-divider::after {
  content: "";
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
  flex: 1;
}

@media (max-width: 520px) {
  .sticker-input-row {
    grid-template-columns: 1fr;
  }

  .sticker-input-row button.primary {
    width: 100%;
  }
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 10px;
  background: #f5f5f5;
  border-radius: 16px;
  margin-bottom: 16px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

@media (min-width: 400px) {
  .sticker-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 520px) {
  .sticker-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
}

.sticker-grid::-webkit-scrollbar {
  display: none;
}

.sticker-item {
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  background: #fff;
  border: 2px solid transparent;
  overflow: hidden;
  position: relative;
}

.sticker-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sticker-item:hover {
  border-color: #1f1e1c;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.floaters {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.floater {
  position: absolute;
  font-size: 18px;
  animation: drift 6s linear infinite;
  opacity: 0.8;
}

@keyframes float {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(300px) rotate(360deg);
    opacity: 0;
  }
}

@keyframes drift {
  0% {
    transform: translateY(40px) translateX(0);
    opacity: 0;
  }
  20% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(-120px) translateX(30px);
    opacity: 0;
  }
}

@media (max-width: 1023px) {
  .backgrounds {
    grid-template-columns: repeat(3, 1fr);
  }

  .player-card .card-title {
    font-size: 24px;
  }

  .answer-row.stack .playloop-btn {
    width: 100%;
  }

  .answer-row.stack .playloop-btn.no {
    width: 100%;
  }

  input,
  textarea,
  select,
  button {
    font-size: 16px;
  }

  .card {
    padding: 18px;
  }

  .toast {
    right: 16px;
    left: 16px;
    bottom: calc(96px + env(safe-area-inset-bottom));
    text-align: center;
  }
}

@media (min-width: 1024px) and (max-width: 1199px) {
  .app {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px 0;
  }

  main {
    padding-top: 120px;
  }

  .panel-head h1 {
    font-size: 52px;
  }

  .panel-head p {
    font-size: 19px;
  }

  .toast {
    right: 24px;
    left: auto;
    bottom: 24px;
    text-align: left;
  }

  .topbar {
    padding: 16px 32px;
  }
  
  .topbar-inner {
    max-width: calc(1280px - 64px);
  }

  .site-footer {
    margin: 56px 0 0;
    padding: 48px 32px 36px;
  }

  .footer-inner {
    gap: 28px;
    max-width: calc(1280px - 64px);
  }

  .footer-hero {
    gap: 14px;
  }

  .footer-brand {
    font-size: 20px;
  }

  .footer-hero p {
    font-size: 14px;
    max-width: 560px;
  }

  .footer-tags {
    gap: 12px;
  }
}

@media (min-width: 1200px) {
  .app {
    max-width: 1520px;
    margin: 0 auto;
    padding: 0 40px 0;
  }

  main {
    padding-top: 120px;
  }

  .panel-head h1 {
    font-size: 56px;
  }

  .panel-head p {
    font-size: 20px;
  }

  .toast {
    right: 24px;
    left: auto;
    bottom: 24px;
    text-align: left;
  }

  .topbar {
    padding: 16px 40px;
  }
  
  .topbar-inner {
    max-width: calc(1520px - 80px);
  }

  .site-footer {
    margin: 56px 0 0;
    padding: 48px 40px 36px;
  }

  .footer-inner {
    gap: 26px;
    max-width: calc(1520px - 80px);
  }

  .footer-hero {
    gap: 14px;
  }

  .footer-brand {
    font-size: 20px;
  }

  .footer-hero p {
    font-size: 14px;
    max-width: 560px;
  }

  .footer-tags {
    gap: 12px;
  }
}

@media (max-width: 420px) {
  .analytics .tiles {
    grid-template-columns: 1fr;
  }

  .analytics .bar-row {
    grid-template-columns: 1fr;
  }

  .analytics .bar-track {
    width: 100%;
  }

  .modal-card {
    width: 100%;
  }
}
