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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface2: #1e1e1e;
  --border: #2a2a2a;
  --accent: #e8ff47;
  --accent-dim: #c8df27;
  --text: #f0f0f0;
  --text-muted: #666;
  --text-dim: #999;
  --radius: 12px;
  --font-display: 'Syne', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  overflow: hidden;
}

/* SCREENS */
.screen {
  display: none;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
  overflow-y: auto;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen.active { display: flex; }

/* HEADER */
header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 20px 0 16px;
  flex-shrink: 0;
}

.logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.tagline {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s;
}
.back-btn:hover { color: var(--text); }

/* PHOTO GRID */
.capture-area {
  flex: 1;
  min-height: 0;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 0;
}

.add-photo-btn {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  padding: 32px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  transition: all 0.2s;
  width: 100%;
}
.add-photo-btn:hover, .add-photo-btn:active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232, 255, 71, 0.04);
}
.add-photo-btn .hint {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.6;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-thumb .remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.7);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.add-more-btn {
  aspect-ratio: 1;
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.add-more-btn:hover { border-color: var(--accent); color: var(--accent); }

/* DESCRIPTION */
.description-area {
  padding: 8px 0 12px;
  flex-shrink: 0;
}
.description-area label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}
textarea {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 14px;
  resize: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
textarea:focus {
  outline: none;
  border-color: var(--accent);
}
textarea::placeholder { color: var(--text-muted); }

/* ACTIONS */
.actions {
  padding: 8px 0 calc(16px + var(--safe-bottom));
  flex-shrink: 0;
}
.actions.stacked {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:hover { background: var(--accent-dim); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
  background: var(--surface2);
  color: var(--text-muted);
  cursor: not-allowed;
}
.btn-primary:disabled:active { transform: none; }

.btn-spinner svg {
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-secondary {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--text-dim); }

.btn-ghost {
  width: 100%;
  background: none;
  color: var(--text-muted);
  border: none;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px;
  cursor: pointer;
  transition: color 0.15s;
}
.btn-ghost:hover { color: var(--text); }

/* REVIEW SCREEN */
.review-photos {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0;
  flex-shrink: 0;
  scrollbar-width: none;
}
.review-photos::-webkit-scrollbar { display: none; }
.review-photos img {
  height: 80px;
  width: 80px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.listing-output {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
  overflow-y: auto;
  scrollbar-width: none;
  min-height: 0;
}
.listing-output::-webkit-scrollbar { display: none; }

.field label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.field.half {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.editable {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 14px;
  min-height: 44px;
  transition: border-color 0.2s;
}
.editable.tall { min-height: 120px; }
.editable:focus {
  outline: none;
  border-color: var(--accent);
}

/* TOAST */
.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 100px;
  opacity: 0;
  transition: all 0.25s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* DRAG OVER */
.capture-area.drag-over .add-photo-btn {
  border-color: var(--accent);
  background: rgba(232, 255, 71, 0.06);
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 50;
  backdrop-filter: blur(4px);
}
.loading-overlay svg {
  animation: spin 0.8s linear infinite;
  color: var(--accent);
}
.loading-overlay span {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}
