@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&family=Playfair+Display:wght@700;900&display=swap');

:root {
  --bg: #0e0f13;
  --bg-card: rgba(22, 24, 32, 0.92);
  --bg-card-hover: rgba(30, 33, 44, 0.96);
  --ink: #eae8e3;
  --ink-secondary: #9a9a9e;
  --muted: #6b6b72;
  --line: rgba(255, 255, 255, 0.08);
  --line-hover: rgba(255, 255, 255, 0.16);
  --accent: #6c63ff;
  --accent-glow: rgba(108, 99, 255, 0.35);
  --accent-hover: #7e77ff;
  --accent-contrast: #ffffff;
  --gold: #f0c040;
  --gold-glow: rgba(240, 192, 64, 0.3);
  --success: #34d399;
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 24px 80px rgba(108, 99, 255, 0.15);
  --radius: 20px;
  --radius-sm: 14px;
  --glass: rgba(255, 255, 255, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(108, 99, 255, 0.10), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(240, 192, 64, 0.06), transparent 40%),
    var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 80px;
  display: grid;
  gap: 28px;
}

/* ===== HERO ===== */
.hero {
  padding: 12px 4px 0;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.hero-logo {
  height: 64px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 12px rgba(108, 99, 255, 0.3));
}

.brand-name {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: linear-gradient(135deg, var(--ink), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.hero h1,
.status-header h2,
.references-panel h2 {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  color: var(--ink);
}

.hero h1 {
  font-size: clamp(2.3rem, 5vw, 4.1rem);
  line-height: 1;
  background: linear-gradient(135deg, var(--ink) 40%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  max-width: 740px;
  margin: 14px 0 0;
  color: var(--ink-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ===== PANELS ===== */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  backdrop-filter: blur(12px);
  transition: border-color 300ms ease, box-shadow 300ms ease;
}

.panel:hover {
  border-color: var(--line-hover);
}

/* ===== REFERENCES ===== */
.references-panel h2 {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.ref-intro {
  margin: 0 0 20px;
  color: var(--ink-secondary);
  font-size: 0.92rem;
}

.ref-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

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

.ref-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ref-drop-zone {
  position: relative;
  min-height: 180px;
  border: 2px dashed var(--line-hover);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 250ms ease;
  overflow: hidden;
  background: var(--glass);
}

.ref-drop-zone:hover,
.ref-drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(108, 99, 255, 0.06);
  box-shadow: 0 0 30px var(--accent-glow);
}

.ref-drop-zone.drag-over {
  transform: scale(1.02);
}

.ref-drop-zone.has-image {
  border-style: solid;
  border-color: var(--success);
}

.ref-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
}

.ref-icon {
  font-size: 2rem;
  filter: grayscale(0.3);
}

.ref-text {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.ref-preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
  position: absolute;
  inset: 0;
}

.ref-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.8);
  color: white;
  border: 0;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 200ms;
  padding: 0;
  z-index: 5;
}

.ref-drop-zone:hover .ref-remove:not(.hidden) {
  opacity: 1;
}

.ref-file-input {
  display: none;
}

.ref-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.ref-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--ink-secondary);
}

.ref-option input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* ===== FORM ===== */
.form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.form label {
  display: grid;
  gap: 8px;
}

.form label span {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form select,
.form textarea,
.form input[type="file"] {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 14px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  transition: border-color 200ms, box-shadow 200ms;
}

.form select:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.form select option {
  background: #1a1c24;
  color: var(--ink);
}

.form textarea {
  resize: vertical;
  min-height: 140px;
}

.full {
  grid-column: 1 / -1;
}

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

/* ===== BUTTON ===== */
button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: var(--accent-contrast);
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
  box-shadow: 0 4px 20px var(--accent-glow);
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.5;
  cursor: wait;
  box-shadow: none;
}

/* ===== HINTS & STATUS ===== */
.hint,
.status-copy,
.enhanced {
  margin: 0;
  color: var(--ink-secondary);
  line-height: 1.5;
  font-size: 0.92rem;
}

.field-hint,
.error-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.status-panel {
  display: grid;
  gap: 16px;
}

.health-panel {
  display: grid;
  gap: 16px;
}

.status-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

/* ===== BADGE ===== */
.badge {
  min-width: 108px;
  text-align: center;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(108, 99, 255, 0.15);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  border: 1px solid rgba(108, 99, 255, 0.2);
}

/* ===== HEALTH LIST ===== */
.health-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.health-item {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--glass);
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
  transition: border-color 200ms;
}

.health-item:hover {
  border-color: var(--line-hover);
}

.health-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.health-name {
  font-weight: 700;
  font-size: 0.92rem;
}

.health-message,
.health-detail {
  margin: 0;
  line-height: 1.45;
}

.health-message {
  color: var(--ink-secondary);
  font-size: 0.9rem;
}

.health-detail {
  color: var(--muted);
  font-size: 0.82rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ===== STATUS PILLS ===== */
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: 0.03em;
}

.status-pill.ok {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.status-pill.error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ===== WARNINGS & ERRORS ===== */
.warnings,
.error {
  margin: 0;
  padding: 0;
}

.warnings {
  list-style: none;
  display: grid;
  gap: 8px;
}

.warnings li {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 0.9rem;
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.error {
  color: var(--error);
  font-weight: 600;
}

/* ===== RESULT ===== */
.result {
  display: grid;
  gap: 16px;
}

.result video {
  width: min(100%, 520px);
  border-radius: var(--radius);
  background: #000;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.download-link {
  display: inline-flex;
  width: fit-content;
  text-decoration: none;
  border-radius: 999px;
  padding: 12px 22px;
  background: linear-gradient(135deg, var(--gold), #e6a800);
  color: #111;
  font-weight: 700;
  font-size: 0.92rem;
  transition: transform 150ms, box-shadow 150ms;
  box-shadow: 0 4px 16px var(--gold-glow);
}

.download-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--gold-glow);
}

.hidden {
  display: none !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 820px) {
  .form {
    grid-template-columns: 1fr;
  }

  .ref-grid {
    grid-template-columns: 1fr;
  }

  .status-header {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .page {
    padding: 20px 0 40px;
    gap: 20px;
  }

  .panel {
    padding: 20px 16px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }
}
