@font-face {
  font-family: "OrbitronLocal";
  src: url("./orbitron_variable.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "BangersLocal";
  src: url("./bangers.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "JanuaryLocal";
  src: url("./january_strike.otf") format("opentype");
  font-display: swap;
}

:root {
  --topbar-height: 60px;
  --primary: #ff2d55;
  --primary-soft: #ff4d6d;
  --secondary: #2da8ff;
  --secondary-soft: #6bcbff;
  --primary-rgb: 255, 45, 85;
  --primary-soft-rgb: 255, 77, 109;
  --secondary-rgb: 45, 168, 255;
  --secondary-soft-rgb: 107, 203, 255;
  --background: #0b0c12;
  --surface: #12141d;
  --surface-variant: #1b1e2a;
  --text: #f5f7fa;
  --muted: #b9c0d4;
  --ok: #39e2a2;
  --error: #ff8096;
  --font-main: "OrbitronLocal", "Orbitron", "Segoe UI", system-ui, sans-serif;
  --font-display: "BangersLocal", "JanuaryLocal", "OrbitronLocal", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: -webkit-fill-available;
  margin: 0;
  overflow: hidden;
}

body {
  background: #08090f;
  color: var(--text);
  font-family: var(--font-main);
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: url("./default_home_bg.webp") center / cover no-repeat;
  pointer-events: none;
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform, background-image;
}

body.background-disabled .app-bg {
  background-image: none !important;
  background: #05060b;
}

.app-bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(8, 10, 18, 0.3), rgba(8, 10, 18, 0.8)),
    radial-gradient(circle at 20% 8%, rgba(255, 45, 85, 0.24), transparent 32%),
    radial-gradient(circle at 84% 14%, rgba(45, 168, 255, 0.2), transparent 28%);
  pointer-events: none;
}

.app-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  z-index: 16;
  display: grid;
  grid-template-columns: 72px 1fr 64px;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: linear-gradient(180deg, rgba(8, 10, 18, 0.72), rgba(8, 10, 18, 0));
}

.app-top-actions {
  grid-column: 2;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-left-spacer {
  width: 100%;
  height: 100%;
}

#collagePickerTopHomeBtn {
  justify-self: center;
}

.title-wrap {
  min-height: 24px;
}

.secret-hotspot {
  justify-self: end;
  width: 54px;
  height: 54px;
  border: none;
  border-radius: 10px;
  background: transparent;
  opacity: 0;
  cursor: pointer;
}

.kiosk-service-hotspot {
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + 10px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  width: 72px;
  height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 18px;
  background-color: rgba(12, 18, 28, 0.56);
  background-image: var(--kiosk-service-icon-url, url("app_logo.webp"));
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  opacity: 0.96;
  z-index: 130;
  cursor: pointer;
  pointer-events: none;
  touch-action: manipulation;
}

.app-main {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: 100vw;
  height: calc(100dvh - var(--topbar-height));
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  overflow: hidden;
  contain: layout paint;
}

.glass-panel {
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(18, 20, 29, 0.86), rgba(12, 15, 25, 0.78));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: opacity, transform;
}

.hidden {
  display: none !important;
}

.app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 10, 16, 0.56);
  backdrop-filter: blur(4px);
}

.app-loading-card {
  width: min(540px, 100%);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(165deg, rgba(20, 23, 36, 0.84), rgba(var(--primary-rgb), 0.14));
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42);
  padding: 18px 18px 16px;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.app-loading-spinner {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(var(--primary-rgb), 0.95);
  animation: app-loader-spin 0.9s linear infinite;
}

.app-loading-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 32px);
  line-height: 0.96;
  color: #fff;
}

.app-loading-detail {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(13px, 1.7vw, 18px);
  line-height: 1.18;
}

.app-loading-phase {
  margin: 0;
  color: rgba(var(--secondary-rgb), 0.95);
  font-size: clamp(12px, 1.5vw, 16px);
  letter-spacing: 0.02em;
  font-weight: 700;
}

@keyframes app-loader-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

input,
textarea,
select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 11, 19, 0.9);
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.neon-btn,
.soft-btn {
  border-radius: 13px;
  cursor: pointer;
  touch-action: manipulation;
}

.neon-btn {
  border: 2px solid rgba(var(--primary-rgb), 0.92);
  background: linear-gradient(145deg, rgba(var(--primary-rgb), 0.34), rgba(var(--secondary-rgb), 0.24));
  color: #fff;
  padding: 10px 14px;
  box-shadow: 0 0 18px rgba(var(--primary-rgb), 0.32);
}

.soft-btn {
  border: 1px solid rgba(var(--primary-rgb), 0.55);
  background: linear-gradient(165deg, rgba(20, 23, 36, 0.78), rgba(var(--primary-rgb), 0.16));
  box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.2);
  color: var(--text);
  padding: 9px 12px;
}

.soft-btn.small {
  font-size: 12px;
  padding: 7px 10px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.message {
  display: none !important;
}

.message.ok {
  color: var(--ok);
}

.message.error {
  color: var(--error);
}

.orientation-guard {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 8, 14, 0.92);
  backdrop-filter: blur(4px);
}

.orientation-guard-card {
  width: min(520px, 100%);
  border-radius: 16px;
  border: 1px solid rgba(var(--primary-rgb), 0.45);
  background: rgba(8, 16, 27, 0.96);
  padding: 16px;
  text-align: center;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.36);
}

.orientation-guard-card h3 {
  margin: 0 0 8px;
  font-size: clamp(20px, 4vw, 30px);
  font-family: var(--font-display);
}

.orientation-guard-card p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(14px, 3.4vw, 18px);
}

body.orientation-blocked .app-main,
body.orientation-blocked .app-top {
  pointer-events: none;
}

#uxStatusBar {
  display: none !important;
}

body.with-ux-status {
  padding-top: 0 !important;
}

body.device-mobile .capture-badge {
  font-size: 10px;
  padding: 3px 6px;
}

body.device-mobile .home-mode-card strong,
body.device-mobile .choice-simple strong {
  font-size: clamp(18px, 4.8vw, 30px);
}

body.device-mobile .home-actions .soft-btn,
body.device-mobile #galleryBtn,
body.device-mobile #modeBackBtn,
body.device-mobile #videoFunBackBtn,
body.device-mobile #galleryBackBtn,
body.device-mobile #collagePickerTopHomeBtn,
body.device-mobile #collagePickerTopBackBtn {
  min-height: 46px;
  font-size: 14px;
}

body.device-mobile .capture-trigger-btn {
  width: clamp(64px, 16vw, 90px);
  height: clamp(64px, 16vw, 90px);
}

body.device-mobile .capture-footer .capture-stop-btn {
  width: 78px;
  height: 78px;
  min-width: 78px;
  border-radius: 999px;
  padding: 0;
  gap: 0;
  right: calc(env(safe-area-inset-right, 0px) + 10px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  font-size: 0;
}

body.device-mobile .capture-footer .capture-stop-btn::before {
  content: "STOP";
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.6px;
  color: #fff;
  text-shadow: 0 0 10px rgba(var(--primary-rgb), 0.55);
}

body.device-mobile .capture-footer .capture-stop-icon,
body.device-mobile .capture-footer .capture-stop-label {
  display: none;
}

body.device-tablet .capture-badge {
  font-size: 13px;
}

body.device-tablet .home-actions .soft-btn {
  min-height: 54px;
  font-size: 15px;
}

body.touch-device .app-main {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

body.touch-device #homePanel,
body.touch-device #modePanel,
body.touch-device #videoFunPanel,
body.touch-device #galleryPanel,
body.touch-device #collagePickerPanel {
  overflow: auto;
}

body.touch-device .mode-grid,
body.touch-device .choice-grid,
body.touch-device .video-fun-grid {
  overflow: visible;
  height: auto;
  align-content: start;
}

body.touch-device .gallery-panel {
  overflow: auto;
}

body.touch-device .gallery-grid {
  overflow: auto;
  grid-template-rows: none;
  align-content: start;
}

body.touch-device #collagePickerPanel {
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

body.touch-device .collage-picker-grid {
  overflow: hidden;
  -webkit-overflow-scrolling: auto;
}

body.device-mobile .mode-icon {
  width: clamp(40px, 10vw, 62px);
}

body.device-mobile .choice-note {
  font-size: clamp(10px, 2.4vw, 12px);
}

.secret-sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.secret-sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ffb347;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.secret-sync-indicator.sync-ok .secret-sync-dot {
  background: #2de38f;
}

.secret-sync-indicator.sync-pending .secret-sync-dot {
  background: #ffb347;
}

.secret-sync-indicator.sync-error .secret-sync-dot {
  background: #ff5f5f;
}

/* Login */
#loginPanel {
  width: min(860px, 100%);
  margin: auto;
  padding: 18px;
  display: grid;
  gap: 10px;
}

