/* ---- Custom Fonts ---- */
@font-face {
    font-family: 'home_videoregular';
    src: url('assets/UI/homevideo-regular-webfont.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Jumps Winter';
    src: url('assets/fonts/JumpsWinter.woff2') format('woff2'),
        url('assets/fonts/JumpsWinter.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Spicy Sale';
    src: url('assets/fonts/SpicySale.woff2') format('woff2'),
        url('assets/fonts/SpicySale.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Start Story';
    src: url('assets/fonts/StartStory.woff2') format('woff2'),
        url('assets/fonts/StartStory.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Super Chiby';
    src: url('assets/fonts/SuperChiby.woff2') format('woff2'),
        url('assets/fonts/SuperChiby.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Super Crawler';
    src: url('assets/fonts/SuperCrawler.woff2') format('woff2'),
        url('assets/fonts/SuperCrawler.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ==== LOADING SCREEN ==== */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0a0a14;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#exporting-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0a0a14;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999999;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#exporting-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  text-align: center;
  position: relative;
  padding: 20px;
  box-sizing: border-box;
  max-width: 100%;
}

.loading-logo {
  width: 480px;
  max-width: 90vw;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-logo img,
.loading-logo video {
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Container for loading text and button - fixed height to prevent shift */
.loading-status {
  min-height: 100px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

/* Mobile adjustments for loading/export screens */
@media (max-width: 600px) {
  .loading-logo {
    width: 280px;
    margin-bottom: 16px;
  }
  
  .loading-status {
    min-height: 80px;
    gap: 8px;
  }
  
  .loading-text {
    font-size: 14px;
    letter-spacing: 2px;
  }
  
  .get-started-btn {
    padding: 10px 24px;
    font-size: 16px;
    min-width: 160px;
    border-width: 3px;
  }
  
  .completed-text,
  .error-text {
    font-size: 14px;
    letter-spacing: 2px;
  }
  
  .error-message {
    font-size: 10px;
    max-width: 250px;
  }
  
  .export-progress-container {
    width: 200px !important;
  }
}

.loading-text {
  font-family: 'home_videoregular', sans-serif;
  font-size: 18px;
  color: #5a3fd9;
  letter-spacing: 4px;
  text-transform: uppercase;
  position: relative;
  display: inline-block;
}

.loading-text.hidden {
  display: none;
}

/* Dots positioned absolutely so they don't shift the text */
.loading-dots {
  position: absolute;
  left: 100%;
  top: 0;
}

.loading-dots::after {
  content: '';
  animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
  100% { content: ''; }
}

/* Get Started button - purple with white text */
.get-started-btn {
  padding: 12px 32px;
  border: 4px solid #5a3fd9;
  background: #3013a9;
  color: #fff;
  cursor: url('assets/UI/hand.ico'), pointer;
  min-width: 200px;
  text-align: center;
  font-family: 'home_videoregular', sans-serif;
  font-weight: normal;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 2px;
  filter: drop-shadow(0px 2px 0px #5a3fd9) drop-shadow(0px 8px 0px #1a0a5c);
  transition: filter 0.05s, transform 0.1s;
  image-rendering: pixelated;
}

.get-started-btn:hover {
  filter: brightness(1.2) drop-shadow(0px 2px 0px #5a3fd9) drop-shadow(0px 8px 0px #1a0a5c);
}

.get-started-btn:active {
  transform: translateY(8px);
  filter: drop-shadow(0px 0px 0px) drop-shadow(0px 0px 0px);
}

.get-started-btn.hidden {
  display: none;
}

/* Completed state container */
/* Completed text - same style as loading text */
.completed-text {
  font-family: 'home_videoregular', sans-serif;
  font-size: 18px;
  color: #5a3fd9;
  letter-spacing: 4px;
  text-transform: uppercase;
}

/* Error state */
.error-text {
  font-family: 'home_videoregular', sans-serif;
  font-size: 18px;
  color: #ff6666;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.error-message {
  font-family: 'home_videoregular', sans-serif;
  font-size: 12px;
  color: #999;
  text-align: center;
  max-width: 300px;
  margin-top: -10px;
}

.get-started-btn.secondary {
  background: #1a1a2e;
  border-color: #3013a9;
}

/* Export progress bar */
.export-progress-container {
  width: 300px;
  max-width: 80vw;
  height: 20px;
  background: #1a1a2e;
  border: 3px solid #3013a9;
  margin: 0 auto 16px auto;
  position: relative;
  overflow: hidden;
}

.export-progress-container.hidden {
  display: none;
}

.export-progress-bar {
  height: 100%;
  width: 0%;
  background: #5a3fd9;
  transition: width 0.1s ease-out;
  position: relative;
}

/* Pixel shine effect on progress bar */
.export-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: rgba(255, 255, 255, 0.15);
}


/* ---- sizing tokens ---- */
:root{
  /* set these; your JS also overrides --stage-w/--stage-h at runtime */
  --stage-w: 1200px;          /* or 600px */
  --stage-h: 600px;           /* or 300px */
  --sidebar-w: 240px;         /* increased to 240px for 2:1 editor ratio */
  --panel-w: 200px;
  --stickerbar-h: 120px;      /* comfortable height for mobile tapping */
  --stage-bg: #fff;
  
  /* frame size derived from parts */
  --frame-w: calc(var(--sidebar-w) + var(--stage-w));
  --frame-h: calc(var(--stage-h) + var(--stickerbar-h));

  /* current visual scale, set by JS */
  --ui-scale: 1;
  
  --popup-pad: 24px;
  --popup-bg: rgba(0,0,0,.8);
  --popup-br: 0px;
  --popup-bw: 2px;
}

html, body { 
  margin:0; 
  height:100%; 
  overflow: hidden; /* Prevent scrollbars when in iframe */
}
body { 
  font-family: 'home_videoregular', sans-serif; 
  background:#3013a9;
  color: #fff;
  cursor: url('assets/UI/cursor.ico'), auto;
  /* Prevent text selection on UI */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Hide scrollbars globally but allow scrolling where needed */
html, body, #root {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
#root::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Opera */
}

/* Custom cursors */
a, button, .clickable {
  cursor: url('assets/UI/hand.ico'), pointer;
}

*:active {
  cursor: url('assets/UI/click.ico'), pointer;
}

.drag, .sticker-wrapper {
  cursor: url('assets/UI/hand.ico'), move;
}

.drag:active, .sticker-wrapper:active {
  cursor: url('assets/UI/drag.ico'), grabbing;
}

/* viewport shell that centers the frame */
#root{
  display:flex;
  justify-content:center;  /* center horizontally */
  align-items:center;      /* center vertically */
  height:100vh;
  width:100vw;
  overflow:hidden; /* Prevent scrollbars in iframe */
  background:#3013a9;
}

/* Frame: 3 columns (sidebar | panel | stage), 2 rows (stage | sticker bar) */
#app{
  width: calc(var(--sidebar-w) + var(--stage-w));
  height: calc(var(--stage-h) + var(--stickerbar-h));
  transform: scale(var(--ui-scale));
  transform-origin: center center;  /* center since app is centered */
  display: grid;
  grid-template-columns: var(--sidebar-w) var(--stage-w);
  grid-template-rows: var(--stage-h) var(--stickerbar-h);
  gap: 0;
  min-width: calc(var(--sidebar-w) + var(--stage-w));
  min-height: calc(var(--stage-h) + var(--stickerbar-h));
  border: 8px solid #3013a9;    /* purple pixel art border */
  border-radius: 0;              /* no rounded corners - pixel style */
  box-sizing: content-box;
  overflow: hidden;
}

/* Sidebar occupies left column, spanning both rows */
#sidebar{
  grid-column: 1;
  grid-row: 1 / 3;           /* span both rows - full height */
  width: var(--sidebar-w);
  background: #0a0a0a;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 16px 0;           /* padding top and bottom */
  box-sizing: border-box;
  overflow: hidden;
  border-right: 4px solid #3013a9; /* purple pixel border */
  align-items: center;
  image-rendering: pixelated;
}

.category{
  flex: 1;                   /* each button takes equal space */
  padding: 0;
  background: transparent;   /* no button background */
  cursor: url('assets/UI/hand.ico'), pointer;
  text-align: center;
  user-select: none;
  border: none;              /* no borders between buttons */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.1s, margin-top 0.1s;
  margin: 4px 0;
}

.category img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 80px;
  image-rendering: pixelated;
  filter: drop-shadow(0px 8px 0px #3013a9);
}

.category:hover img {
  filter: brightness(1.2) drop-shadow(0px 8px 0px #3013a9);
}

.category:active img {
  margin-top: 8px;
  filter: drop-shadow(0px 0px 0px);
}

.category:hover,
.category.active {
  background: transparent;
}

/* Guided flow states */
.category.locked {
  cursor: url('assets/UI/hand.ico'), pointer; /* Still show hand cursor */
}

.category.locked img {
  filter: drop-shadow(0px 8px 0px #3013a9) saturate(0) brightness(0.5);
}

.category.completed img {
  filter: drop-shadow(0px 8px 0px #3013a9);
}

.category.completed:hover img {
  filter: brightness(1.2) drop-shadow(0px 8px 0px #3013a9);
}

.category.current img {
  filter: brightness(1.1) drop-shadow(0px 8px 0px #3013a9);
}

.category.blinking img {
  animation: blinkPulse 1s ease-in-out infinite;
}

@keyframes blinkPulse {
  0%, 100% {
    filter: drop-shadow(0px 8px 0px #3013a9) brightness(0.7);
  }
  50% {
    filter: drop-shadow(0px 8px 0px #3013a9) brightness(1.3);
  }
}

/* Export buttons - 9slice pixel art style */
.export-btn {
  margin-top: 10px;
  padding: 6px 24px;
  border: none;
  border-image: url('assets/UI/9button.png') 6 6 6 6 fill / 6px 6px 6px 6px;
  background: transparent;
  color: #fff;
  cursor: url('assets/UI/hand.ico'), pointer;
  min-width: 180px;
  text-align: center;
  font-family: 'home_videoregular', sans-serif;
  font-weight: normal;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  filter: drop-shadow(0px 2px 0px #ffb3c6) drop-shadow(0px 8px 0px #a20029);
  transition: filter 0.05s, margin-top 0.1s;
  image-rendering: pixelated;
}

.export-btn:hover {
  filter: brightness(1.2) drop-shadow(0px 2px 0px #ffb3c6) drop-shadow(0px 8px 0px #a20029);
}

.export-btn:active {
  margin-top: 18px;
  filter: drop-shadow(0px 0px 0px) drop-shadow(0px 0px 0px);
}

.export-btn[disabled]{ 
  opacity:.5; 
  cursor:not-allowed; 
  filter: drop-shadow(0px 2px 0px #888) drop-shadow(0px 8px 0px #444) saturate(0);
}

/* Confirm button variant (green) */
.export-btn.confirm-btn,
.button-container .export-btn:last-child {
  filter: hue-rotate(150deg) drop-shadow(0px 2px 0px #00f700) drop-shadow(0px 8px 0px #005c00);
}

.export-btn.confirm-btn:hover,
.button-container .export-btn:last-child:hover {
  filter: brightness(1.2) hue-rotate(150deg) drop-shadow(0px 2px 0px #00f700) drop-shadow(0px 8px 0px #005c00);
}

.export-btn.confirm-btn:active,
.button-container .export-btn:last-child:active {
  margin-top: 18px;
  filter: hue-rotate(150deg) drop-shadow(0px 0px 0px) drop-shadow(0px 0px 0px);
}

/* Regenerate button variant (purple) */
.export-btn.regen-btn,
.button-row .export-btn {
  filter: hue-rotate(-100deg) drop-shadow(0px 2px 0px #9f84e5) drop-shadow(0px 8px 0px #2c14a2);
}

.export-btn.regen-btn:hover,
.button-row .export-btn:hover {
  filter: brightness(1.2) hue-rotate(-100deg) drop-shadow(0px 2px 0px #9f84e5) drop-shadow(0px 8px 0px #2c14a2);
}

.export-btn.regen-btn:active,
.button-row .export-btn:active {
  margin-top: 18px;
  filter: hue-rotate(-100deg) drop-shadow(0px 0px 0px) drop-shadow(0px 0px 0px);
}

.hidden{ display: none; }
.lbl{ display:block; margin:8px 0 4px; font-size:12px; color:#fff; }
.num{ width:80px; }
.btn-row{ margin-top:12px; display:flex; gap:8px; }
.progress{ margin-top:8px; font-size:12px; color:#fff; }

/* BACKGROUND OPTIONS */
.bg-option {
  width: 100%;
  height: 80px;
  background-size: cover;
  background-position: center;
  margin-bottom: 10px;
  cursor: url('assets/UI/hand.ico'), pointer;
  border: 2px solid #3013a9;
}

/* positioned container for stage + overlay */
#stage-wrap{
  grid-column: 2;
  grid-row: 1;
  position: relative;
  width: var(--stage-w);
  height: var(--stage-h);
  box-sizing: border-box;
  z-index: 550; /* Above UI snow canvas (500) so element bar shows on top */
}

/* Stage: fixed box; never flexes, never covered */
#stage{
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;          /* pure black for stage */
  
  /* === BACKGROUND SIZING OPTIONS === */
  /* OPTION 1: Crop to fit (no distortion, may cut off edges) */
  /* background-size: cover; */
  
  /* OPTION 2: Full stretch/squash to fit exactly (may distort) */
  /* background-size: 100% 100%; */
  
  /* OPTION 3: Partial squash - compromise between crop and stretch */
  /* Stretches width fully, height 115% for subtle squash + slight crop */
  background-size: 100% 115%;
  /* === END BACKGROUND SIZING OPTIONS === */
  
  background-position: center;
  overflow: hidden;
  box-sizing: border-box;
  z-index: 1;
}

/* overlay that floats above stage, with margin from edges */
#overlay{
  position: absolute;
  inset: 24px;                       /* margin from stage edge */
  background: rgba(10,10,10,0.95);
  border: 4px solid #3013a9;
  border-radius: 0;
  padding: 16px;
  color: #fff;
  overflow: hidden;                  /* No scrollbar */
  z-index: 10000;                    /* way above stickers (100-999) and other layers (2000) */
  pointer-events: none;
  image-rendering: pixelated;
}

#overlay.open{
  display:block;
  pointer-events: auto;
}

/* while overlay is open, block interacting with the editor under it */
body.modal-open #sidebar,
body.modal-open #sticker-bar,
body.modal-open #stage { 
  pointer-events: none !important;
  filter: brightness(.75); 
}

/* Ensure ALL descendants are also blocked */
body.modal-open #stage *,
body.modal-open #sticker-bar * {
  pointer-events: none !important;
}

/* ===== BG OVERLAY ONLY (grid) ===== */
.overlay-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.bg-card{
  background:#111;
  border:2px solid #3013a9;
  border-radius: 0;
  overflow:hidden;
}

.bg-card .thumb{
  aspect-ratio: 1 / 1;              /* square tile */
  background:#111 center/cover no-repeat;
}

.bg-card .caption{
  padding:6px 8px;
  font-size:12px;
  text-align:center;
  border-top:2px solid #3013a9;
  font-family: 'home_videoregular', sans-serif;
}

.bg-card:hover{ 
  border-color:#fff; 
  cursor: url('assets/UI/hand.ico'), pointer; 
}

/* Sticker bar: only under the stage (column 2, row 2) */
#sticker-bar{
  grid-column: 2;
  grid-row: 2;
  height: var(--stickerbar-h);
  background: #0a0a0a;       /* very dark, matching sidebar */
  border-top: 4px solid #3013a9; /* purple pixel border */
  display: flex;
  gap: 16px;                 /* comfortable spacing */
  align-items: center;
  padding: 14px;             /* comfortable padding */
  padding-bottom: 20px;      /* Extra bottom padding to avoid scrollbar */
  margin-right: 60px;        /* Make container narrower - ends before button */
  overflow-x: auto;
  overflow-y: hidden;        /* No vertical scrollbar */
  box-sizing: border-box;
  image-rendering: pixelated;
  touch-action: pan-x;       /* Allow horizontal scroll, vertical for drag-out */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  cursor: url('assets/UI/hand.ico'), pointer;
}

/* Styled scrollbar for sticker bar - chunky pixel art style */
#sticker-bar::-webkit-scrollbar {
  height: 20px;
}

#sticker-bar::-webkit-scrollbar-track {
  background: #1a1a2e;
  border: 2px solid #3013a9;
}

#sticker-bar::-webkit-scrollbar-thumb {
  background: #3013a9;
  border: 2px solid #5a3fd9;
}

#sticker-bar::-webkit-scrollbar-thumb:hover {
  background: #5a3fd9;
}

/* Base style for arrow buttons */
#sticker-bar::-webkit-scrollbar-button {
  background: #1a1a2e;
  border: 2px solid #3013a9;
  width: 24px;
}

#sticker-bar::-webkit-scrollbar-button:hover {
  background: #2a2a4e;
}

/* Hide the double-button pairs (keeps only single buttons) */
#sticker-bar::-webkit-scrollbar-button:horizontal:start:increment,
#sticker-bar::-webkit-scrollbar-button:horizontal:end:decrement {
  display: none;
}

/* Left arrow - only at start */
#sticker-bar::-webkit-scrollbar-button:horizontal:start:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpolygon points='7,1 7,9 2,5' fill='%235a3fd9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* Right arrow - only at end */
#sticker-bar::-webkit-scrollbar-button:horizontal:end:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpolygon points='3,1 3,9 8,5' fill='%235a3fd9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* Add top padding when stickers are unlocked to make room for title */
#sticker-bar.unlocked {
  padding-top: 50px;
}

/* Title area - overlaid in top-left corner of sticker bar */
/* ============================================
   ELEMENT EFFECT BAR (Hero/Headline/Company/CTA)
   Positioned at bottom edge of stage, above sticker bar
   ============================================ */

#element-bar-title-area {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 108px;  /* Fixed width to match sticker title */
  padding: 8px 16px;
  background: rgba(10, 10, 10, 0.95);
  border: 4px solid #3013a9;
  border-left: none;
  border-bottom: none;
  border-top-right-radius: 0;  /* No radius when tabs visible */
  display: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  z-index: 600;  /* Above UI snow (500) */
  height: 38px;
}

#element-bar-title-area span {
  color: #fff;
  font-size: 14px;
  font-weight: normal;
  font-family: 'home_videoregular', sans-serif;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============================================
   STICKER BAR TITLE & EFFECTS
   ============================================ */

#sticker-bar-title-area {
  grid-column: 2;
  grid-row: 2;
  position: absolute;
  left: 0;
  top: 0;  /* TOP not bottom! */
  width: 108px;  /* Fixed width to match element bar */
  padding: 8px 16px;
  background: rgba(10, 10, 10, 0.95); /* Very dark, matching sidebar */
  border: 4px solid #3013a9;
  border-left: none;
  border-bottom-right-radius: 0;  /* Rounded when tabs not visible */
  display: none;             /* Hidden by default, shown via JS when unlocked */
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  z-index: 151;              /* Above stickers and slightly above tabs */
  height: 38px;              /* Fixed height for alignment */
}

/* Remove rounded corner from title when effect tabs are visible */
#sticker-bar-title-area.tabs-visible {
  border-bottom-right-radius: 0;
}

#sticker-bar-title-area span {
  color: #fff;
  font-size: 14px;
  font-weight: normal;
  font-family: 'home_videoregular', sans-serif;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Delete button area - top right of sticker bar (same style as title) */
#sticker-bar-delete-area {
  grid-column: 2;
  grid-row: 2;
  position: absolute;
  right: 60px;  /* Account for fullscreen button width */
  top: 0;
  width: auto;
  padding: 8px 16px;
  background: #ff4444;  /* Red background */
  border: 4px solid #3013a9;
  border-right: none;
  border-bottom-left-radius: 0;  /* Rounded corner at bottom-left */
  display: none;  /* Hidden by default, shown when sticker is selected */
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  z-index: 150;  /* Above stickers */
  cursor: url('assets/UI/hand.ico'), pointer;
  transition: background 0.2s;
}

#sticker-bar-delete-area:hover {
  background: #ff0000;
}

#sticker-bar-delete-area span {
  color: #fff;
  font-size: 14px;
  font-weight: normal;
  font-family: 'home_videoregular', sans-serif;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Button area fills the right margin space */
#sticker-bar-button-area {
  grid-column: 2;
  grid-row: 2;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 60px;
  height: var(--stickerbar-h);
  background: #0a0a0a;       /* Very dark, matching sidebar */
  border-top: 4px solid #3013a9; /* Purple pixel border */
  border-left: 4px solid #3013a9; /* Purple pixel border */
  display: flex;
  flex-direction: column;     /* Stack buttons vertically */
  align-items: center;
  justify-content: center;
  gap: 8px;                   /* Space between buttons */
  box-sizing: border-box;
  padding: 8px 0;
}

/* Sticker thumbnails */
.sticker-src{
  z-index: 100;
  height: 70px;              /* Reduced from 80px to avoid scrollbar */
  cursor: url('assets/UI/hand.ico'), pointer;
  user-drag: none;
  -webkit-user-drag: none;
  border-radius: 0;
  display: none;             /* hidden by default */
  transition: transform 0.15s ease;
  box-sizing: border-box;
}

/* Show stickers when unlocked */
#sticker-bar.unlocked .sticker-src {
  display: block;
}

/* Sticker hover effect */
#sticker-bar.unlocked .sticker-src:hover {
  transform: scale(1.2);
  z-index: 101;
}

