:root {
  --ink: #101014;
  --panel: #19181f;
  --panel-2: #22202a;
  --line: rgba(221, 196, 143, 0.18);
  --gold: #d6b36f;
  --teal: #61b6bd;
  --rose: #c95f6b;
  --paper: #f4ecd9;
  --muted: #bcb09b;
  --field: #0f1117;
  --shadow: rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper);
  background:
    linear-gradient(135deg, rgba(16, 16, 20, 0.98), rgba(27, 29, 31, 0.96)),
    repeating-linear-gradient(90deg, rgba(214, 179, 111, 0.04) 0 1px, transparent 1px 72px);
  font-family: Inter, "Noto Serif SC", serif;
}

button, input, select, textarea { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(380px, 0.78fr);
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - 56px);
}

.form-panel,
.preview-panel {
  border: 1px solid var(--line);
  background: rgba(25, 24, 31, 0.92);
  box-shadow: 0 24px 70px var(--shadow);
  border-radius: 8px;
}

.form-panel { padding: 26px; }
.preview-panel { padding: 18px; display: flex; flex-direction: column; gap: 14px; }

.topbar,
.result-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-weight: 700;
  letter-spacing: 0;
}

h1 { font-size: 34px; }
h2 { font-size: 22px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(97, 182, 189, 0.35);
  color: var(--teal);
  background: rgba(97, 182, 189, 0.08);
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

.status-pill.warn {
  color: var(--rose);
  border-color: rgba(201, 95, 107, 0.35);
  background: rgba(201, 95, 107, 0.08);
}

.mingli-form {
  display: grid;
  gap: 14px;
}

.field-row {
  display: grid;
  gap: 12px;
}

.field-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field span,
.focus-set legend {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(244, 236, 217, 0.12);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--paper);
  background: var(--field);
  outline: none;
}

.field textarea {
  resize: vertical;
  line-height: 1.7;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(214, 179, 111, 0.62);
  box-shadow: 0 0 0 3px rgba(214, 179, 111, 0.12);
}

.focus-set {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.focus-set legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.focus-set label,
.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--paper);
  user-select: none;
}

.focus-set label {
  justify-content: center;
  border: 1px solid rgba(244, 236, 217, 0.12);
  border-radius: 6px;
  background: rgba(15, 17, 23, 0.78);
}

.focus-set input,
.toggle input { accent-color: var(--gold); }

.toggle { color: var(--muted); }

.extra-panel {
  border: 1px solid rgba(244, 236, 217, 0.12);
  border-radius: 6px;
  background: rgba(15, 17, 23, 0.54);
  padding: 0 12px;
}

.extra-panel summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 42px;
  color: var(--muted);
  cursor: pointer;
}

.extra-panel[open] {
  padding-bottom: 12px;
}

.extra-panel[open] summary {
  margin-bottom: 10px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.primary-button,
.icon-button {
  border: 0;
  cursor: pointer;
  color: var(--ink);
  background: var(--gold);
  transition: transform 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  flex: 1;
  border-radius: 6px;
  font-weight: 700;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  text-decoration: none;
}

.primary-button:hover,
.icon-button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.primary-button:disabled { cursor: wait; opacity: 0.68; transform: none; }

.sample-frame {
  position: relative;
  overflow: hidden;
  flex: 1;
  min-height: 520px;
  border-radius: 8px;
  border: 1px solid rgba(214, 179, 111, 0.2);
  background: var(--panel-2);
}

.sample-frame img {
  width: 100%;
  height: 100%;
  min-height: 520px;
  object-fit: cover;
  object-position: top center;
  opacity: 0.72;
  filter: saturate(0.86) contrast(1.04);
}

.sample-caption {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(244, 236, 217, 0.12);
  border-radius: 6px;
  background: rgba(16, 16, 20, 0.78);
  backdrop-filter: blur(12px);
}

.sample-caption span { color: var(--teal); font-size: 12px; }
.sample-caption strong { font-family: "Noto Serif SC", serif; font-size: 20px; }

.result-panel {
  display: grid;
  gap: 14px;
  flex: 1;
}

.result-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.result-links a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--paper);
  text-decoration: none;
  border: 1px solid rgba(97, 182, 189, 0.32);
  border-radius: 6px;
  background: rgba(97, 182, 189, 0.08);
  font-size: 13px;
}

#reportPreview {
  width: 100%;
  min-height: 640px;
  border: 1px solid rgba(214, 179, 111, 0.2);
  border-radius: 8px;
  background: var(--ink);
}

.message {
  min-height: 24px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}

.message.error { color: var(--rose); }
.message.good { color: var(--teal); }

svg { width: 18px; height: 18px; stroke-width: 2; }

@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .sample-frame, .sample-frame img { min-height: 360px; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 20px, 1180px); padding: 10px 0; }
  .form-panel, .preview-panel { padding: 16px; }
  .field-row.two, .focus-set, .result-links { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  h1 { font-size: 28px; }
  #reportPreview { min-height: 520px; }
}