#loginPanel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 4.2vw, 46px);
  line-height: 0.95;
  letter-spacing: 0.5px;
}

#loginPanel p {
  margin: 0;
  color: var(--muted);
}

.login-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

/* Home + mode */
#homePanel,
#modePanel,
#videoFunPanel {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  overflow: hidden;
}

#homePanel.glass-panel,
#modePanel.glass-panel,
#videoFunPanel.glass-panel {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.home-head {
  display: grid;
  gap: 4px;
  position: relative;
  z-index: 12;
}

#homePanel .home-head,
#modePanel .home-head,
#videoFunPanel .home-head {
  display: none !important;
}

.home-head h2 {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(28px, 4.6vw, 56px);
  line-height: 0.95;
  letter-spacing: 0.6px;
  text-shadow: 0 0 18px rgba(45, 168, 255, 0.3);
}

.home-head p {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.mode-grid,
.choice-grid,
.video-fun-grid {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 12px;
  padding: clamp(4px, 0.9vw, 10px);
  align-items: center;
  align-content: center;
  overflow: hidden;
  position: relative;
  z-index: 3;
}

.mode-grid.single-choice,
.choice-grid.single-choice,
.video-fun-grid.single-choice {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}

#homePanel .mode-grid {
  margin-top: 0;
}

.mode-card,
.choice-card {
  min-height: 0;
  height: 100%;
  aspect-ratio: 1 / 1;
  width: auto;
  max-width: 100%;
  place-self: center;
  border-radius: 20px;
  padding: clamp(10px, 2.2vw, 24px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(8, 10, 16, 0.42);
  color: #fff;
  cursor: pointer;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 10px 18px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  position: relative;
  z-index: 5;
  pointer-events: auto;
  touch-action: manipulation;
  min-width: 0;
}

@media (pointer: coarse) {
  .soft-btn,
  .neon-btn,
  .home-btn,
  .switch-camera-btn {
    min-height: 48px;
  }

  .soft-btn.small {
    min-height: 44px;
    font-size: 14px;
    padding: 10px 12px;
  }

  .home-actions .soft-btn,
  #galleryBtn,
  #modeBackBtn,
  #videoFunBackBtn,
  #galleryBackBtn,
  #collagePickerTopHomeBtn,
  #collagePickerTopBackBtn {
    min-height: 92px;
  }

  .capture-trigger-btn {
    width: min(180px, 36vw);
    height: min(180px, 36vw);
  }
}

.mode-card::before,
.choice-card::before {
  content: "";
  position: absolute;
  inset: auto -45% -48% auto;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2), transparent 66%);
  pointer-events: none;
}

.mode-card.photo,
.choice-card.choice-simple {
  border-color: rgba(var(--primary-rgb), 0.95);
  box-shadow: 0 0 30px rgba(var(--primary-rgb), 0.28), inset 0 0 0 1px rgba(var(--primary-rgb), 0.5);
}

.mode-card.video,
.choice-card.choice-fun {
  border-color: rgba(var(--secondary-rgb), 0.95);
  box-shadow: 0 0 30px rgba(var(--secondary-rgb), 0.28), inset 0 0 0 1px rgba(var(--secondary-rgb), 0.5);
}

.choice-card.choice-gif {
  border-color: rgba(var(--secondary-soft-rgb), 0.95);
  box-shadow: 0 0 30px rgba(var(--secondary-soft-rgb), 0.22), inset 0 0 0 1px rgba(var(--secondary-soft-rgb), 0.45);
}

.choice-card.choice-boomerang {
  border-color: rgba(255, 211, 92, 0.95);
  box-shadow: 0 0 30px rgba(255, 211, 92, 0.24), inset 0 0 0 1px rgba(255, 211, 92, 0.45);
}

.home-mode-card strong,
.choice-simple strong {
  margin: 0;
  width: calc(100% - clamp(16px, 3vw, 36px));
  margin-inline: auto;
  font-family: var(--font-display);
  font-size: clamp(24px, 4.6vw, 72px);
  line-height: 0.92;
  max-width: 100%;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  white-space: normal;
  text-wrap: balance;
}

#modePanel .choice-simple strong,
#videoFunPanel .choice-simple strong {
  width: calc(100% - clamp(18px, 4vw, 44px));
  margin-inline: auto;
  font-size: clamp(26px, 4.9vw, 78px);
  line-height: 0.92;
}

#videoFunInstructionBtn strong,
#videoFunBoomerangBtn strong {
  white-space: nowrap !important;
  text-wrap: nowrap !important;
  letter-spacing: -0.02em;
  font-size: clamp(22px, 4vw, 58px);
}

.mode-card strong,
.choice-card strong,
.soft-btn,
.neon-btn,
.home-btn,
.switch-camera-btn {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.mode-icon {
  width: clamp(74px, 14vw, 170px);
  max-width: calc(100% - clamp(22px, 4vw, 48px));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.mode-icon svg {
  width: 100%;
  height: auto;
}

.mode-icon-photo {
  color: var(--primary-soft);
  filter: drop-shadow(0 0 14px rgba(var(--primary-rgb), 0.55));
}

.mode-icon-video {
  color: var(--secondary-soft);
  filter: drop-shadow(0 0 14px rgba(var(--secondary-rgb), 0.55));
}

.choice-note {
  display: block;
  max-width: calc(100% - 12px);
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(11px, 1.4vw, 16px);
  line-height: 1.12;
  text-align: center;
  overflow: hidden;
}

.choice-note-placeholder {
  visibility: hidden;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  position: relative;
  z-index: 3;
}

.home-actions .soft-btn {
  width: 100%;
  min-height: 44px;
}

body.kiosk-exe-mode #homeActions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#galleryBtn,
#modeBackBtn,
#videoFunBackBtn,
#galleryBackBtn,
#collagePickerTopHomeBtn,
#collagePickerTopBackBtn {
  min-height: 88px;
  font-size: 24px;
  padding: 14px 20px;
  border-radius: 16px;
  font-weight: 700;
}

/* Gallery */
.gallery-panel {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(180deg, rgba(8, 10, 18, 0.2), rgba(8, 10, 18, 0.14));
  backdrop-filter: blur(2px);
}

body.kiosk-exe-mode .gallery-panel {
  position: relative;
}

.gallery-topbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
}

#galleryBackBtn {
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.96), rgba(var(--secondary-rgb), 0.92));
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: 0 10px 24px rgba(var(--primary-rgb), 0.32);
}

#galleryBackBtn:hover,
#galleryBackBtn:focus-visible {
  filter: brightness(1.08);
}

.gallery-show-qr-btn {
  min-height: 56px;
  font-size: clamp(16px, 1.8vw, 22px);
  font-weight: 700;
  padding: 12px 18px;
}

#galleryShowQrBtn {
  display: none;
}

body.kiosk-exe-mode #galleryShowQrBtn {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

body.kiosk-exe-mode #galleryShowQrBtn.hidden {
  display: inline-flex !important;
}

.gallery-qr-reveal {
  display: grid;
  place-items: center;
  padding: 10px 0 4px;
}

body.kiosk-exe-mode .gallery-qr-reveal {
  position: absolute;
  inset: 0;
  z-index: 120;
  padding: 14px;
  margin: 0;
  border-radius: inherit;
  background: rgba(6, 10, 16, 0.78);
  backdrop-filter: blur(4px);
}