/* STICKER WRAPPER */
.sticker-wrapper {
  position: absolute;
  touch-action: none;
  transform-origin: center center;
}

/* Sticker image */
.sticker-wrapper img{
  display:block;
  user-select:none;
  pointer-events:auto;
  position:relative;
  z-index:1;
  cursor: move; /* 4-way move icon */
  /* Shadows applied inline via JS for random outline effect */
}

/* --- DEFAULT: HIDE HANDLES --- */
.scale-handle,
.rot-handle { display: none; }

/* SHOW HANDLES ONLY WHEN SELECTED */
.sticker-wrapper.selected .scale-handle { display: block; }
.sticker-wrapper.selected .rot-handle   { display: block; }

/* Selection outline - white dashed for better visibility */
.sticker-wrapper.selected {
  outline: 3px dashed rgba(255, 255, 255, 0.8);
  outline-offset: 4px;
  image-rendering: pixelated;
}

/* SCALE HANDLE - White with purple icon */
.scale-handle{
  position:absolute;
  width:28px; height:28px;
  bottom:-14px; right:-14px;
  background: rgba(255, 255, 255, 0.95);
  border: 3px solid #5a3fd9;
  border-radius: 0;
  z-index:2;
  pointer-events:auto;
  image-rendering: pixelated;
  cursor: url('assets/UI/hand.ico'), pointer;
}

