:root {
  color-scheme: dark;
  --bg: #07110f;
  --surface: rgba(14, 29, 25, 0.84);
  --surface-strong: #10231e;
  --surface-soft: #132b24;
  --border: rgba(171, 210, 195, 0.14);
  --border-strong: rgba(190, 255, 105, 0.38);
  --text: #f4f8f5;
  --muted: #94a9a1;
  --accent: #c7ff63;
  --accent-strong: #a8ed37;
  --teal: #54ddbb;
  --danger: #ff8f82;
  --warning: #ffc861;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  font-family:
    Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(59, 132, 107, 0.16), transparent 28rem),
    linear-gradient(160deg, #07110f 0%, #081713 54%, #07100e 100%);
}

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

button,
select {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  filter: blur(110px);
  pointer-events: none;
  opacity: 0.11;
}

.ambient-one {
  top: -14rem;
  right: 8%;
  background: var(--accent);
}

.ambient-two {
  bottom: -18rem;
  left: 0;
  background: var(--teal);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 34px 54px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand strong {
  display: block;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 7px);
  align-items: end;
  gap: 3px;
  width: 48px;
  height: 48px;
  padding: 12px;
  border-radius: 15px;
  background: var(--accent);
  box-shadow: 0 0 34px rgba(199, 255, 99, 0.18);
}

.brand-mark.small {
  width: 40px;
  height: 40px;
  padding: 10px;
  border-radius: 12px;
  grid-template-columns: repeat(3, 5px);
}

.brand-mark span {
  display: block;
  border-radius: 4px 4px 1px 1px;
  background: #102018;
}

.brand-mark span:nth-child(1) {
  height: 52%;
}

.brand-mark span:nth-child(2) {
  height: 100%;
}

.brand-mark span:nth-child(3) {
  height: 72%;
}

.topbar-actions,
.system-state {
  display: flex;
  align-items: center;
  gap: 10px;
}

.system-state {
  color: var(--muted);
  font-size: 12px;
}

.system-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: center;
  min-height: 345px;
  padding: 58px 5% 42px;
}

.eyebrow,
.step-label {
  margin: 0 0 15px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.17em;
}

.hero h1 {
  margin: 0;
  max-width: 700px;
  font-size: clamp(42px, 5.3vw, 76px);
  line-height: 0.99;
  letter-spacing: -0.065em;
}

.hero h1 em {
  color: var(--accent);
  font-style: normal;
}