.gallery-qr-reveal-card {
  width: min(940px, 100%);
  border-radius: 16px;
  border: 1px solid rgba(var(--secondary-rgb), 0.55);
  background: linear-gradient(165deg, rgba(12, 17, 28, 0.92), rgba(9, 13, 22, 0.95));
  box-shadow: 0 0 24px rgba(var(--secondary-rgb), 0.22);
  padding: 14px;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.gallery-qr-reveal-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gallery-qr-reveal-title {
  margin: 0;
  font-size: clamp(15px, 1.6vw, 22px);
  font-weight: 700;
  color: #fff;
}

.gallery-qr-countdown {
  min-width: 64px;
  text-align: center;
  border-radius: 999px;
  border: 1px solid rgba(var(--primary-rgb), 0.7);
  background: rgba(var(--primary-rgb), 0.2);
  color: #fff;
  font-weight: 800;
  font-size: clamp(15px, 1.4vw, 20px);
  line-height: 1;
  padding: 8px 10px;
}

.gallery-qr-reveal-card a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: #fff;
}

.gallery-fake-qr {
  flex: 0 0 auto;
  width: 78px;
  height: 78px;
  display: block;
  object-fit: contain;
  border-radius: 6px;
  border: 0;
  background: #ffffff;
  box-shadow: none;
}

.gallery-fake-qr-large {
  width: min(46vw, 360px);
  height: min(46vw, 360px);
}

.gallery-qr-text {
  margin: 0;
  font-size: clamp(13px, 1.3vw, 18px);
  line-height: 1.2;
  color: #fff;
  text-align: center;
}

.gallery-qr-actions {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gallery-grid {
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.1vw, 16px);
  padding: clamp(6px, 0.9vw, 10px);
  align-content: stretch;
}

.gallery-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 0 0;
  background: rgba(8, 12, 20, 0.14);
  border-radius: 12px;
}

.gallery-page-info {
  min-width: 132px;
  text-align: center;
  font-size: clamp(14px, 1.6vw, 20px);
  font-weight: 700;
  color: #fff;
}

body.kiosk-exe-mode .gallery-pager {
  gap: 20px;
  padding: 10px 12px 8px;
}

body.kiosk-exe-mode #galleryPagePrevBtn,
body.kiosk-exe-mode #galleryPageNextBtn {
  min-height: 96px !important;
  min-width: 280px !important;
  font-size: 26px !important;
  font-weight: 700 !important;
  padding: 16px 26px !important;
  border-radius: 20px !important;
}

body.kiosk-exe-mode .gallery-page-info {
  min-width: 190px !important;
  font-size: clamp(26px, 2.5vw, 36px) !important;
}

.gallery-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(160, 205, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(14, 20, 34, 0.44), rgba(10, 14, 26, 0.32));
  min-height: 0;
  height: 100%;
  padding: 8px 8px 10px;
  box-shadow:
    0 0 0 1px rgba(160, 210, 255, 0.16) inset,
    0 0 12px rgba(60, 120, 255, 0.12),
    0 8px 16px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(1.4px);
  transition: none;
}

.gallery-card.is-video::after {
  content: "▶";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: clamp(44px, 7vw, 68px);
  height: clamp(44px, 7vw, 68px);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(5, 8, 14, 0.62);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1;
  pointer-events: none;
}

.gallery-card.video-no-thumb .gallery-thumb {
  background:
    linear-gradient(160deg, rgba(10, 14, 24, 0.9), rgba(20, 28, 46, 0.72));
  border-color: rgba(255, 255, 255, 0.22);
}

.gallery-card.neon:hover {
  transform: none;
  border-color: rgba(160, 205, 255, 0.34);
  box-shadow:
    0 0 0 1px rgba(160, 210, 255, 0.16) inset,
    0 0 12px rgba(60, 120, 255, 0.12),
    0 8px 16px rgba(0, 0, 0, 0.26);
}

.gallery-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: rgba(5, 8, 14, 0.18);
  border-radius: 2px;
  border: 1px solid rgba(16, 18, 24, 0.12);
}

.gallery-sync-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 2px rgba(5, 8, 14, 0.65);
}

.gallery-sync-dot.uploaded {
  background: #24d66f;
}

.gallery-sync-dot.uploading {
  background: #ff9f1a;
}

.gallery-sync-dot.not_uploaded {
  background: #ff3b30;
}

.gallery-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.gallery-pill {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.35px;
  color: #a9d8ff;
  text-transform: uppercase;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  background:
    radial-gradient(circle at 50% 20%, rgba(18, 24, 40, 0.34), rgba(0, 0, 0, 0.88)),
    rgba(0, 0, 0, 0.9);
  display: block;
  padding: 0;
}

.gallery-lightbox-close {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 12px);
  z-index: 2000;
  min-height: 72px;
  min-width: 176px;
  font-size: 22px;
  font-weight: 800;
  padding: 12px 20px;
  pointer-events: auto;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}

#galleryLightboxCloseBtn {
  position: fixed;
  z-index: 2000;
  pointer-events: auto;
}

.gallery-lightbox-print {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 208px);
  z-index: 999;
  min-height: 72px;
  min-width: 176px;
  font-size: 22px;
  font-weight: 800;
  padding: 12px 20px;
  pointer-events: auto;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}

.gallery-lightbox-media-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox-media {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-width: 100vw;
  max-height: 100dvh;
  border-radius: 0;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.52);
  pointer-events: none;
}

#galleryLightboxVideo::-webkit-media-controls {
  display: none !important;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 141;
  width: 136px;
  height: 136px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: rgba(16, 18, 28, 0.5);
  color: #fff;
  font-size: 86px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  opacity: 0.78;
  transition: opacity 120ms ease;
}

.gallery-arrow-prev {
  left: 30px;
}

.gallery-arrow-next {
  right: 30px;
}

.gallery-arrow:hover {
  opacity: 1;
}

.gallery-arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Capture */
.capture-shell {
  position: fixed;
  inset: 0;
  z-index: 60;
  width: 100dvw;
  height: 100dvh;
  overflow: hidden;
  background: #000;
}

.capture-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) calc(env(safe-area-inset-right, 0px) + 10px) 8px calc(env(safe-area-inset-left, 0px) + 10px);
  background: transparent;
}

.capture-badges {
  display: none !important;
}

.capture-badge {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(10, 14, 22, 0.72);
  color: #fff;
  font-size: clamp(11px, 1.2vw, 14px);
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 6px 10px;
  line-height: 1;
  white-space: nowrap;
}

.capture-badge.ghost {
  background: rgba(12, 18, 30, 0.58);
}

.capture-badge.ok {
  border-color: rgba(57, 226, 162, 0.72);
  box-shadow: 0 0 8px rgba(57, 226, 162, 0.26);
}

.capture-badge.warn {
  border-color: rgba(255, 204, 76, 0.75);
  box-shadow: 0 0 8px rgba(255, 204, 76, 0.24);
}

.capture-badge.error {
  border-color: rgba(255, 128, 150, 0.78);
  box-shadow: 0 0 8px rgba(255, 128, 150, 0.28);
}

.capture-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin: 0 auto;
}

.home-btn {
  min-width: 42px;
  height: 84px;
  padding: 0 22px;
  border: 2px solid rgba(var(--primary-rgb), 0.72);
  background: rgba(18, 20, 29, 0.86);
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(var(--primary-rgb), 0.24);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.switch-camera-btn {
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + 14px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  z-index: 12;
  width: 56px;
  height: 56px;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-radius: 12px;
  background-color: rgba(var(--primary-rgb), 0.96);
  background-image:
    linear-gradient(135deg, rgba(var(--primary-rgb), 0.98), rgba(var(--secondary-rgb), 0.94)),
    url("./changer-de-camera.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 52%;
  color: transparent;
  font-size: 0;
  text-indent: -9999px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: none;
}

.exit-fullscreen-btn {
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + 14px);
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  z-index: 18;
  width: 56px;
  height: 56px;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(var(--primary-rgb), 0.98), rgba(var(--secondary-rgb), 0.94));
  background-image:
    linear-gradient(135deg, rgba(var(--primary-rgb), 0.98), rgba(var(--secondary-rgb), 0.94)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 24V10h14'/%3E%3Cpath d='M54 24V10H40'/%3E%3Cpath d='M10 40v14h14'/%3E%3Cpath d='M54 40v14H40'/%3E%3Cpath d='M18 18l12 12'/%3E%3Cpath d='M46 18L34 30'/%3E%3Cpath d='M18 46l12-12'/%3E%3Cpath d='M46 46L34 34'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 52%;
  color: transparent;
  display: none;
  cursor: pointer;
  box-shadow: none;
}

.exit-fullscreen-icon {
  display: block;
  width: 100%;
  height: 100%;
}

body.device-mobile.capture-active .exit-fullscreen-btn,
body.device-tablet.capture-active .exit-fullscreen-btn {
  display: block;
}

body:not(.gallery-active) .exit-fullscreen-btn {
  display: block;
}

body:not(.gallery-active) .exit-fullscreen-btn {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

body.kiosk-exe-mode .exit-fullscreen-btn {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.kiosk-exe-mode .switch-camera-btn,
body.kiosk-exe-mode #switchCameraBtn {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.gallery-active .switch-camera-btn,
body.gallery-active #switchCameraBtn,
body.gallery-active .exit-fullscreen-btn {
  display: none !important;
}

#switchCameraBtn {
  position: fixed !important;
  right: calc(env(safe-area-inset-right, 0px) + 14px) !important;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px) !important;
  z-index: 12 !important;
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  padding: 0 !important;
  border: 2px solid rgba(255, 255, 255, 0.34) !important;
  border-radius: 12px !important;
  background-color: rgba(var(--primary-rgb), 0.96) !important;
  background-image:
    linear-gradient(135deg, rgba(var(--primary-rgb), 0.98), rgba(var(--secondary-rgb), 0.94)),
    url("./changer-de-camera.png") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 52% !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  text-indent: -9999px !important;
  overflow: hidden !important;
}

.switch-camera-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: saturate(0.5);
}

