:root {
  --ink: #101114;
  --ink-2: #1d2026;
  --paper: #f7efe5;
  --paper-2: #eadbcb;
  --rose: #f05d5e;
  --wine: #651c32;
  --mint: #79e2bf;
  --gold: #d8aa52;
  --muted: #746b63;
  --line: rgba(16, 17, 20, 0.14);
  --white: #fffaf4;
  --shadow: 0 24px 70px rgba(33, 17, 22, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(16,17,20,0.045) 1px, transparent 1px) 0 0 / 46px 46px,
    linear-gradient(180deg, #fff8ef 0%, #f1dfcf 52%, #ddc7bd 100%);
  font-family: "Manrope", "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 75% 15%, rgba(240, 93, 94, 0.22), transparent 31%);
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.age-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 80% 16%, rgba(240,93,94,0.34), transparent 32%),
    linear-gradient(135deg, rgba(16,17,20,0.98), rgba(101,28,50,0.92));
}

.age-gate.hidden {
  display: none;
}

.gate-panel {
  width: min(520px, 100%);
  padding: clamp(28px, 5vw, 48px);
  color: var(--white);
  border: 1px solid rgba(255,250,244,0.24);
  background: rgba(16,17,20,0.72);
  box-shadow: 18px 18px 0 rgba(240,93,94,0.55);
  backdrop-filter: blur(18px);
}

.gate-mark {
  display: inline-grid;
  width: 64px;
  height: 64px;
  place-items: center;
  color: var(--ink);
  background: var(--mint);
  border-radius: 50%;
  font-weight: 900;
}

.gate-panel h1,
.hero-copy h2 {
  margin: 18px 0 12px;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(44px, 7vw, 86px);
  font-weight: 400;
  line-height: 0.93;
  letter-spacing: 0;
}

.gate-panel p {
  color: rgba(255,250,244,0.78);
  font-size: 18px;
  line-height: 1.5;
}

.gate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.gate-actions button,
.gate-actions a,
.action-row button,
.queue-panel button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: var(--mint);
  font-weight: 900;
  cursor: pointer;
}

.gate-actions a {
  color: var(--white);
  background: transparent;
  border-color: rgba(255,250,244,0.32);
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  color: var(--white);
  background: linear-gradient(180deg, var(--ink), #231018 62%, var(--wine));
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand span {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--ink);
  background: var(--rose);
  font-weight: 900;
}

.brand strong {
  font-size: 20px;
}

.rail nav {
  display: grid;
  gap: 8px;
}

.rail nav a {
  padding: 12px 14px;
  border: 1px solid rgba(255,250,244,0.14);
  color: rgba(255,250,244,0.78);
  font-weight: 800;
}

.rail nav a.active,
.rail nav a:hover {
  color: var(--ink);
  background: var(--paper);
}

.rail-note {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255,250,244,0.18);
  background: rgba(255,250,244,0.08);
}

.rail-note p {
  margin-bottom: 0;
  color: rgba(255,250,244,0.72);
  font-size: 13px;
  line-height: 1.45;
}

main {
  min-width: 0;
}

.hero-band {
  padding: clamp(34px, 6vw, 78px) clamp(18px, 5vw, 72px) 22px;
}

.hero-copy {
  max-width: 930px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--rose);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-copy h2 {
  color: var(--ink);
}

.lede {
  max-width: 720px;
  margin: 0;
  color: #4e403b;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.45;
  font-weight: 700;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}

.trust-strip span {
  padding: 8px 12px;
  color: var(--white);
  background: var(--ink);
  border-left: 5px solid var(--rose);
  font-size: 12px;
  font-weight: 900;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 20px;
  padding: 20px clamp(18px, 5vw, 72px) 64px;
}

