:root {
  --paper: #fffaf2;
  --ink: #2a2218;
  --muted: #6f6456;
  --line: #e4d8c6;
  --accent: #c45c26;
  --accent-dark: #9a3f14;
  --bg: #efe4d2;
  --shadow: 0 18px 40px rgba(74, 48, 22, 0.12);
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12px 12px, #e7d8bf 1.1px, transparent 1.2px) 0 0 / 28px 28px,
    var(--bg);
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

.page {
  width: min(760px, calc(100% - 32px));
  margin: 36px auto 64px;
}

.hero {
  position: relative;
  margin-bottom: 22px;
  padding: 8px 6px 4px;
}

.hero h1 {
  margin: 6px 0 10px;
  font-size: clamp(32px, 6vw, 46px);
  letter-spacing: 0.08em;
  font-weight: 700;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.lead {
  margin: 0;
  max-width: 34em;
  color: var(--muted);
  line-height: 1.7;
}

.beads {
  position: absolute;
  right: 0;
  top: 4px;
  display: flex;
  gap: 8px;
}

.dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.12), inset 3px 3px 0 rgba(255,255,255,.35);
}
.d1 { background: #c45c26; }
.d2 { background: #3d6b58; }
.d3 { background: #d4a017; }
.d4 { background: #3d5a80; }
.d5 { background: #b23a48; }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.drop {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 22px;
  border: 1.5px dashed #d3c3aa;
  border-radius: 16px;
  background: #f7efe3;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
}

.drop:hover, .drop.over {
  border-color: var(--accent);
  background: #fff6ea;
}

.drop input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.drop-copy {
  display: grid;
  gap: 6px;
}

.drop-copy strong {
  font-size: 18px;
}

.drop-copy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

#thumb {
  max-width: min(100%, 280px);
  max-height: 160px;
  margin-top: 12px;
  border-radius: 10px;
  object-fit: contain;
  background: #efe6d6;
}

.slider-row {
  margin-top: 22px;
}

.slider-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.slider-head label {
  font-weight: 700;
}

.size-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.slider-ctrl {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

#widthOut {
  min-width: 2.4em;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 22px;
}

.unit { color: var(--muted); }

.actions {
  margin-top: 22px;
}

button, #download {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

button {
  background: var(--accent);
  color: #fff7ee;
}

button:hover { background: var(--accent-dark); }

button:disabled {
  background: #cbbba8;
  cursor: not-allowed;
}

.error {
  margin: 14px 0 0;
  color: #9a1f1f;
  font-size: 14px;
}

.result {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.result-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.result-bar p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

#download {
  background: #2a2218;
  color: #fff7ee;
  white-space: nowrap;
}

#download:hover { background: #4a3b2a; }

figure {
  margin: 0;
  overflow: auto;
  max-height: 70vh;
  border-radius: 14px;
  background:
    linear-gradient(45deg, #e8dcc8 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(-45deg, #e8dcc8 25%, transparent 25%) 0 8px / 16px 16px,
    #f4eadb;
}

#out {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  image-rendering: auto;
}

.privacy {
  margin-top: 28px;
  padding: 4px 8px;
  color: var(--muted);
}

.privacy h2 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--ink);
}

.privacy p {
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
}

@media (max-width: 640px) {
  .beads { display: none; }
  .slider-head, .result-bar { flex-direction: column; align-items: flex-start; }
}