.preview-wrap {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #020306;
}

.capture-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  background: #000;
}

#preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  pointer-events: none;
}

.live-preview-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  z-index: 1;
}

.frame-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  z-index: 2;
}

.frame-elements-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.frame-elements-overlay-item {
  position: absolute;
  transform-origin: center center;
  pointer-events: none;
}

.frame-elements-overlay-item.text {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: pre-wrap;
  line-height: 1.1;
  font-family: var(--font-display);
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.65);
}

.frame-elements-overlay-item.image {
  object-fit: contain;
}

.frame-text-overlay {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  z-index: 3;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: clamp(20px, 3vw, 48px);
  line-height: 1.05;
  text-align: center;
  font-family: var(--font-display);
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.flash-overlay.active {
  animation: photoFlash 300ms cubic-bezier(0.12, 0.85, 0.18, 1);
}

@keyframes photoFlash {
  0% {
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  45% {
    opacity: 0.92;
  }
  100% {
    opacity: 0;
  }
}

.countdown {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(150px, 24vw, 360px);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 26px rgba(var(--primary-rgb), 0.9);
  background: rgba(0, 0, 0, 0.18);
}

.countdown.countdown-top-right {
  inset: auto;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: calc(env(safe-area-inset-right, 0px) + 14px);
  width: 120px;
  height: 120px;
  border-radius: 18px;
  align-items: center;
  justify-content: center;
  font-size: clamp(54px, 6vw, 82px);
  line-height: 1;
  background: rgba(0, 0, 0, 0.46);
  border: 2px solid rgba(var(--primary-rgb), 0.8);
  box-shadow: 0 0 18px rgba(var(--primary-rgb), 0.35);
}

/* Kiosk Windows only: larger countdown for better visibility */
body.kiosk-exe-mode .countdown {
  font-size: clamp(300px, 48vw, 720px);
}

body.kiosk-exe-mode .countdown.countdown-top-right {
  width: 240px;
  height: 240px;
  font-size: clamp(108px, 12vw, 164px);
}

.instruction {
  position: absolute;
  z-index: 4;
  left: 8px;
  right: 8px;
  bottom: 8px;
  border-radius: 12px;
  border: 1px solid rgba(var(--primary-rgb), 0.85);
  background: rgba(0, 0, 0, 0.56);
  padding: 10px 12px;
  font-size: clamp(34px, 6.8vw, 88px);
  line-height: 0.95;
  font-family: var(--font-display);
  text-align: center;
  text-shadow: 0 0 16px rgba(var(--primary-rgb), 0.7);
}

.capture-shell.capture-in-progress .capture-topbar {
  opacity: 0;
  pointer-events: none;
}

.capture-shell.capture-in-progress .instruction {
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  bottom: auto;
}

.recording-hud {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  right: calc(env(safe-area-inset-right, 0px) + 8px);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 75, 75, 0.85);
  padding: 9px 14px;
  font-size: 15px;
}

#recordingHud {
  display: none !important;
}

.rec-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff2d55;
  box-shadow: 0 0 10px rgba(255, 45, 85, 0.8);
}

.rec-label {
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ff8aa0;
}

.rec-timer {
  color: #fff;
  font-size: clamp(22px, 2.4vw, 34px);
  font-weight: 800;
  letter-spacing: 0.6px;
  line-height: 1;
}

.capture-style-shell {
  position: absolute;
  left: calc(env(safe-area-inset-left, 0px) + 16px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  z-index: 5;
  display: grid;
  justify-items: start;
  gap: 10px;
  pointer-events: auto;
}

.capture-style-toggle {
  min-width: 176px;
  min-height: 62px;
  padding: 10px 16px 11px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: linear-gradient(160deg, rgba(10, 14, 24, 0.92), rgba(19, 28, 44, 0.82));
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  color: #fff;
  display: grid;
  justify-items: start;
  gap: 2px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 140ms ease, box-shadow 160ms ease;
}

.capture-style-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--secondary-rgb), 0.72);
}

.capture-style-toggle.active {
  border-color: rgba(var(--secondary-rgb), 0.88);
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(var(--secondary-rgb), 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.capture-style-toggle:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.capture-style-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.64);
}

.capture-style-value {
  font-size: clamp(16px, 1.7vw, 22px);
  font-weight: 800;
  line-height: 1.08;
}

.capture-style-panel {
  width: min(290px, calc(100vw - 30px));
  padding: 10px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(160deg, rgba(8, 12, 21, 0.96), rgba(14, 21, 34, 0.92));
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 8px;
}

.capture-style-option {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, border-color 140ms ease, background-color 140ms ease;
}

.capture-style-option:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--primary-rgb), 0.45);
  background: rgba(255, 255, 255, 0.07);
}

.capture-style-option.active {
  border-color: rgba(var(--secondary-rgb), 0.82);
  background: rgba(var(--secondary-rgb), 0.12);
  box-shadow: inset 0 0 0 1px rgba(var(--secondary-rgb), 0.2);
}

.capture-style-preview {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  display: block;
  background-size: cover;
  background-position: center;
}

.capture-style-preview-color {
  background:
    linear-gradient(145deg, rgba(255, 190, 140, 0.96), rgba(255, 108, 108, 0.9) 42%, rgba(95, 165, 255, 0.96));
}

.capture-style-preview-mono {
  background:
    linear-gradient(145deg, rgba(244, 244, 244, 0.96), rgba(164, 164, 164, 0.94) 46%, rgba(58, 58, 58, 0.98));
}

.capture-style-option-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.capture-style-option-copy strong {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.1;
}

.capture-style-option-copy small {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.15;
}

.result-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-home-btn {
  z-index: 1;
  pointer-events: auto;
}

.result-top-actions {
  position: absolute;
  left: calc(env(safe-area-inset-left, 0px) + 12px);
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-media {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.capture-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
  z-index: 12;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.capture-progress-ring {
  position: relative;
  grid-area: 1 / 1;
  width: clamp(100px, 15vw, 172px);
  height: clamp(100px, 15vw, 172px);
  pointer-events: none;
  z-index: 13;
  filter: drop-shadow(0 0 14px rgba(var(--primary-rgb), 0.32));
}

.capture-progress-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.capture-progress-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.24);
  stroke-width: 8;
}

.capture-progress-value {
  fill: none;
  stroke: rgba(var(--secondary-rgb), 0.96);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 160ms linear;
}

.capture-trigger-btn {
  grid-area: 1 / 1;
  width: clamp(88px, 14vw, 160px);
  height: clamp(88px, 14vw, 160px);
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  background:
    radial-gradient(circle at 30% 25%, rgba(var(--primary-soft-rgb), 0.35), transparent 46%),
    radial-gradient(circle at 50% 58%, rgba(var(--primary-rgb), 0.98), rgba(var(--primary-rgb), 0.56));
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.22),
    0 0 18px rgba(var(--primary-rgb), 0.7),
    0 10px 18px rgba(0, 0, 0, 0.48);
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  transition: transform 120ms ease, box-shadow 160ms ease, filter 120ms ease;
}

