@font-face {
  font-family: 'ChoretBubble';
  src: url('https://raw.githubusercontent.com/kynahpics4-ship-it/tff/c2817acfdf63b0b1957b32fc89ebcaa162391091/ChoretFudyngBubbleRegular-3zYPG.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

body {
  font-family: 'VT323', monospace;
  margin: 0;
  padding: 0;
  color: #f4eeff;
  overflow-x: hidden;
  background: #120c2c;
}

#balloon-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse farthest-corner at 20% 80%, rgba(44, 26, 84, 0.92) 0%, rgba(24, 18, 52, 0.9) 52%, rgba(18, 12, 44, 0.96) 100%),
    radial-gradient(circle at 28% 24%, rgba(105, 224, 255, 0.16) 0%, transparent 32%),
    radial-gradient(circle at 74% 22%, rgba(139, 108, 255, 0.16) 0%, transparent 30%),
    radial-gradient(circle at 78% 72%, rgba(209, 109, 255, 0.14) 0%, transparent 28%),
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 22px,
      rgba(111, 88, 180, 0.26) 22px,
      rgba(111, 88, 180, 0.26) 24px
    ),
    repeating-linear-gradient(
      to right,
      transparent 0px,
      transparent 22px,
      rgba(91, 205, 255, 0.2) 22px,
      rgba(91, 205, 255, 0.2) 24px
    ),
    linear-gradient(to bottom, rgba(255,255,255,0.03) 0%, transparent 12%, transparent 88%, rgba(0,0,0,0.18) 100%),
    #120c2c;
  backdrop-filter: blur(0.6px) saturate(1.08);
}

