:root {
  --bg: #0a0c0e;
  --surface: #12161a;
  --surface-2: #171c21;
  --line: #232a31;
  --line-2: #2e373f;
  --text: #e8edf1;
  --muted: #8b98a5;
  --accent: #4ee0c0;
  --accent-ink: #04211b;
  --danger: #ff6b6b;
  --radius: 14px;
  --ease: cubic-bezier(.32, .72, 0, 1);
}

* { box-sizing: border-box; }

/* [hidden] must win over any display rule below */
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

button { font: inherit; color: inherit; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 620;
  letter-spacing: -.01em;
  font-size: 16px;
}

.brand-mark { width: 21px; height: 21px; color: var(--accent); }

.topbar-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .02em;
}

/* ---------- layout ---------- */
.app {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
  padding: 0 clamp(16px, 4vw, 40px) 32px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 880px) {
  .app { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- stage ---------- */
.stage { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.frame-wrap {
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 100% at 50% 0%, #141a20 0%, var(--bg) 70%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(12px, 2.2vw, 26px);
  min-height: 300px;
}

.frame {
  position: relative;
  width: 100%;
  /* the widest this aspect ratio can be while still fitting the viewport height */
  max-width: min(100%, max(300px, calc((100vh - 250px) * var(--aspect, 1))));
  aspect-ratio: var(--aspect, 1);
  border-radius: 12px;
  overflow: hidden;
  background: #0e1215;
  touch-action: none;
  cursor: grab;
  isolation: isolate;
  contain: paint;
}

.frame.dragging { cursor: grabbing; }
.frame.has-photo { box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset; }

.layer {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: 0 0;
  will-change: transform;
  object-fit: fill;
  max-width: none;
}

/* the graded pixels are painted as their own layers so the crop can move by transform */
.layer.compare { opacity: 0; transition: opacity .12s linear; }
body.comparing .layer.compare { opacity: 1; }

.frame.no-photo .layer { opacity: 0 !important; }

/* ---------- drop ---------- */
.drop {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

.drop svg { width: 30px; height: 30px; margin-bottom: 8px; opacity: .75; }
.drop-title { margin: 0; color: var(--text); font-weight: 560; font-size: 16px; }
.drop-sub { margin: 0; font-size: 13px; }

body[data-state="ready"] .drop { display: none; }

/* ---------- busy ---------- */
.busy {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 12, 14, .62);
  backdrop-filter: blur(6px);
  font-size: 13px;
  letter-spacing: .04em;
  color: var(--text);
}

.busy span::after {
  content: "";
  display: block;
  margin: 10px auto 0;
  width: 90px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: slide 1.1s linear infinite;
}

@keyframes slide {
  from { transform: translateX(-45%); }
  to { transform: translateX(45%); }
}

/* ---------- video scrubber ---------- */
.video-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.video-label { font-size: 12px; color: var(--muted); flex: none; }
.video-bar input[type="range"] { flex: 1; min-width: 0; }
.video-time {
  flex: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 74px;
  text-align: right;
}

/* the video sits under the graded stills: it is what you see while scrubbing */
.layer.video { background: #000; z-index: 0; }
#photo-hdr, #photo-orig { z-index: 1; }
#photo-orig { z-index: 2; }

/* ---------- stage bar ---------- */
.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.formats, .seg {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 3px;
  gap: 2px;
}

.formats button, .seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 520;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.formats button:hover, .seg button:hover { color: var(--text); }

.formats button[aria-checked="true"], .seg button[aria-checked="true"] {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--line-2);
}

.seg { width: 100%; display: flex; }
.seg button { flex: 1; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.chip svg { width: 15px; height: 15px; }
.chip:hover:not(:disabled) { color: var(--text); border-color: var(--line-2); }
.chip[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.chip:disabled { opacity: .4; cursor: default; }

.stage-note { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ---------- panel ---------- */
.panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  position: sticky;
  top: 16px;
}

@media (max-width: 880px) {
  .panel { position: static; }
}

.field { display: flex; flex-direction: column; gap: 9px; }

.label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}

.sliders { display: flex; flex-direction: column; gap: 15px; }

.slider-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 7px;
}

.slider-head label { font-size: 13.5px; }

.slider-head output {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--muted);
  font-feature-settings: "tnum";
}

input[type="range"] {
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
  margin: 0;
  display: block;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 50%), var(--line-2) var(--fill, 50%));
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--text);
  margin-top: -5.5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
  transition: transform .12s;
}

input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--line-2);
}

input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
}

input[type="range"]:disabled { opacity: .35; cursor: default; }

.hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

.readout {
  display: grid;
  gap: 1px;
  margin: 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.readout > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: var(--surface-2);
  padding: 9px 12px;
}

