* { box-sizing: border-box; }

:root {
  --paper: #f2eee5;
  --paper-2: #e9e3d6;
  --ink: #161513;
  --ink-2: #4a4740;
  --muted: #8a8578;
  --line: #161513;
  --soft-line: #cfc8b8;
  --accent: #e8542a;
  --accent-dark: #c43f19;
  --mono: "IBM Plex Mono", Consolas, monospace;
}

body {
  margin: 0;
  font-family: "Archivo", "Segoe UI", Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
}

a { color: var(--ink); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  height: 56px;
  background: var(--ink);
  color: var(--paper);
}
.logo {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 18px;
  color: var(--paper);
  text-decoration: none;
  letter-spacing: -.02em;
}
.logo span { color: var(--accent); }
.topbar nav { display: flex; height: 100%; }
.topbar nav a {
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-family: var(--mono);
  font-size: 14px;
  color: #bdb6a6;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.topbar nav a:hover { color: var(--paper); }
.topbar nav a.active { color: var(--paper); border-bottom-color: var(--accent); }

.container { max-width: 1180px; margin: 0 auto; padding: 36px 24px 70px; }

.footer {
  display: flex;
  gap: 28px;
  justify-content: center;
  padding: 18px;
  border-top: 1px solid var(--soft-line);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.footer b { font-weight: 500; margin-left: 4px; }
.footer b.on { color: #2f7d3b; }
.footer b.off { color: var(--accent-dark); }

.flash {
  border-left: 4px solid var(--accent);
  background: #fff;
  padding: 10px 14px;
  margin-bottom: 20px;
  font-family: var(--mono);
  font-size: 13px;
}

.intro {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: end;
  margin-bottom: 30px;
}
.intro h1 {
  font-size: 46px;
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -.03em;
  margin: 0 0 14px;
}
.intro p { color: var(--ink-2); line-height: 1.55; max-width: 520px; margin: 0; }
.pipeline { list-style: none; margin: 0; padding: 0; font-family: var(--mono); font-size: 13px; }
.pipeline li { padding: 8px 0; border-bottom: 1px dashed var(--soft-line); color: var(--ink-2); }
.pipeline li:first-child { border-top: 1px dashed var(--soft-line); }
.pipeline span { color: var(--accent); margin-right: 10px; }

.upload-box { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 50px; }
.drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 220px;
  background: #fbf9f4;
  cursor: pointer;
  padding: 30px;
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  transition: background .15s;
}
.drop strong { color: var(--ink); font-size: 16px; font-weight: 500; }
.drop:hover, .drop.over { background: #fff; }
.drop.over .corner { border-color: var(--accent); }
.drop img { max-height: 200px; max-width: 100%; }
.corner { position: absolute; width: 26px; height: 26px; border: 0 solid var(--ink); }
.corner.tl { top: 12px; left: 12px; border-top-width: 2px; border-left-width: 2px; }
.corner.tr { top: 12px; right: 12px; border-top-width: 2px; border-right-width: 2px; }
.corner.bl { bottom: 12px; left: 12px; border-bottom-width: 2px; border-left-width: 2px; }
.corner.br { bottom: 12px; right: 12px; border-bottom-width: 2px; border-right-width: 2px; }
.upload-actions { display: flex; align-items: center; gap: 18px; }
.loading { font-family: var(--mono); font-size: 13px; color: var(--ink-2); margin: 0; }

.btn {
  display: inline-block;
  padding: 11px 20px;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.primary:disabled { background: var(--muted); border-color: var(--muted); cursor: wait; }
.btn.small { padding: 5px 10px; font-size: 13px; border-width: 1px; font-weight: 500; }
.btn.full { display: block; width: 100%; margin-top: 10px; }
.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: underline;
}
.link-btn:hover { color: var(--accent-dark); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 22px; }
.section-head a { font-family: var(--mono); font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 22px 18px; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--ink);
  text-decoration: none;
}
.card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--soft-line);
  margin-bottom: 6px;
}
a.card:hover img { border-color: var(--ink); }
.card span { font-weight: 700; text-transform: capitalize; }
.card .frame-no {
  position: absolute;
  top: 8px;
  left: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  background: var(--ink);
  color: var(--paper);
  padding: 1px 6px;
}
.card small { font-family: var(--mono); font-size: 12px; }
.card form { margin-top: 4px; }
.muted { color: var(--muted); }
.count { font-family: var(--mono); font-size: 13px; font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: 0; margin-left: 8px; }