.scale-handle::before{
  content:"";
  position:absolute;
  inset:-8px;
  cursor: se-resize;
}

.scale-handle::after{
  content:"⤡";
  position:absolute;
  left:50%; top:50%;
  transform:translate(-50%,-50%);
  font-size:14px;
  font-family: 'home_videoregular', sans-serif;
  line-height:1;
  color:#3013a9;
  pointer-events:none;
  opacity:1;
}

.scale-handle:hover {
  background: #fff;
  border-color: #3013a9;
}

.scale-handle:hover::after,
.scale-handle.dragging::after{ color: #5a3fd9; }

/* ROTATE HANDLE - White with purple icon */
.rot-handle{
  position:absolute;
  width:28px; height:28px;
  top:-36px; left:50%;
  transform:translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  border: 3px solid #5a3fd9;
  border-radius: 0;
  z-index:2;
  pointer-events:auto;
  image-rendering: pixelated;
  cursor: url('assets/UI/hand.ico'), pointer;
}

.rot-handle::before{
  content:"";
  position:absolute;
  inset:-12px;
  cursor: grab;
}

.rot-handle::after{
  content:"↻";
  position:absolute;
  left:50%; top:50%;
  transform:translate(-50%,-50%);
  font-size:14px;
  font-family: 'home_videoregular', sans-serif;
  line-height:1;
  color:#3013a9;
  pointer-events:none;
  opacity:1;
}

.rot-handle:hover {
  background: #fff;
  border-color: #3013a9;
}

.rot-handle:hover::after,
.rot-handle.dragging::after{ color: #5a3fd9; }

/* Drag/scale/rotate feedback */
.sticker-wrapper.dragging img { cursor: grabbing; }
.scale-handle.dragging        { cursor: se-resize !important; background: #fff; border-color: #5a3fd9; }
.rot-handle.dragging          { cursor: grabbing !important; background: #fff; border-color: #5a3fd9; }
body.scaling,  body.scaling  * { cursor: se-resize !important; }
body.rotating, body.rotating * { cursor: grabbing  !important; }

/* Mobile: Bigger scale/rotate handles for touch */
@media (max-width: 768px), (pointer: coarse) {
  .scale-handle {
    width: 44px;
    height: 44px;
    bottom: -22px;
    right: -22px;
  }
  
  .scale-handle::before {
    inset: -12px;
  }
  
  .scale-handle::after {
    font-size: 20px;
  }
  
  .rot-handle {
    width: 44px;
    height: 44px;
    top: -52px;
  }
  
  .rot-handle::before {
    inset: -16px;
  }
  
  .rot-handle::after {
    font-size: 20px;
  }
}

/* Fullscreen button (bottom-right of viewport, not scaled) */
/* Buttons in sticker bar button area - pixel art style matching UI */
.bar-btn {
  width: 36px;
  height: 36px;
  border: 3px solid #3013a9;
  border-radius: 0;
  background: #1a1a2e;
  color: #fff;
  cursor: url('assets/UI/hand.ico'), pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  image-rendering: pixelated;
  
  /* Pixel art 3D effect */
  box-shadow: 
    inset -2px -2px 0 0 #0a0a1a,
    inset 2px 2px 0 0 #2a2a4e;
  
  transition: all 0.05s ease;
}

/* Pixel art icon styling */
.bar-btn .btn-icon {
  font-family: 'home_videoregular', monospace;
  font-size: 18px;
  line-height: 1;
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: none;
}

#btn-mute .btn-icon {
  font-size: 18px;
}

#btn-snow .btn-icon {
  font-size: 22px;
  font-weight: bold;
}

#btn-fullscreen .btn-icon {
  font-size: 22px;
}

.bar-btn:hover { 
  background: #2a2a4e;
  border-color: #5a3fd9;
  box-shadow: 
    inset -2px -2px 0 0 #1a1a2e,
    inset 2px 2px 0 0 #3a3a5e;
}

.bar-btn:active {
  background: #0a0a1a;
  box-shadow: 
    inset 2px 2px 0 0 #0a0a1a,
    inset -2px -2px 0 0 #2a2a4e;
  transform: translate(1px, 1px);
}

/* Muted state for mute button */
#btn-mute[aria-pressed="true"] {
  color: #ff6666;
  background: #2a1a2a;
  border-color: #a02060;
}

