.draw-page {
  --canvas: #130f0e;
  --canvas-glow: rgba(161, 43, 45, 0.18);
  --surface: #211a18;
  --surface-strong: #2b201d;
  --surface-soft: #322622;
  --text: #f7f0e7;
  --muted: #b9aaa0;
  --border: rgba(238, 212, 183, 0.16);
  --accent: #ef756b;
  --accent-strong: #9f222b;
  --accent-soft: rgba(193, 39, 45, 0.15);
  --gold: #e4bc6d;
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 72% 4%, var(--canvas-glow), transparent 34%), var(--canvas);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  line-height: 1.5;
}

.light-mode .draw-page {
  --canvas: #f8f3e8;
  --canvas-glow: rgba(193, 39, 45, 0.09);
  --surface: #fffdf8;
  --surface-strong: #fbf5e9;
  --surface-soft: #f3e9da;
  --text: #2b2928;
  --muted: #695f58;
  --border: rgba(104, 76, 53, 0.2);
  --accent: #9e252d;
  --accent-strong: #bd2d34;
  --accent-soft: rgba(193, 39, 45, 0.09);
  --gold: #8b631e;
}

.draw-page *, .draw-page *::before, .draw-page *::after { box-sizing: border-box; }
.draw-page button, .draw-page textarea { font: inherit; }
.draw-page button { cursor: pointer; }
.draw-page a { color: inherit; text-decoration: none; }
.draw-page [hidden] { display: none !important; }
.draw-page :focus-visible, .draw-tools-nav-link:focus-visible { outline: 3px solid var(--gold, #e4bc6d); outline-offset: 3px; }
.draw-page .shell { width: min(1120px, calc(100% - 40px)); margin-inline: auto; }

.site-header { border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--canvas) 88%, transparent); }
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; min-height: 44px; font-weight: 800; letter-spacing: 0.02em; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; flex: 0 0 37px; border-radius: 10px; background: #b52b32; color: #fff7ed; font-family: "STKaiti", "KaiTi", serif; font-size: 23px; box-shadow: 0 8px 22px rgba(139, 31, 35, 0.24); }
.brand-name { font-size: 17px; white-space: nowrap; }
.brand-name span { color: var(--muted); font-size: 13px; font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); white-space: nowrap; font-size: 13px; font-weight: 700; }
.header-button:hover { border-color: var(--accent); background: var(--surface-strong); }

