:root {
  --body-bg: #f0f2f5;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --muted-soft: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --card-soft: #f8fafc;
  --preview-bg: #f1f5f9;
  --cta-bg: #1a1a1a;
  --ok: #80f20d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--body-bg);
  color: var(--text);
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.app-card {
  width: min(100%, 448px);
  min-height: 850px;
  border: 1px solid var(--surface);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
  padding: 40px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.app-header {
  text-align: center;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.app-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.4;
}

.upload-cta {
  border: 2px dashed var(--line-strong);
  border-radius: 16px;
  background: var(--card-soft);
  min-height: 180px;
  display: grid;
  place-items: center;
  gap: 8px;
  color: #334155;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
}

.upload-cta span:last-child {
  font-size: 24px;
}

.upload-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  font-size: 32px;
}

.preview-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--preview-bg);
}

.preview-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 8px;
  color: var(--muted-soft);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

.preview-mark {
  font-size: 30px;
}

.finish-switch-wrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card-soft);
}

.finish-pill {
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.finish-pill.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
}

.palette-wrap h2 {
  margin: 0 0 12px;
  color: var(--muted-soft);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.color-option {
  border: 1px solid transparent;
  border-radius: 12px;
  min-height: 44px;
  aspect-ratio: 1 / 1;
  width: 100%;
  cursor: pointer;
}

.color-option.selected {
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 0 4px #1a1a1a,
    0 1px 2px rgba(0, 0, 0, 0.06);
}

.wrap-btn {
  height: 56px;
  border: 0;
  border-radius: 12px;
  background: var(--cta-bg);
  color: #fff;
  font-size: 30px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.wrap-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wrapped-progress {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 12px;
  background: rgba(255, 255, 255, 0.84);
  border-radius: 10px;
  backdrop-filter: blur(2px);
}

.preview-frame.processing::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(112deg, transparent 30%, rgba(255, 255, 255, 0.38) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: processing-shine 2.8s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes processing-shine {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -100% 0;
  }
}

.progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--preview-bg);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--ok);
  box-shadow: 0 0 10px rgba(128, 242, 13, 0.5);
  transition: width 0.3s ease;
}

.status-text {
  margin: 8px 0 0;
  color: var(--muted-soft);
  font-size: 12px;
  text-align: center;
}

.feedback-wrap {
  display: grid;
  gap: 10px;
}

.status-card,
.selected-film {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.error-card {
  border-color: #fecaca;
  background: #fef2f2;
}

.error-card .status-text {
  color: #b91c1c;
}

.ghost-btn {
  width: 100%;
  margin-top: 8px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.selected-film h3 {
  margin: 0;
  font-size: 16px;
}

.selected-film p {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #334155;
}

.bottom-actions {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--preview-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.footer-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
}

.footer-btn.save {
  color: var(--ok);
  font-weight: 700;
}

.footer-btn:hover:not(:disabled) {
  background: #f8fafc;
}

.footer-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.contact-strip {
  margin-top: auto;
  text-align: center;
  padding-top: 8px;
}

.contact-strip a {
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.contact-strip a:hover {
  text-decoration: underline;
}

.hidden {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 540px) {
  .app-card {
    min-height: 0;
    border-radius: 20px;
    padding: 28px 16px 16px;
    gap: 16px;
  }

  .app-header h1 {
    font-size: 40px;
  }

  .app-header p {
    font-size: 15px;
  }

  .upload-cta {
    min-height: 136px;
  }

  .upload-cta span:last-child {
    font-size: 18px;
  }

  .finish-pill {
    font-size: 16px;
  }

  .color-option {
    min-height: 24px;
  }

  .palette-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 4px;
  }

  .wrap-btn {
    font-size: 24px;
  }

  .bottom-actions {
    flex-wrap: wrap;
    justify-content: center;
  }
}
