:root {
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: #111827;
  background: #fff;
  --blue: #2563eb;
  --line: #e5e7eb;
}
* { box-sizing: border-box; }
body, h1, h2, h3, h4, p { margin: 0; }
p { line-height: 1.7; }
a { color: inherit; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: 12px; top: -100px; z-index: 2; background: white; padding: 8px; }
.skip:focus { top: 8px; }
.wrap { max-width: 1320px; margin: auto; padding-inline: 24px; }
.top, .foot { background: #111827; color: #fff; }
.top { border-bottom: 4px solid #3b82f6; }
.top-inner, .foot .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.15rem; }
.brand small { color: #d1d5db; font-size: .8rem; }
.mark { display: grid; place-items: center; width: 46px; height: 46px; background: #2563eb; border-radius: 6px; font-size: 1.65rem; }
.lab { align-self: flex-start; border-radius: 5px; background: #f59e0b; color: #111827; padding: 4px 8px; font-size: .75rem; }
nav { display: flex; gap: 18px; font-size: .9rem; }
nav a { text-decoration: none; }
.hero { background: #eff6ff; border-bottom: 1px solid #bfdbfe; }
.hero .wrap { padding-block: 26px; }
.kicker { color: #1d4ed8; font-size: .8rem; font-weight: 800; letter-spacing: .08em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.4rem); margin: 6px 0 8px; }
h2 { font-size: 1.15rem; }
.hero p:last-child { color: #374151; }
.main { padding-block: 24px 40px; }
.workspace { display: grid; grid-template-columns: minmax(290px, 365px) minmax(0, 1fr); align-items: start; gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: 7px; min-width: 0; overflow: hidden; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; background: #f9fafb; border-bottom: 1px solid var(--line); }
.body { padding: 16px; }
.jump { display: none; }
label { display: block; font-size: .9rem; font-weight: 700; margin-bottom: 5px; }
input, textarea { width: 100%; min-width: 0; border: 1px solid #cbd5e1; border-radius: 6px; padding: 9px 10px; color: #111827; background: white; }
textarea { resize: vertical; }
#title { margin-bottom: 14px; }
.hint { color: #475569; font-size: .875rem; margin-top: 6px; }
.fields, .groups-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-block: 14px 10px; }
.groups-settings { align-items: end; border-top: 1px solid var(--line); padding-top: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
button { min-height: 42px; border: 1px solid #cbd5e1; border-radius: 6px; padding: 7px 11px; background: #f8fafc; color: #111827; font-size: .875rem; font-weight: 700; }
button:hover:enabled { background: #e2e8f0; }
.actions button { flex: 1 1 auto; }
.primary, #print:enabled { background: var(--blue); border-color: var(--blue); color: white; }
.primary:hover:enabled, #print:hover:enabled { background: #1d4ed8; }
button[aria-pressed="true"] { background: #dbeafe; color: #1e40af; border-color: #60a5fa; }
.view-buttons { margin-top: 0; }
#status { color: #1e40af; font-size: .9rem; margin-top: 10px; }
#status.error { color: #b91c1c; }
.stage { padding: 16px; background: #eef2f7; }
.empty { padding: 50px 10px; text-align: center; color: #475569; }
.sheet { background: white; padding: 15px; border-radius: 6px; overflow-x: auto; }
.sheet-title { text-align: center; font-size: 1.15rem; overflow-wrap: anywhere; margin-bottom: 10px; }
.board { border-radius: 4px; background: #1e3a5f; color: white; text-align: center; padding: 5px; margin-bottom: 10px; font-size: .9rem; }
.seats { display: grid; grid-template-columns: repeat(var(--cols), minmax(72px, 1fr)); gap: 6px; }
.cols-1 { --cols: 1; } .cols-2 { --cols: 2; } .cols-3 { --cols: 3; } .cols-4 { --cols: 4; } .cols-5 { --cols: 5; }
.cols-6 { --cols: 6; } .cols-7 { --cols: 7; } .cols-8 { --cols: 8; } .cols-9 { --cols: 9; } .cols-10 { --cols: 10; }
.seat { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; min-width: 0; padding: 4px; background: #eff6ff; border-color: #bfdbfe; line-height: 1.2; }
.seat[draggable="true"] { cursor: grab; }
.seat.fixed { background: #fef3c7; border-color: #d97706; color: #78350f; }
.seat.vacant { border-style: dashed; background: white; color: #475569; }
.seat-number { font-weight: 600; font-size: .75rem; }
.student, .members li { overflow-wrap: anywhere; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); gap: 8px; }
.group-card { border: 1px solid #bfdbfe; border-radius: 5px; break-inside: avoid; min-width: 0; }
.group-card h4 { background: #eff6ff; padding: 7px 9px; font-size: .9rem; }
.members { padding: 0 9px 0 26px; margin-block: 8px; line-height: 1.45; font-size: .9rem; }
.guide { margin-top: 22px; }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.guide h3 { font-size: 1rem; margin-bottom: 6px; }
.guide p { color: #475569; }
.foot { border-top: 4px solid #3b82f6; }
@media (max-width: 720px) {
  .wrap { padding-inline: 14px; }
  .top-inner, .foot .wrap { flex-wrap: wrap; }
  .brand strong { font-size: .95rem; }
  .workspace, .guide-grid { grid-template-columns: 1fr; }
  .jump { display: inline; font-size: .875rem; }
  .stage, .sheet { padding: 10px; }
}
@page { size: A4 landscape; margin: 9mm; }
@media print {
  .stage.stale { display: none !important; }
  .skip, .top, .hero, .foot, .guide, .workspace > :first-child, #preview > .head, .toolbar { display: none !important; }
  body, .main, .workspace, #preview, .stage, .sheet { display: block; width: auto; max-width: none; margin: 0; padding: 0; border: 0; overflow: visible; background: white; }
  .sheet { color: #000; }
  .sheet-title { font-size: 14pt; margin-bottom: 2mm; }
  .board { background: white; color: black; border: 1px solid black; padding: 1mm; margin-bottom: 2mm; font-size: 9pt; }
  .seats { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 1mm; }
  .seat, .seat.fixed, .seat.vacant, .seat[aria-pressed="true"] { appearance: none; min-height: 10mm; padding: .5mm; gap: .4mm; font-size: 8.5pt; color: black; border-color: #777; background: white; break-inside: avoid; }
  .seat-number { font-size: 6.5pt; }
  .group-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .group-card h4, .members { font-size: 9pt; }
}
