/* ============================================================================
   摄影 × 纸张 · 拼贴生成器
   ========================================================================== */
:root {
  --bg: #FAF8F4;
  --card: #FFFFFF;
  --ink: #2B2823;
  --ink-2: #5C554A;
  --muted: #8A8274;
  --line: #E5DFD3;
  --line-2: #EFEAE0;
  --clay: #A2604F;
  --clay-dark: #8A4F41;
  --paper: #F4EFE5;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(43, 40, 35, .05), 0 4px 16px rgba(43, 40, 35, .05);
  --shadow-md: 0 2px 6px rgba(43, 40, 35, .06), 0 18px 44px rgba(43, 40, 35, .10);
  --mono: "Courier New", Courier, "Nimbus Mono PS", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ 顶栏 -- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px clamp(16px, 3vw, 40px);
  background: rgba(250, 248, 244, .86);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--clay); align-self: center; flex: none;
}
.brand h1 {
  margin: 0; font-size: 17px; font-weight: 600; letter-spacing: .04em;
  white-space: nowrap;
}
.brand .en {
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em;
  color: var(--muted); text-transform: uppercase; white-space: nowrap;
}
.specs {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  letter-spacing: .06em; white-space: nowrap;
}
.specs b { color: var(--ink-2); font-weight: 400; }