.capture-trigger-btn::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.9);
}

.capture-trigger-btn:hover {
  filter: brightness(1.03);
}

.capture-trigger-btn:active {
  transform: scale(0.96);
}

.capture-trigger-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

.capture-stop-btn {
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + 16px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 14;
  grid-area: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: clamp(120px, 18vw, 180px);
  height: clamp(58px, 7vw, 84px);
  border-radius: 999px;
  padding: 0 14px;
  background:
    radial-gradient(circle at 30% 25%, rgba(var(--primary-soft-rgb), 0.3), transparent 46%),
    radial-gradient(circle at 50% 58%, rgba(var(--primary-rgb), 0.95), rgba(var(--primary-rgb), 0.56));
}

.capture-stop-btn::after {
  content: none;
}

.capture-stop-icon {
  display: none !important;
}

.capture-stop-label {
  max-width: none;
  font-size: clamp(18px, 2.2vw, 30px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  text-align: center;
  color: #fff;
  text-shadow: 0 0 10px rgba(var(--primary-rgb), 0.45);
  white-space: nowrap;
}

.capture-message {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 124px);
  text-align: center;
  z-index: 12;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(3, 5, 9, 0.42);
  backdrop-filter: blur(3px);
}

.modal-card {
  width: min(860px, 100%);
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(11, 14, 24, 0.68);
  backdrop-filter: blur(6px);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.kiosk-service-menu {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 16px;
  background: rgba(3, 5, 9, 0.42);
  backdrop-filter: blur(3px);
}

.kiosk-service-card {
  width: min(430px, calc(100vw - 20px));
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(11, 14, 24, 0.86);
  padding: 12px;
  display: grid;
  gap: 10px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.46);
}

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

.kiosk-service-head h3 {
  margin: 0;
  font-size: 18px;
  font-family: var(--font-display);
}

.kiosk-service-actions {
  display: grid;
  gap: 8px;
}

.kiosk-service-actions .soft-btn {
  width: 100%;
  justify-content: center;
}

.kiosk-service-status {
  margin: 0;
  min-height: 18px;
  font-size: 12px;
  color: var(--muted);
}

.kiosk-service-status.ok {
  color: #2de38f;
}

.kiosk-service-status.warn {
  color: #ffb347;
}

.kiosk-service-status.error {
  color: #ff5f5f;
}

body.studio-mode .app-top,
body.studio-mode .app-bg,
body.studio-mode .app-bg-overlay,
body.studio-mode #homePanel,
body.studio-mode #modePanel,
body.studio-mode #videoFunPanel,
body.studio-mode #capturePanel,
body.studio-mode #galleryPanel,
body.studio-mode #collagePickerPanel,
body.studio-mode #secretModal,
body.studio-mode #kioskServiceMenu,
body.studio-mode #kioskServiceHotspot {
  display: none !important;
}

body.studio-mode .app-main {
  top: 0;
  height: 100dvh;
  padding: 0;
}

body.studio-mode .modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  background: #070c14;
  backdrop-filter: none;
}

body.studio-mode .modal-card {
  width: 100%;
  max-width: none;
  max-height: none;
  min-height: 100dvh;
  border: 0;
  border-radius: 0;
  padding: 14px;
  background: #070c14;
}

body.studio-mode.studio-frame #collageBuilderModal,
body.studio-mode.studio-collage #frameBuilderModal {
  display: none !important;
}

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

.modal-head h3 {
  margin: 0;
  font-size: clamp(24px, 4.2vw, 34px);
  font-family: var(--font-display);
  letter-spacing: 0.5px;
}

.settings-grid {
  display: grid;
  gap: 10px;
}

.settings-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.switch-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.switch-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
}

.slider-value {
  font-size: 12px;
  color: var(--muted);
}

.secret-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.secret-tab-btn {
  min-width: 102px;
}

.secret-tab-btn.active {
  border-color: rgba(var(--primary-rgb), 0.9);
  background: linear-gradient(145deg, rgba(var(--primary-rgb), 0.28), rgba(var(--secondary-rgb), 0.2));
  box-shadow: 0 0 14px rgba(var(--primary-rgb), 0.24);
}

.secret-tab-panel {
  margin-bottom: 8px;
}

#secretModal .modal-card {
  max-height: calc(100dvh - 16px);
  overflow: auto;
  padding: 10px;
  gap: 8px;
}

#secretModal .settings-grid {
  gap: 8px;
}

#secretModal .settings-grid label {
  gap: 4px;
  font-size: 12px;
}

#secretModal .soft-btn.small,
#secretModal .neon-btn {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 12px;
}

.mode-collage-select {
  display: grid;
  gap: 6px;
  width: min(700px, 100%);
  margin: 0 auto;
  font-size: 14px;
}

.choice-grid.photo-three-modes {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

#collagePickerPanel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  background: none;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
  padding-top: 54px;
  position: relative;
}

.collage-picker-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

.collage-picker-filters .soft-btn.active {
  border-color: rgba(var(--primary-rgb), 0.78);
  box-shadow: none;
  background: rgba(var(--primary-rgb), 0.14);
}

.collage-picker-grid {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  align-items: stretch;
  align-content: stretch;
  overflow: hidden;
  position: relative;
  z-index: 3;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 12, 20, 0.22);
}

.collage-picker-card {
  min-height: 0;
  position: relative;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(20, 26, 40, 0.24);
  backdrop-filter: blur(5px);
  box-shadow: none;
  padding: 2px;
  display: grid;
  gap: 4px;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 140ms ease, background-color 140ms ease, transform 120ms ease;
}

.collage-picker-card:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(24, 32, 48, 0.32);
  transform: translateY(-1px);
}

.collage-picker-card.active {
  border-color: rgba(var(--primary-rgb), 0.92);
  box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.32) inset;
  background: rgba(34, 46, 68, 0.42);
}

.collage-picker-thumb {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  background: linear-gradient(165deg, rgba(20, 23, 36, 0.18), rgba(var(--primary-rgb), 0.06));
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.collage-picker-badge {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(7, 10, 16, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.collage-picker-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding-top: 2px;
}

.collage-picker-floating-pager {
  display: none;
  grid-row: 2;
  position: relative;
  z-index: 8;
  pointer-events: none;
}

.collage-picker-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(52px, 7vw, 72px);
  height: clamp(52px, 7vw, 72px);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: linear-gradient(165deg, rgba(11, 16, 26, 0.9), rgba(var(--primary-rgb), 0.22));
  color: #fff;
  font-size: clamp(34px, 4vw, 46px);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}

.collage-picker-nav-prev {
  left: max(6px, env(safe-area-inset-left, 0px));
}

.collage-picker-nav-next {
  right: max(6px, env(safe-area-inset-right, 0px));
}

.collage-picker-nav-btn:disabled {
  opacity: 0.35;
}

.collage-picker-page-info-floating {
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translateX(-50%);
  min-width: 96px;
  text-align: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: rgba(6, 10, 17, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.26);
  pointer-events: none;
}

.collage-picker-footer .gallery-page-info {
  min-width: 94px;
  font-size: 12px;
}

#collagePickerPrevBtn,
#collagePickerNextBtn {
  min-height: 84px !important;
  padding: 14px 22px !important;
  font-size: 26px !important;
  border-radius: 18px !important;
  font-weight: 800 !important;
}

#collagePickerPanel .soft-btn.small {
  min-height: 42px;
  padding: 8px 14px;
  font-size: 14px;
}

#collagePickerPanel .soft-btn {
  min-height: 38px;
  padding: 7px 12px;
  font-size: 13px;
}

body.collage-picker-active .app-main {
  overflow: hidden !important;
  -webkit-overflow-scrolling: auto !important;
}

body.collage-picker-active #collagePickerPanel {
  overflow: hidden !important;
  -webkit-overflow-scrolling: auto !important;
}

body.collage-picker-active .collage-picker-grid {
  overflow: hidden !important;
}

body.touch-device .collage-picker-floating-pager {
  display: block;
}

body.touch-device .collage-picker-footer {
  display: none;
}

body.collage-picker-active .app-main,
body.collage-picker-active #collagePickerPanel,
body.collage-picker-active .collage-picker-grid {
  scrollbar-width: none;
}

