/* ==========================================================================
   MON BOOTH — Hand-Drawn Sketch Photobooth Stylesheet
   Paper & fountain-pen ink palette · Phone, Tablet & Desktop responsive
   ========================================================================== */

:root {
  --paper: #FAF9F5;
  --paper-pure: #FFFFFF;
  --mat: #EEEAE0;
  --ink: #141413;
  --ink-muted: #5F5C54;
  --rule: #D6D1C6;
  --danger: #B93524;
  --curtain: #C43B2B;

  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-hand: 'Caveat', Georgia, cursive;

  --radius-sm: 4px;
  --radius-md: 8px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
}

button,
input {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.app-shell {
  width: 100%;
  max-width: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Header & Footer
   -------------------------------------------------------------------------- */

.site-header {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-mark {
  background: none;
  border: none;
  padding: 0;
}

.brand-box {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  border: 2px solid var(--ink);
  background: var(--paper-pure);
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.brand-mark:hover .brand-box {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}

.brand-mark:active .brand-box {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-text {
  background: none;
  border: none;
  padding: 6px 4px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: transparent;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.btn-text:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

.site-footer {
  margin-top: auto;
  padding: 16px 20px 22px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-muted);
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Reusable Tactile Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.15s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-ink {
  background: var(--ink);
  color: var(--paper-pure);
  box-shadow: 3px 3px 0 rgba(20, 20, 19, 0.28);
}

.btn-ink:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 rgba(20, 20, 19, 0.34);
}

.btn-ink:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(20, 20, 19, 0.25);
}

.btn-outline {
  background: var(--paper-pure);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}

.btn-outline:hover:not(:disabled) {
  background: var(--paper);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}

.btn-outline:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

.full-width-btn {
  width: 100%;
}

/* --------------------------------------------------------------------------
   Stage 1: Hand-Drawn Booth Entrance
   -------------------------------------------------------------------------- */

.view-landing {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px 28px;
}

.booth-sketch-stage {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.booth-drawing-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 640 / 460;
  user-select: none;
}

.booth-svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Live miniature featured strips overlay positioned inside the SVG glass display */
.featured-strips-overlay {
  position: absolute;
  left: 17.8%;
  top: 29.8%;
  width: 25.4%;
  height: 18.8%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  padding: 2px 3px;
  overflow: hidden;
}

.mini-showcase-strip {
  flex: 1 1 0;
  height: 100%;
  background: none;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.16s ease;
}

.mini-showcase-strip:hover {
  transform: rotate(0deg) scale(1.12);
  z-index: 2;
}

.mini-showcase-strip canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  border: 1px solid rgba(20, 20, 19, 0.35);
  box-shadow: 0 1px 2px rgba(20, 20, 19, 0.15);
}

/* Enter button centered cleanly over the curtain entrance on any screen width */
.booth-enter-anchor {
  position: absolute;
  left: 49.5%;
  top: 39%;
  width: 25.5%;
  height: 15%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.booth-enter-btn {
  pointer-events: auto;
  min-height: 36px;
  padding: 6px 12px;
  white-space: nowrap;
  background: var(--paper-pure);
  color: var(--ink);
  border: 2px solid var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 1.9vw, 0.94rem);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 0.12s ease, background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.booth-enter-btn:hover {
  background: var(--ink);
  color: var(--paper-pure);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 rgba(20, 20, 19, 0.35);
}

.booth-enter-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

.booth-coin-btn {
  position: absolute;
  left: 23.2%;
  top: 63.2%;
  width: 5.8%;
  height: 16%;
  background: transparent;
  border: none;
}

.coin-toast {
  position: absolute;
  left: 20%;
  top: 57%;
  background: var(--ink);
  color: var(--paper-pure);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 3px 7px;
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.coin-toast.is-visible {
  opacity: 1;
  transform: translateY(-4px);
}

.landing-caption {
  text-align: center;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.landing-lead {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.landing-quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Stage 2: Studio Workbench
   -------------------------------------------------------------------------- */

.view-studio {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 4px 16px 24px;
  box-sizing: border-box;
}

@media (max-width: 520px) {
  .view-studio {
    padding: 2px 10px 20px;
  }
}

.sketch-panel {
  background: var(--paper-pure);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 3px 3px 0 rgba(20, 20, 19, 0.1);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 520px) {
  .sketch-panel {
    padding: 13px 11px;
    border-radius: var(--radius-sm);
  }
}

/* Mobile 3-step bar (shown < 900px) */
.mobile-step-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 899px) {
  .mobile-step-bar {
    position: sticky;
    top: 0;
    z-index: 25;
    background: var(--paper);
    padding: 6px 0 8px;
    margin-bottom: 8px;
  }
}

.step-tab {
  min-height: 42px;
  padding: 6px 4px;
  background: var(--paper-pure);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: clamp(0.68rem, 2.3vw, 0.76rem);
  font-weight: 700;
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  box-sizing: border-box;
}

.step-tab.is-active {
  border-color: var(--ink);
  border-width: 2px;
  color: var(--ink);
  background: var(--paper-pure);
  box-shadow: 2px 2px 0 var(--ink);
}

.step-count {
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--mat);
  flex-shrink: 0;
}

.studio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.studio-col {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Mobile visibility rules for stepped workflow */
@media (max-width: 899px) {
  .studio-col {
    display: none;
  }
  .studio-col.is-mobile-active {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .view-studio[data-mobile-step="style"] .export-block {
    display: none;
  }
  .view-studio[data-mobile-step="save"] .style-controls-card > .control-block {
    display: none;
  }
  .view-studio[data-mobile-step="save"] .strip-preview-mat {
    max-height: none;
  }
}

@media (min-width: 900px) {
  .mobile-step-bar,
  .mobile-next-wrap {
    display: none;
  }

  .studio-grid {
    grid-template-columns: minmax(380px, 1.05fr) minmax(440px, 1.25fr);
    align-items: start;
    gap: 20px;
  }
}

/* --------------------------------------------------------------------------
   Left Panel: Camera & Upload
   -------------------------------------------------------------------------- */

.panel-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper);
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 8px 14px;
  min-height: 38px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.seg-btn.is-active {
  background: var(--ink);
  color: var(--paper-pure);
}

.segmented-sm .seg-btn {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 0.72rem;
}

.top-right-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-demo {
  color: var(--ink);
}

/* Viewfinder */
.viewfinder-box {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 58dvh;
  margin: 0 auto;
  background: #171615;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewfinder-box.is-square {
  aspect-ratio: 1 / 1;
  max-width: 440px;
}

#camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.18s ease;
}

#camera-video.is-mirrored {
  transform: scaleX(-1);
}

.vf-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
  z-index: 3;
}
.vf-tl { top: 10px; left: 10px; border-top: 2px solid rgba(255, 255, 255, 0.75); border-left: 2px solid rgba(255, 255, 255, 0.75); }
.vf-tr { top: 10px; right: 10px; border-top: 2px solid rgba(255, 255, 255, 0.75); border-right: 2px solid rgba(255, 255, 255, 0.75); }
.vf-bl { bottom: 10px; left: 10px; border-bottom: 2px solid rgba(255, 255, 255, 0.75); border-left: 2px solid rgba(255, 255, 255, 0.75); }
.vf-br { bottom: 10px; right: 10px; border-bottom: 2px solid rgba(255, 255, 255, 0.75); border-right: 2px solid rgba(255, 255, 255, 0.75); }

.vf-hud-top {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 4;
}

.vf-pill {
  background: rgba(20, 20, 19, 0.72);
  color: #FAF9F5;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

/* Live Pose-Along reference picture floating neatly in viewfinder corner */
.pose-guide-pip {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  width: clamp(92px, 24%, 134px);
  padding: 4px;
  background: var(--paper-pure);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: 2px 2px 0 var(--ink);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: width 0.16s ease;
}

.pose-guide-pip[hidden] {
  display: none;
}

.pose-guide-pip.is-expanded {
  width: clamp(148px, 40%, 210px);
}

.pose-guide-pip canvas {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid rgba(20, 20, 19, 0.25);
}

.pose-guide-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.countdown-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 19, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
}

.countdown-overlay[hidden] {
  display: none;
}

.countdown-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(3.5rem, 12vw, 6rem);
  color: #FFFFFF;
  text-shadow: 0 3px 0 rgba(20, 20, 19, 0.65);
}

.flash-curtain {
  position: absolute;
  inset: 0;
  background: #FFFFFF;
  opacity: 0;
  pointer-events: none;
  z-index: 7;
}

.flash-curtain.is-flashing {
  animation: boothFlash 0.32s ease-out;
}

@keyframes boothFlash {
  0% { opacity: 0.96; }
  100% { opacity: 0; }
}

.camera-overlay-state {
  position: absolute;
  inset: 0;
  background: var(--paper);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  z-index: 5;
}

.camera-overlay-state[hidden] {
  display: none;
}

.camera-state-title {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
}

.camera-state-desc {
  margin: 0;
  max-width: 340px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink-muted);
}

.camera-state-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}

