:root {
  --bg: #0f1115;
  --card: #181b22;
  --card-border: #262a33;
  --text: #e8eaed;
  --muted: #9aa0aa;
  --accent: #6c8cff;
  --accent-hover: #5577ff;
  --success: #36c275;
  --error: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2030 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

.masthead { text-align: center; margin-bottom: 32px; }
.masthead h1 { font-size: 2rem; margin: 0 0 6px; letter-spacing: -0.02em; }
.masthead p { color: var(--muted); margin: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.field { margin-bottom: 22px; }
.field:last-of-type { margin-bottom: 26px; }
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.95rem;
}
.field small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.82rem;
}
.field code {
  background: #0e1117;
  border: 1px solid var(--card-border);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.8em;
}

input[type="file"],
input[type="url"],
select {
  width: 100%;
  padding: 12px 14px;
  background: #0e1117;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
}
input[type="url"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 140, 255, 0.2);
}

.btn {
  display: inline-block;
  width: 100%;
  text-align: center;
  padding: 13px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  margin-top: 18px;
}
.btn.small {
  width: auto;
  display: inline-block;
  padding: 8px 14px;
  font-size: 0.85rem;
  margin-top: 0;
}

/* Photo gallery */
.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.gallery:empty { display: none; }
.thumb {
  width: 72px;
  height: 96px;
  border-radius: 10px;
  border: 2px solid var(--card-border);
  background: #0e1117 center / cover no-repeat;
  padding: 0;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.05s ease;
}
.thumb:hover { transform: translateY(-1px); }
.thumb.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 140, 255, 0.25); }

/* Share row */
.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}
.share-label { color: var(--muted); font-size: 0.85rem; margin-right: 2px; }

/* Shared-look page */
.share-card { display: flex; justify-content: center; }
.shared-img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}

.result.hidden,
.hidden { display: none; }

.status {
  font-weight: 600;
  margin-bottom: 18px;
  text-align: center;
}
.status[data-kind="error"] { color: var(--error); }
.status[data-kind="success"] { color: var(--success); }

.preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.preview figure { margin: 0; }
.preview figcaption {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 6px;
  text-align: center;
}
.preview img,
.img-wrap {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  background: #0e1117;
  border: 1px solid var(--card-border);
}
.preview img { object-fit: cover; }

.img-wrap { position: relative; overflow: hidden; }
.img-wrap img {
  height: 100%;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  object-fit: cover;
  display: block;
  transition: filter 0.3s ease, transform 0.3s ease;
}

/* Loading state: dim/blur the base image and overlay an animated skeleton. */
.shimmer {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  pointer-events: none;
}
#result-figure.loading .shimmer { display: block; }
#result-figure.loading .img-wrap img {
  filter: blur(7px) brightness(0.55) saturate(0.85);
  transform: scale(1.03);
}

/* Diagonal light sweep. */
.shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(108, 140, 255, 0.28) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: sweep 1.3s ease-in-out infinite;
}
@keyframes sweep { to { transform: translateX(100%); } }

/* Pulsing skeleton blocks roughly over torso / skirt / legs. */
.blk {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  animation: pulse 1.2s ease-in-out infinite;
}
.blk.b1 { top: 25%; width: 46%; height: 16%; animation-delay: 0s; }
.blk.b2 { top: 45%; width: 38%; height: 22%; animation-delay: 0.2s; }
.blk.b3 { top: 72%; width: 30%; height: 12%; animation-delay: 0.4s; }
@keyframes pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.65; } }

@media (prefers-reduced-motion: reduce) {
  .shimmer::after, .blk { animation: none; }
}

@media (max-width: 520px) {
  .preview { grid-template-columns: 1fr; }
}