body.collage-picker-active .app-main::-webkit-scrollbar,
body.collage-picker-active #collagePickerPanel::-webkit-scrollbar,
body.collage-picker-active .collage-picker-grid::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.collage-builder-card {
  width: min(1220px, 100%);
  max-height: calc(100dvh - 24px);
}

.collage-builder-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.collage-builder-left {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.collage-builder-right {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(280px, 1fr) minmax(160px, auto);
  gap: 10px;
}

.collage-editor-stage {
  position: relative;
  width: 100%;
  min-height: 280px;
  border-radius: 14px;
  border: 1px solid rgba(var(--primary-rgb), 0.42);
  background: rgba(8, 10, 16, 0.7);
  overflow: hidden;
  touch-action: none;
}

.collage-editor-bg,
.collage-editor-ov {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.collage-editor-bg {
  z-index: 1;
}

.collage-editor-ov {
  z-index: 4;
}

.collage-slots-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.collage-slot-rect {
  position: absolute;
  border: 2px dashed rgba(var(--secondary-rgb), 0.95);
  background: rgba(var(--secondary-rgb), 0.1);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  user-select: none;
}

.collage-slot-rect.active {
  border-color: rgba(var(--primary-rgb), 0.98);
  background: rgba(var(--primary-rgb), 0.2);
}

.collage-slot-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  right: -7px;
  bottom: -7px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: rgba(var(--primary-rgb), 0.95);
}

.collage-safe-rect {
  position: absolute;
  border: 2px solid rgba(255, 215, 0, 0.92);
  background: rgba(255, 215, 0, 0.08);
  z-index: 2;
  pointer-events: none;
}

.collage-slots-list {
  min-height: 120px;
  max-height: 280px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 4px;
}

.collage-slot-item {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: rgba(11, 14, 24, 0.58);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.collage-slot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.collage-slot-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.collage-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.collage-config-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.collage-config-tabs .soft-btn.active {
  border-color: rgba(var(--primary-rgb), 0.96);
  box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.28);
  background: linear-gradient(165deg, rgba(22, 28, 44, 0.8), rgba(var(--primary-rgb), 0.2));
}

.collage-config-panel {
  display: grid;
  gap: 8px;
  align-content: start;
}

#collageCreateTypePrompt {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(var(--primary-rgb), 0.45);
  background: rgba(12, 18, 30, 0.6);
}

#collageCreateTypePrompt p {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#collageCreateTypePrompt .soft-btn.active {
  border-color: rgba(var(--primary-rgb), 0.95);
  box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.28);
  background: linear-gradient(165deg, rgba(22, 28, 44, 0.78), rgba(var(--primary-rgb), 0.18));
}

#collageSlotTools {
  display: grid;
  gap: 8px;
}

.collage-mode-menu {
  display: grid;
  gap: 8px;
  padding: 8px 0;
}

.collage-mode-menu-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
}

.frame-builder-card {
  width: min(1360px, 100%);
}

.frame-builder-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr) minmax(240px, 320px);
  gap: 10px;
  min-height: 0;
}

.frame-builder-pane {
  display: grid;
  gap: 8px;
  min-height: 0;
}

.frame-builder-stage-wrap {
  min-height: 0;
  display: grid;
  gap: 8px;
}

.frame-builder-toolbar {
  justify-content: flex-start;
}

.frame-builder-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  border: 1px solid rgba(var(--primary-rgb), 0.45);
  background: rgba(8, 12, 20, 0.75);
  overflow: hidden;
}

.frame-builder-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.frame-builder-elements-layer {
  position: absolute;
  inset: 0;
}

.frame-builder-element {
  position: absolute;
  border: 1px dashed rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  cursor: move;
  user-select: none;
  transform-origin: center center;
}

.frame-builder-element.active {
  border-color: rgba(var(--primary-rgb), 1);
  box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.35);
}

.frame-builder-element.is-hidden {
  opacity: 0.35;
}

.frame-builder-element.is-locked {
  border-style: solid;
  border-color: rgba(255, 215, 0, 0.9);
}

.frame-builder-element.text {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: pre-wrap;
  line-height: 1.1;
  padding: 2px 4px;
  font-family: var(--font-display);
}

.frame-builder-element.image {
  object-fit: contain;
}

.frame-builder-resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  right: -7px;
  bottom: -7px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: rgba(var(--primary-rgb), 0.95);
  cursor: nwse-resize;
}

.frame-library-list,
.frame-layers-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.frame-library-item,
.frame-layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 14, 24, 0.5);
}

.frame-layer-item.active {
  border-color: rgba(var(--primary-rgb), 0.95);
}

.frame-item-name {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1200px) {
  .frame-builder-layout {
    grid-template-columns: 1fr;
  }
}

.collage-template-manage-list {
  display: grid;
  gap: 6px;
  max-height: 150px;
  overflow: auto;
  padding-right: 4px;
}

.collage-template-manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(10, 14, 24, 0.55);
}

.collage-template-manage-name {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collage-template-manage-actions {
  display: flex;
  gap: 6px;
}

.collage-template-manage-empty {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.collage-frame-hint {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(var(--primary-rgb), 0.35);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(12, 18, 30, 0.65);
}

.collage-frame-tools {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--secondary-rgb), 0.35);
  border-radius: 10px;
  background: rgba(10, 18, 32, 0.72);
}

.collage-frame-tools p {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.collage-frame-tools .soft-btn[data-mask-tool].active {
  border-color: rgba(var(--primary-rgb), 0.95);
  box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.32);
  background: linear-gradient(165deg, rgba(22, 28, 44, 0.78), rgba(var(--primary-rgb), 0.18));
}

.collage-frame-tools .soft-btn.active {
  border-color: rgba(var(--secondary-rgb), 0.95);
  box-shadow: 0 0 10px rgba(var(--secondary-rgb), 0.24);
}

.collage-mask-preview {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.collage-import-label {
  border: 1px solid rgba(var(--primary-rgb), 0.55);
  background: linear-gradient(165deg, rgba(20, 23, 36, 0.78), rgba(var(--primary-rgb), 0.16));
  box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.2);
  color: var(--text);
  border-radius: 13px;
  cursor: pointer;
  touch-action: manipulation;
  font-size: 12px;
  padding: 7px 10px;
}

.collage-import-label input {
  display: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

/* Responsive logic: narrow screens */
@media (max-width: 1024px) {
  :root {
    --topbar-height: 56px;
  }

  .app-top {
    grid-template-columns: 56px 1fr 52px;
    padding: 5px 8px;
  }

  .secret-hotspot {
    width: 50px;
    height: 50px;
  }

  .app-main {
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  }

  #homePanel,
  #modePanel,
  #videoFunPanel {
    padding: 10px;
    gap: 10px;
  }

  .mode-grid,
  .choice-grid,
  .video-fun-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
  }

  .home-mode-card strong,
  .choice-simple strong {
    font-size: clamp(26px, 8vw, 62px);
  }

  #modePanel .choice-simple strong,
  #videoFunPanel .choice-simple strong {
    width: calc(100% - clamp(14px, 8vw, 30px));
    margin-inline: auto;
    font-size: clamp(28px, 8.4vw, 72px);
    line-height: 0.92;
  }

  .mode-icon {
    width: clamp(58px, 18vw, 120px);
    max-width: calc(100% - 18px);
  }

  .choice-note {
    font-size: clamp(12px, 3.4vw, 18px);
  }

  .home-actions .soft-btn {
    min-height: 46px;
    font-size: 14px;
  }

  #galleryBtn,
  #modeBackBtn,
  #videoFunBackBtn,
  #galleryBackBtn,
  #collagePickerTopHomeBtn,
  #collagePickerTopBackBtn {
    min-height: 64px;
    font-size: 18px;
    padding: 10px 14px;
    border-radius: 14px;
  }

  .gallery-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: clamp(6px, 1.8vw, 12px);
  }

  .gallery-show-qr-btn {
    max-width: 100%;
    width: 100%;
  }

  .gallery-fake-qr-large {
    width: min(72vw, 320px);
    height: min(72vw, 320px);
  }

  .gallery-qr-text {
    font-size: clamp(12px, 3vw, 16px);
  }

  .gallery-pager {
    gap: 8px;
    flex-wrap: wrap;
  }

  .gallery-page-info {
    min-width: 100px;
    font-size: clamp(13px, 3.2vw, 16px);
  }

  .capture-topbar {
    padding: calc(env(safe-area-inset-top, 0px) + 7px) calc(env(safe-area-inset-right, 0px) + 9px) 7px calc(env(safe-area-inset-left, 0px) + 9px);
  }

  .instruction {
    font-size: clamp(32px, 8.6vw, 54px);
  }

  .capture-trigger-btn {
    width: clamp(86px, 22vw, 116px);
    height: clamp(86px, 22vw, 116px);
  }

  .capture-footer .capture-stop-btn {
    width: min(92vw, 520px);
    height: 74px;
    border-radius: 16px;
    padding: 0 16px;
    gap: 10px;
    right: calc(env(safe-area-inset-right, 0px) + 10px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  }

  .capture-footer .capture-stop-icon {
    width: 20px;
    height: 20px;
    border-radius: 5px;
  }

  .capture-footer .capture-stop-label {
    font-size: clamp(16px, 4.2vw, 24px);
    white-space: nowrap;
  }

  .modal {
    padding: 8px;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 16px);
  }

  .secret-tabs {
    position: sticky;
    top: 0;
    z-index: 3;
    background: rgba(11, 14, 24, 0.98);
    padding-bottom: 8px;
  }

  #secretModal .modal-head h3 {
    font-size: clamp(18px, 5vw, 24px);
  }

  #secretModal .secret-tabs {
    gap: 6px;
  }

  #secretModal .secret-tab-btn {
    min-width: auto;
    flex: 1 1 calc(50% - 6px);
    font-size: 12px;
    padding: 6px 8px;
  }

  #secretModal input,
  #secretModal select,
  #secretModal textarea {
    font-size: 14px;
    padding: 8px 10px;
  }
}