/* ------------------------------------------------------------------ 布局 -- */
.layout {
  display: grid;
  grid-template-columns: 372px minmax(0, 1fr);
  gap: clamp(20px, 2.6vw, 36px);
  align-items: start;
  padding: clamp(20px, 3vw, 36px) clamp(16px, 3vw, 40px) 8px;
}
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- 控制列 -- */
.controls {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.block { padding: 18px 20px; border-bottom: 1px solid var(--line-2); }
.block:last-child { border-bottom: 0; }
.block-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.label {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.label .idx { color: #C9C1B2; margin-right: 6px; font-family: var(--mono); }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.55; }

/* 上传区 */
.drop {
  position: relative;
  border: 1.5px dashed #D8D0C1;
  border-radius: 11px;
  background: #FCFBF8;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s;
}
.drop:hover, .drop.over { border-color: var(--clay); background: #FDF7F3; }
.drop input[type=file] { display: none; }
.drop .big { font-size: 13px; font-weight: 500; }
.drop .small { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.thumbrow { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.thumbrow img {
  width: 74px; height: 50px; object-fit: cover;
  border-radius: 7px; border: 1px solid var(--line); flex: none;
}
.thumbrow .meta { font-family: var(--mono); font-size: 11px; color: var(--muted); line-height: 1.7; min-width: 0; }
.thumbrow .meta b { color: var(--ink-2); font-weight: 400; }
.warn {
  margin-top: 10px; font-size: 11.5px; color: #95683F;
  background: #FDF6EA; border: 1px solid #F0E3CC;
  border-radius: 8px; padding: 7px 10px; display: none;
}
.warn.on { display: block; }

/* 造型选择 */
.shapes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.shape {
  appearance: none; border: 1px solid var(--line); background: #FCFBF8;
  border-radius: 9px; padding: 9px 4px 7px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: var(--ink-2); transition: all .16s;
}
.shape svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.4; }
.shape span { font-size: 10.5px; letter-spacing: .04em; }
.shape:hover { border-color: #CFC6B5; }
.shape.on {
  border-color: var(--clay); background: #FCF3EF; color: var(--clay-dark);
  box-shadow: inset 0 0 0 1px rgba(162, 96, 79, .18);
}

/* 表单 */
select, input[type=text] {
  width: 100%; appearance: none;
  border: 1px solid var(--line); border-radius: 8px;
  background: #FCFBF8; color: var(--ink);
  padding: 9px 11px; font-size: 13px; font-family: inherit;
  transition: border-color .16s, box-shadow .16s;
}
select:focus, input[type=text]:focus {
  outline: none; border-color: #C9A69A;
  box-shadow: 0 0 0 3px rgba(162, 96, 79, .10);
}
input.mono { font-family: var(--mono); letter-spacing: .06em; }
input.mono::placeholder { letter-spacing: .04em; color: #B8B0A2; }

.inline { display: flex; gap: 8px; align-items: center; }
.inline > * { flex: 1; }
.inline .mini { flex: none; }

/* 油墨色 */
.inks { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.ink {
  width: 27px; height: 27px; border-radius: 50%; border: 0; cursor: pointer;
  position: relative; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .10);
  transition: transform .14s;
}
.ink:hover { transform: translateY(-1px); }
.ink.on::after {
  content: ''; position: absolute; inset: -4px;
  border: 1.5px solid var(--ink); border-radius: 50%; opacity: .55;
}
.ink.auto {
  background: #FCFBF8; border: 1px dashed #C9C0AF; color: var(--muted);
  font-size: 10px; line-height: 25px; text-align: center;
}

/* 按钮 */
.btn {
  appearance: none; border: 1px solid var(--line); cursor: pointer;
  background: #FCFBF8; color: var(--ink);
  padding: 10px 14px; border-radius: 9px;
  font-size: 12.5px; font-family: inherit; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: all .16s; white-space: nowrap;
}
.btn:hover { border-color: #CFC6B5; background: #fff; }
.btn:active { transform: translateY(.5px); }
.btn.primary {
  background: var(--clay); border-color: var(--clay); color: #fff;
}
.btn.primary:hover { background: var(--clay-dark); border-color: var(--clay-dark); }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.mini { padding: 7px 10px; font-size: 11.5px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-row.wide { grid-template-columns: 1fr; }
.btn-row.tri { grid-template-columns: 1fr 1fr 1fr; }
.status {
  margin-top: 10px; font-size: 11.5px; color: var(--muted);
  font-family: var(--mono); min-height: 16px;
}
.status.ok { color: #6E7A56; }
.status.err { color: #A85A48; }

/* 预设 chips */
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px;
  background: #FCFBF8; color: var(--ink-2);
  font-size: 11.5px; padding: 5px 12px;
  transition: all .15s;
}
.chip:hover { border-color: var(--clay); color: var(--clay-dark); background: #FCF3EF; }

/* 画面风格 */
.styles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.pstyle {
  appearance: none; border: 1px solid var(--line); background: #FCFBF8;
  border-radius: 9px; padding: 9px 4px 7px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: var(--ink-2); transition: all .16s;
}
.pstyle .ico {
  width: 26px; height: 18px; border-radius: 3px;
  background:
    linear-gradient(135deg, #C9BFA9 0%, #8F8672 100%);
  position: relative; overflow: hidden;
}
.pstyle[data-style=sketch] .ico { background: repeating-linear-gradient(115deg, #E8E2D4 0 2px, #9A9280 2px 3px); }
.pstyle[data-style=line] .ico {
  background:
    linear-gradient(#F4F0E6, #F4F0E6);
}
.pstyle[data-style=line] .ico::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 30% 45%, transparent 3px, #6E675A 3px 4px, transparent 4px),
    linear-gradient(115deg, transparent 44%, #6E675A 46% 54%, transparent 56%),
    linear-gradient(65deg, transparent 40%, #6E675A 42% 47%, transparent 49%);
}
.pstyle[data-style=halftone] .ico {
  background: radial-gradient(#6E675A 28%, transparent 30%);
  background-size: 6px 6px; background-color: #EFEADF;
}
.pstyle span { font-size: 10.5px; letter-spacing: .04em; }
.pstyle.on {
  border-color: var(--clay); background: #FCF3EF; color: var(--clay-dark);
  box-shadow: inset 0 0 0 1px rgba(162, 96, 79, .18);
}

/* 滑杆行 */
.slider-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.slider-row label {
  font-size: 11px; color: var(--muted); white-space: nowrap; flex: none;
  width: 62px; letter-spacing: .02em;
}
.slider-row output {
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  width: 44px; text-align: right; flex: none;
}
input[type=range] {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 3px; border-radius: 2px;
  background: #E0D9CA; outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--card); border: 1.5px solid var(--clay);
  box-shadow: 0 1px 3px rgba(43,40,35,.18);
}
input[type=range]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--card); border: 1.5px solid var(--clay);
}

/* 纸色 swatch */
.papers { display: flex; gap: 8px; align-items: center; }
.paper-swatch {
  width: 30px; height: 22px; border-radius: 6px; cursor: pointer;
  border: 1px solid #D8D0C1; position: relative; transition: transform .14s;
}
.paper-swatch:hover { transform: translateY(-1px); }
.paper-swatch.on::after {
  content: ''; position: absolute; inset: -3.5px;
  border: 1.5px solid var(--clay); border-radius: 8px;
}

/* ------------------------------------------------------------------ 舞台 -- */
.stage { min-width: 0; }
.stage-frame {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: clamp(14px, 1.8vw, 26px);
  display: flex; justify-content: center;
}
#poster {
  display: block;
  width: auto; height: auto;
  max-width: 100%;
  max-height: min(76vh, 860px);
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(43, 40, 35, .12), 0 12px 34px rgba(43, 40, 35, .13);
  background: #EFEAE0;
}
.stage-meta {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  margin-top: 12px; padding: 0 4px;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  letter-spacing: .05em;
}
.stage-meta b { color: var(--ink-2); font-weight: 400; }

/* ------------------------------------------------------------------ 记录 -- */
.records { padding: 26px clamp(16px, 3vw, 40px) 56px; }
.records-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; padding-bottom: 12px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.records-head h2 {
  margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-2);
}
.records-head .count { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
.rec {
  border: 1px solid var(--line); border-radius: 11px; overflow: hidden;
  background: var(--card); box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s;
  position: relative;
}
.rec:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.rec img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: #EFEAE0; }
.rec .cap {
  padding: 8px 10px 9px; border-top: 1px solid var(--line-2);
}
.rec .cap .t {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rec .cap .d { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.rec .del {
  position: absolute; top: 7px; right: 7px;
  width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .9); color: #97786D;
  font-size: 13px; line-height: 1; cursor: pointer; opacity: 0;
  transition: opacity .16s; backdrop-filter: blur(4px);
}
.rec:hover .del { opacity: 1; }
.rec .del:hover { background: #fff; color: #A85A48; }
.empty {
  padding: 30px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 11px; font-size: 12.5px;
}

/* ------------------------------------------------------------------ 说明 -- */
.notes {
  margin: 0 clamp(16px, 3vw, 40px) 40px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px 28px;
}
.notes h3 {
  margin: 0 0 6px; font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.notes p { margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.7; }
.notes code {
  font-family: var(--mono); font-size: 11px; background: #F1ECE2;
  padding: 1px 5px; border-radius: 4px; color: #6C6353;
}

/* 静态预览提示条 */
.banner {
  margin: 0 clamp(16px, 3vw, 40px);
  padding: 10px 14px; border-radius: 10px;
  background: #FBF3E9; border: 1px solid #EFE0CB;
  color: #8A6A46; font-size: 12px;
}