.doodle {
  position: absolute;
  font-family: 'Silkscreen', 'VT323', monospace;
  font-size: clamp(1rem, 2.8vw, 1.55rem);
  font-weight: 400;
  color: #9fdcff;
  white-space: nowrap;
  opacity: 0;
  overflow: hidden;
  border-right: 2px solid transparent;
  pointer-events: none;
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px rgba(105, 224, 255, 0.22);
  animation: handwriting 4s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.doodle::before {
  content: attr(data-text);
  position: absolute;
  width: 0;
  overflow: hidden;
  border-right: 2px solid #69e0ff;
  animation: writeText 4s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

@keyframes handwriting {
  0% { opacity: 0; transform: translateY(15px) translateX(10px) rotate(-2deg) scale(0.9); }
  12% { opacity: 1; transform: translateY(-2px) translateX(0) rotate(0deg) scale(1.02); }
  45%, 55% { transform: translateY(-1px) rotate(1deg) scale(1); }
  88% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translateY(-8px) translateX(-5px) rotate(1deg) scale(0.95); }
}

@keyframes writeText {
  0% { width: 0; }
  70% { width: 100%; }
  100% { width: 100%; }
}

.doodle-1 { top: 12%; left: 5%; color: #c8b6ff; font-size: clamp(1rem, 2.8vw, 1.45rem); transform: rotate(-8deg); animation-delay: 0s; }
.doodle-2 { top: 28%; right: 6%; color: #69e0ff; font-size: clamp(1rem, 3vw, 1.55rem); transform: rotate(5deg); animation-delay: 2.5s; }
.doodle-3 { top: 32%; left: 22%; color: #d16dff; transform: rotate(-5deg); animation-delay: 5s; }
.doodle-4 { bottom: 22%; right: 10%; color: #8b6cff; transform: rotate(6deg); animation-delay: 1s; }
.doodle-5 { bottom: 12%; left: 4%; color: #ffe66d; font-size: clamp(1rem, 3vw, 1.6rem); transform: rotate(-7deg); animation-delay: 3.8s; }
.doodle-6 { top: 6%; right: 15%; color: #b8a9e6; transform: rotate(9deg); animation-delay: 7s; }

@media (max-width: 480px) {
  .doodle-1 { left: 2%; top: 10%; }
  .doodle-2 { right: 2%; top: 26%; }
  .doodle-5 { left: 2%; bottom: 10%; }
  .doodle-6 { right: 8%; top: 4%; }
}

.pagedemo {
  min-height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  animation: fadeInPage 0.9s;
  position: relative;
  z-index: 1;
  padding: 24px;
}

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

.balloon-heading {
  font-family: 'Silkscreen', 'ChoretBubble', monospace;
  font-size: clamp(2rem, 8vw, 4.8rem);
  color: #c8b6ff;
  letter-spacing: 0.06em;
  text-align: center;
  margin: 0 0 0.13em 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  user-select: none;
  line-height: 1.15;
  max-width: 98vw;
  animation: breathe-bubble 2.9s infinite cubic-bezier(.75,0,.25,1);
  font-weight: 700;
  text-shadow:
    0 0 0 #000,
    0 0 12px rgba(139, 108, 255, 0.35),
    0 0 22px rgba(105, 224, 255, 0.18);
}

@keyframes breathe-bubble {
  0%,100% { transform: scale(1); }
  35% { transform: scale(1.09); }
  65% { transform: scale(1.04); }
}

.layout-page h1,
#layout-frames-page h1,
#layout-frames-page-4stacked h1,
#layout-frames-page-4grid h1 {
  font-family: 'Silkscreen', monospace;
  color: #69e0ff;
  letter-spacing: 0.05em;
  text-shadow: 0 0 10px rgba(105, 224, 255, 0.2);
}

.emoji-btn {
  background: #24164d;
  border: 2px solid #8b6cff;
  font-size: 2.1rem;
  cursor: pointer;
  padding: 6px 14px;
  color: #ffe66d;
  transition: transform 0.1s, color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
  margin: 0 2px;
  border-radius: 12px;
  outline: none;
  z-index: 2;
  box-shadow: 0 0 0 2px rgba(18, 12, 44, 0.7), 0 0 16px rgba(139, 108, 255, 0.16);
}

.emoji-btn:hover,
.emoji-btn:focus {
  color: #120c2c;
  background: #69e0ff;
  border-color: #c8b6ff;
  transform: scale(1.12);
  box-shadow: 0 0 18px rgba(105, 224, 255, 0.35);
}

.layout-selection {
  display: flex;
  gap: 18px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  justify-content: center;
}

.layout-option {
  border: 3px solid #8b6cff;
  border-radius: 14px;
  font-family: 'Silkscreen', monospace;
  font-size: 1rem;
  line-height: 1.8;
  padding: 12px 10px;
  background: #1d1444;
  color: #f4eeff;
  margin: 0 2px;
  transition: box-shadow 0.2s, border 0.2s, background 0.21s, transform 0.15s;
  box-shadow: 0 2px 8px rgba(18, 12, 44, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  min-height: 84px;
}

.layout-option:focus,
.layout-option:hover {
  background: #2c1d61;
  box-shadow: 0 0 0 4px rgba(105, 224, 255, 0.22), 0 0 18px rgba(105, 224, 255, 0.16);
  outline: none;
  border-color: #69e0ff;
  transform: translateY(-2px);
}

.layout-option.selected {
  box-shadow: 0 0 0 4px rgba(139, 108, 255, 0.45), 0 0 18px rgba(139, 108, 255, 0.2);
}

.frame-selection {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
  justify-content: center;
}

.frame,
.frame-4stacked,
.frame-4grid {
  cursor: pointer;
  border: 3px solid #8b6cff;
  border-radius: 16px;
  background: #1d1444;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 10px;
  margin-right: 6px;
  box-shadow: 0 2px 8px rgba(18, 12, 44, 0.35);
  transition: box-shadow 0.18s, border 0.18s, background 0.18s, transform 0.15s;
  min-width: clamp(100px, 22vw, 180px);
  min-height: clamp(80px, 18vw, 168px);
}

.frame.selected,
.frame-4stacked.selected,
.frame-4grid.selected {
  transform: scale(1.07);
  border: 3.5px solid #69e0ff;
  box-shadow: 0 4px 18px rgba(105, 224, 255, 0.3);
}

.frame img,
.frame-4stacked img,
.frame-4grid img {
  width: clamp(110px, 21vw, 180px);
  height: auto;
  display: block;
  border-radius: 13px;
}

#layout-frames-page-4grid,
#layout-frames-page-4grid .frame-selection {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  background: transparent !important;
}

#layout-frames-page-4grid .frame-4grid img {
  width: clamp(210px, 42vw, 320px);
  border-radius: 14px;
  box-shadow: 0 2px 16px rgba(105, 224, 255, 0.24), 0 0 0 rgba(0,0,0,0.18);
}

#layout-frames-page-4grid .frame-4grid {
  min-width: 210px;
  min-height: 128px;
  max-width: 320px;
  max-height: 240px;
  margin-bottom: 9px;
  margin-top: 0;
  background: #1d1444;
}

#layout-frames-page-4grid .frame-selection {
  gap: 24px !important;
}

.controls-single {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.video-container {
  position: relative;
  display: block;
  width: 95vw;
  max-width: 425px;
  aspect-ratio: 16 / 9;
  margin: 0 auto 10px;
  overflow: hidden;
  border-radius: 13px;
  background: #140f31;
  box-shadow: 0 10px 30px rgba(10, 8, 24, 0.5), 0 0 0 2px rgba(139, 108, 255, 0.22);
}

video,
#video-4stacked,
#video-4grid {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scaleX(-1);
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#camera-guide .center-box,
#camera-guide-4stacked .center-box,
#camera-guide-4grid .center-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 76%;
  aspect-ratio: 16/9;
  border: 2.5px dashed rgba(105, 224, 255, 0.82);
  border-radius: 13px;
  box-sizing: border-box;
  box-shadow: 0 0 14px 2px rgba(105, 224, 255, 0.34), 0 0 32px 4px rgba(209, 109, 255, 0.14);
  animation: guideGlow 1.2s infinite alternate;
  pointer-events: none;
}

@keyframes guideGlow {
  0% { box-shadow: 0 0 7px 2px rgba(105, 224, 255, 0.22), 0 0 32px 0px rgba(209, 109, 255, 0); }
  100% { box-shadow: 0 0 14px 2px rgba(105, 224, 255, 0.36), 0 0 32px 4px rgba(209, 109, 255, 0.12); }
}

#countdown-overlay,
#countdown-overlay-4stacked,
#countdown-overlay-4grid {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Silkscreen', monospace;
  font-size: 62px;
  color: #ffe66d;
  font-weight: bold;
  pointer-events: none;
  text-shadow: 0 0 10px rgba(255, 230, 109, 0.45), 2px 2px 0 rgba(0,0,0,0.55);
  display: none;
  z-index: 9;
}

.flash-overlay {
  position: absolute;
  inset: 0;
  background: #f8f2ff;
  opacity: 0;
  pointer-events: none;
  z-index: 8;
  transition: opacity 0.2s ease-out;
}

.flash-overlay.active {
  opacity: 0.9;
}

.instructions {
  font-family: 'VT323', monospace;
  font-size: 1.65em;
  letter-spacing: 0.02em;
  text-align: center;
  color: #f4eeff;
  background: rgba(29, 20, 68, 0.92);
  border-radius: 12px;
  border: 2px solid rgba(139, 108, 255, 0.5);
  margin-bottom: 10px;
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  padding: 8px 14px;
  display: block;
  box-shadow: 0 0 14px rgba(105, 224, 255, 0.08);
}

.strip img,
.strip-4stacked img,
.strip-4grid img {
  width: 34vw;
  max-width: 195px;
  min-width: 82px;
  height: auto;
  display: block;
  margin: 10px auto;
  border-radius: 14px;
  background: #1d1444;
  box-shadow: 0 12px 22px rgba(8, 6, 20, 0.45), 0 0 0 2px rgba(200, 182, 255, 0.16);
}

@media (max-width: 500px) {
  .strip img,
  .strip-4stacked img {
    width: 70vw;
    max-width: 165px;
    min-width: 70px;
    margin: 5px auto;
  }
}

.strip-4grid img {
  width: 76vw;
  max-width: 680px;
  min-width: 220px;
  margin: 18px auto;
  border-radius: 13px;
}

@media (max-width: 700px) {
  .strip-4grid img {
    width: 99vw;
    max-width: 400px;
    min-width: 100px;
    margin: 7px auto;
  }
}

.controls {
  display: flex;
  gap: 13px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 16px 0;
}

#progress-bar,
#progress-bar-4,
#progress-bar-4grid {
  height: 19px;
  width: 81%;
  background: #0f0a24;
  border-radius: 11px;
  overflow: hidden;
  margin-bottom: 13px;
  display: block;
  box-shadow: 0 0 0 2px rgba(139, 108, 255, 0.2), 0 0 8px rgba(8, 6, 20, 0.6);
}

#progress-fill,
#progress-fill-4,
#progress-fill-4grid {
  background: linear-gradient(90deg, #69e0ff, #8b6cff, #d16dff);
  width: 0;
  height: 100%;
  transition: width 0.4s;
  border-radius: 13px;
}

#qr-box,
#qr-box-4,
#qr-box-4grid {
  margin: 16px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 130px;
  font-family: 'VT323', monospace;
  font-size: 1.5rem;
  font-weight: 400;
  color: #c8b6ff;
}

.controls button,
.controls-single button {
  font-size: 1.9rem;
}

@media (max-width: 420px) {
  .layout-option {
    font-size: 0.9rem;
  }
}