@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700&family=Newsreader:ital,opsz,wght@1,6..72,500&display=swap");

:root {
  --ink: #f3f1eb;
  --muted: #9b9cab;
  --panel: rgba(22, 23, 38, 0.72);
  --line: rgba(255, 255, 255, 0.1);
  --accent: #ff7657;
  --violet: #7467ff;
  --green: #76e6ad;
  --bg: #0a0b12;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 72% 8%, rgba(72, 61, 201, 0.2), transparent 29rem),
    radial-gradient(circle at 2% 36%, rgba(175, 73, 49, 0.12), transparent 30rem),
    var(--bg);
  font-family: "Manrope", sans-serif;
  min-height: 100vh;
}

.noise {
  position: fixed;
  inset: 0;
  opacity: 0.035;
  pointer-events: none;
  z-index: 10;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  max-width: 1440px;
  height: 82px;
  margin: 0 auto;
  padding: 0 42px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  color: #0b0c12;
  background: var(--ink);
  border-radius: 50% 50% 50% 8px;
  font-family: "DM Mono", monospace;
  font-size: 14px;
}

nav { display: flex; gap: 8px; }

.nav-link {
  padding: 9px 14px;
  border: 0;
  border-radius: 99px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
}

.nav-link:hover, .nav-link.active { color: var(--ink); background: rgba(255,255,255,.07); }

.system-status {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font: 11px "DM Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(118,230,173,.8);
}

main { max-width: 1280px; margin: 0 auto; padding: 0 38px; }
.view { display: none; animation: reveal .45s ease both; }
.view.active { display: block; }

@keyframes reveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero { max-width: 850px; padding: 92px 0 64px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 22px;
  color: #bbb9ca;
  font: 11px "DM Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .13em;
}

.eyebrow span { width: 25px; height: 1px; background: var(--accent); }

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

.hero h1, .page-intro h1 {
  margin-bottom: 22px;
  font-size: clamp(52px, 7.4vw, 103px);
  line-height: .88;
  letter-spacing: -.072em;
}

.hero h1 em {
  color: var(--accent);
  font-family: "Newsreader", serif;
  font-weight: 500;
}

.hero > p, .page-intro > p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.workspace-grid { display: grid; grid-template-columns: 1.03fr .97fr; gap: 18px; }

.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 80px rgba(0,0,0,.2);
}

.composer, .pipeline-card { padding: 28px; min-height: 520px; }

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 34px;
}

.panel-heading > div { display: flex; align-items: center; gap: 12px; }
.panel-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.03em; }

.step-number, .state-label {
  color: var(--muted);
  font: 10px "DM Mono", monospace;
  letter-spacing: .08em;
}

.modality-pill {
  padding: 7px 11px;
  color: #cdc9ff;
  border: 1px solid rgba(116,103,255,.28);
  border-radius: 99px;
  background: rgba(116,103,255,.1);
  font: 10px "DM Mono", monospace;
  text-transform: uppercase;
}

label {
  display: block;
  margin-bottom: 9px;
  color: #babac5;
  font-size: 12px;
  font-weight: 600;
}

.prompt-wrap { position: relative; margin-bottom: 20px; }

textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  outline: none;
  color: var(--ink);
  background: rgba(5, 6, 13, .48);
  transition: border .2s, box-shadow .2s;
}

textarea:focus, input:focus, select:focus {
  border-color: rgba(116,103,255,.75);
  box-shadow: 0 0 0 3px rgba(116,103,255,.1);
}

.composer textarea {
  height: 160px;
  padding: 17px 18px 36px;
  resize: none;
  border-radius: 12px;
  line-height: 1.6;
  font-size: 14px;
}

