/* ── Variables ── */
:root {
  --dark:  #1C4220;
  --lime:  #7DC242;
  --white: #FFFFFF;
  --gray:  #E8EDE8;
  --muted: rgba(28,66,32,0.45);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0d2410;
  color: var(--dark);
  overflow: hidden;
}

/* ── Screen system ── */
.screen {
  display: none;
  position: fixed;
  inset: 0;
  flex-direction: column;
  overflow: hidden;
}
.screen.active { display: flex; }

/* ─────────────────────────────────────────
   Screen 1 · Landing
───────────────────────────────────────── */
#screen-landing { background: #0d2410; }

.land-bg {
  position: absolute;
  inset: 0;
}
.land-bg-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
}
.land-grad-top {
  position: absolute;
  top: 0; left: 0; right: 0; height: 45%;
  background: linear-gradient(180deg, rgba(0,0,0,0.55) 0%, transparent 100%);
}
.land-grad-bot {
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 70%;
  background: linear-gradient(0deg, rgba(10,30,12,0.9) 0%, rgba(10,30,12,0.4) 55%, transparent 100%);
}

.land-top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 52px 22px 0;
}

/* Logo image */
.logo-img {
  height: 40px;
  width: auto;
  display: block;
  border-radius: 8px;
}
.logo-img-light {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 3px 6px;
  height: 46px;
}

/* Horizontal logo mark (legacy, kept for safety) */
.logo-h {
  display: flex;
  align-items: center;
  gap: 7px;
}
.logo-h-text { display: flex; flex-direction: column; line-height: 1; }
.lh-eco { font-size: 13px; font-weight: 900; color: var(--white); letter-spacing: -0.2px; line-height: 1; }
.lh-k   { font-size: 7px;  font-weight: 700; color: var(--white); letter-spacing: 2px;   line-height: 1; }

.logo-h.dark .lh-eco,
.logo-h.dark .lh-k,
.lh-eco.dark,
.lh-k.dark { color: var(--dark); }

/* Live badge */
.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
}
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ff4444;
  animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* Landing bottom sheet */
.land-sheet {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 2;
  background: rgba(10,30,12,0.58);
  backdrop-filter: blur(40px) saturate(1.4);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -4px 40px rgba(0,0,0,0.3);
  padding: 8px 24px 40px;
}
.land-h1 {
  font-size: 32px;
  font-weight: 900;
  color: var(--white);
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 10px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.land-h1 .lime { color: var(--lime); }
.land-p {
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  line-height: 1.6;
  margin-bottom: 20px;
}
.pill-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.pbadge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(125,194,66,0.2);
  border: 1px solid rgba(125,194,66,0.3);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--white);
}
.bdot {
  width: 6px; height: 6px;
  border-radius: 3px;
  background: var(--lime);
  flex-shrink: 0;
}

/* Handle */
.handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
  margin: 0 auto 20px;
}
.handle.dark { background: rgba(28,66,32,0.12); }

/* ── Buttons ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 17px 24px;
  border-radius: 100px;
  border: none;
  font-size: 15px;
  font-weight: 800;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  letter-spacing: -0.2px;
  transition: opacity 0.18s, transform 0.1s, background 0.15s;
  text-align: center;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }

.btn.lime { background: var(--lime); color: var(--dark); }
.btn.lime:hover:not(:disabled) { background: #89cf4e; }

.btn.dark { background: var(--dark); color: var(--white); }
.btn.dark:hover:not(:disabled) { background: #265428; }

.btn.outw {
  flex: 1;
  background: rgba(255,255,255,0.08);
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,0.2);
  font-size: 13px;
}

/* Micro text */
.micro {
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  font-weight: 500;
  margin-top: 12px;
}
.micro.dark { color: rgba(28,66,32,0.38); }

/* ─────────────────────────────────────────
   White screens (Upload · Choose)
───────────────────────────────────────── */
.white-s { background: var(--white); }

/* Screen head */
.s-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 52px 20px 0;
  flex-shrink: 0;
}

/* Back button */
.back-btn {
  width: 40px; height: 40px;
  border-radius: 20px;
  background: rgba(28,66,32,0.08);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: rgba(28,66,32,0.7);
}

/* Step dots */
.stepdots {
  display: flex;
  gap: 5px;
  align-items: center;
}
.sd {
  height: 4px;
  border-radius: 4px;
  width: 6px;
  background: rgba(28,66,32,0.15);
  transition: all 0.3s;
  font-size: 0;
  color: transparent;
}
.sd.on   { width: 20px; background: var(--lime); }
.sd.done { width: 12px; background: var(--lime); }