#btn-mute[aria-pressed="true"] .btn-icon {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

/* Active state for snow button */
#btn-snow[aria-pressed="true"] {
  background: #1a2a3a;
  border-color: #3a7fd9;
  color: #8af;
}

/* Active state for fullscreen button */
#btn-fullscreen[aria-pressed="true"] {
  background: #1a2a1a;
  border-color: #3ad93a;
  color: #8f8;
}

/* Future non-sticker layers that must sit above stickers */
.headline-layer,
.cta-layer,
.hero-layer {
  position: absolute;
  z-index: 2000;
  pointer-events: auto;
}

/* Fullscreen ON (class-based, works everywhere) */
#root.fs-on{
  background:#000;
  justify-content:center;
  align-items:center;
  overflow:hidden;
}

#root.fs-on #app{
  transform-origin:center center;
}

/* ==== POPUP CONTENT ====================================================== */
#popup {
  display: flex;
  flex-direction: column;
  height: 100%;  /* Fill entire overlay */
  width: 100%;
}

.popup-head{
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  justify-content: center;  /* Center title */
  align-items: center;
  flex-shrink: 0;  /* Don't shrink header */
  position: relative;  /* For absolute positioning of close button */
  font-family: 'home_videoregular', sans-serif;
}

.popup-head span {
  text-align: center;  /* center the title */
  font-size: 24px;
  font-weight: normal;
  font-family: 'home_videoregular', sans-serif;
}

