:root {
  --bg: #0a0805;
  --panel: #14100a;
  --panel-2: #1a160e;
  --line: rgba(201, 147, 43, 0.12);
  --line-strong: rgba(201, 147, 43, 0.3);
  --gold: #c9932b;
  --gold-soft: #b8946a;
  --gold-dim: #8a7a5e;
  --cream: #f0dfc8;
  --text: #e8e0d0;
  --dim: #8a8275;
  --faint: #4a4540;
  --feature: #e8b84b;
  --warn: #c97050;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Lato', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  font-weight: 300;
}

body {
  padding: 24px 16px 80px;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.2), transparent),
    radial-gradient(1px 1px at 80% 20%, rgba(201,147,43,0.3), transparent),
    radial-gradient(1px 1px at 30% 80%, rgba(255,255,255,0.2), transparent),
    radial-gradient(800px 400px at 50% 0%, rgba(201,147,43,0.04), transparent);
}

/* ============ HERO ============ */
.hero {
  max-width: 720px;
  margin: 0 auto 40px;
  text-align: center;
  padding-top: 16px;
}
.hero-chinese {
  font-family: 'Noto Serif SC', serif;
  font-size: 13px;
  color: var(--gold-soft);
  letter-spacing: 0.5em;
  margin-bottom: 18px;
  opacity: 0.7;
  padding-right: 0.5em;
  font-weight: 500;
}
.badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--gold);
  border: 1px solid rgba(201, 147, 43, 0.4);
  background: rgba(201, 147, 43, 0.04);
  padding: 5px 14px;
  border-radius: 99px;
  margin-bottom: 22px;
  text-transform: uppercase;
  font-family: 'Lato', sans-serif;
  font-weight: 400;
}
.hero h1 {
  font-family: 'Playfair Display', 'Georgia', serif;
  font-size: clamp(40px, 8vw, 64px);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--cream);
  margin-bottom: 6px;
  line-height: 1.05;
}
.hero h1 .dot { color: var(--gold); }
.hero h1 .cn-mark {
  font-family: 'Noto Serif SC', serif;
  font-size: 0.55em;
  color: var(--gold);
  font-weight: 500;
  margin-left: 10px;
  vertical-align: 0.2em;
}
.hero .divider {
  width: 44px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,147,43,0.5), transparent);
  margin: 18px auto;
}
.tagline {
  font-family: 'Lora', 'Georgia', serif;
  font-style: italic;
  color: var(--cream);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 6px;
  font-weight: 400;
  opacity: 0.7;
}
.tagline-sub {
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.15em;
  font-style: italic;
  font-family: 'Lora', serif;
  opacity: 0.6;
}

.help-trigger {
  margin-top: 22px;
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 99px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.1em;
  transition: 0.2s;
}
.help-trigger span { color: var(--gold); font-weight: 500; margin-right: 6px; }
.help-trigger:hover { border-color: var(--gold-soft); color: var(--cream); }

/* ============ MAIN ============ */
main {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 20px;
  position: relative;
  overflow: hidden;
}
.panel::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.3;
}
.panel-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.panel-head .num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(201, 147, 43, 0.06);
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  flex-shrink: 0;
}
.panel-head h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--cream);
  letter-spacing: 0.02em;
}
.panel-head .panel-sub {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.12em;
  margin-left: auto;
  font-style: italic;
  font-family: 'Lora', serif;
}

/* ============ UPLOAD ============ */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 640px) { .upload-grid { grid-template-columns: 1fr; } }

.drop {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: 0.2s;
  background: var(--panel-2);
  display: block;
}
.drop:hover { border-color: var(--gold-soft); background: rgba(201, 147, 43, 0.03); }
.drop.has-file { border-color: var(--gold); border-style: solid; background: rgba(201, 147, 43, 0.04); }
.drop.dragover { border-color: var(--feature); background: rgba(232, 184, 75, 0.05); }
.drop .icon { font-size: 22px; margin-bottom: 8px; color: var(--gold); }
.drop .label { font-size: 10px; color: var(--dim); letter-spacing: 0.18em; margin-bottom: 6px; text-transform: uppercase; }
.drop .text { font-size: 12px; color: var(--dim); font-style: italic; font-family: 'Lora', serif; }
.drop .filename { font-size: 11px; color: var(--gold); word-break: break-all; margin-top: 8px; font-weight: 500; }

/* ============ CONTROLS ============ */
.controls { display: flex; flex-direction: column; gap: 16px; }
.ctrl { display: flex; flex-direction: column; gap: 6px; }
.ctrl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ctrl label, .block-label {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.ctrl-hint { text-transform: none; letter-spacing: 0.02em; opacity: 0.7; font-style: italic; font-family: 'Lora', serif; }
.block-label { display: block; margin-bottom: 10px; }
.ctrl .val { font-size: 13px; color: var(--gold); font-weight: 600; }

.ctrl input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--panel-2);
  border-radius: 99px;
  outline: none;
  border: 1px solid var(--line);
}
.ctrl input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: var(--gold);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(201, 147, 43, 0.5);
}
.ctrl input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--gold);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(201, 147, 43, 0.5);
}
.ctrl input[type=color] {
  width: 56px; height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: none;
  cursor: pointer;
  padding: 2px;
}

