:root {
  --bg: #f3fbf6;
  --card: #ffffff;
  --muted: #5a7c6e;
  --green: #18b058;
  --green2: #0f8f4f;
  --band: #2b915f;
  --shadow: 0 10px 28px rgba(0, 0, 0, .08);
  --radius: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #0a2e22;
}

.page {
  max-width: 520px;
  margin: 0 auto;
  padding: 18px 14px 30px;
}

/* Header/Hero */
.hero {
  text-align: center;
  padding: 6px 10px 0;
}

.hero h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: .2px;
}

.hero p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* Mode Selection */
.modeWrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 14px auto 12px;
  max-width: 520px;
}

.modeCard {
  position: relative;
  border: 1px solid #e3efe8;
  background: var(--card);
  border-radius: 16px;
  padding: 14px 12px 12px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .06);
  text-align: center;
  cursor: pointer;
}

.modeCard.active {
  border: 2px solid rgba(24, 176, 88, .75);
  background: #e9fff2;
}

.modeCard.active::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  right: 10px;
  top: 10px;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(24, 176, 88, .18);
}

.modeIcon {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eaf6ef;
  font-size: 18px;
  margin-bottom: 8px;
}

.modeCard.active .modeIcon {
  background: var(--green);
  color: white;
}

.modeTitle {
  display: block;
  font-weight: 800;
  margin-top: 2px;
}

.modeMeta {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

/* Preview Area */
.previewBand {
  background: linear-gradient(180deg, #2b915f 0%, #2a8c5c 65%, #2b915f 100%);
  border-radius: 20px;
  padding: 12px 0 14px;
  box-shadow: var(--shadow);
}

.frameStage {
  width: min(520px, 94vw);
  margin: 0 auto;
  position: relative;
  display: flex;
  justify-content: center;
  touch-action: none; /* Required for mobile dragging */
}

#stage {
  width: 100%;
  height: auto;
  border-radius: 18px;
  background: transparent;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .18);
}

/* =========================================
   UPLOAD PROMPT (ICON & TEXT OVERLAY)
   ========================================= */
.uploadPrompt {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: pointer;
  pointer-events: auto;
}

/* Allows clicks to pass through text/icon to the parent prompt */
.uploadPrompt * {
  pointer-events: none;
}

.uploadText {
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 8px 20px;
  border-radius: 99px;
  margin-top: 15px; /* Positions text below the icon */
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}

.uploadIcon {
  background: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  color: var(--green);
}

/* Navigation Arrows */
.navArrow {
  position: absolute;
  bottom: -10px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: none;
  background: #fff;
  color: #123;
  box-shadow: 0 10px 20px rgba(0, 0, 0, .18);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  opacity: .95;
  z-index: 11;
}

.navArrow.left { left: -18px; }
.navArrow.right { right: -18px; }

/* Frame Picker */
.pickerCard {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 14px auto 12px;
  padding: 10px 12px 8px;
  max-width: 520px;
}

.pickerTitle {
  font-size: 13px;
  color: #1e4b39;
  font-weight: 700;
  margin: 4px 2px 8px;
  text-align: center;
}

.thumbRow {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.thumb {
  width: 68px;
  height: 68px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  box-shadow: 0 10px 18px rgba(0, 0, 0, .08);
  background: #e8f6ef;
}

.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.active { border-color: rgba(24, 176, 88, .95); }

.pager {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

/* Controls */
.controlCard {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 520px;
  margin: 0 auto;
  padding: 14px;
}

#fileInput { display: none; }

.uploadBar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8eee2;
  border-radius: 12px;
  padding: 12px 10px;
  cursor: pointer;
  color: #1a3e30;
  font-weight: 600;
}

.sliderBlock { margin-top: 12px; }

.sliderHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.sliderLabel {
  font-size: 13px;
  color: #1e4b39;
  font-weight: 700;
}

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

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #dff3e9;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--green);
  border: 3px solid #ffffff;
  box-shadow: 0 8px 14px rgba(0, 0, 0, .16);
}

.miniBtns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.mini {
  border: 1px solid #d8eee2;
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  font-weight: 700;
  cursor: pointer;
  color: #1a3e30;
}

.cta {
  width: 100%;
  margin-top: 12px;
  border: none;
  background: linear-gradient(180deg, var(--green) 0%, var(--green2) 100%);
  color: #fff;
  border-radius: 12px;
  padding: 14px 12px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(24, 176, 88, .28);
}

/* Screen Adjustments */
@media (max-width:420px) {
  .hero h1 { font-size: 18px; }
  .frameStage { width: 94vw !important; }
  .navArrow { bottom: -8px !important; }
  .thumb { width: 64px; height: 64px; }
}

#stage {
  touch-action: none;
}