.hero-copy {
  max-width: 590px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.agent-orbit {
  position: relative;
  width: 270px;
  height: 270px;
  margin-left: auto;
  border: 1px solid rgba(199, 255, 99, 0.16);
  border-radius: 50%;
  animation: breathe 6s ease-in-out infinite;
}

.agent-orbit::before,
.agent-orbit::after {
  content: "";
  position: absolute;
  inset: 34px;
  border: 1px dashed rgba(84, 221, 187, 0.22);
  border-radius: 50%;
}

.agent-orbit::after {
  inset: 74px;
  border-style: solid;
}

.orbit-core {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 22px;
  color: #102018;
  background: var(--accent);
  font-weight: 900;
  box-shadow: 0 0 45px rgba(199, 255, 99, 0.24);
}

.orbit-node {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #dce8e3;
  background: rgba(10, 25, 21, 0.94);
  box-shadow: var(--shadow);
  font-size: 11px;
}

.orbit-node span {
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
}

.node-one {
  top: 20px;
  left: 14px;
}

.node-two {
  top: 102px;
  right: -28px;
}

.node-three {
  bottom: 8px;
  left: 42px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 285px minmax(0, 1fr);
  gap: 22px;
}

.sidebar,
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.sidebar {
  align-self: start;
  padding: 18px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

.button-primary {
  color: #102018;
  background: var(--accent);
}

.button-primary:hover {
  background: var(--accent-strong);
}

.button-ghost {
  border-color: var(--border);
  color: var(--muted);
}

.button-wide {
  width: 100%;
}

.plus {
  font-size: 20px;
  font-weight: 400;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 27px 5px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.icon-button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 18px;
}

.icon-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.job-list {
  display: grid;
  gap: 7px;
  max-height: 420px;
  overflow: auto;
}

.job-list-item {
  width: 100%;
  padding: 13px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: inherit;
  background: transparent;
  text-align: left;
}

.job-list-item:hover,
.job-list-item.active {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.job-list-item.active {
  border-color: var(--border-strong);
}

.job-list-item strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-completed {
  color: var(--accent);
}

.status-generating {
  color: var(--teal);
}

.status-rejected,
.status-failed {
  color: var(--danger);
}

.status-awaiting_approval {
  color: var(--warning);
}

.empty-list {
  padding: 22px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.principle-card {
  display: flex;
  gap: 11px;
  margin-top: 20px;
  padding: 15px;
  border: 1px solid rgba(84, 221, 187, 0.16);
  border-radius: 14px;
  background: rgba(84, 221, 187, 0.055);
}

.principle-icon {
  display: grid;
  flex: 0 0 25px;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  color: #102018;
  background: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.principle-card strong {
  font-size: 11px;
}

.principle-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.stage {
  min-width: 0;
}

.panel {
  min-height: 555px;
  padding: clamp(25px, 4vw, 48px);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--border);
}

.panel-heading h2,
.job-title {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
  letter-spacing: -0.045em;
}

.duration-chip,
.status-badge {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 10px;
  font-weight: 700;
}

.create-form {
  padding-top: 30px;
}

.field {
  display: grid;
  gap: 9px;
}

.field > span {
  color: #c9d7d1;
  font-size: 11px;
  font-weight: 750;
}

.field small {
  color: var(--muted);
  font-size: 10px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: 0;
  color: var(--text);
  background: rgba(3, 13, 10, 0.58);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

input,
select {
  min-height: 46px;
  padding: 0 13px;
}

textarea {
  min-height: 132px;
  padding: 16px;
  resize: vertical;
  line-height: 1.6;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(199, 255, 99, 0.07);
}

textarea::placeholder,
input::placeholder {
  color: #5f756d;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr 115px;
  gap: 14px;
  margin-top: 20px;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  min-height: 62px;
  margin-top: 22px;
}

.form-error {
  flex: 1;
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 11px;
}

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

.pipeline-step {
  position: relative;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 10px;
}

.pipeline-step strong {
  display: block;
  margin-bottom: 4px;
  color: #d9e5e0;
  font-size: 11px;
}

.pipeline-step.done,
.pipeline-step.active {
  border-color: var(--border-strong);
  background: rgba(199, 255, 99, 0.055);
}

.pipeline-step.active::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 11px var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}

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

.job-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.idea-card {
  position: relative;
  display: flex;
  min-height: 230px;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.idea-card:hover,
.idea-card.selected {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: rgba(199, 255, 99, 0.055);
}

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

.idea-index {
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.idea-card h3 {
  margin: 15px 0 10px;
  font-size: 17px;
  letter-spacing: -0.025em;
}

.idea-hook {
  margin: 0;
  color: #cbd9d3;
  font-size: 12px;
  line-height: 1.55;
}

.idea-why {
  margin: auto 0 0;
  padding-top: 16px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.approval-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.approval-bar p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.generating-state {
  display: grid;
  min-height: 320px;
  place-items: center;
  text-align: center;
}

.spinner {
  position: relative;
  width: 82px;
  height: 82px;
  margin: 0 auto 24px;
  border: 1px solid var(--border);
  border-radius: 50%;
}

.spinner::before {
  content: "";
  position: absolute;
  inset: -1px;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}

.spinner::after {
  content: "AI";
  position: absolute;
  inset: 15px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #102018;
  background: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.generating-state h3 {
  margin: 0;
  font-size: 20px;
}

.generating-state p {
  max-width: 410px;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
  gap: 22px;
}

.video-frame {
  overflow: hidden;
  aspect-ratio: 9 / 16;
  max-height: 590px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #020806;
}

.video-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-info {
  display: grid;
  align-content: start;
  gap: 12px;
}

.info-card {
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.023);
}

.info-card h4 {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.info-card p {
  margin: 0;
  color: #d9e5e0;
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.storyboard {
  display: grid;
  gap: 8px;
}

.quality-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 12px;
}

.quality-grid span {
  display: grid;
  gap: 3px;
  padding: 10px 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 8px;
  text-align: center;
}

.quality-grid strong {
  color: var(--accent);
  font-size: 16px;
}

.story-segment {
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px solid rgba(84, 221, 187, 0.13);
  border-radius: 12px;
  background: rgba(84, 221, 187, 0.045);
}

.story-segment > span {
  color: var(--accent);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.story-segment strong {
  color: #edf5f1;
  font-size: 12px;
}

.story-segment p {
  color: #c7d5cf;
}

.story-segment small {
  color: var(--teal);
  font-size: 9px;
  line-height: 1.45;
}

.prompt-card {
  max-height: 270px;
  overflow: auto;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 6px 8px;
  border-radius: 999px;
  color: var(--teal);
  background: rgba(84, 221, 187, 0.08);
  font-size: 10px;
}

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

.risk-score {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 3px;
}

.error-state {
  padding: 45px 20px;
  text-align: center;
}

.error-state strong {
  color: var(--danger);
}

.error-state p {
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 26px;
  bottom: 26px;
  max-width: 360px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: #163128;
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

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

.login-screen {
  position: relative;
  z-index: 2;
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-card {
  width: min(420px, 100%);
  padding: 38px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: rgba(12, 29, 24, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.login-card .brand-mark {
  margin-bottom: 25px;
}

.login-card h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.05em;
}

.login-card .muted {
  margin: 10px 0 30px;
  color: var(--muted);
  font-size: 12px;
}

.login-card label {
  display: block;
  margin-bottom: 8px;
  color: #c9d7d1;
  font-size: 11px;
  font-weight: 750;
}

.login-card .button {
  margin-top: 8px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.82);
  }
}

@keyframes breathe {
  50% {
    transform: scale(1.015);
  }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    padding-inline: 2%;
  }

  .agent-orbit {
    display: none;
  }

  .workspace-grid {
    grid-template-columns: 220px minmax(0, 1fr);
  }

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

  .idea-card {
    min-height: 180px;
  }

  .result-grid {
    grid-template-columns: minmax(220px, 0.8fr) 1.2fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 0 14px 32px;
  }

  .topbar {
    min-height: 68px;
  }

  .brand small,
  .system-state {
    display: none;
  }

  .hero {
    min-height: auto;
    padding: 45px 5px 34px;
  }

  .hero h1 {
    font-size: 42px;
  }

  .workspace-grid {
    display: flex;
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .job-list {
    display: flex;
    max-height: none;
    overflow-x: auto;
  }

  .job-list-item {
    flex: 0 0 210px;
  }

  .principle-card {
    display: none;
  }

  .panel {
    min-height: 0;
    padding: 25px 18px;
    border-radius: 20px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .form-footer,
  .approval-bar,
  .job-header {
    align-items: stretch;
    flex-direction: column;
  }

  .form-footer .button,
  .approval-bar .button {
    width: 100%;
  }

  .pipeline {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .video-frame {
    width: min(100%, 340px);
    margin: 0 auto;
  }

  .login-card {
    padding: 28px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