/* Close button - small and positioned absolutely */
#popup-close {
  position: absolute;
  right: 0;
  top: 0;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #fff;
  cursor: url('assets/UI/hand.ico'), pointer;
  font-size: 32px;
  font-family: 'home_videoregular', sans-serif;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#popup-close:hover {
  opacity: 0.6;
}

.popup-body{
  flex: 1 1 auto;
  min-height: 0;  /* Allow flexbox to shrink */
  overflow: auto;  /* Allow scrolling for grids */
  position: relative;  /* For absolute positioning of generators */
}

/* For generators and bg selection, prevent scrolling */
.popup-body:has(.headline-generator),
.popup-body:has(.company-generator),
.popup-body:has(.cta-generator),
.popup-body:has(.bg-grid) {
  overflow: hidden;
}

.bg-grid{
  display: grid;
  grid-template-columns: repeat(5, 1fr);  /* 5 columns for 5x2 grid */
  gap: 12px;
  padding: 10px 5px;
  height: 100%;
  align-content: space-evenly;  /* Evenly distribute rows */
}

.bg-card{
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;  /* Allow border to show */
  display: flex;
  flex-direction: column;
  cursor: url('assets/UI/hand.ico'), pointer;
}

.bg-thumb{
  aspect-ratio: 1200 / 628;
  width: 100%;
  background: transparent;
  border: 2px solid transparent;
  box-sizing: border-box;
}

