:root {
  color-scheme: light;
  --bg: #f5f8fb;
  --panel: #ffffff;
  --line: #d9e2ec;
  --text: #172033;
  --muted: #657184;
  --blue: #2f6fbd;
  --blue-dark: #215493;
  --gold: #a98732;
  --shadow: 0 18px 45px rgba(30, 52, 82, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(47, 111, 189, .08), transparent 38%),
    var(--bg);
}

.page {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 22px;
  min-height: 100vh;
  padding: 22px;
}

.panel,
.preview {
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(217, 226, 236, .9);
  box-shadow: var(--shadow);
}

.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
}

.panel-head {
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 15px;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.group {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}

.group h2 {
  margin-bottom: 12px;
}

.group-note {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.muted-group input:disabled {
  color: #8b96a8;
  background: #f2f5f8;
  cursor: not-allowed;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #3a4658;
  font-size: 13px;
  font-weight: 600;
}

input {
  width: 100%;
  border: 1px solid #cdd8e6;
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  background: #fff;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 189, .14);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.check {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  font-weight: 500;
}

.check input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 16px 22px 22px;
  margin-top: auto;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 11px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
}

#resetBtn {
  color: var(--blue-dark);
  background: #e8f1fc;
}

#downloadBtn {
  color: #fff;
  background: var(--blue);
}

.preview {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 8px;
  overflow: hidden;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

#renderState {
  color: var(--blue-dark);
  background: #e8f1fc;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}

.canvas-shell {
  display: grid;
  place-items: center;
  flex: 1;
  padding: 28px;
  overflow: auto;
  background:
    linear-gradient(45deg, #eef3f8 25%, transparent 25%),
    linear-gradient(-45deg, #eef3f8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef3f8 75%),
    linear-gradient(-45deg, transparent 75%, #eef3f8 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

canvas {
  display: block;
  width: min(100%, 1024px);
  height: auto;
  background: #faf7ef;
  box-shadow: 0 18px 40px rgba(28, 42, 62, .18);
}

#qrScratch {
  position: fixed;
  left: -9999px;
  top: -9999px;
  width: 96px;
  height: 96px;
  overflow: hidden;
}

@media (max-width: 1000px) {
  .page {
    grid-template-columns: 1fr;
  }

  .panel {
    max-height: none;
  }
}
