@font-face {
  font-family: "Syne Local";
  src: url("../assets/fonts/syne-latin.woff2") format("woff2");
  font-weight: 500 800;
  font-display: swap;
}

@font-face {
  font-family: "Manrope Local";
  src: url("../assets/fonts/manrope-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --fg: #eee9df;
  --muted: #aaa49a;
  --line: #33312f;
  --orange: #ff9d4a;
  --cyan: #5ee2ff;
  --lime: #d8ff3a;
  --danger: #ff756d;
  --display: "Syne Local", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --body: "Manrope Local", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  color-scheme: dark;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--fg);
  background: var(--bg);
  font-family: var(--body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
textarea,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: var(--bg);
  background: var(--lime);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  min-height: 66px;
  padding: 0 26px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.brand,
.back-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--fg);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 7px;
  height: 7px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 14px rgba(255, 157, 74, 0.75);
}

.runtime {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.runtime-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.runtime-dot.online {
  background: var(--lime);
}

.runtime-dot.configured {
  background: var(--orange);
}

.back-link {
  justify-self: end;
  color: var(--muted);
}

.back-link:hover {
  color: var(--orange);
}

.workspace {
  min-height: calc(100vh - 116px);
  display: grid;
  grid-template-columns: minmax(430px, 0.82fr) minmax(0, 1.18fr);
}

.input-pane,
.output-pane {
  min-width: 0;
  padding: 64px max(28px, 6vw);
}

.input-pane {
  border-right: 1px solid var(--line);
}

.eyebrow,
.empty-output span,
.result-kicker,
.result-no,
.model-badge,
.boundary,
.field-meta,
.form-status,
footer {
  font-family: "Cascadia Code", Consolas, monospace;
}

.eyebrow {
  margin: 0 0 20px;
  color: var(--orange);
  font-size: 10px;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 78px;
  font-weight: 800;
  line-height: 0.92;
}

.lead {
  max-width: 540px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.boundary {
  margin: 28px 0 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.boundary span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
}

.field-label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 132px;
  padding: 16px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--fg);
  background: var(--surface);
}

textarea:focus {
  border-color: var(--orange);
}

.field-meta {
  margin-top: 7px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 9px;
}

.samples {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.samples button,
.density-control label span {
  min-height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.samples button:hover,
.samples button[aria-pressed="true"] {
  border-color: var(--cyan);
  color: var(--cyan);
}

.density-control {
  margin: 24px 0 0;
  padding: 0;
  display: flex;
  border: 0;
}

.density-control legend {
  width: 100%;
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 700;
}

.density-control label {
  position: relative;
}

.density-control label + label {
  margin-left: 7px;
}

.density-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.density-control input:checked + span {
  border-color: var(--orange);
  color: var(--bg);
  background: var(--orange);
}

.submit-button {
  width: 100%;
  min-height: 50px;
  margin-top: 24px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--orange);
  border-radius: 4px;
  color: var(--bg);
  background: var(--orange);
  font-weight: 800;
  cursor: pointer;
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.form-status {
  min-height: 20px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.form-status.error {
  color: var(--danger);
}

.output-pane {
  background: #0d0d0d;
}

.empty-output {
  height: 100%;
  min-height: 620px;
  display: grid;
  align-content: center;
  gap: 26px;
}

.empty-output img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  filter: saturate(0.7) contrast(1.05);
}

.empty-output span,
.result-kicker {
  color: var(--cyan);
  font-size: 9px;
}

.empty-output strong {
  margin-top: 6px;
  display: block;
  font-family: var(--display);
  font-size: 30px;
}

.empty-output p {
  margin: 8px 0 0;
  color: var(--muted);
}

.result-header {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.result-header h2,
.safety-result h2 {
  margin: 10px 0 0;
  font-family: var(--display);
  font-size: 34px;
  line-height: 1.16;
}

.result-meta {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-badge {
  padding: 5px 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
}

.model-badge.live {
  border-color: var(--lime);
  color: var(--lime);
}

.result-section {
  padding: 30px 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 22px;
  border-bottom: 1px solid var(--line);
}

.result-no {
  color: var(--orange);
  font-size: 11px;
}

.result-section h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 22px;
}

.result-section p {
  margin: 10px 0 0;
  color: #d4cfc6;
  font-size: 16px;
  line-height: 1.75;
}

.output-actions {
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.copy-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--cyan);
  border-radius: 4px;
  color: var(--cyan);
  background: transparent;
  cursor: pointer;
}

.output-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.safety-result {
  max-width: 680px;
  margin: 10vh auto 0;
  padding: 34px;
  border: 1px solid var(--danger);
  border-radius: 6px;
}

.safety-result .result-kicker {
  color: var(--danger);
}

.safety-result p,
.safety-result li {
  color: #d4cfc6;
}

.safety-result li + li {
  margin-top: 10px;
}

footer {
  min-height: 50px;
  padding: 12px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .runtime {
    display: none;
  }

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

  .input-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .empty-output {
    min-height: 520px;
  }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 58px;
    padding: 0 14px;
  }

  .brand {
    font-size: 9px;
  }

  .back-link {
    font-size: 10px;
  }

  .input-pane,
  .output-pane {
    padding: 38px 14px;
  }

  h1 {
    font-size: 54px;
  }

  .lead {
    font-size: 15px;
  }

  .field-meta {
    display: block;
  }

  .field-meta span + span {
    margin-top: 4px;
    display: block;
  }

  .samples {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .samples button:last-child {
    grid-column: 1 / -1;
  }

  .density-control label {
    flex: 1;
  }

  .density-control label span {
    width: 100%;
    padding: 0 8px;
  }

  .result-header h2,
  .safety-result h2 {
    font-size: 27px;
  }

  .result-section {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
  }

  .result-section p {
    font-size: 14px;
  }

  .output-actions,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .output-note {
    text-align: left;
  }

  .safety-result {
    margin-top: 0;
    padding: 24px;
  }
}

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