.bg-thumb > img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: transparent;
}

/* Hero thumbnails - square with contained images */
.hero-thumb {
  aspect-ratio: 1 / 1;
  width: 100%;
  background: transparent;
  border: 2px solid transparent;
  box-sizing: border-box;
}

.hero-thumb > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: transparent;  /* Fully transparent - no box visible */
}

.bg-caption{
  padding: 4px 2px;
  font-size: 18px;
  font-family: 'home_videoregular', sans-serif;
  line-height: 1.2;
  text-align: center;
  color: #aaa;
  word-wrap: break-word;
}

.bg-card:hover .bg-thumb,
.bg-card:hover .hero-thumb {
  border-color: #5a3fd9;
}

.bg-card:hover .bg-caption{
  color: #fff;
}

/* Hero grid - 4 columns */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 10px 5px;
}

/* ==== HEADLINE UI ======================================================== */
.vibes-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px 0;
  box-sizing: border-box;
}

.headline-instructions {
  text-align: center;
  font-size: 16px;
  font-family: 'home_videoregular', sans-serif;
  margin-bottom: 16px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 2px;
  flex-shrink: 0;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
  flex: 1;
  align-content: center;
}

.word-box {
  background: #1a1a2e;
  border: 2px solid #3013a9;
  border-radius: 0;
  padding: 20px 12px;
  text-align: center;
  cursor: url('assets/UI/hand.ico'), pointer;
  color: #fff;
  font-size: 18px;
  font-weight: normal;
  font-family: 'home_videoregular', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  user-select: none;
  transition: all 0.05s ease;
  image-rendering: pixelated;
  display: flex;
  align-items: center;
  justify-content: center;
}