.studio-panel,
.policy-panel,
.queue-panel {
  border: 1px solid var(--line);
  background: rgba(255,250,244,0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.studio-panel {
  display: grid;
  gap: 18px;
  padding: clamp(18px, 3vw, 28px);
}

.panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.panel-head.compact {
  margin-top: 8px;
}

h3 {
  margin: 0;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 34px;
  font-weight: 400;
  line-height: 1;
}

.panel-head output,
.queue-panel button {
  color: var(--white);
  background: var(--ink);
  border: 0;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
}

.dropzone {
  min-height: 220px;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  border: 2px dashed rgba(101,28,50,0.32);
  background:
    linear-gradient(135deg, rgba(240,93,94,0.11), rgba(121,226,191,0.13)),
    var(--white);
  cursor: pointer;
}

.dropzone.drag {
  border-color: var(--rose);
  box-shadow: inset 0 0 0 4px rgba(240,93,94,0.12);
}

.dropzone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  color: var(--white);
  background: var(--rose);
  border-radius: 50%;
  font-size: 34px;
  line-height: 1;
}

.dropzone strong {
  font-size: 20px;
}

.dropzone small,
.prompt-field span,
.tool-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.preview-item {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--ink);
  overflow: hidden;
}

.preview-item img,
.preview-item video {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
}

.preview-item span {
  display: block;
  padding: 9px;
  color: var(--white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 14px;
}

.tool-grid label,
.prompt-field {
  display: grid;
  gap: 8px;
}

select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px;
  color: var(--ink);
  border: 1px solid rgba(16,17,20,0.18);
  background: var(--white);
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

select:focus,
textarea:focus,
input[type="range"]:focus-visible {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(240,93,94,0.14);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--rose);
}

.checkbox-card {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(16,17,20,0.16);
  background: rgba(234,219,203,0.44);
}

.checkbox-card legend {
  padding: 0 8px;
  color: var(--wine);
  font-weight: 900;
}

.checkbox-card label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.35;
  font-weight: 700;
}

.checkbox-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--rose);
}

.safety-result {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-left: 7px solid var(--gold);
  background: #fff5db;
}

.safety-result.pass {
  border-left-color: #1f9d6a;
  background: #def8eb;
}

.safety-result.block {
  border-left-color: #c8273e;
  background: #ffe1e4;
}

.safety-result span {
  color: #554a45;
  font-size: 14px;
  font-weight: 700;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.action-row button {
  background: var(--paper-2);
}

.action-row .primary {
  color: var(--white);
  background: var(--rose);
  border-color: var(--rose);
}

.side-stack {
  display: grid;
  align-content: start;
  gap: 20px;
}

.policy-panel,
.queue-panel {
  padding: 22px;
}

.policy-panel ul {
  margin: 10px 0 22px;
  padding-left: 20px;
}

.policy-panel li {
  margin: 8px 0;
  color: #4f453f;
  line-height: 1.45;
  font-weight: 700;
}

pre {
  min-height: 240px;
  max-height: 520px;
  margin: 16px 0 0;
  padding: 14px;
  overflow: auto;
  color: #eafbf3;
  background: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.5;
}

.render-stage {
  min-height: 260px;
  display: grid;
  place-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 18px;
  text-align: center;
  color: var(--white);
  background:
    linear-gradient(135deg, rgba(16,17,20,0.82), rgba(101,28,50,0.78)),
    linear-gradient(90deg, rgba(255,250,244,0.08) 1px, transparent 1px) 0 0 / 24px 24px;
  border: 1px solid rgba(16,17,20,0.2);
}

.render-stage span {
  color: rgba(255,250,244,0.78);
  font-size: 14px;
  font-weight: 700;
}

.render-stage img,
.render-stage video {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: #08090b;
}

.render-stage.error {
  color: var(--ink);
  background: #ffe1e4;
  border-left: 7px solid #c8273e;
}

.render-stage.error span {
  color: #554a45;
}

.debug-packet {
  min-height: 150px;
  max-height: 260px;
}

@media (max-width: 1040px) {
  .app-shell,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .rail {
    position: relative;
    height: auto;
  }

  .rail-note {
    margin-top: 0;
  }
}

@media (max-width: 680px) {
  .rail {
    padding: 18px;
  }

  .rail nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .rail nav a {
    text-align: center;
    padding: 10px 8px;
    font-size: 13px;
  }

  .hero-band {
    padding-top: 30px;
  }

  .tool-grid,
  .panel-head {
    grid-template-columns: 1fr;
  }

  .panel-head {
    display: grid;
    align-items: start;
  }

  .gate-panel {
    box-shadow: 10px 10px 0 rgba(240,93,94,0.55);
  }
}