/* ============ BOOM RADIO ============ */
.boom-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
@media (max-width: 640px) { .boom-options { grid-template-columns: 1fr; } }
.boom-opt { cursor: pointer; display: block; }
.boom-opt input { display: none; }
.boom-card {
  display: block;
  padding: 14px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: 0.15s;
  text-align: center;
}
.boom-opt input:checked + .boom-card {
  border-color: var(--gold);
  background: rgba(201, 147, 43, 0.05);
  box-shadow: 0 0 10px rgba(201, 147, 43, 0.1);
}
.boom-name {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  color: var(--cream);
  margin-bottom: 3px;
  font-weight: 500;
}
.boom-desc {
  display: block;
  font-size: 10px;
  color: var(--dim);
  font-family: 'Lora', serif;
  font-style: italic;
}

/* ============ TOGGLES ============ */
.toggles { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  cursor: pointer;
  font-size: 11px;
  color: var(--dim);
  transition: 0.15s;
}
.toggle:hover { border-color: var(--gold-soft); }
.toggle input[type=checkbox] { accent-color: var(--gold); cursor: pointer; width: 14px; height: 14px; }
.toggle:has(input:checked) {
  color: var(--cream);
  border-color: var(--gold-soft);
  background: rgba(201, 147, 43, 0.03);
}

/* ============ RENDER ============ */
.render-zone { display: flex; flex-direction: column; align-items: center; gap: 14px; }
button, .primary {
  font-family: 'Lato', sans-serif;
  cursor: pointer;
  border: none;
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.1em;
  transition: 0.15s;
  text-decoration: none;
  display: inline-block;
  font-weight: 400;
}
button:hover:not(:disabled) { border-color: var(--gold-soft); color: var(--gold); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary, .primary {
  background: rgba(201, 147, 43, 0.1);
  color: var(--gold);
  border: 1px solid rgba(201, 147, 43, 0.45);
  font-weight: 500;
  font-size: 12px;
  padding: 14px 32px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
button.primary:hover:not(:disabled), .primary:hover {
  background: rgba(201, 147, 43, 0.2);
  color: var(--feature);
  border-color: var(--gold);
}
.btn-rocket { display: inline-block; margin-right: 8px; font-size: 0.9em; }

.status {
  font-size: 11px;
  color: var(--dim);
  min-height: 16px;
  text-align: center;
  font-style: italic;
  font-family: 'Lora', serif;
}
.status.error { color: var(--warn); }

.progress-box {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  display: none;
}
.progress-box.active { display: block; }
.progress-label {
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 10px;
  letter-spacing: 0.05em;
  font-style: italic;
  font-family: 'Lora', serif;
}
.progress-track { height: 6px; background: #000; border-radius: 99px; overflow: hidden; }
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--feature));
  transition: width 0.3s;
}

.result-card {
  background: linear-gradient(135deg, rgba(201,147,43,0.08), rgba(232,184,75,0.03));
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  width: 100%;
  display: none;
}
.result-card.active { display: block; animation: popIn 0.4s; }
@keyframes popIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.result-chinese {
  font-family: 'Noto Serif SC', serif;
  color: var(--gold);
  font-size: 24px;
  letter-spacing: 0.5em;
  margin-bottom: 12px;
  padding-right: 0.5em;
  opacity: 0.85;
}
.result-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--cream);
}
.result-card p {
  color: var(--dim);
  font-size: 11px;
  margin-bottom: 16px;
  font-style: italic;
  font-family: 'Lora', serif;
}
.download-btn { margin-top: 8px; }
.copy-hint { margin-top: 16px !important; font-size: 10px; font-style: normal !important; }
.copy-hint code {
  background: var(--panel);
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--gold);
  font-size: 10px;
  word-break: break-all;
  font-family: 'JetBrains Mono', monospace;
}

/* ============ FOOTER ============ */
footer { max-width: 720px; margin: 32px auto 0; text-align: center; color: var(--dim); font-size: 10px; letter-spacing: 0.15em; }
.footer-cn {
  font-family: 'Noto Serif SC', serif;
  font-size: 12px;
  color: var(--gold-soft);
  margin-bottom: 14px;
  letter-spacing: 0.5em;
  padding-right: 0.5em;
  opacity: 0.5;
}
footer p { margin-bottom: 4px; }
footer a { color: var(--gold); text-decoration: none; }
.footer-credit { opacity: 0.6; margin-top: 8px !important; }

/* ============ MODAL ============ */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
  animation: fadeIn 0.2s;
}
.modal.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  max-width: 640px;
  margin: 40px auto;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 32px 28px;
  position: relative;
  line-height: 1.7;
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--dim);
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}
.modal-chinese {
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  color: var(--gold-soft);
  letter-spacing: 0.4em;
  margin-bottom: 12px;
  opacity: 0.7;
  padding-right: 0.4em;
}
.modal-content h2 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--cream);
}
.modal-intro { color: var(--dim); font-size: 12px; margin-bottom: 24px; font-style: italic; font-family: 'Lora', serif; }
.modal-content h3 {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  color: var(--gold);
  margin-top: 22px;
  margin-bottom: 8px;
  font-weight: 500;
}
.modal-content p, .modal-content li { font-size: 12px; color: var(--text); margin-bottom: 10px; }
.modal-content ul, .modal-content ol { padding-left: 20px; margin-bottom: 12px; }
.modal-content li { margin-bottom: 6px; }
.modal-content strong { color: var(--gold); font-weight: 500; }
.modal-content a { color: var(--gold); text-decoration: none; border-bottom: 1px dotted var(--gold); }
.modal-signoff {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 10px !important;
  color: var(--dim) !important;
  font-style: italic;
  font-family: 'Lora', serif;
}