/* Screen body */
.s-body {
  flex: 1;
  padding: 24px 24px 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Screen foot */
.s-foot {
  padding: 16px 24px 36px;
  flex-shrink: 0;
}

/* Screen titles */
.s-title {
  font-size: 30px;
  font-weight: 900;
  color: var(--dark);
  letter-spacing: -0.8px;
  line-height: 1.1;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.s-sub {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 20px;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────
   Screen 2 · Upload
───────────────────────────────────────── */
.upload-zone {
  flex: 1;
  border-radius: 28px;
  border: 2px dashed rgba(125,194,66,0.45);
  background: rgba(125,194,66,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: 200px;
  transition: border-color 0.2s, background 0.2s;
}
.upload-zone:hover { background: rgba(125,194,66,0.08); border-color: rgba(125,194,66,0.7); }

.upload-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
}
.uph-ic {
  width: 80px; height: 80px;
  border-radius: 40px;
  background: linear-gradient(135deg, rgba(125,194,66,0.2), rgba(28,66,32,0.08));
  display: flex;
  align-items: center;
  justify-content: center;
}
.uph-lbl { font-size: 16px; font-weight: 800; color: var(--dark); }
.uph-hint { font-size: 12px; color: var(--muted); }

.photo-preview {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.photo-preview.hidden { display: none !important; }

/* Tip sheet */
.tip-sheet {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  z-index: 10;
}
.tip-sheet.hidden { display: none !important; }

.tip-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
}
.tip-box {
  position: relative;
  background: var(--white);
  border-radius: 28px 28px 0 0;
  padding: 8px 24px 44px;
  box-shadow: 0 -8px 48px rgba(0,0,0,0.18);
}
.tip-h {
  font-size: 22px;
  font-weight: 900;
  color: var(--dark);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.tip-p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 20px;
}
.tips-list { display: flex; flex-direction: column; margin-bottom: 8px; }
.tip-row {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
}
.tip-em {
  width: 44px; height: 44px;
  border-radius: 22px;
  background: rgba(125,194,66,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────
   Screen 3 · Choose
───────────────────────────────────────── */

/* Featured card — fills remaining space */
.featured-card {
  flex: 1;
  min-height: 0;
  border-radius: 28px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 40px rgba(28,66,32,0.18);
  background: var(--gray);
}
.featured-img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.feat-badge {
  position: absolute;
  top: 16px; left: 16px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--dark);
}
.feat-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(0deg, rgba(10,30,12,0.88) 0%, transparent 100%);
  padding: 32px 20px 20px;
}
.feat-lbl {
  font-size: 16px;
  font-weight: 800;
  color: var(--white);
  min-height: 20px;
}

/* Thumb strip */
.thumb-strip {
  display: flex;
  gap: 10px;
  padding: 14px 0 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}
.thumb-strip::-webkit-scrollbar { display: none; }

.base-card {
  width: 60px; height: 72px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(28,66,32,0.1);
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 0.18s, border-width 0.1s;
}
.base-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.base-card.selected { border: 2.5px solid var(--lime); }
.base-card-label { display: none; }

.base-loading { font-size: 13px; color: var(--muted); padding: 16px 0; }

.emsg {
  font-size: 14px;
  color: var(--muted);
  padding: 24px 0;
  line-height: 1.6;
}

/* ─────────────────────────────────────────
   Screen 4 · Processing
───────────────────────────────────────── */
.proc-screen { background: var(--dark); }
.proc-bg {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: blur(20px) brightness(0.35) saturate(0.8);
  transform: scale(1.08);
}
.proc-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
}
.spin-wrap {
  position: relative;
  width: 120px; height: 120px;
  margin-bottom: 36px;
}
.spin-arc {
  transform-origin: 60px 60px;
  animation: spinRing 1.6s linear infinite;
}
@keyframes spinRing { to { transform: rotate(360deg); } }
.spin-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.proc-h {
  font-size: 28px;
  font-weight: 900;
  color: var(--white);
  text-align: center;
  letter-spacing: -0.6px;
  line-height: 1.15;
  margin-bottom: 12px;
}
.proc-msg {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  text-align: center;
  line-height: 1.6;
  min-height: 22px;
  transition: opacity 0.3s;
}
.pbar-wrap {
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  margin-top: 40px;
  overflow: hidden;
}
.pbar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--lime);
  animation: pbarAnim 2s ease-in-out infinite alternate;
}
@keyframes pbarAnim { from { width: 40%; } to { width: 80%; } }
.ptime {
  margin-top: 10px;
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  font-weight: 500;
  text-align: center;
}
.fact-card {
  margin-top: 40px;
  width: 100%;
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 18px 20px;
  border: 1px solid rgba(255,255,255,0.1);
}
.fact-lbl {
  font-size: 10px;
  font-weight: 700;
  color: var(--lime);
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}
.fact-txt {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  line-height: 1.6;
}

/* ─────────────────────────────────────────
   Screen 5 · Result
───────────────────────────────────────── */
.result-screen { background: #000; }

.result-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: auto;
  display: block;
}

.res-top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 100%);
  padding: 52px 22px 40px;
  pointer-events: none;
}
.res-top-grad { pointer-events: none; }
.res-ready {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
}

.res-sheet {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 2;
  background: rgba(10,30,12,0.72);
  backdrop-filter: blur(40px) saturate(1.4);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -8px 48px rgba(0,0,0,0.3);
  padding: 8px 24px 40px;
}
.rs-h {
  font-size: 22px;
  font-weight: 900;
  color: var(--white);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.rs-p {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  margin-bottom: 16px;
}
.rs-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* ── Bubble controls (dark theme) ── */
.bubble-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.bubble-label {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
}
.bubble-input {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: 'Montserrat', sans-serif;
  color: var(--white);
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.4;
}
.bubble-input::placeholder { color: rgba(255,255,255,0.3); }
.bubble-input:focus { border-color: var(--lime); }
.bubble-positions { display: flex; gap: 8px; }
.pos-btn {
  flex: 1;
  padding: 8px 4px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  border: 1.5px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.5);
  transition: all 0.15s;
}
.pos-btn:hover { border-color: var(--lime); color: var(--white); }
.pos-btn.active { border-color: var(--lime); background: var(--lime); color: var(--dark); }

/* ─────────────────────────────────────────
   Error screen
───────────────────────────────────────── */
.white-s.center-s {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding: 32px;
}
.err-ic { font-size: 56px; }
#error-detail { font-size: 15px; color: var(--muted); max-width: 280px; }

/* ── Utils ── */
.hidden { display: none !important; }