/* Camera Controls */
.camera-controls {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cam-toggles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.chip-btn {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 6px 4px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: clamp(0.68rem, 2.3vw, 0.76rem);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.chip-btn.is-pressed {
  background: var(--mat);
  font-weight: 700;
}

.shutter-row {
  display: flex;
  gap: 8px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.shutter-main-btn {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  font-size: clamp(0.78rem, 2.6vw, 0.88rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 10px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.shutter-single-btn {
  flex: 0 0 auto;
  min-height: 48px;
  font-size: clamp(0.78rem, 2.6vw, 0.85rem);
  white-space: nowrap;
  padding: 10px 12px;
}

.shutter-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--curtain);
  border: 1.5px solid var(--paper-pure);
}

/* Upload Dropzone */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  min-height: 220px;
  padding: 24px;
  background: var(--paper);
  border: 2px dashed var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  background: var(--mat);
}

.dropzone-icon {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
}

.dropzone-title {
  font-weight: 700;
  font-size: 0.98rem;
}

.dropzone-sub {
  font-size: 0.84rem;
  color: var(--ink-muted);
}

/* Strip Frames Tray */
.slots-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1.5px solid var(--rule);
}

.slots-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.section-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.slots-hint {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.slots-tray {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.slot-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  min-width: 0;
  background: var(--paper);
  border: 2px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.slot-thumb.is-selected {
  border-color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}

.slot-thumb canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.slot-empty-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.slot-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(20, 20, 19, 0.78);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
}

/* Inline Slot Editor */
.slot-editor {
  margin-top: 12px;
  padding: 12px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
}

.slot-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.slot-editor-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-mini {
  min-height: 32px;
  padding: 4px 9px;
  background: var(--paper-pure);
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.btn-mini-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.slot-sliders {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 520px) {
  .slot-sliders {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.slider-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
}

.slider-field input[type='range'] {
  width: 100%;
  accent-color: var(--ink);
}

.mobile-next-wrap,
.mobile-to-save-wrap {
  margin-top: 14px;
}

@media (min-width: 900px) {
  .mobile-to-save-wrap {
    display: none;
  }
}

@media (max-width: 899px) {
  .view-studio:not([data-mobile-step="style"]) .mobile-to-save-wrap {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Right Panel: Live Strip Preview & Customization
   -------------------------------------------------------------------------- */

.style-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

@media (min-width: 1120px) {
  .style-layout {
    grid-template-columns: 230px 1fr;
    align-items: start;
  }
  .strip-preview-mat {
    position: sticky;
    top: 14px;
  }
}

.strip-preview-mat {
  background: var(--mat);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.strip-canvas-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

#strip-preview-canvas {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 70dvh;
  height: auto;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(20, 20, 19, 0.16);
}

@media (max-width: 899px) {
  #strip-preview-canvas {
    max-height: 44dvh;
  }
}

.preview-note {
  margin: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-muted);
}

.style-controls-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.control-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

/* Template selector cards */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (min-width: 560px) and (max-width: 899px) {
  .template-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

.tpl-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--paper);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  text-align: left;
  min-height: 48px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.tpl-card:hover {
  border-color: var(--ink);
}

.tpl-card.is-selected {
  background: var(--paper-pure);
  border-color: var(--ink);
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--ink);
}

.tpl-mini-thumb {
  width: 26px;
  height: 52px;
  flex: 0 0 auto;
  border: 1px solid rgba(20, 20, 19, 0.25);
  background: #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tpl-mini-thumb canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.tpl-meta {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.tpl-name {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tpl-sub {
  font-size: 0.67rem;
  color: var(--ink-muted);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Paper swatches */
.paper-swatches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 330px) {
  .paper-swatches {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  }
}

.paper-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 38px;
  padding: 4px 6px;
  background: var(--paper);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: clamp(0.64rem, 2.2vw, 0.72rem);
  width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.paper-chip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paper-chip.is-selected {
  border-color: var(--ink);
  border-width: 2px;
  background: var(--paper-pure);
  font-weight: 700;
}

.paper-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(20, 20, 19, 0.4);
  flex-shrink: 0;
}

/* Filter swatches */
.filter-row {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding: 4px 2px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  box-sizing: border-box;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 64px;
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 6px 3px;
  background: var(--paper);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  box-sizing: border-box;
}

.filter-chip span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.filter-chip.is-selected {
  border-color: var(--ink);
  border-width: 2px;
  background: var(--paper-pure);
  font-weight: 700;
  box-shadow: 2px 2px 0 var(--ink);
}

.filter-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
}

/* Strip Details */
.details-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.text-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-caption {
  font-size: 0.76rem;
  color: var(--ink-muted);
}

.text-field input[type='text'] {
  min-height: 40px;
  padding: 8px 10px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.toggles-pair {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 5px 10px;
  background: var(--paper);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
}

.check-pill input {
  accent-color: var(--ink);
  width: 16px;
  height: 16px;
}

.check-pill-sm {
  min-height: 30px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.duet-pack-block {
  padding: 10px 12px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
}

.duet-pack-block[hidden],
.custom-duet-row[hidden] {
  display: none;
}

.custom-duet-row {
  margin-top: 4px;
}

/* Export area */
.export-block {
  padding-top: 12px;
  border-top: 1.5px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-hint {
  margin: 0;
  min-height: 18px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-muted);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Modals (Full-Size Print Chute & FAQ)
   -------------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 19, 0.56);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 40;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--paper-pure);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: 5px 5px 0 var(--ink);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1rem;
}

.modal-preview-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.modal-tab-btn {
  flex: 1;
  padding: 7px 10px;
  background: var(--paper-warm);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 2px 2px 0 var(--ink);
}

.modal-tab-btn:hover {
  background: var(--paper-pure);
  transform: translateY(-1px);
}

.modal-tab-btn.is-active {
  background: var(--ink);
  color: var(--paper-pure);
  box-shadow: none;
  transform: translate(1px, 1px);
}

.print-slot-chute {
  background: var(--mat);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chute-lip {
  width: 80%;
  height: 7px;
  background: var(--ink);
  border-radius: 3px;
  margin-bottom: 10px;
}

.printed-img-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  animation: stripPrintOut 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes stripPrintOut {
  from {
    opacity: 0.2;
    transform: translateY(-28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#printed-strip-img,
#printed-gif-img,
#printed-video-el {
  max-width: 240px;
  width: 100%;
  max-height: 58dvh;
  object-fit: contain;
  display: block;
  box-shadow: 0 4px 12px rgba(20, 20, 19, 0.2);
}

#printed-strip-img[hidden],
#printed-gif-img[hidden],
#printed-video-el[hidden] {
  display: none !important;
}

.print-mobile-tip {
  margin: 12px 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-muted);
  text-align: center;
}

.modal-foot-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
}

@media (min-width: 480px) {
  .modal-foot-actions {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }
}

.faq-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.faq-body p {
  margin: 0;
}

.faq-body code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--mat);
  padding: 2px 5px;
  border-radius: 3px;
}