.page-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0 0 24px;
  text-transform: capitalize;
}

.editor { display: grid; grid-template-columns: 1fr 290px 230px; gap: 24px; align-items: start; }
.preview-frame {
  position: relative;
  background: #fff;
  border: 2px solid var(--ink);
  padding: 14px;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-frame img { max-width: 100%; max-height: 640px; }
.spinner {
  position: absolute;
  top: 14px;
  right: 14px;
  font-family: var(--mono);
  font-size: 11px;
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
}
.spinner::after { content: "rendering…"; }

.small-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.small-row figure { margin: 0; }
.small-row img { width: 100%; height: 150px; object-fit: contain; background: #fff; border: 1px solid var(--soft-line); }
.small-row figcaption { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 4px; }
.checker img {
  background-color: #fff;
  background-image: linear-gradient(45deg, #e6e1d6 25%, transparent 25%), linear-gradient(-45deg, #e6e1d6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e6e1d6 75%), linear-gradient(-45deg, transparent 75%, #e6e1d6 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.controls { counter-reset: sec; }
.controls h3, .info h3, .side h3 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-2);
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ink);
}
.controls h3::before { counter-increment: sec; content: counter(sec, upper-alpha) " / "; color: var(--accent); }
.controls h3:first-child, .info h3:first-child { margin-top: 0; }
.controls select {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
}

.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.swatch { cursor: pointer; }
.swatch input { display: none; }
.swatch span { display: block; height: 42px; border: 1px solid var(--soft-line); font-size: 0; }
.swatch:hover span { border-color: var(--ink); }
.swatch input:checked + span { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--ink); }
.bg-white span { background: #fff; }
.bg-light_gray span { background: #eeeff1; }
.bg-studio span { background: radial-gradient(circle at 50% 45%, #fcfcfc, #cdd0d5); }
.bg-warm span { background: linear-gradient(#faf4eb, #e2d4c0); }
.bg-cool span { background: linear-gradient(#f0f6fc, #c4d6e8); }
.bg-pink span { background: linear-gradient(#fdf2f4, #f0cdd5); }
.bg-dark span { background: radial-gradient(circle at 50% 45%, #505258, #16171a); }
.bg-custom span { background: repeating-linear-gradient(45deg, #fff 0 6px, #e8542a 6px 8px); }

.row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 14px; }
.slider { display: block; font-size: 14px; margin-bottom: 12px; }
.slider output { float: right; font-family: var(--mono); font-size: 12px; color: var(--accent-dark); }
.slider input { width: 100%; accent-color: var(--ink); }
.check { display: block; font-size: 14px; margin-bottom: 6px; }
.check input { accent-color: var(--accent); }

.info { font-size: 14px; }
.caption { font-style: italic; }
.caption small, .plain small { font-family: var(--mono); color: var(--muted); }
.plain { list-style: none; padding: 0; margin: 4px 0 12px; }
.plain li { padding: 3px 0; }
.info h4 { margin: 14px 0 6px; font-size: 13px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 14px; font-family: var(--mono); font-size: 13px; }
.tag::before { content: "#"; color: var(--accent); }
.info a.muted { font-family: var(--mono); font-size: 12px; }

.result { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }
.compare {
  position: relative;
  aspect-ratio: 1;
  max-height: 700px;
  background: #fff;
  border: 2px solid var(--ink);
  overflow: hidden;
  user-select: none;
}
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.compare .compare-before { background: #2a2824; }
.compare-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); transform: translateX(-1px); pointer-events: none; }
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.compare .label {
  position: absolute;
  top: 12px;
  background: var(--ink);
  color: var(--paper);
  padding: 2px 8px;
  font-family: var(--mono);
  font-size: 12px;
  pointer-events: none;
}
.compare .label.left { left: 12px; }
.compare .label.right { right: 12px; background: var(--accent); color: #fff; }
.side h3 { margin-top: 26px; }

.details { width: 100%; font-size: 13px; border-collapse: collapse; }
.details td { padding: 6px 0; border-bottom: 1px dashed var(--soft-line); vertical-align: top; word-break: break-all; }
.details td:first-child { color: var(--muted); width: 42%; word-break: normal; font-family: var(--mono); font-size: 12px; }

@media (max-width: 1000px) {
  .editor, .result, .intro { grid-template-columns: 1fr; }
  .intro h1 { font-size: 36px; }
}
