:root {
  --bg: #0f172a;
  --card: #111c34;
  --card-soft: #162640;
  --accent: #e879f9;
  --accent-strong: #a855f7;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --success: #22c55e;
  --error: #f87171;
  font-family: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1e1b4b, #020617 60%);
  color: var(--text);
}

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.hero {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.3rem);
  margin: 0.4rem 0;
}

.lede {
  color: var(--muted);
  max-width: 520px;
}

.hero-pill {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  padding: 1rem 1.5rem;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.hero-pill span {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.8rem;
  color: var(--accent);
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.layout .grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.2rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 20px 65px rgba(2, 6, 23, 0.45);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.card-header-text {
  flex: 1;
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.platform-reset {
  margin: 0;
}

.card-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.card-header p {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.field-grid {
  display: grid;
  gap: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
}

label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

label.checkbox input[type='checkbox'] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}

input:not([type='file']),
select,
textarea {
  background: var(--card-soft);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  color: var(--text);
  padding: 0.9rem 1rem;
  font-size: 1rem;
}

select {
  appearance: none;
}

textarea {
  resize: vertical;
}

.dropzone {
  border: 1px dashed rgba(255, 255, 255, 0.2);
  padding: 2rem;
  align-items: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 1rem;
}

.dropzone input {
  display: none;
}

.dz-icon {
  font-size: 2.2rem;
  color: var(--accent);
}

.product-gallery {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.product-gallery p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.product-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 140px));
  gap: 0.75rem;
  justify-content: start;
}

.product-gallery-item {
  border-radius: 0.9rem;
  overflow: hidden;
  background: var(--card-soft);
  border: 1px solid var(--border);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.product-gallery-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.product-gallery-item:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.3);
}

.product-gallery-item input:checked + img {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.product-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border: none;
  color: #05051a;
  font-weight: 600;
  padding: 0.95rem 1.4rem;
  border-radius: 0.9rem;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 15px 35px rgba(168, 85, 247, 0.3);
}

button.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ghost-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  padding: 0.75rem 1rem;
  border-radius: 0.7rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ghost-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.65;
}

.icon-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.6rem;
  font-size: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.flash {
  padding: 0.9rem 1.1rem;
  border-radius: 0.8rem;
  border: 1px solid var(--border);
}

.flash.success {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
}

.flash.error {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.08);
}

.result dl {
  margin: 0;
  display: grid;
  row-gap: 0.4rem;
}

.result dt {
  font-weight: 600;
  color: var(--muted);
}

.result dd {
  margin: 0 0 0.5rem;
}

.tag {
  display: inline-flex;
  padding: 0.3rem 0.75rem;
  margin: 0 0.4rem 0.4rem 0;
  border-radius: 999px;
  background: rgba(232, 121, 249, 0.1);
  border: 1px solid rgba(232, 121, 249, 0.3);
  font-size: 0.85rem;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  align-items: flex-start;
}

.preview-image img {
  width: 100%;
  border-radius: 1rem;
  border: 1px solid var(--border);
  box-shadow: 0 10px 35px rgba(5, 5, 26, 0.55);
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.preview-actions form {
  margin: 0;
  flex: 1 1 220px;
}

.preview-actions button {
  width: 100%;
}

.preview-actions .ghost-btn {
  width: 100%;
}

.instagram-actions {
  display: grid;
  gap: 1rem;
}

.instagram-actions .action-group {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
  border-radius: 0.9rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.instagram-actions .action-group h3 {
  margin: 0;
}

.platform-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: start;
}

.platform-preview {
  width: 100%;
  border-radius: 0.8rem;
  border: 1px solid var(--border);
  display: block;
  margin-bottom: 1rem;
  box-shadow: 0 12px 30px rgba(5, 5, 26, 0.4);
}

.copy-block {
  white-space: pre-wrap;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  padding: 1rem;
  min-height: 120px;
}

.tag-tray {
  display: flex;
  flex-wrap: wrap;
}

.video-preview {
  width: 100%;
  border-radius: 0.8rem;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr !important;
  }

  .hero {
    flex-direction: column;
    text-align: left;
  }
}
