:root {
  --bg: #171716;
  --panel: #222220;
  --panel-2: #292927;
  --line: rgba(255, 255, 245, 0.12);
  --text: #eee9df;
  --muted: #a29d94;
  --accent: #e68b4d;
  --accent-soft: #f0b27c;
  --danger: #ef7770;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(70% 55% at 72% 15%, rgba(230, 139, 77, 0.1), transparent 65%),
    radial-gradient(45% 35% at 12% 88%, rgba(96, 117, 113, 0.12), transparent 70%),
    var(--bg);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.32'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px clamp(16px, 3vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(23, 23, 22, 0.86);
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(230, 139, 77, 0.62);
  border-radius: 50%;
}
.brand-mark::before {
  content: "";
  width: 17px;
  height: 17px;
  border: 2px solid var(--accent);
  border-radius: 50%;
}
.brand-mark i { width: 5px; height: 5px; border-radius: 50%; background: var(--text); }
.brand strong { display: block; letter-spacing: 0.18em; font-size: 13px; }
.brand small { display: block; color: var(--muted); font-size: 9px; letter-spacing: 0.19em; margin-top: 2px; }

.top-actions { display: flex; align-items: center; gap: 9px; min-width: 0; }
.status { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.status-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #7ca982; box-shadow: 0 0 10px rgba(124, 169, 130, 0.7); }
.status-dot.busy { background: var(--accent); animation: pulse 1s infinite alternate; }
.status-dot.error { background: var(--danger); }
@keyframes pulse { to { opacity: 0.35; } }

.text-button {
  border: 0;
  padding: 7px 10px;
  color: #cfc9bf;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}
.text-button:hover { color: #fff; }

main { position: relative; z-index: 2; }
.landing {
  min-height: calc(100vh - 66px);
  max-width: 1420px;
  margin: 0 auto;
  padding: clamp(38px, 7vh, 90px) clamp(22px, 5vw, 74px) 38px;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(340px, 0.72fr);
  gap: clamp(36px, 8vw, 120px);
  align-items: center;
}
.eyebrow {
  margin: 0 0 18px;
  color: var(--accent-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
}
.landing h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(48px, 7vw, 94px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.055em;
}
.landing h1 em { color: var(--accent-soft); font-style: normal; }
.lede { max-width: 570px; margin: 28px 0 0; color: #c2bcb2; font-size: 15px; line-height: 1.9; }
.feature-line { display: flex; flex-wrap: wrap; gap: 9px 20px; margin-top: 30px; color: #918c84; font-size: 11px; }
.feature-line span::before { content: "·"; color: var(--accent); margin-right: 8px; }

.drop-card {
  position: relative;
  min-height: 420px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 22px;
  background: linear-gradient(160deg, #30302d, #1e1e1c 70%);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.drop-card:hover, .drop-card.dragging {
  transform: translateY(-4px);
  border-color: rgba(230, 139, 77, 0.72);
  box-shadow: 0 34px 84px rgba(0, 0, 0, 0.42), 0 0 42px rgba(230, 139, 77, 0.1);
}
.drop-visual { position: absolute; inset: 0; overflow: hidden; background: linear-gradient(180deg, #6f8888, #d3a56f 59%, #493424); }
.drop-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 9, 8, 0.05), rgba(10, 9, 8, 0.72) 78%);
}
.drop-sun { position: absolute; width: 108px; height: 108px; left: 23%; top: 23%; border-radius: 50%; background: #f6d79b; filter: blur(1px); box-shadow: 0 0 70px rgba(255, 214, 139, 0.75); }
.drop-hills {
  position: absolute;
  width: 130%;
  height: 58%;
  left: -15%;
  bottom: 11%;
  border-radius: 50% 55% 0 0;
  background: linear-gradient(170deg, #49544c, #171b18 65%);
  transform: rotate(-7deg);
}
.film-hole { position: absolute; z-index: 3; top: 20px; width: 13px; height: 25px; border-radius: 4px; background: #171716; opacity: 0.8; }
.film-hole.h1 { left: 18px; }.film-hole.h2 { left: 48px; }.film-hole.h3 { right: 48px; }.film-hole.h4 { right: 18px; }
.drop-title, .drop-note, .drop-button { position: relative; z-index: 4; }
.drop-title { font-family: "Songti SC", "STSong", serif; font-size: clamp(24px, 3vw, 35px); }
.drop-note { margin-top: 8px; color: #d4cec5; font-size: 11px; letter-spacing: 0.03em; }
.drop-button { margin-top: 24px; padding: 10px 16px; border-radius: 999px; background: var(--accent); color: #21160f; font-size: 12px; font-weight: 800; }
.technical-note { grid-column: 1 / -1; max-width: 700px; margin-top: -22px; padding-left: 15px; border-left: 2px solid var(--accent); color: #8e8981; font-size: 11px; line-height: 1.75; }
.technical-note p { margin: 0; }
.technical-note strong { color: #c9c1b5; }

.upload-progress {
  grid-column: 2;
  align-self: center;
  width: min(420px, 100%);
  margin-top: -10px;
  padding: 12px 14px;
  border: 1px solid rgba(230, 139, 77, 0.24);
  border-radius: 11px;
  background: rgba(35, 32, 29, 0.84);
}
.upload-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #c8c0b5;
  font-size: 10px;
}
.upload-progress-head strong { color: var(--accent-soft); font-variant-numeric: tabular-nums; }
.upload-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}
.upload-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #bd6934, #f4b67f);
  box-shadow: 0 0 12px rgba(230, 139, 77, 0.5);
  transition: width 0.16s ease;
}
.upload-progress.processing .upload-bar {
  width: 100% !important;
  animation: upload-processing 1.1s ease-in-out infinite alternate;
}
@keyframes upload-processing {
  from { opacity: 0.48; filter: saturate(0.6); }
  to { opacity: 1; filter: saturate(1.2); }
}

.workspace {
  min-height: calc(100vh - 66px);
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 300px;
  gap: 0;
}
.film-rail, .controls { background: rgba(32, 32, 30, 0.9); }
.film-rail { border-right: 1px solid var(--line); padding: 24px 18px; }
.controls { border-left: 1px solid var(--line); padding: 24px 20px; overflow-y: auto; max-height: calc(100vh - 66px); }
.rail-heading { display: flex; gap: 11px; align-items: center; margin-bottom: 22px; }
.rail-heading > span { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: 0.08em; }
.rail-heading strong { display: block; font-size: 13px; }
.rail-heading small { display: block; color: var(--muted); font-size: 8px; letter-spacing: 0.18em; margin-top: 2px; }

.stock-select { display: block; margin-bottom: 15px; }
.stock-select > span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 6px; }
.stock-select select {
  width: 100%;
  padding: 10px 28px 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #181817;
  outline: none;
}
.stock-select select:focus { border-color: rgba(230, 139, 77, 0.65); }
.stock-note { min-height: 48px; color: #858078; font-size: 10px; line-height: 1.65; }
.meta-card { margin-top: 26px; padding-top: 15px; border-top: 1px solid var(--line); }
.meta-card div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 10px; }
.meta-card span { color: var(--muted); }
.meta-card strong { text-align: right; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.image-panel { min-width: 0; display: flex; flex-direction: column; padding: 16px 18px 18px; }
.image-toolbar, .image-footer { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 10px; }
.render-badge { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: #cfc7bb; letter-spacing: 0.06em; }
.render-badge.large { border-color: rgba(230, 139, 77, 0.45); color: var(--accent-soft); }
.image-stage {
  position: relative;
  flex: 1;
  min-height: 420px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #0c0c0b;
  border-radius: 8px;
  background:
    linear-gradient(45deg, #171716 25%, transparent 25%),
    linear-gradient(-45deg, #171716 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #171716 75%),
    linear-gradient(-45deg, transparent 75%, #171716 75%),
    #1c1c1a;
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.55);
}
.image-stage img { display: block; max-width: 100%; max-height: calc(100vh - 168px); object-fit: contain; box-shadow: 0 16px 45px rgba(0, 0, 0, 0.45); }
.empty-image { color: #716d66; font-size: 12px; }
.busy-layer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 14, 0.64);
  backdrop-filter: blur(4px);
  font-size: 12px;
}
.spinner { width: 28px; height: 28px; border: 2px solid rgba(255,255,255,.18); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.primary-button {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  color: #25170e;
  background: linear-gradient(180deg, #f1ae75, var(--accent));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 7px 20px rgba(230,139,77,.16);
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
}
.primary-button:disabled { opacity: 0.45; cursor: wait; }

.control-group { padding: 3px 0 17px 0; margin-bottom: 15px; border-bottom: 1px solid var(--line); }
.group-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 17px; font-size: 11px; }
.group-title small { color: #716d66; font-size: 8px; letter-spacing: 0.15em; }
.mini-reset { border: 0; padding: 0; color: var(--muted); background: none; cursor: pointer; font-size: 9px; }
.slider-row { display: block; margin: 15px 0; }
.slider-row > span { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #bdb7ad; font-size: 10px; }
.slider-row b { font-weight: 500; }
.slider-row output { min-width: 44px; text-align: right; color: #8d887f; font-variant-numeric: tabular-nums; }
.slider-row input[type="range"] { width: 100%; height: 18px; margin: 7px 0 0; accent-color: var(--accent); cursor: ew-resize; }
.slider-row input[type="checkbox"] { accent-color: var(--accent); vertical-align: -2px; margin-right: 5px; }
.slider-row input[type="range"]:disabled { opacity: 0.28; }
.privacy-note { margin: 20px 0 0; color: #6f6b64; font-size: 9px; line-height: 1.75; }

.modal {
  width: min(470px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 18px;
  color: var(--text);
  background: #22221f;
  box-shadow: 0 36px 100px rgba(0,0,0,.58);
}
.modal::backdrop { background: rgba(7,7,6,.78); backdrop-filter: blur(8px); }
.modal-card { padding: 28px; }
.modal-card h2 { margin: 0 0 12px; font-family: "Songti SC", "STSong", serif; font-size: 30px; font-weight: 400; }
.modal-card > p:not(.eyebrow):not(.form-error) { color: var(--muted); font-size: 12px; line-height: 1.7; }
.modal-card label { display: block; margin: 18px 0; }
.modal-card label > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.modal-card input, .modal-card select {
  width: 100%;
  padding: 11px 12px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171716;
  outline: none;
}
.modal-card input:focus, .modal-card select:focus { border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-error { min-height: 18px; margin: 4px 0; color: var(--danger); font-size: 10px; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 18px; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 200px minmax(0, 1fr); }
  .controls { grid-column: 1 / -1; max-height: none; border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
  .controls .rail-heading, .controls .privacy-note { grid-column: 1 / -1; margin-bottom: 0; }
}

@media (max-width: 760px) {
  .topbar { padding: 9px 13px; }
  .brand small, .status { display: none; }
  .top-actions { gap: 3px; }
  .landing { grid-template-columns: 1fr; gap: 32px; padding-top: 42px; }
  .drop-card { min-height: 360px; }
  .technical-note { margin-top: 0; }
  .upload-progress { grid-column: 1; }
  .workspace { display: flex; flex-direction: column; }
  .film-rail { border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px; }
  .film-rail .rail-heading, .film-rail .stock-note, .film-rail .meta-card { grid-column: 1 / -1; }
  .film-rail .rail-heading { margin-bottom: 4px; }
  .stock-select { margin: 0; }
  .meta-card { margin-top: 4px; }
  .image-panel { padding: 10px; min-height: 68vh; }
  .image-stage { min-height: 330px; }
  .image-stage img { max-height: 60vh; }
  .controls { display: block; padding: 18px 17px 30px; }
  .group-title { margin-bottom: 13px; }
}
