:root {
  color-scheme: light;
  --paper: #f7f8f5;
  --ink: #142018;
  --muted: #657168;
  --line: #cbd2cc;
  --signal: #18a66a;
  --signal-dark: #087749;
  --warm: #f05d3f;
  --white: #fff;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

button, input { font: inherit; }

.shell {
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 30px clamp(20px, 6vw, 72px) 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}

.brand-mark {
  width: 26px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.brand-mark span {
  width: 8px;
  height: 8px;
  background: var(--signal);
  border-radius: 50%;
  box-shadow: 5px 0 0 -2px var(--warm);
}

.workspace {
  align-self: center;
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(360px, 1.05fr);
  gap: clamp(46px, 9vw, 110px);
  align-items: center;
  padding: 60px 0;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--signal-dark);
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  max-width: 600px;
  font-family: "Arial Narrow", "PingFang SC", sans-serif;
  font-size: clamp(44px, 6.4vw, 78px);
  line-height: .98;
  letter-spacing: 0;
}

.lede {
  max-width: 520px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

code { color: var(--ink); font-size: .88em; }

.download-form {
  border-top: 4px solid var(--ink);
  border-bottom: 1px solid var(--line);
  padding: 28px 0 30px;
}

.download-form > label:first-child {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
}

.input-wrap { position: relative; }

input[type="url"] {
  width: 100%;
  height: 62px;
  padding: 0 58px 0 16px;
  border: 1px solid #98a39b;
  border-radius: 4px;
  background: var(--white);
  color: var(--ink);
  outline: none;
}

input[type="url"]:focus {
  border-color: var(--signal-dark);
  box-shadow: 0 0 0 3px rgba(24, 166, 106, .16);
}

.icon-button {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--signal-dark);
  cursor: pointer;
}

.icon-button svg, .primary-button svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rights-check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 17px 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.rights-check input { accent-color: var(--signal-dark); }

.primary-button {
  width: 100%;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 4px;
  background: var(--signal);
  color: var(--white);
  font-weight: 750;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}

.primary-button:hover { background: var(--signal-dark); }
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled { cursor: wait; opacity: .66; }

.status {
  grid-column: 2;
  margin-top: -34px;
  padding: 12px 14px;
  border-left: 3px solid var(--signal);
  background: #e8f5ee;
  color: #145f3e;
  font-size: 14px;
}

.status.error { border-color: var(--warm); background: #fff0ec; color: #8b321f; }

.video-result {
  grid-column: 1 / -1;
  width: min(100%, 560px);
  justify-self: end;
  margin-top: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--signal);
  background: var(--white);
}

.result-kicker {
  margin-bottom: 12px;
  color: var(--signal-dark);
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.video-result video {
  display: block;
  width: 100%;
  max-height: 62vh;
  background: #0b0f0c;
  border-radius: 3px;
}

.video-result h2 {
  margin: 16px 0;
  font-size: 17px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-actions { display: grid; gap: 10px; }

.secondary-button {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 4px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.text-link { color: var(--muted); text-align: center; font-size: 13px; }
.save-guide { margin: 15px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }

footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.pulse { width: 4px; height: 4px; border-radius: 50%; background: var(--signal); }

@media (max-width: 760px) {
  .shell { padding-top: 22px; }
  .workspace { grid-template-columns: 1fr; gap: 44px; padding: 54px 0 36px; }
  h1 { font-size: clamp(42px, 13vw, 62px); }
  .lede { margin-top: 20px; }
  .status { grid-column: 1; margin-top: -26px; }
  .video-result { grid-column: 1; justify-self: stretch; margin-top: 0; padding: 14px; }
  footer { justify-content: flex-start; flex-wrap: wrap; }
}

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

.setup-shell { display: block; }
.setup-panel { max-width: 760px; margin: 72px auto; }
.setup-panel h1 { font-size: clamp(38px, 7vw, 64px); }
.setup-panel ol { margin: 32px 0; padding-left: 22px; color: var(--muted); line-height: 1.8; }
.setup-panel a { color: var(--signal-dark); }
.setup-panel textarea { width: 100%; min-height: 150px; margin-bottom: 18px; padding: 14px; resize: vertical; border: 1px solid #98a39b; border-radius: 4px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.setup-panel textarea:focus { border-color: var(--signal-dark); outline: 3px solid rgba(24, 166, 106, .16); }
.setup-panel kbd { padding: 2px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: white; }
.setup-status { margin: 18px 0; }