/* Responsive logic: medium screens */
@media (max-width: 1366px) {
  :root {
    --topbar-height: 48px;
  }

  .app-top {
    grid-template-columns: 50px 1fr 46px;
    padding: 4px 8px;
  }

  .secret-hotspot {
    width: 44px;
    height: 44px;
  }

  .app-main {
    padding: 6px 8px max(6px, env(safe-area-inset-bottom));
  }

  #homePanel,
  #modePanel,
  #videoFunPanel {
    padding: 8px;
    gap: 8px;
  }

  .mode-grid,
  .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-fun-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-head h2 {
    font-size: clamp(22px, 4.8vw, 34px);
  }

  .home-mode-card strong,
  .choice-simple strong {
    font-size: clamp(28px, 6vw, 66px);
  }

  #modePanel .choice-simple strong,
  #videoFunPanel .choice-simple strong {
    width: calc(100% - clamp(16px, 4vw, 34px));
    margin-inline: auto;
    font-size: clamp(30px, 6.2vw, 78px);
    line-height: 0.92;
  }

  .mode-icon {
    width: clamp(60px, 11.5vw, 130px);
    max-width: calc(100% - 20px);
  }

  .choice-note {
    font-size: clamp(13px, 2.1vw, 22px);
  }

  .home-actions .soft-btn {
    min-height: 38px;
    font-size: 12px;
    padding: 7px 8px;
  }

  .capture-topbar {
    padding: calc(env(safe-area-inset-top, 0px) + 6px) calc(env(safe-area-inset-right, 0px) + 8px) 6px calc(env(safe-area-inset-left, 0px) + 8px);
  }

  .capture-nav .soft-btn.small {
    font-size: 11px;
    padding: 5px 8px;
  }

  .home-btn {
    min-width: 68px;
    height: 68px;
    padding: 0 14px;
    border-radius: 14px;
    font-size: 18px;
  }

  .switch-camera-btn {
    width: 56px;
    height: 56px;
    right: calc(env(safe-area-inset-right, 0px) + 10px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    border-radius: 12px;
  }

  #switchCameraBtn {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    right: calc(env(safe-area-inset-right, 0px) + 10px) !important;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px) !important;
    border-radius: 12px !important;
  }

  .instruction {
    font-size: clamp(24px, 4.3vw, 42px);
    padding: 8px 10px;
  }

  .recording-hud {
    transform: scale(1);
    transform-origin: top right;
  }

  .capture-stop-btn {
    width: min(88vw, 360px);
    height: 58px;
    border-radius: 14px;
    gap: 10px;
    right: calc(env(safe-area-inset-right, 0px) + 8px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  }

  .capture-stop-icon {
    width: 18px;
    height: 18px;
    border-radius: 5px;
  }

  .capture-stop-label {
    font-size: clamp(14px, 3.5vw, 20px);
  }

  .capture-trigger-btn {
    width: clamp(70px, 10vw, 94px);
    height: clamp(70px, 10vw, 94px);
  }

  .capture-footer .capture-stop-btn {
    width: min(86vw, 540px);
    height: 68px;
    border-radius: 16px;
    padding: 0 16px;
    gap: 10px;
    right: calc(env(safe-area-inset-right, 0px) + 8px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  }

  .capture-footer .capture-stop-icon {
    width: 20px;
    height: 20px;
    border-radius: 5px;
  }

  .capture-footer .capture-stop-label {
    font-size: clamp(16px, 2.4vw, 26px);
    white-space: nowrap;
  }

  .collage-picker-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .collage-picker-footer {
    justify-content: center;
  }
}

/* Final mobile/tablet overrides for web-only touch devices */
body.device-mobile .home-mode-card strong,
body.device-mobile .choice-simple strong {
  font-size: clamp(18px, 4.8vw, 30px) !important;
}

body.device-apple-touch.device-mobile .home-mode-card strong,
body.device-apple-touch.device-mobile .choice-simple strong {
  font-size: clamp(15px, 4.1vw, 24px) !important;
  line-height: 0.98 !important;
  letter-spacing: 0 !important;
}

body.device-apple-touch.device-tablet .home-mode-card strong,
body.device-apple-touch.device-tablet .choice-simple strong {
  font-size: clamp(18px, 3.2vw, 28px) !important;
  line-height: 0.98 !important;
  letter-spacing: 0 !important;
}

body.device-apple-touch #modePanel .choice-simple strong,
body.device-apple-touch #videoFunPanel .choice-simple strong {
  font-size: clamp(16px, 3.7vw, 26px) !important;
}

body.device-mobile #videoFunInstructionBtn strong,
body.device-mobile #videoFunBoomerangBtn strong,
body.device-apple-touch #videoFunInstructionBtn strong,
body.device-apple-touch #videoFunBoomerangBtn strong {
  font-size: clamp(14px, 4vw, 22px) !important;
}

body.device-apple-touch .mode-icon {
  width: clamp(34px, 8.5vw, 56px) !important;
}

body.device-apple-touch .choice-note {
  font-size: clamp(9px, 2.1vw, 11px) !important;
  line-height: 1.05 !important;
}

body.device-mobile .mode-icon {
  width: clamp(40px, 10vw, 62px) !important;
}

body.device-mobile #galleryBtn,
body.device-mobile #modeBackBtn,
body.device-mobile #videoFunBackBtn,
body.device-mobile #galleryBackBtn,
body.device-mobile #collagePickerTopHomeBtn,
body.device-mobile #collagePickerTopBackBtn {
  min-height: 46px !important;
  font-size: 14px !important;
}

/* Final override for capture utility buttons: fixed size + theme background + readable icon */
.switch-camera-btn,
#switchCameraBtn,
.exit-fullscreen-btn {
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  border-radius: 12px !important;
  border: 2px solid rgba(255, 255, 255, 0.9) !important;
  box-shadow: none !important;
}

.switch-camera-btn,
#switchCameraBtn {
  background-image:
    url("./changer-de-camera.png"),
    radial-gradient(circle at center, rgba(255, 255, 255, 0.98) 0 34%, rgba(255, 255, 255, 0) 36%),
    linear-gradient(135deg, rgba(var(--primary-rgb), 0.98), rgba(var(--secondary-rgb), 0.94)) !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 44% 44%, 100% 100%, 100% 100% !important;
}

