:root {
  color-scheme: dark;
  --bg: #08090b;
  --panel: rgba(18, 22, 27, 0.78);
  --panel-strong: #121820;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4f1ea;
  --muted: #aeb5b8;
  --gold: #d6b45f;
  --cyan: #65d6d0;
  --red: #ff6b5f;
  --green: #8bd884;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.45);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 78% 8%, rgba(101, 214, 208, 0.18), transparent 28rem),
    radial-gradient(circle at 6% 18%, rgba(214, 180, 95, 0.16), transparent 24rem),
    linear-gradient(180deg, #08090b 0%, #0e1114 45%, #08090b 100%);
  color: var(--text);
}

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

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

.app-shell {
  min-height: 100vh;
}

.hero {
  position: relative;
  min-height: 92vh;
  overflow: hidden;
  isolation: isolate;
  border-bottom: 1px solid var(--line);
}

.hero::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(90deg, rgba(8, 9, 11, 0.96) 0%, rgba(8, 9, 11, 0.76) 48%, rgba(8, 9, 11, 0.48) 100%),
    linear-gradient(180deg, rgba(8, 9, 11, 0.28), #08090b 96%);
}

.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0;
}

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

.brand {
  font-weight: 760;
  letter-spacing: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(214, 180, 95, 0.65);
  background:
    linear-gradient(135deg, rgba(214, 180, 95, 0.95), rgba(101, 214, 208, 0.25)),
    #161b20;
  box-shadow: 0 0 28px rgba(214, 180, 95, 0.22);
}

.nav-actions a {
  color: var(--muted);
  font-size: 0.94rem;
  padding: 8px 10px;
}

.nav-actions a:hover {
  color: var(--text);
}

.hero-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: end;
  gap: 36px;
  width: min(1180px, calc(100% - 32px));
  min-height: calc(92vh - 88px);
  margin: 0 auto;
  padding: 80px 0 72px;
}

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

.kicker {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 780;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 0.98;
  letter-spacing: 0;
}

h1 {
  max-width: 860px;
  font-size: clamp(3.4rem, 8vw, 8.8rem);
}

h2 {
  font-size: clamp(2.1rem, 4vw, 4.1rem);
}

h3 {
  font-size: 1.15rem;
}

.hero-copy p:not(.kicker),
.section-heading p:not(.kicker) {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.hero-actions,
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.movie-generator {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 180px;
  gap: 12px;
  max-width: 760px;
  margin-top: 28px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 13, 16, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.movie-generator .full,
.generator-actions,
.generator-note {
  grid-column: 1 / -1;
}

.movie-generator label span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 520;
}

.generator-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.generator-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

body.is-generating .movie-generator {
  border-color: rgba(101, 214, 208, 0.7);
  box-shadow: 0 24px 90px rgba(101, 214, 208, 0.13);
}

body.is-generating #generateFullBtn {
  opacity: 0.78;
  cursor: progress;
}

.button,
.icon-button {
  min-height: 44px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  font-weight: 760;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
}

.button.primary {
  border-color: rgba(214, 180, 95, 0.72);
  background: linear-gradient(135deg, #d6b45f, #946f2a);
  color: #111;
}

.button.ghost {
  backdrop-filter: blur(16px);
}

.button.dark {
  background: rgba(0, 0, 0, 0.2);
}

.button.compact {
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.9rem;
}

.button.danger {
  border-color: rgba(255, 107, 95, 0.36);
  color: #ffd5d1;
}

.icon-button {
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
}

.hero-panel {
  padding: 22px;
  border: 1px solid var(--line);
  background: rgba(13, 17, 21, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.metric-value {
  display: block;
  color: var(--cyan);
  font-size: 3rem;
  font-weight: 820;
}

.metric-label {
  color: var(--muted);
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 22px 0;
}

.signal-grid span {
  aspect-ratio: 1.6;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(145deg, rgba(101, 214, 208, 0.3), rgba(214, 180, 95, 0.08));
}

.hero-panel p {
  color: var(--muted);
  line-height: 1.55;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.workspace,
.guide {
  padding: 78px 0;
}

.section-heading {
  margin-bottom: 28px;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 9, 11, 0.82);
  backdrop-filter: blur(18px);
}

.progress-track {
  flex: 1 1 220px;
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  transition: width 240ms ease;
}

.analysis-form {
  display: grid;
  gap: 14px;
}

.form-section {
  border: 1px solid var(--line);
  background: rgba(18, 22, 27, 0.68);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
}

.form-section summary {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
}

.form-section summary::-webkit-details-marker {
  display: none;
}

.section-number {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #111;
  background: var(--gold);
  font-weight: 860;
}

.section-title p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.section-status {
  color: var(--muted);
  font-size: 0.9rem;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 18px 18px;
}

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

label,
.field span {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 730;
}

.hint {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 480;
  line-height: 1.5;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  background: rgba(0, 0, 0, 0.24);
  outline: none;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 104px;
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(101, 214, 208, 0.72);
  box-shadow: 0 0 0 3px rgba(101, 214, 208, 0.12);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.guide-card {
  min-height: 210px;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(18, 22, 27, 0.58);
}

.guide-card h3 {
  margin-bottom: 12px;
}

.guide-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100% - 36px));
  padding: 13px 15px;
  border: 1px solid var(--line);
  background: #111820;
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 920px) {
  .hero-content {
    grid-template-columns: 1fr;
  }

  .hero-content {
    align-items: start;
    padding-top: 54px;
  }

  .hero-panel {
    max-width: 420px;
  }

  .fields,
  .guide-grid,
  .movie-generator {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar,
  .nav-actions,
  .toolbar {
    align-items: flex-start;
  }

  .topbar {
    flex-direction: column;
  }

  .nav-actions {
    width: 100%;
    justify-content: space-between;
  }

  .form-section summary {
    grid-template-columns: 40px 1fr;
  }

  .section-status {
    grid-column: 2;
  }

  h1 {
    font-size: clamp(3rem, 16vw, 5.4rem);
  }
}

.generation-status {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  line-height: 1.45;
}

.generation-status strong {
  color: var(--text);
}

.generation-status.running {
  border-color: rgba(101, 214, 208, 0.62);
  background: rgba(101, 214, 208, 0.08);
}

.generation-status.success {
  border-color: rgba(139, 216, 132, 0.62);
  background: rgba(139, 216, 132, 0.08);
}

.generation-status.error {
  border-color: rgba(255, 107, 95, 0.72);
  background: rgba(255, 107, 95, 0.08);
}

.generation-report {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid rgba(101, 214, 208, 0.28);
  background: rgba(18, 22, 27, 0.72);
  box-shadow: var(--shadow);
}

.generation-report[hidden] {
  display: none;
}

.generation-report p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.generation-report ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.report-meta {
  font-size: 0.88rem;
  color: var(--cyan) !important;
}

.button:disabled {
  opacity: 0.62;
  cursor: wait;
}

@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: #fff;
    color: #111;
  }

  .hero,
  .topbar,
  .guide,
  .toolbar,
  .toast,
  .hero-canvas,
  .movie-generator,
  .hero-panel {
    display: none !important;
  }

  main {
    width: 100%;
    margin: 0;
  }

  .workspace {
    padding: 0;
  }

  .section-heading,
  .generation-report,
  .form-section {
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #111;
    break-inside: avoid;
  }

  .form-section summary {
    padding: 12px 0;
  }

  .section-number {
    background: #111;
    color: #fff;
  }

  input,
  select,
  textarea {
    border: 1px solid #bbb;
    color: #111;
    background: #fff;
  }
}
