:root {
  --pink: #f7a8c4;
  --pink-deep: #e07aa0;
  --bg: #fff6fa;
  --card: #ffffff;
  --ink: #4a3540;
  --muted: #9b8791;
  --line: #f3d9e5;
  --ok: #1b5e20;
  --err: #842029;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
/* Author rules like .btn { display: inline-block } otherwise beat the
   UA stylesheet's [hidden] { display: none }, since both are equal
   specificity and .btn is declared after -- make [hidden] always win. */
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.wrap { max-width: 560px; margin: 0 auto; padding: 18px 16px 40px; }
.hero { text-align: center; padding: 12px 0 6px; }
.hero h1 { font-size: 27px; margin: 6px 0; color: var(--pink-deep); letter-spacing: .01em; }
.sub { color: var(--muted); font-size: 14px; margin: 0 auto; max-width: 40ch; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  margin: 14px 0;
  box-shadow: 0 6px 20px rgba(224, 122, 160, .08);
}
.hint { color: var(--muted); font-size: 13px; }
.hint a { color: var(--pink-deep); }

textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: #fffafc;
  margin: 8px 0;
  resize: vertical;
}
textarea:focus { outline: none; border-color: var(--pink); }

.btn {
  display: inline-block; text-align: center;
  border: none; border-radius: 999px;
  padding: 11px 20px; font: inherit; font-weight: 600;
  background: #fbe4ee; color: var(--pink-deep);
  cursor: pointer; transition: transform .05s ease, filter .1s ease;
}
.btn:hover { filter: brightness(.98); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--pink); color: #fff; }
.btn.primary:disabled { background: #f3d3e0; color: #fff; cursor: default; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.big { width: 100%; padding: 14px; font-size: 17px; margin-top: 6px; }
.btn.small { padding: 6px 14px; font-size: 15px; }

.pick { display: block; }
.pick .btn { width: 100%; }
#preview { width: 100%; border-radius: 14px; display: block; }

/* Tap-to-place marker overlay, shared by the pre-generate preview and the
   after-image fix target (see js/compositor.js withMarkers). */
.marker-wrap { position: relative; width: 100%; margin: 12px 0; border-radius: 14px; overflow: hidden; cursor: crosshair; }
.marker-wrap img { width: 100%; display: block; }
.marker-layer { position: absolute; inset: 0; pointer-events: none; }
/* Result-screen fix overlay: draws committed lasso loops, the live
   in-progress drag path, and the single tap-fix dot -- and owns the
   pointer events that drive them (see js/app.js's pointerdown/move/up
   handlers). touch-action: none stops the browser's own scroll/pinch
   gesture from stealing a single-finger drag before it's read as a loop. */
.fix-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.marker-dot {
  position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border-radius: 50%; background: rgba(255, 0, 255, .69); border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.15);
  pointer-events: auto; cursor: pointer;
}
/* Numbered variant, used for the pre-generate placement markers -- same
   number that's baked into the marked photo sent to the model (see
   js/compositor.js withMarkers) and that labels this marker's caption field. */
.marker-dot.numbered {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700; line-height: 1;
}
.marker-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.marker-row .hint { margin: 0; }

/* One caption field per placed marker -- see js/app.js renderMarkerCaptions. */
.marker-captions { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.marker-caption-field { display: flex; flex-direction: column; }
.marker-caption-field label { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.marker-caption-field input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #fffafc;
}
.marker-caption-field input:focus { outline: none; border-color: var(--pink); }

.status { margin-top: 12px; padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.status.busy { background: #fff3cd; color: #664d03; }
.status.ok { background: #d4edda; color: var(--ok); }
.status.error { background: #f8d7da; color: var(--err); }

.results .pair { display: grid; gap: 12px; }
.results figure { margin: 0; }
.results figcaption { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.results img { width: 100%; border-radius: 14px; display: block; }

.variation-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 12px 0 2px; }
.variation-nav #var-label { color: var(--muted); font-size: 14px; min-width: 3em; text-align: center; }

.actions-row { display: flex; gap: 8px; margin-top: 10px; }
.actions-row .btn { flex: 1; }

.fix-panel { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }

#add-more-btn { width: 100%; margin-top: 10px; }
#back-btn { width: 100%; margin-top: 10px; }

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

@media (prefers-color-scheme: dark) {
  :root { --bg: #221019; --card: #2b1922; --ink: #f3e3ec; --muted: #c39fb2; --line: #3d2531; }
  textarea { background: #34202b; }
}