.readout dt { font-size: 12.5px; color: var(--muted); }
.readout dd {
  margin: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ---------- buttons ---------- */
.downloads { display: flex; flex-direction: column; gap: 9px; }

.btn {
  appearance: none;
  border: 1px solid var(--line-2);
  text-decoration: none;
  color: inherit;
  background: var(--surface-2);
  border-radius: 11px;
  padding: 11px 14px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform .12s var(--ease), border-color .15s, background .15s, opacity .15s;
}

.btn:hover:not([aria-disabled="true"]) { border-color: #3b464f; }
.btn:active:not([aria-disabled="true"]) { transform: scale(.99); }
.btn[aria-disabled="true"] { opacity: .45; cursor: default; pointer-events: none; }

.btn-main {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 560;
}

.btn-sub { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn.primary .btn-sub { color: rgba(4, 33, 27, .68); }
.btn.primary:hover:not([aria-disabled="true"]) { background: #5cebcd; border-color: #5cebcd; }

.spin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: spin .7s linear infinite;
}

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

.link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link.reset {
  align-self: center;
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: none;
  padding: 4px;
  margin-top: 2px;
}

.link.reset:hover { color: var(--text); }

/* ---------- details ---------- */
.howto {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  font-size: 13px;
}

.howto summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 520;
  list-style: none;
  display: flex;
  justify-content: space-between;
}

.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: "+"; }
.howto[open] summary::after { content: "−"; }
.howto summary:hover { color: var(--text); }

.howto ol { margin: 12px 0; padding-left: 18px; color: var(--muted); }
.howto li { margin-bottom: 5px; }
.howto li strong { color: var(--text); font-weight: 560; }
.howto code {
  background: var(--surface-2);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 12px;
  color: var(--accent);
}

.error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 107, 107, .1);
  border: 1px solid rgba(255, 107, 107, .3);
  color: #ffb3b3;
  font-size: 13px;
}

/* ---------- footer ---------- */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px clamp(16px, 4vw, 40px) 28px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.footer p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
}
/* ================= landing ================= */
/* The editor and the landing page are two full states of the same document. */
body[data-state="landing"] .app { display: none; }
body[data-state="ready"] :is(.hero, .hero-cards) { display: none; }

.hero {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .78fr);
  gap: clamp(28px, 5vw, 60px);
  align-items: center;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(8px, 2vw, 28px) clamp(16px, 4vw, 40px) 0;
}

.hero-copy { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12.5px;
  font-weight: 540;
  letter-spacing: .04em;
  color: var(--muted);
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(78, 224, 192, .13);
}

.hero h1 {
  margin: 0;
  font-size: clamp(44px, 8vw, 84px);
  line-height: .94;
  letter-spacing: -.045em;
  font-weight: 700;
}

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

.lede {
  margin: 0;
  max-width: 30em;
  font-size: clamp(15px, 1.6vw, 17px);
  line-height: 1.6;
  color: #b8c4cf;
  text-wrap: pretty;
}

.lede strong { color: var(--text); font-weight: 600; }

.hero-actions { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.btn.lg {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 24px;
  border-radius: 999px;
  font-size: 15.5px;
  font-weight: 580;
}

.btn.lg svg { width: 17px; height: 17px; }

.hero-drop { margin: 0; font-size: 12.5px; color: var(--muted); }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  color: var(--muted);
}

.facts li + li::before { content: "·"; margin: 0 9px; opacity: .6; }

/* ---------- demo ---------- */
.hero-art { margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.demo {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #05070a;
  box-shadow: 0 30px 90px -40px #000, 0 0 0 1px rgba(255, 255, 255, .02);
}

.demo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#demo-sdr { opacity: 0; transition: opacity .14s linear; }
.demo.show-sdr #demo-sdr { opacity: 1; }

.hero-art figcaption {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------- the two cards ---------- */
.hero-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.28fr);
  gap: 14px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 40px) clamp(16px, 4vw, 40px) 36px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  min-width: 0;
}

.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.card-head h2 { margin: 0; font-size: 13.5px; font-weight: 620; letter-spacing: -.005em; }
.cap { font-size: 11.5px; color: var(--muted); text-align: right; }

.swatches { display: flex; gap: 10px; }
.swatches figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.swatches img { display: block; width: 46px; height: 46px; border-radius: 10px; }
.swatches figcaption { font-size: 11.5px; color: var(--muted); }

.check-q { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.check-q p { margin: 0; font-size: 12.5px; color: var(--muted); }
.check-btns { display: flex; gap: 6px; }

.check-btns button {
  appearance: none;
  padding: 5px 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.check-btns button:hover:not([aria-pressed="true"]) { color: var(--text); }
.check-btns button[aria-pressed="true"] { background: #1d242b; border-color: #3f4b55; color: var(--text); }

.check-note { margin: 0; font-size: 11.5px; line-height: 1.55; color: var(--muted); text-wrap: pretty; }

.rule-list {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rule;
}

.rule-list li {
  position: relative;
  display: grid;
  gap: 2px;
  padding-left: 26px;
  counter-increment: rule;
}

.rule-list li::before {
  content: counter(rule);
  position: absolute;
  left: 0;
  top: 1px;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-size: 10.5px;
  font-weight: 620;
  color: var(--muted);
}

.rule-list strong { font-size: 13px; font-weight: 600; }
.rule-list span { font-size: 12.5px; line-height: 1.55; color: var(--muted); text-wrap: pretty; }

.rule-tail {
  margin: 0;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------- iOS banner ---------- */
.ios-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin: 0 clamp(16px, 4vw, 40px) 6px;
  padding: 10px 14px;
  border: 1px solid rgba(78, 224, 192, .26);
  border-radius: 12px;
  background: rgba(78, 224, 192, .07);
  font-size: 12.5px;
  line-height: 1.5;
}

.ios-banner p { margin: 0; }
.btn.tiny { flex-direction: row; padding: 7px 14px; border-radius: 999px; font-size: 12.5px; }
.btn.tiny.btn { flex: 0 0 auto; }

/* ---------- download note ---------- */
.warn {
  margin: 2px 0 0;
  padding-left: 9px;
  border-left: 2px solid var(--line-2);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  text-wrap: pretty;
}

@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .hero-art { order: -1; }
  .hero-cards { grid-template-columns: minmax(0, 1fr); }
  .demo { aspect-ratio: 4 / 3; }
}

@media (max-width: 420px) {
  .btn.lg { width: 100%; }
  .hero-actions { align-items: stretch; }
}
