:root {
  --brand-red: #e4003b;
  --brand-red-dark: #c90035;
  --brand-pale: #fff4f6;
  --text: #30343b;
  --muted: #7d858d;
  --line: #eadde1;
  --shadow: 0 3px 14px rgba(34, 44, 52, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background: linear-gradient(180deg, #fff 0%, var(--brand-pale) 100%);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 15px;
}

a { color: var(--brand-red); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header { text-align: center; padding: 30px 16px 58px; }
.brand-mark { display: inline-grid; place-items: center; min-width: 76px; height: 46px; padding: 0 9px; margin-bottom: 14px; border-radius: 10px; color: #fff; background: var(--brand-red); font-size: 20px; font-weight: 800; letter-spacing: -1px; box-shadow: 0 5px 14px rgba(228, 0, 59, .24); }
.site-header h1 { margin: 0; color: var(--brand-red); font-size: 26px; letter-spacing: 1px; }

main { width: min(820px, calc(100% - 32px)); margin: 0 auto; }
.panel { background: #fff; border: 1px solid #f0dfe4; border-radius: 9px; box-shadow: 0 4px 16px rgba(122, 25, 53, .10); }
.editor-panel { padding: 26px 32px 35px; }
.docs-panel { margin-top: 64px; padding: 40px 32px 28px; position: relative; }
.result-panel { margin-top: 28px; padding: 20px 26px 26px; }
.hidden { display: none; }

.field-label { display: block; font-weight: 700; margin-bottom: 12px; }
.upload-row { margin-bottom: 22px; }
.file-line { display: flex; align-items: center; height: 40px; border: 1px solid #d8dde3; border-radius: 4px; overflow: hidden; }
.file-button { padding: 8px 13px; border-right: 1px solid #c8cfd8; background: #f7f8fa; cursor: pointer; white-space: nowrap; }
.file-button:hover { background: #fff0f3; }
input[type=file] { display: none; }
#fileName { padding: 0 12px; color: #6e767f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.paste-hint { margin-top: 8px; color: #8a7379; font-size: 12px; }
.primary-button { border: 0; border-radius: 4px; padding: 10px 17px; color: #fff; background: var(--brand-red); cursor: pointer; font-size: 14px; }
.primary-button:hover { background: var(--brand-red-dark); }
.primary-button:disabled { color: #a9afb6; background: #eef1f5; cursor: not-allowed; }
.file-line .primary-button { height: 40px; border-radius: 0; min-width: 98px; border-left: 1px solid #d8dde3; }

.text-input { width: 100%; height: 34px; padding: 5px 10px; border: 1px solid #d9dde2; border-radius: 4px; color: var(--text); font-size: 14px; margin-bottom: 23px; }
.text-input:focus { outline: 2px solid rgba(228, 0, 59, .16); border-color: var(--brand-red); }
.range-field { margin: 0 0 27px; }
.range-field .field-label { display: flex; justify-content: space-between; margin-bottom: 12px; }
output { display: none; }
input[type=range] { width: 100%; height: 16px; appearance: none; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(to right, var(--brand-red) 0 var(--range-progress, 35%), #f0dfe4 var(--range-progress, 35%) 100%); }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 20px; height: 20px; margin-top: -7px; border: 2px solid var(--brand-red); border-radius: 50%; background: #fff; }
input[type=range]::-moz-range-track { height: 6px; border-radius: 6px; background: #e4e7ed; }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--brand-red); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 2px solid var(--brand-red); border-radius: 50%; background: #fff; }

.color-field { display: flex; align-items: center; gap: 18px; margin-top: 3px; }
.color-field .field-label { margin: 0; }
.color-picker-wrap { position: relative; }
.color-button { width: 29px; height: 29px; border: 1px solid #cfd4db; border-radius: 4px; background: #000; cursor: pointer; box-shadow: inset 0 0 0 4px #fff; }
.color-palette { display: none; position: absolute; z-index: 2; top: 38px; left: 0; width: 170px; padding: 8px; grid-template-columns: repeat(5, 1fr); gap: 7px; background: #fff; border: 1px solid #dfe3e8; border-radius: 6px; box-shadow: var(--shadow); }
.color-palette.open { display: grid; }
.swatch { width: 23px; height: 23px; border: 2px solid #fff; outline: 1px solid #d7dce1; border-radius: 50%; cursor: pointer; }
.custom-color-label { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: #68727b; font-size: 12px; }
#customColor { width: 24px; height: 24px; padding: 0; border: 0; cursor: pointer; background: transparent; }

.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.result-heading h2 { margin: 0; font-size: 16px; }
.result-actions { display: flex; align-items: center; gap: 12px; }
.zoom-controls { display: flex; align-items: center; gap: 5px; padding: 3px; border: 1px solid #f0dfe4; border-radius: 5px; background: #fff8f9; }
.zoom-controls button { min-width: 28px; height: 28px; padding: 0 6px; border: 0; border-radius: 3px; color: var(--brand-red); background: transparent; cursor: pointer; font-size: 18px; line-height: 1; }
.zoom-controls button:hover { background: #ffe3ea; }
.zoom-controls button:last-child { font-size: 12px; }
.zoom-controls span { min-width: 42px; color: #7b666c; text-align: center; font-size: 12px; }
.canvas-wrap { min-height: 180px; display: grid; place-items: center; overflow: auto; padding: 16px; border: 1px dashed #ccd4d8; background: #f7f9fa; }
.canvas-stage { display: grid; place-items: center; min-width: min-content; min-height: min-content; }
#previewCanvas { display: block; max-width: none; height: auto; box-shadow: 0 2px 9px rgba(0,0,0,.12); transform-origin: center center; }

.docs-panel h2 { position: absolute; top: -19px; left: 28px; margin: 0; padding: 9px 16px; color: #fff; background: var(--brand-red); border-radius: 17px; font-size: 16px; box-shadow: 0 2px 8px rgba(228, 0, 59, .24); }
.docs-panel h2 span { margin-right: 8px; }
.docs-panel ul { list-style: none; margin: 0; padding: 0; }
.docs-panel li { position: relative; margin: 0 0 18px; padding-left: 23px; line-height: 1.5; }
.docs-panel li:last-child { margin-bottom: 8px; }
.docs-panel li::before { content: ""; position: absolute; left: 3px; top: .48em; width: 9px; height: 9px; border-radius: 50%; background: var(--brand-red); box-shadow: 0 0 0 3px #ffe3ea; }

footer { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 88px 16px 18px; font-size: 14px; color: #111; }
footer a { color: var(--brand-red); }
footer .notice { color: #69737b; }

@media (max-width: 600px) {
  .site-header { padding-bottom: 36px; }
  .editor-panel, .docs-panel { padding-left: 20px; padding-right: 20px; }
  .file-line { height: auto; flex-wrap: wrap; }
  #fileName { min-width: 0; height: 40px; line-height: 40px; }
  .file-line .primary-button { width: 100%; border-left: 0; border-top: 1px solid #d8dde3; }
  .result-heading { align-items: flex-start; flex-direction: column; }
  .result-actions { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  footer { flex-wrap: wrap; padding-top: 62px; text-align: center; }
}