.exit-fullscreen-btn {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%230b1220' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 24V10h14'/%3E%3Cpath d='M54 24V10H40'/%3E%3Cpath d='M10 40v14h14'/%3E%3Cpath d='M54 40v14H40'/%3E%3Cpath d='M18 18l12 12'/%3E%3Cpath d='M46 18L34 30'/%3E%3Cpath d='M18 46l12-12'/%3E%3Cpath d='M46 46L34 34'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(circle at center, rgba(255, 255, 255, 0.98) 0 34%, rgba(255, 255, 255, 0) 36%),
    linear-gradient(135deg, rgba(var(--primary-rgb), 0.98), rgba(var(--secondary-rgb), 0.94)) !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 44% 44%, 100% 100%, 100% 100% !important;
  position: fixed !important;
  top: env(safe-area-inset-top, 0px) !important;
  right: env(safe-area-inset-right, 0px) !important;
  left: auto !important;
  bottom: auto !important;
  z-index: 120 !important;
}

body.touch-device .app-main,
body.touch-device .gallery-panel,
body.touch-device #collagePickerPanel {
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
}

body.touch-device .gallery-panel,
body.touch-device .gallery-card {
  backdrop-filter: none !important;
}

body.touch-device .collage-picker-grid {
  overflow: hidden !important;
  -webkit-overflow-scrolling: auto;
}

body.touch-device #collagePickerPanel {
  overflow: hidden !important;
  -webkit-overflow-scrolling: auto;
}

/* Capture fullscreen behavior */
body.capture-active .app-top {
  opacity: 0;
  pointer-events: none;
}

body.capture-active .app-main {
  top: 0;
  width: 100vw;
  height: 100dvh;
  padding: 0;
}

body.force-landscape .mode-grid,
body.force-landscape .choice-grid,
body.force-landscape .video-fun-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

body.force-landscape .choice-grid.photo-three-modes {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

/* Narrow-screen support on all widths */
@media (max-width: 1024px) {
  :root {
    --topbar-height: 56px;
  }

  .app-top {
    grid-template-columns: 56px 1fr 52px;
    padding: 5px 8px;
  }

  .app-main {
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  }

  #homePanel,
  #modePanel,
  #videoFunPanel {
    padding: 10px;
    gap: 10px;
  }

  .mode-grid,
  .choice-grid,
  .video-fun-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: stretch;
    gap: 10px;
  }

  #modePanel .choice-grid.photo-three-modes {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .mode-card,
  .choice-card {
    width: 100%;
    min-width: 0;
  }

  .home-mode-card strong,
  .choice-simple strong {
    font-size: clamp(34px, 8.8vw, 80px);
  }

  #modePanel .choice-simple strong,
  #videoFunPanel .choice-simple strong {
    font-size: clamp(36px, 9.2vw, 88px);
  }

  .mode-icon {
    width: clamp(76px, 20vw, 170px);
  }

  .collage-picker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .collage-picker-filters {
    justify-content: stretch;
  }

  .collage-picker-filters .soft-btn {
    flex: 1 1 0;
  }
}

@media (max-width: 700px) {
  #collagePickerPanel {
    padding-top: 50px;
    gap: 6px;
  }

  .collage-picker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
  }

  .collage-picker-footer {
    justify-content: center;
  }

  body.touch-device .collage-picker-nav-btn {
    width: clamp(48px, 12vw, 58px);
    height: clamp(48px, 12vw, 58px);
    font-size: clamp(30px, 8vw, 40px);
  }

  body.touch-device .collage-picker-page-info-floating {
    top: 4px;
    font-size: 11px;
    padding: 3px 8px;
  }

  #collagePickerPanel .soft-btn {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .collage-picker-filters .soft-btn {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 12px;
  }

  #collagePickerPrevBtn,
  #collagePickerNextBtn {
    min-height: 68px !important;
    padding: 10px 16px !important;
    font-size: 20px !important;
    border-radius: 16px !important;
  }

  #collagePickerPanel .soft-btn.small {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* Final hard lock: no vertical scrollbar in collage picker on touch devices */
body.touch-device.collage-picker-active .app-main,
body.touch-device.collage-picker-active #collagePickerPanel,
body.touch-device.collage-picker-active .collage-picker-grid {
  overflow: hidden !important;
  -webkit-overflow-scrolling: auto !important;
  overscroll-behavior: none;
  scrollbar-width: none !important;
}

body.touch-device.collage-picker-active .app-main::-webkit-scrollbar,
body.touch-device.collage-picker-active #collagePickerPanel::-webkit-scrollbar,
body.touch-device.collage-picker-active .collage-picker-grid::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Mobile/tablet web: fixed 8x2 grid (16 items) with bottom pager */
body.collage-picker-mobile-grid.collage-picker-active .app-main,
body.collage-picker-mobile-grid.collage-picker-active #collagePickerPanel {
  overflow: hidden !important;
  -webkit-overflow-scrolling: auto !important;
}

body.collage-picker-mobile-grid #collagePickerPanel {
  grid-template-rows: minmax(0, 1fr) auto auto !important;
  padding-top: 4px !important;
  gap: 6px !important;
}

body.collage-picker-mobile-grid .collage-picker-grid {
  --kb-collage-cell: 72px;
  height: 100% !important;
  min-height: 0 !important;
  grid-template-rows: repeat(2, minmax(0, var(--kb-collage-cell, 72px))) !important;
  grid-template-columns: repeat(8, minmax(0, var(--kb-collage-cell, 72px))) !important;
  justify-content: center !important;
  align-content: center !important;
  overflow: hidden !important;
  -webkit-overflow-scrolling: auto !important;
  padding: 6px 6px max(10px, env(safe-area-inset-bottom, 0px)) !important;
  gap: 4px !important;
}

body.collage-picker-mobile-grid .collage-picker-floating-pager,
body.collage-picker-mobile-grid .collage-picker-page-info-floating {
  display: none !important;
}

body.collage-picker-mobile-grid .collage-picker-footer {
  display: grid !important;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 6px 2px !important;
}

body.collage-picker-mobile-grid #collagePickerPrevBtn,
body.collage-picker-mobile-grid #collagePickerNextBtn {
  min-height: 54px !important;
  width: 64px !important;
  min-width: 64px !important;
  padding: 0 !important;
  font-size: 36px !important;
  line-height: 1 !important;
  border-radius: 14px !important;
  font-weight: 900 !important;
}

body.collage-picker-mobile-grid .collage-picker-footer .gallery-page-info {
  min-width: 0 !important;
  text-align: center !important;
  font-size: 14px !important;
  font-weight: 700 !important;
}

body.collage-picker-mobile-grid .collage-picker-card {
  width: var(--kb-collage-cell, 72px);
  height: var(--kb-collage-cell, 72px);
  aspect-ratio: 1 / 1;
  min-height: 0 !important;
}

body.device-mobile .capture-style-shell {
  left: calc(env(safe-area-inset-left, 0px) + 10px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  gap: 8px;
}

body.device-mobile .capture-style-toggle {
  min-width: 148px;
  min-height: 54px;
  padding: 9px 13px 10px;
  border-radius: 18px;
}

body.device-mobile .capture-style-kicker {
  font-size: 10px;
}

body.device-mobile .capture-style-value {
  font-size: 15px;
}

body.device-mobile .capture-style-panel {
  width: min(250px, calc(100vw - 20px));
  padding: 8px;
  border-radius: 18px;
}

body.device-mobile .capture-style-option {
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  padding: 8px;
  border-radius: 14px;
}

body.device-mobile .capture-style-preview {
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

body.device-mobile .capture-style-option-copy strong {
  font-size: 13px;
}

body.device-mobile .capture-style-option-copy small {
  font-size: 11px;
}

body.kiosk-exe-mode .capture-style-shell {
  left: calc(env(safe-area-inset-left, 0px) + 18px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
}

body.kiosk-exe-mode .capture-style-toggle {
  min-width: 228px;
  min-height: 76px;
  padding: 12px 18px 13px;
  border-radius: 22px;
}

body.kiosk-exe-mode .capture-style-kicker {
  font-size: 12px;
}

body.kiosk-exe-mode .capture-style-value {
  font-size: clamp(20px, 1.8vw, 28px);
}

body.kiosk-exe-mode .capture-style-panel {
  width: 320px;
}

body.kiosk-exe-mode .capture-style-option {
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
}

body.kiosk-exe-mode .capture-style-preview {
  width: 52px;
  height: 52px;
}

body.kiosk-exe-mode .capture-style-option-copy strong {
  font-size: 18px;
}

body.kiosk-exe-mode .capture-style-option-copy small {
  font-size: 13px;
}
