:root {
  color-scheme: dark;
  --bg: #050506;
  --ink: #f8f7ef;
  --muted: #a5a7ad;
  --panel: #0d0d12;
  --panel-2: #15151b;
  --line: rgba(255, 255, 255, 0.16);
  --line-strong: rgba(255, 255, 255, 0.32);
  --red: #ff3b30;
  --cyan: #21f6ff;
  --yellow: #ffd51f;
  --green: #9dff00;
  --shadow: 7px 7px 0 rgba(0, 0, 0, 0.62);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

body {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 59, 48, 0.14), transparent 220px),
    #050506;
  background-size: 32px 32px, auto, auto;
}

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

button,
a,
select,
textarea {
  border-radius: 0;
}

button,
a {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  background: rgba(8, 8, 12, 0.92);
  color: var(--ink);
  font-weight: 900;
}

button {
  padding: 0 14px;
  cursor: pointer;
}

a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  text-decoration: none;
}

button:hover,
a:hover {
  border-color: var(--cyan);
  box-shadow: 4px 4px 0 rgba(33, 246, 255, 0.34);
}

.primary {
  border-color: #050506;
  background: linear-gradient(135deg, var(--yellow), #ff7a21 54%, var(--red));
  color: #050506;
  box-shadow: 5px 5px 0 rgba(255, 59, 48, 0.62);
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(135deg, rgba(33, 246, 255, 0.1), transparent 55%),
    #0a0a0f;
  color: var(--ink);
}

select {
  min-height: 40px;
  padding: 0 10px;
}

textarea {
  min-height: 92px;
  resize: none;
  padding: 12px;
  line-height: 1.65;
}

label {
  display: grid;
  gap: 7px;
  color: rgba(248, 247, 239, 0.72);
  font-size: 12px;
  font-weight: 850;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.director-app {
  min-height: 100vh;
  padding: clamp(10px, 1vw, 18px);
}

.director-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  min-width: 0;
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--red);
  padding: clamp(22px, 2.4vw, 38px);
  background:
    linear-gradient(90deg, rgba(5, 5, 6, 0.96), rgba(5, 5, 6, 0.74) 46%, rgba(5, 5, 6, 0.2)),
    url("assets/cyber-zine-hero-clean.png") right 42% / cover no-repeat;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
}

.kicker {
  display: inline-block;
  margin-bottom: 9px;
  border: 1px solid rgba(33, 246, 255, 0.72);
  padding: 5px 9px;
  background: rgba(33, 246, 255, 0.12);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 950;
}

h1 {
  font-size: clamp(44px, 6.5vw, 96px);
  line-height: 0.9;
  text-shadow: 4px 0 0 rgba(255, 59, 48, 0.92), -4px 0 0 rgba(33, 246, 255, 0.48);
}

.director-topbar p {
  max-width: 760px;
  margin-top: 12px;
  color: rgba(248, 247, 239, 0.8);
  font-weight: 800;
  line-height: 1.7;
}

.top-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, auto));
  gap: 10px;
  align-self: start;
}

.console-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(300px, 380px);
  gap: 12px;
  min-height: calc(100vh - 250px);
  margin-top: 12px;
}

.project-panel,
.canvas-panel,
.inspector-panel {
  min-width: 0;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 59, 48, 0.1), transparent 34%),
    linear-gradient(315deg, rgba(33, 246, 255, 0.09), transparent 34%),
    var(--panel);
  box-shadow: var(--shadow);
}

.project-panel,
.inspector-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
}

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

.panel-head span,
.section-title span,
.status-pill {
  border: 1px solid rgba(33, 246, 255, 0.42);
  padding: 4px 7px;
  color: var(--cyan);
  background: rgba(33, 246, 255, 0.08);
  font-size: 11px;
  font-weight: 950;
}

.panel-head strong,
.section-title h2 {
  border: 1px solid #050506;
  padding: 5px 9px;
  background: var(--ink);
  color: #050506;
  font-size: 14px;
  box-shadow: 3px 3px 0 var(--red);
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.panel-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

#domesticModeBtn[aria-pressed="true"] {
  border-color: #050506;
  background: var(--cyan);
  color: #050506;
  box-shadow: 4px 4px 0 var(--red);
}

.asset-bank {
  min-height: 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.asset-bank h2 {
  margin-bottom: 9px;
  color: var(--yellow);
  font-size: 14px;
}

.asset-list {
  display: grid;
  gap: 8px;
}

.asset-card {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-left: 3px solid var(--cyan);
  padding: 9px;
  background: rgba(8, 8, 12, 0.74);
}

.asset-card:nth-child(2) {
  border-left-color: var(--red);
}

.asset-card:nth-child(3) {
  border-left-color: var(--yellow);
}

.asset-card span {
  display: block;
  margin-bottom: 5px;
  color: var(--yellow);
  font-size: 11px;
  font-weight: 950;
}

.asset-card p {
  color: rgba(248, 247, 239, 0.78);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.48;
}

.canvas-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
}