.word-box:hover {
  background: #2a2a4e;
  border-color: #5a3fd9;
  color: #fff;
}

.word-box.selected {
  background: #3013a9;
  border-color: #5a3fd9;
  color: #fff;
  box-shadow: 0 0 0 2px #5a3fd9 inset;
}

.headline-generator {
  position: absolute;
  top: 20px;  /* Moved up from 60px */
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px;
  padding-bottom: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.headline-generator .headline-preview {
  font-size: 42px;
  font-weight: bold;
  text-align: center;
  word-break: break-word;
  line-height: 1.2;
  max-width: 90%;
}

.headline-generator .button-container {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  z-index: 1000;
}


.headline-text {
  font-size: 48px;           /* increased from 32px */
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
  cursor: move;
  user-select: none;
  padding: 10px 20px;
}

/* Text layer wrappers size to their content */
.headline-layer,
.company-layer {
  display: inline-block;
}

/* ==== COMPANY NAME UI ==================================================== */
.company-generator {
  position: absolute;
  top: 20px;  /* Moved up from 60px */
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px;
  padding-bottom: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.company-generator .company-preview {
  font-size: 48px;
  font-weight: bold;
  text-align: center;
  word-break: break-word;
  line-height: 1.2;
  max-width: 90%;
}

.company-generator .button-container {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  z-index: 1000;
}

.company-generator .button-row {
  display: none !important;
}

.button-row {
  display: flex;
  gap: 10px;
}

.company-text {
  font-size: 40px;           /* increased from 28px */
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
  cursor: move;
  user-select: none;
  padding: 8px 16px;
}

/* ==== CTA BUTTON UI ====================================================== */
.cta-generator {
  position: absolute;
  top: 20px;  /* Moved up from 60px */
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px;
  padding-bottom: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cta-generator .cta-preview {
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
  cursor: url('assets/UI/hand.ico'), pointer;
  user-select: none;
  padding: 12px 24px;
  display: inline-block;
  image-rendering: pixelated;
}

.cta-generator .button-container {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  z-index: 1000;
}

.cta-generator .button-row {
  display: none !important;
}


.cta-button {
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
  cursor: move;
  user-select: none;
  padding: 12px 24px;
  display: inline-block;
  image-rendering: pixelated;
}

/* Stepped bounce animation - pixel art style (choppy, like old games) */
@keyframes pixelBounce {
  0% { transform: scale(1); }
  25% { transform: scale(1.10); }
  50% { transform: scale(1.20); }
  75% { transform: scale(1.10); }
  100% { transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.cta-button.bouncing {
  animation: pixelBounce 2s steps(4) forwards;
}

.cta-layer {
  display: inline-block;
}

/* Bounce wrapper - just a container */
.cta-bounce {
  display: inline-block;
}

/* ============================================
   EXPORT UI STYLES
   ============================================ */

.export-section-title {
  font-family: 'home_videoregular', sans-serif;
  font-size: 18px;
  font-weight: normal;
  color: #fff;
  margin: 0 0 16px 0;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.input-group {
  margin-bottom: 16px;
}

.export-input {
  width: 100%;
  padding: 12px 16px;
  font-family: 'home_videoregular', sans-serif;
  font-size: 16px;
  color: #fff;
  background: #111;
  border: 4px solid #3013a9;
  border-radius: 0;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  cursor: text;
}

.export-input:focus {
  border-color: #5a3fd9;
  background: #1a1a1a;
}

.export-input::placeholder {
  color: #666;
}

.export-input.input-invalid {
  border-color: #ff4444;
  background: #1a0a0a;
}

.input-error {
  display: block;
  color: #ff6666;
  font-family: 'home_videoregular', sans-serif;
  font-size: 12px;
  margin-top: 6px;
  min-height: 16px;
}

.btn-row.centered {
  justify-content: center;
}

/* Banner name input group */
.banner-name-group {
  margin-bottom: 20px;
}

.banner-name-group .lbl {
  text-align: center;
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.banner-name-input {
  text-align: center;
  font-size: 18px;
}

.send-status {
  text-align: center;
  font-family: 'home_videoregular', sans-serif;
  font-size: 14px;
  margin-top: 12px;
  min-height: 20px;
}

.send-status.pending {
  color: #ffcc00;
}

.send-status.success {
  color: #00ff00;
}

.send-status.error {
  color: #ff6666;
}

.export-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: saturate(0) drop-shadow(0px 2px 0px #666) drop-shadow(0px 8px 0px #333) !important;
}

/* Make popup body scrollable for export UI */
.popup-body:has(.export-ui-wrapper) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.export-ui-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 10px;
  min-height: 0;
}

.export-section {
  margin-bottom: 20px;
}

/* Export section layout - centered content */
.export-section.main-export-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: center;
  align-items: center;
  gap: 25px;
  margin-bottom: 0;
  padding: 20px 0;
}

.export-congrats {
  font-family: 'home_videoregular', sans-serif;
  font-size: 18px;
  color: #ff69b4;
  text-align: center;
  margin: 0;
  letter-spacing: 1px;
  line-height: 1.5;
  text-shadow: 2px 2px 0 #3013a9;
  max-width: 100%;
}

.banner-name-group {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.btn-row.centered {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* Pixel-art style scrollbar */
.export-ui-wrapper::-webkit-scrollbar,
.popup-body::-webkit-scrollbar {
  width: 12px;
}

.export-ui-wrapper::-webkit-scrollbar-track,
.popup-body::-webkit-scrollbar-track {
  background: #0a0a0a;
  border: 2px solid #3013a9;
}

.export-ui-wrapper::-webkit-scrollbar-thumb,
.popup-body::-webkit-scrollbar-thumb {
  background: #3013a9;
  border: 2px solid #5a3fd9;
}

.export-ui-wrapper::-webkit-scrollbar-thumb:hover,
.popup-body::-webkit-scrollbar-thumb:hover {
  background: #5a3fd9;
}