:root {
  --bg: #100e0c;
  --bg-2: #1a1612;
  --panel: #221c16;
  --panel-2: #2b241c;
  --line: rgba(243, 214, 176, 0.16);
  --text: #f7f1e8;
  --muted: #c3b6a6;
  --faint: #9c8f81;
  --amber: #e39a45;
  --amber-2: #ffd7a1;
  --amber-ink: #2a1c0d;
  --danger: #ff9b8c;
  --ok: #b7d7c3;
  --shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", Palatino, Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(227, 154, 69, 0.18), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(92, 58, 32, 0.35), transparent 50%),
    var(--bg);
  line-height: 1.5;
}
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, summary { cursor: pointer; }
:focus-visible { outline: 2px solid var(--amber-2); outline-offset: 2px; }
.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--amber);
  color: var(--amber-ink);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 5;
}
.skip:focus { top: 12px; }

.top, .layout, .foot { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 28px 0 12px;
}
.brand { display: flex; gap: 14px; align-items: center; }
.mark { width: 46px; height: 46px; color: var(--amber); }
.eyebrow { margin: 0; color: var(--faint); letter-spacing: 0.08em; font-size: 12px; text-transform: uppercase; }
h1 { margin: 0; font-family: var(--serif); font-size: 40px; font-weight: 600; letter-spacing: 0.04em; }
h2, h3 { font-family: var(--serif); font-weight: 600; }
.pill, .note, .badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--amber-2);
  background: rgba(227, 154, 69, 0.08);
}
.pill { margin: 0; }
.banner {
  width: min(1180px, calc(100% - 32px));
  margin: 8px auto 0;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(227, 154, 69, 0.14);
  border: 1px solid rgba(227, 154, 69, 0.4);
}
.layout {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  gap: 22px;
  padding: 18px 0 28px;
  align-items: start;
}
.panel, .stage {
  background: rgba(34, 28, 22, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { padding: 18px; position: sticky; top: 12px; }
.stage { padding: 18px; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab, .ghost, .primary, .chip, .danger-btn {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  min-height: 44px;
  padding: 8px 14px;
}
.tab[aria-selected="true"], .primary {
  background: var(--amber);
  color: var(--amber-ink);
  border-color: transparent;
  font-weight: 650;
}
.primary { width: 100%; margin-top: 8px; }
.linkish { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; width: auto; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.grid, fieldset { border: 1px solid var(--line); border-radius: 14px; margin: 0 0 14px; padding: 12px; }
legend { padding: 0 6px; color: var(--muted); }
label { color: var(--muted); font-size: 14px; }
input, select, textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
}
textarea { resize: vertical; min-height: 120px; }
input[type="range"] { padding: 0; min-height: 32px; }
.check label { display: flex; gap: 8px; align-items: center; color: var(--text); min-height: 44px; }
.check input { width: auto; min-height: 0; }
.hint, .foot { color: var(--faint); font-size: 13px; }
.hint.warn { color: var(--danger); }
.note { margin: 0; display: inline-flex; width: fit-content; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 36px; color: var(--amber-2); }
.pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.drop {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 16px;
  text-align: center;
  border: 1px dashed rgba(227, 154, 69, 0.5);
  border-radius: 14px;
  background: rgba(227, 154, 69, 0.05);
  margin-bottom: 10px;
}
.drop.hot { background: rgba(227, 154, 69, 0.16); }
.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.thumbs, .single-preview { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 8px; list-style: none; }
.thumbs li, .single-preview .mini {
  position: relative;
  width: 84px;
}
.thumbs img, .single-preview img, .card img, .lb-frame img, .skeleton img {
  width: 100%;
  border-radius: 10px;
  background-color: #1a1714;
  background-image:
    linear-gradient(45deg, #3a322a 25%, transparent 25%),
    linear-gradient(-45deg, #3a322a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #3a322a 75%),
    linear-gradient(-45deg, transparent 75%, #3a322a 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.thumbs button, .single-preview button {
  position: absolute;
  top: 4px;
  right: 4px;
  min-height: 28px;
  padding: 2px 6px;
  border-radius: 8px;
  border: 0;
  background: rgba(0, 0, 0, 0.7);
}
.fold { margin-bottom: 12px; }
.fold summary { color: var(--amber-2); margin-bottom: 8px; }
pre {
  margin: 0;
  padding: 12px;
  overflow: auto;
  max-height: 240px;
  border-radius: 12px;
  background: #120f0c;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
}
.form-errors { color: var(--danger); min-height: 0; margin: 0; }
.form-errors:empty { display: none; }
.stage-head { display: flex; align-items: baseline; gap: 12px; }
.stage-head h2 { margin: 0 0 8px; }
.elapsed { margin: 0; font-variant-numeric: tabular-nums; color: var(--amber-2); }
.live, .history { display: grid; gap: 12px; }
.history { margin-top: 8px; }
.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: var(--panel-2);
}
.card-images, .skeletons { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.thumb-btn { padding: 0; border: 0; background: transparent; border-radius: 10px; }
.snippet {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 8px 0;
}
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 12px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions a, .actions button { min-height: 36px; }
.danger-btn { color: var(--danger); }
.skeleton {
  border-radius: 12px;
  min-height: 120px;
  background: linear-gradient(90deg, #2a241c 25%, #3a3127 37%, #2a241c 63%);
  background-size: 400% 100%;
  animation: shine 1.2s ease infinite;
}
.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 0;
  padding: 36px 18px;
  text-align: center;
  border: 1px dashed rgba(227, 154, 69, 0.38);
  border-radius: 16px;
  background: rgba(227, 154, 69, 0.05);
}
.empty-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--amber);
  font-family: var(--serif);
  font-size: 22px;
}
.empty-state h3 { margin: 0; font-size: 22px; }
.empty-state p { margin: 0; max-width: 36em; color: var(--faint); }
dialog {
  width: min(960px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #16130f;
  color: var(--text);
  padding: 0;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.72); }
.lb { display: grid; grid-template-columns: 1.3fr 0.8fr; }
.lb-frame { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 12px; }
.lb-frame img { max-height: 72vh; object-fit: contain; }
.lb-copy { padding: 16px; border-left: 1px solid var(--line); }
.lb-copy h3 { margin: 12px 0 4px; font-size: 16px; }
.lb-copy p { margin: 0; white-space: pre-wrap; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 6; }
.toast {
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 12px;
  background: #2a2118;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.toast.error { border-color: var(--danger); }
.foot { padding-bottom: 28px; }
@keyframes shine {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
@media (min-width: 1280px) {
  .top, .layout, .foot, .banner { width: min(1400px, calc(100% - 48px)); }
  .layout { grid-template-columns: 420px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .layout, .lb { grid-template-columns: 1fr; }
  .panel { position: static; }
  .lb-copy { border-left: 0; border-top: 1px solid var(--line); }
  h1 { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}