.intro { padding: 58px 0 39px; }
.eyebrow, .section-kicker { margin: 0; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: 0.16em; }
.intro h1 { max-width: 1040px; margin: 14px 0 17px; font-size: clamp(34px, 4.6vw, 58px); line-height: 1.18; letter-spacing: -0.045em; }
.intro h1 span { color: var(--accent); }
.intro-copy { max-width: 730px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.8; }
.draw-shell { border: 1px solid var(--border); border-radius: 20px; padding: 30px; background: var(--surface); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.13); }
.unified-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 23px; }
.unified-heading h2 { margin: 8px 0 0; font-size: clamp(23px, 2.5vw, 30px); line-height: 1.25; }
.mode-chip { display: inline-flex; align-items: center; min-height: 35px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-strong); color: var(--gold); font-size: 12px; font-weight: 800; white-space: nowrap; }
.unified-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: start; gap: 18px; }
.work-card, .result-card { min-width: 0; border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
.work-card { background: var(--surface-strong); }
.result-card { min-height: 450px; background: linear-gradient(145deg, var(--accent-soft), var(--surface-strong) 72%); }
.field-label, .result-label { display: block; margin: 0 0 11px; color: var(--text); font-size: 13px; font-weight: 800; }
.field-divider { height: 1px; margin: 22px 0 21px; background: var(--border); }
.source-switch { display: flex; gap: 8px; }
.source-button { flex: 1; min-height: 46px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); font-weight: 700; }
.source-button:hover { border-color: var(--accent); color: var(--text); }
.source-button.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.draw-page textarea { display: block; width: 100%; min-height: 132px; resize: vertical; padding: 13px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); outline: none; line-height: 1.6; }
.draw-page textarea::placeholder { color: var(--muted); opacity: 0.75; }
.draw-page textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#custom-pool { margin-top: 17px; }
.actions { margin-top: 24px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; padding: 0 23px; border: 1px solid var(--accent-strong); border-radius: 10px; background: #b82e35; color: #fff; box-shadow: 0 7px 18px rgba(142, 31, 36, 0.18); font-size: 14px; font-weight: 800; }
.primary-button:hover { background: #92222b; }
.notice { min-height: 20px; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.notice.is-error { color: var(--accent); }
.result-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.result-label { margin: 0; color: var(--gold); font-size: 12px; letter-spacing: 0.12em; }
.result-summary { margin: 0; color: var(--muted); font-size: 12px; text-align: right; }
.draw-results { display: grid; gap: 13px; }
.empty-result { display: grid; place-items: center; min-height: 345px; margin: 0; padding: 20px; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); font-size: 14px; line-height: 1.8; text-align: center; }
.match-card, .bye-card { min-width: 0; padding: 17px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.match-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.match-number, .bye-label { color: var(--gold); font-size: 11px; font-weight: 900; letter-spacing: 0.08em; }
.match-state { color: var(--muted); font-size: 11px; }
.match-topic { display: flex; align-items: baseline; gap: 12px; min-width: 0; margin-bottom: 15px; overflow-wrap: anywhere; }
.match-topic span { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.match-topic strong { min-width: 0; font-size: 17px; line-height: 1.55; }
.match-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.match-side { display: flex; flex-direction: column; gap: 5px; min-width: 0; min-height: 77px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-strong); overflow-wrap: anywhere; }
.match-side span { color: var(--gold); font-size: 11px; font-weight: 800; }
.match-side.negative span { color: var(--accent); }
.match-side strong { font-size: 17px; line-height: 1.35; }
.bye-card { display: flex; flex-direction: column; gap: 7px; border-color: color-mix(in srgb, var(--gold) 40%, var(--border)); background: color-mix(in srgb, var(--gold) 8%, var(--surface)); }
.bye-team { overflow-wrap: anywhere; font-size: 20px; }
.bye-note { margin: 0; color: var(--muted); font-size: 12px; }
.page-footnote { margin: 20px 0 54px; color: var(--muted); font-size: 12px; text-align: center; }

.draw-tools-nav-link { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; color: #f8fafc; font-size: 14px; text-decoration: none; }
.draw-tools-nav-link:hover { background: rgba(255, 255, 255, 0.1); }
.light-mode .draw-tools-nav-link { color: #1f2937; }
.light-mode .draw-tools-nav-link:hover { background: rgba(80, 55, 30, 0.09); }
.draw-tools-nav-link.mobile { min-height: 44px; margin-inline: 0; border-radius: 8px; font-size: 14px; }

@media (max-width: 700px) {
  .draw-page .shell { width: min(100% - 28px, 1120px); }
  .header-inner { min-height: 68px; }
  .brand-name { font-size: 15px; }
  .brand-name span { display: none; }
  .header-button { padding-inline: 10px; font-size: 12px; }
  .intro { padding: 42px 0 29px; }
  .intro h1 { font-size: clamp(30px, 8vw, 35px); }
  .intro h1 span { display: block; }
  .intro-copy { font-size: 14px; }
  .draw-shell { padding: 19px 14px; }
  .unified-heading { align-items: start; flex-direction: column; margin-bottom: 17px; }
  .unified-grid { grid-template-columns: 1fr; gap: 12px; }
  .work-card, .result-card { padding: 18px; }
  .result-card { min-height: 230px; }
  .empty-result { min-height: 140px; }
}

@media (max-width: 370px) {
  .brand { gap: 7px; }
  .brand-name { font-size: 13px; }
  .header-actions { gap: 4px; }
  .header-button { padding-inline: 7px; font-size: 11px; }
  .result-header { flex-direction: column; align-items: start; }
  .result-summary { text-align: left; }
  .match-sides { grid-template-columns: 1fr; }
}