textarea::placeholder, input::placeholder { color: #626371; }
#prompt-count { position: absolute; right: 14px; bottom: 12px; color: #686978; font: 9px "DM Mono", monospace; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }
.field input, .field select { height: 45px; padding: 0 13px; border-radius: 9px; font-size: 12px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #777 50%), linear-gradient(135deg, #777 50%, transparent 50%); background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }

.primary-button, .secondary-button, .file-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 51px;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  font-size: 12px;
}

.primary-button {
  width: 100%;
  color: #141016;
  background: var(--accent);
  box-shadow: 0 10px 30px rgba(255,118,87,.18);
  transition: transform .2s, filter .2s;
}

.primary-button:hover { transform: translateY(-2px); filter: brightness(1.07); }
.primary-button:disabled { opacity: .5; transform: none; cursor: wait; }
.button-arrow { margin-left: auto; padding-right: 5px; font-size: 17px; }
.cost-note { margin: 12px 0 0; color: #696a77; text-align: center; font-size: 10px; }

.pipeline-line { padding: 3px 5px; }
.pipeline-node {
  display: grid;
  grid-template-columns: 45px 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  transition: all .3s;
}

.pipeline-node.active { border-color: rgba(116,103,255,.35); background: rgba(116,103,255,.08); }
.pipeline-node.complete .node-icon { color: #102018; background: var(--green); }

.node-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.035);
}

.pipeline-node strong { display: block; margin-bottom: 4px; font-size: 13px; }
.pipeline-node div span { color: var(--muted); font-size: 10px; }
.pipeline-node b { color: #555664; font: 9px "DM Mono", monospace; }
.connector { height: 30px; padding-left: 40px; }
.connector i { display: block; width: 1px; height: 100%; background: var(--line); }

.progress-shell { margin-top: 29px; padding: 17px; border-radius: 11px; background: rgba(0,0,0,.2); }
.progress-header { display: flex; justify-content: space-between; color: var(--muted); font: 9px "DM Mono", monospace; text-transform: uppercase; }
.progress-track { height: 3px; margin-top: 13px; overflow: hidden; background: #292a36; border-radius: 5px; }
#progress-bar { width: 0; height: 100%; background: linear-gradient(90deg, var(--violet), var(--accent)); transition: width .5s ease; }

.result-section {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 70px;
  align-items: center;
  padding: 130px 15px 60px;
}

.result-copy h2 { margin-bottom: 18px; font-size: clamp(36px,5vw,62px); letter-spacing: -.06em; line-height: .97; }
.result-copy > p { color: var(--muted); font-size: 14px; line-height: 1.7; }
.result-prompt {
  max-width: 34rem;
  padding: 14px 16px;
  border-left: 2px solid var(--accent);
  color: #d9d8e2 !important;
  background: rgba(255,255,255,.03);
  font-size: 13px !important;
}
.receipt { margin: 28px 0; border-top: 1px solid var(--line); }
.receipt div { display: grid; grid-template-columns: 90px 1fr; gap: 15px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.receipt span { color: var(--muted); }
.receipt code, .receipt strong {
  overflow: hidden;
  color: #d6d5df;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 10px "DM Mono", monospace;
}
#result-params, #result-prompt {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}
.routing-trail { margin: 0 0 26px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,.22); }
.routing-trail h3 { margin: 0 0 12px; color: var(--muted); font: 9px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .1em; }
.routing-trail ul { margin: 0; padding: 0; list-style: none; }
.routing-trail li { display: grid; grid-template-columns: 16px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 11px; }
.routing-trail li.failed span { color: var(--accent); }
.routing-trail li.succeeded span { color: var(--green); }
.routing-trail li em { color: var(--muted); font-style: normal; font-family: "DM Mono", monospace; font-size: 10px; }

.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.secondary-button.disabled { opacity: .4; pointer-events: none; }
.compact { width: auto; height: 44px; padding: 0 18px; }
.secondary-button, .file-button { padding: 0 18px; color: var(--ink); border: 1px solid var(--line); background: transparent; }
.asset-frame { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 19px; background: #11121d; box-shadow: 0 38px 100px rgba(0,0,0,.4); }
.asset-frame img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.asset-frame figcaption { display: flex; justify-content: space-between; padding: 12px 15px; color: var(--muted); font: 9px "DM Mono", monospace; text-transform: uppercase; }
.verified-badge { color: var(--green); }

.library-intro { display: grid; gap: 18px; max-width: 760px; padding: 90px 0 40px; }
.library-intro .secondary-button { justify-self: start; }
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  padding-bottom: 80px;
}
.library-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  cursor: pointer;
  transition: transform .2s, border-color .2s;
}
.library-card:hover { transform: translateY(-3px); border-color: rgba(116,103,255,.45); }
.library-thumb { aspect-ratio: 16/10; background: #12131c; }
.library-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.library-meta { padding: 16px; }
.library-meta strong { display: block; margin-bottom: 8px; font-size: 13px; }
.library-meta p {
  display: -webkit-box;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.library-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.library-tags span {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #b7b6c4;
  font: 9px "DM Mono", monospace;
  text-transform: uppercase;
}
.library-meta code { color: #6f7080; font: 10px "DM Mono", monospace; }
.library-empty, .library-loading {
  padding: 40px 0 100px;
  color: var(--muted);
  font-size: 14px;
}

.narrow-view { min-height: calc(100vh - 150px); max-width: 920px; margin: 0 auto; padding: 100px 0; }
.page-intro { padding-bottom: 50px; }
.page-intro h1 { font-size: clamp(52px,7vw,82px); }
.verify-panel { padding: 28px; }
.verify-panel textarea { min-height: 270px; padding: 16px; resize: vertical; border-radius: 10px; font: 11px/1.7 "DM Mono", monospace; }
.verify-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.verify-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-preview {
  margin: 16px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0d0e16;
}
.photo-preview img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
}
.photo-name {
  display: block;
  padding: 10px 14px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 11px "DM Mono", monospace;
}
.file-button input { display: none; }
.verification-result { margin-top: 18px; padding: 20px; border: 1px solid rgba(118,230,173,.25); border-radius: 14px; background: rgba(118,230,173,.06); }
.verification-result.invalid { border-color: rgba(255,118,87,.3); background: rgba(255,118,87,.06); }
.verification-result.ai { border-color: rgba(255,176,66,.38); background: rgba(255,176,66,.08); }
.verify-followup { margin-top: 16px; }
.verification-result h3 { margin-bottom: 7px; font-size: 17px; }
.verification-result p { margin: 0; color: var(--muted); font-size: 12px; }
.verify-details { margin-top: 16px; border-top: 1px solid var(--line); }
.verify-details div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.verify-details span { color: var(--muted); }
.verify-details strong, .verify-details code {
  overflow: hidden;
  color: #d6d5df;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 10px "DM Mono", monospace;
}

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.feature-grid article { min-height: 250px; padding: 25px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); }
.feature-grid article > span { color: var(--accent); font: 10px "DM Mono", monospace; }
.feature-grid h3 { margin-top: 75px; margin-bottom: 12px; font-size: 18px; }
.feature-grid p { color: var(--muted); font-size: 12px; line-height: 1.7; }

footer { max-width: 1280px; margin: 70px auto 0; padding: 28px 38px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: #5d5e6b; font: 9px "DM Mono", monospace; text-transform: uppercase; }
.hidden { display: none !important; }

.secondary-button:disabled { opacity: .4; cursor: not-allowed; }

.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 28px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,6,12,.78); backdrop-filter: blur(4px); }
.modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(900px, 100%);
  max-height: 84vh;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #14151f;
  box-shadow: 0 40px 120px rgba(0,0,0,.6);
}
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-header h2 { margin: 6px 0 0; font-size: 19px; letter-spacing: -.03em; }
.modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.modal-close:hover { background: rgba(255,255,255,.07); }
#manifest-view {
  flex: 1;
  margin: 0;
  padding: 20px 24px;
  overflow: auto;
  color: #d7d6e0;
  background: #0d0e16;
  font: 11px/1.75 "DM Mono", monospace;
  white-space: pre;
  tab-size: 2;
}
#manifest-view .k { color: #8ea2ff; }
#manifest-view .s { color: #9ce6b6; }
#manifest-view .n { color: #ffb27a; }
#manifest-view .b { color: #ff8fa3; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
}
#toast { position: fixed; right: 25px; bottom: 25px; z-index: 20; max-width: 340px; padding: 14px 18px; transform: translateY(100px); opacity: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #20212e; font-size: 12px; transition: .3s; }
#toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 800px) {
  .topbar { height: auto; padding: 18px 20px; grid-template-columns: 1fr auto; }
  .topbar nav { grid-column: 1 / -1; grid-row: 2; justify-content: center; margin-top: 15px; flex-wrap: wrap; }
  .system-status { font-size: 0; }
  main { padding: 0 18px; }
  .hero { padding: 70px 0 45px; }
  .workspace-grid, .result-section { grid-template-columns: 1fr; }
  .result-section { gap: 35px; padding-top: 80px; }
  .feature-grid { grid-template-columns: 1fr; }
  .feature-grid article { min-height: 190px; }
  .feature-grid h3 { margin-top: 45px; }
  .verify-actions { gap: 10px; }
  footer { margin-top: 30px; padding: 25px 18px; }
  footer span:last-child { display: none; }
}