/* --------------------------------------------------------------------------
   Studio Backdrop Grid
   -------------------------------------------------------------------------- */

.backdrop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .backdrop-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
}

@media (max-width: 350px) {
  .backdrop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.backdrop-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 5px 3px;
  background: var(--paper);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  min-height: 54px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
  transition: border-color 0.12s ease;
}

.backdrop-tile:hover {
  border-color: var(--ink);
}

.backdrop-tile.is-selected {
  border-color: var(--ink);
  border-width: 2px;
  background: var(--paper-pure);
  box-shadow: 2px 2px 0 var(--ink);
}

.backdrop-swatch {
  width: 100%;
  height: 26px;
  border-radius: 2px;
  border: 1px solid rgba(20, 20, 19, 0.25);
  flex-shrink: 0;
}

.backdrop-name {
  font-family: var(--font-mono);
  font-size: clamp(0.52rem, 1.8vw, 0.62rem);
  font-weight: 700;
  text-align: center;
  line-height: 1.15;
  color: var(--ink);
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backdrop-status {
  margin: 0;
  min-height: 14px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-muted);
}

/* --------------------------------------------------------------------------
   Instagram Creator Links & Follow Popup (mysketchbooth.com style)
   -------------------------------------------------------------------------- */

.ig-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.ig-pill-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper-pure);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  box-shadow: 1.5px 1.5px 0 var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.ig-pill-link:hover {
  transform: translate(-1px, -1px);
  box-shadow: 2.5px 2.5px 0 var(--ink);
}