.canvas-toolbar,
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.canvas-toolbar h2 {
  margin-top: 6px;
  font-size: clamp(20px, 2vw, 34px);
  line-height: 1.1;
}

#projectMeta {
  color: var(--yellow);
  font-size: 12px;
  font-weight: 950;
}

.node-canvas {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.node-canvas::before {
  position: absolute;
  top: 50%;
  right: 4%;
  left: 4%;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, var(--cyan), var(--yellow), var(--red));
  opacity: 0.36;
}

.flow-node {
  position: relative;
  z-index: 1;
  min-width: 0;
  border: 1px solid var(--line);
  padding: 10px;
  background:
    linear-gradient(135deg, rgba(33, 246, 255, 0.1), transparent 46%),
    #0b0b10;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.42);
}

.flow-node.active {
  border-color: var(--yellow);
  box-shadow: 4px 4px 0 rgba(255, 59, 48, 0.46);
}

.flow-node span {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 950;
}

.flow-node strong {
  display: block;
  margin: 5px 0;
  font-size: 14px;
}

.flow-node p {
  color: rgba(248, 247, 239, 0.68);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.storyboard-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.shot-card {
  display: grid;
  gap: 7px;
  min-height: 156px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-top: 3px solid var(--cyan);
  padding: 10px;
  background:
    linear-gradient(135deg, rgba(255, 213, 31, 0.09), transparent 42%),
    #101016;
  color: var(--ink);
  text-align: left;
}

.shot-card.active {
  border-color: var(--yellow);
  border-top-color: var(--red);
  background:
    linear-gradient(135deg, rgba(255, 213, 31, 0.18), transparent 42%),
    #151511;
  box-shadow: 5px 5px 0 rgba(255, 59, 48, 0.45);
}

.shot-card span {
  color: var(--cyan);
  font-size: 11px;
}

.shot-card strong {
  color: var(--ink);
  font-size: 14px;
}

.shot-card em,
.shot-card small {
  color: rgba(248, 247, 239, 0.68);
  font-style: normal;
  font-size: 12px;
  line-height: 1.35;
}

.shot-card p {
  color: rgba(248, 247, 239, 0.82);
  font-size: 12px;
  font-weight: 780;
  line-height: 1.5;
}

.timeline-panel {
  display: grid;
  gap: 9px;
}

.timeline-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(74px, 1fr);
  gap: 6px;
  overflow: auto;
  padding-bottom: 4px;
}

.timeline-clip {
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 3px solid var(--yellow);
  padding: 7px;
  background: #0b0b10;
  color: rgba(248, 247, 239, 0.78);
  font-size: 11px;
  font-weight: 850;
}

.shot-inspector {
  display: grid;
  gap: 10px;
  min-height: 220px;
  overflow: auto;
}

.shot-inspector h3 {
  color: var(--yellow);
  font-size: 20px;
}

.shot-inspector p {
  border-left: 3px solid var(--cyan);
  padding-left: 9px;
  color: rgba(248, 247, 239, 0.78);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.65;
}

.shot-inspector strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 11px;
}

.inspector-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.prompt-package {
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr);
  gap: 10px;
  min-height: 0;
  flex: 1 1 auto;
}

#projectOutput {
  min-height: 280px;
  border-left: 5px solid var(--yellow);
  background:
    linear-gradient(90deg, rgba(255, 213, 31, 0.07) 0 1px, transparent 1px),
    #101016;
  background-size: 24px 24px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #07070a;
}

::-webkit-scrollbar-thumb {
  border: 3px solid #07070a;
  background: var(--red);
}

@media (max-width: 1200px) {
  .console-layout {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  }

  .inspector-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    align-items: start;
  }

  .prompt-package {
    grid-row: span 3;
  }
}

@media (max-width: 860px) {
  .director-app {
    padding: 0;
  }

  .director-topbar {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  h1 {
    font-size: clamp(34px, 12vw, 52px);
  }

  .director-topbar p {
    display: none;
  }

  .top-actions {
    grid-template-columns: 1fr;
  }

  .console-layout,
  .inspector-panel {
    grid-template-columns: 1fr;
  }

  .console-layout {
    min-height: 0;
  }

  .project-panel,
  .canvas-panel,
  .inspector-panel {
    border-right: 0;
    border-left: 0;
    box-shadow: none;
  }

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

  .node-canvas {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .node-canvas::before {
    display: none;
  }

  .shot-grid {
    grid-template-columns: 1fr;
    max-height: none;
    overflow: visible;
  }

  .timeline-track {
    grid-auto-columns: minmax(98px, 40vw);
  }
}

@media (max-width: 460px) {
  .node-canvas {
    grid-template-columns: 1fr;
  }

  .canvas-toolbar,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }
}
