/* ============================================================
   Avatorcam — soft polaroid, gentle retro
   ============================================================ */

:root {
  --paper: #fbf4e4;
  --paper-card: #fffdf6;
  --ink: #3d2817;
  --ink-soft: #6b513a;
  --line: rgba(61, 40, 23, 0.14);

  --cherry: #e8423c;
  --salmon: #ff8a7a;
  --mustard: #ffc93c;
  --mint: #7bd389;
  --sky: #7fb7e6;

  --radius: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 0 rgba(61, 40, 23, 0.04), 0 14px 28px rgba(61, 40, 23, 0.08);
  --shadow-polaroid: 0 1px 0 rgba(61, 40, 23, 0.08), 0 14px 24px -8px rgba(61, 40, 23, 0.22);

  --font-display: "Pacifico", "Hiragino Maru Gothic ProN", cursive;
  --font-hand: "Caveat", "Hiragino Maru Gothic ProN", cursive;
  --font-body: "Nunito", system-ui, -apple-system, "Hiragino Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at 1px 1px, rgba(61, 40, 23, 0.06) 1px, transparent 0) 0 0 / 22px 22px,
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* ── App ──────────────────────────────────────────────────── */
.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 56px 22px 72px;
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  text-align: center;
  margin-bottom: 32px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(40px, 9vw, 64px);
  line-height: 1;
  letter-spacing: 0.5px;
}

.logo-text {
  background: linear-gradient(
    100deg,
    var(--cherry) 0%,
    var(--salmon) 35%,
    var(--mustard) 65%,
    var(--mint) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-cam {
  width: clamp(40px, 8vw, 56px);
  height: auto;
  transform: rotate(6deg) translateY(3px);
}

.lede {
  margin: 6px 0 0;
  font-family: var(--font-hand);
  font-size: 24px;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.2;
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  box-shadow: var(--shadow-card);
  margin-bottom: 22px;
}

.row {
  margin-bottom: 22px;
}
.row:last-child {
  margin-bottom: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-hand);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

.field-sub {
  font-size: 16px;
  color: var(--ink-soft);
  font-weight: 500;
}

.lock-ico {
  width: 16px;
  height: 16px;
}

/* ── Inputs ───────────────────────────────────────────────── */
.field input[type="text"],
.field input[type="password"],
.field textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input[type="text"],
.field input[type="password"] {
  height: 44px;
  padding: 0 14px;
}

.field textarea {
  padding: 12px 14px;
  line-height: 1.55;
  resize: vertical;
  min-height: 130px;
}

.field input[type="text"]:focus,
.field input[type="password"]:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--cherry);
  box-shadow: 0 0 0 4px rgba(232, 66, 60, 0.12);
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(61, 40, 23, 0.38);
}

/* ── Segmented (aspect) ──────────────────────────────────── */
.segmented {
  display: inline-flex;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  align-self: flex-start;
}

.segmented button {
  appearance: none;
  background: transparent;
  border: 0;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.segmented button[aria-checked="true"] {
  background: var(--cherry);
  color: #fff;
  box-shadow: 0 2px 6px rgba(232, 66, 60, 0.3);
}

/* ── Polaroid ─────────────────────────────────────────────── */
.polaroid {
  display: inline-block;
  background: #fff;
  padding: 12px 12px 44px;
  border-radius: 4px;
  box-shadow: var(--shadow-polaroid);
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.polaroid-window {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #f5ecd2 0%, #e6d5a8 100%);
  border-radius: 2px;
  overflow: hidden;
}

.polaroid-caption {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 20px;
  color: var(--ink);
}

/* Dropzone polaroid */
.dropzone-row {
  display: flex;
  justify-content: center;
}

.dropzone {
  width: 100%;
  max-width: 300px;
}

.dropzone:hover {
  transform: translateY(-2px);
}

.dropzone.dragover {
  box-shadow: 0 1px 0 rgba(61, 40, 23, 0.08), 0 18px 30px -8px rgba(232, 66, 60, 0.35);
}

.dropzone.dragover .polaroid-window {
  background: linear-gradient(135deg, #ffd9d4 0%, #ffb8b0 100%);
}

.dropzone-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  text-align: center;
  pointer-events: none;
  padding: 18px;
}

.dz-icon {
  width: 50px;
  height: 50px;
  color: var(--cherry);
  margin-bottom: 2px;
}

.dropzone-hint {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--ink);
}

.dropzone-sub {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-soft);
}

#preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dropzone.has-image .dropzone-inner {
  display: none;
}

/* ── Chips ────────────────────────────────────────────────── */
.prompt-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.chip {
  appearance: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip:hover {
  background: var(--mustard);
  border-color: var(--mustard);
}

/* ── Pose chips (radio-like) ──────────────────────────────── */
.pose-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.pose-chips .chip[aria-checked="true"] {
  background: var(--cherry);
  color: #fff;
  border-color: var(--cherry);
  box-shadow: 0 2px 6px rgba(232, 66, 60, 0.3);
}

/* ── Submit ───────────────────────────────────────────────── */
.submit-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.primary {
  appearance: none;
  background: var(--cherry);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0 28px;
  height: 48px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 14px rgba(232, 66, 60, 0.3);
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s;
}

.primary:not(:disabled):hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(232, 66, 60, 0.36);
}

.primary:not(:disabled):active {
  transform: translateY(1px);
}

.primary:disabled {
  background: #d6c8b0;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ico {
  width: 18px;
  height: 18px;
}

/* ── Status ───────────────────────────────────────────────── */
.status {
  font-family: var(--font-hand);
  font-size: 18px;
  color: var(--ink-soft);
  min-height: 22px;
  text-align: center;
}

.status.error {
  color: var(--cherry);
  font-weight: 700;
}

.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2.2px solid rgba(232, 66, 60, 0.25);
  border-top-color: var(--cherry);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Result ───────────────────────────────────────────────── */
.result-title {
  margin: 0 0 20px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 32px;
  color: var(--ink);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  justify-items: center;
}

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

.result-polaroid {
  width: 100%;
  max-width: 260px;
  cursor: default;
  transition: transform 0.2s ease;
}

.result-polaroid .polaroid-window {
  background: #ece1c2;
}

.result-polaroid img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tilt-l { transform: rotate(-2deg); }
.tilt-r { transform: rotate(1.5deg); }
.tilt-l:hover,
.tilt-r:hover { transform: rotate(0deg) translateY(-2px); }

.download-chip {
  position: absolute;
  bottom: -14px;
  right: 8px;
  background: var(--mustard);
  border-color: var(--mustard);
}

/* ── Footer ───────────────────────────────────────────────── */
.footer {
  margin-top: 32px;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 18px;
  color: var(--ink-soft);
}

.heart {
  color: var(--cherry);
  font-size: 20px;
  vertical-align: -1px;
}

/* ── Small screens ────────────────────────────────────────── */
@media (max-width: 480px) {
  .app { padding: 40px 14px 56px; }
  .card { padding: 22px 18px; }
  .lede { font-size: 21px; }
}