.footer-ig-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink);
  text-decoration: none;
}

.footer-ig-link:hover strong {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.booth-made-by {
  position: absolute;
  left: 12.5%;
  bottom: 1.2%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-muted);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: clamp(0.58rem, 1.5vw, 0.74rem);
  padding: 2px 4px;
}

.booth-made-by:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Follow Prompt Modal */
.follow-modal-card {
  max-width: 440px;
  width: 92vw;
  background: var(--paper-pure, #ffffff);
  border: 2px solid var(--ink, #141413);
  border-radius: 0;
  padding: 22px 22px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.follow-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  padding: 0;
  border-bottom: none;
}

.follow-modal-head h2 {
  font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink, #141413);
  letter-spacing: -0.01em;
  margin: 0;
}

.follow-close-x {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0;
  margin: -8px -8px 0 0;
  background: transparent;
  border: none;
  color: var(--ink, #141413);
  cursor: pointer;
  opacity: 0.75;
  text-decoration: none !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.follow-close-x:hover,
.follow-close-x:active {
  opacity: 1;
  transform: scale(1.1);
  text-decoration: none !important;
}

.follow-lead {
  margin: 0 0 16px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #222222;
  font-weight: 400;
}

.follow-inline-link {
  color: var(--ink, #141413);
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.12s ease;
}

.follow-inline-link:hover {
  opacity: 0.75;
}

.ig-profile-card {
  display: block;
  text-decoration: none;
  color: var(--ink, #141413);
  border: 1px solid #e2e4e8;
  border-radius: 2px;
  padding: 14px 14px 12px;
  background: #ffffff;
  margin-bottom: 16px;
  cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.ig-profile-card:hover {
  border-color: #a8a8a8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ig-profile-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
  position: relative;
}

.ig-avatar-wrapper {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  overflow: hidden;
  background: #f0f0f0;
  flex: 0 0 58px;
  border: 1px solid rgba(20, 20, 19, 0.08);
}

.ig-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ig-profile-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.35;
  padding-top: 1px;
}

.ig-meta-username {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink, #141413);
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.ig-meta-display {
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--ink, #141413);
  margin-bottom: 3px;
}

.ig-meta-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.86rem;
  color: #555555;
  line-height: 1.3;
}

.ig-meta-stats span {
  white-space: nowrap;
}

.ig-meta-bullet {
  font-weight: 700;
  color: #777777;
}

.ig-logo-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.ig-color-mark {
  width: 28px;
  height: 28px;
  display: block;
}

.ig-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  background: #ffffff;
  overflow: hidden;
}

.ig-preview-grid.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.ig-preview-grid.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.ig-preview-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #f4f4f4;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ig-tile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.15s ease;
}

.ig-profile-card:hover .ig-tile-img {
  opacity: 0.95;
}

.ig-carousel-icon {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px;
  height: 16px;
  color: #ffffff;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.ig-carousel-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.follow-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 14px;
}

#follow-later-btn {
  min-height: 44px;
  width: 100%;
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink, #141413);
  background: var(--paper-pure, #ffffff);
  border: 2px solid var(--ink, #141413);
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 2px 2px 0 var(--ink, #141413);
  transition: background 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

#follow-later-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink, #141413);
}

#follow-later-btn:hover {
  background: var(--paper, #faf9f5);
}

@media (max-width: 520px) {
  .site-header {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .brand-box {
    font-size: 0.82rem;
    padding: 5px 8px;
  }
  .header-actions {
    gap: 8px;
  }
  .ig-pill-link {
    font-size: 0.68rem;
    padding: 4px 7px;
  }
  .follow-actions {
    justify-content: stretch;
  }
  .follow-actions .btn {
    flex: 1 1 auto;
  }
}
