:root { --ink:#1a1a1a; --dim:#666; --line:#333; --paper:#fff; --accent:#8a5a1a;
  --font: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
* { box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
body { margin: 0; background: #4a4a4a; color: var(--ink); font-family: var(--font); }

.toolbar { position: sticky; top: 0; z-index: 10; background: #222; color: #eee; padding: 12px 20px;
  display: flex; gap: 14px; align-items: center; }
.toolbar b { font-size: 15px; } .toolbar .sp { margin-left: auto; }
.toolbar button, .toolbar a { font: inherit; font-size: 13px; cursor: pointer; border: 1px solid #555;
  background: #333; color: #eee; padding: 8px 14px; border-radius: 8px; text-decoration: none; }
.toolbar button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.pages { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 24px; }
.page { background: var(--paper); width: 210mm; min-height: 297mm; padding: 16mm; box-shadow: 0 4px 20px #0007; }
.page h1 { font-size: 26px; margin: 0 0 4px; } .page h2 { font-size: 17px; margin: 22px 0 10px; border-bottom: 2px solid var(--line); padding-bottom: 4px; }
.page .sub { color: var(--dim); font-size: 13px; margin-bottom: 12px; }
.muted { color: var(--dim); font-size: 12px; }

/* Board */
.pboard { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 58mm); gap: 3mm; margin-top: 8mm; }
.pcell { border: 1.5px solid var(--line); border-radius: 3mm; padding: 4mm; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.pcell-icon { position: absolute; right: 3mm; top: 3mm; width: 18mm; height: 18mm; color: var(--rc, #888); opacity: .16; }
.pcell-icon svg { width: 100%; height: 100%; }
.pcell .pn, .pcell .pz, .pcell .pa { position: relative; z-index: 1; }
.pcell .pn { font-weight: 700; font-size: 15px; } .pcell .pz { color: var(--dim); font-size: 12px; margin-bottom: 3mm; }
.pcell .pa { font-size: 11px; line-height: 1.55; margin-top: auto; }
.pcell .pa b { color: var(--accent); }
.pcell.pcreature { align-items: center; justify-content: center; text-align: center; background: #faf7f0; }
.pcreature .porgans { display: flex; flex-wrap: wrap; gap: 2mm; justify-content: center; margin-top: 3mm; }
.porgan { display: flex; flex-direction: column; align-items: center; width: 15mm; font-size: 10px; }
.porgan svg { width: 11mm; height: 11mm; }

/* Cards */
.cardsheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; margin-top: 6mm; }
.card { border: 1.5px dashed var(--line); border-radius: 3mm; padding: 5mm; min-height: 44mm; display: flex; flex-direction: column; }
.card .ct { font-weight: 700; font-size: 14px; } .card .cs { color: var(--dim); font-size: 11px; margin-bottom: 2mm; }
.card .cd { font-size: 12px; line-height: 1.6; margin-top: 2mm; }
.card .cbig { margin-top: auto; font-size: 20px; font-weight: 800; }
.card.role { min-height: 56mm; }
.card.role .swatch { width: 100%; height: 8mm; border-radius: 2mm; margin-bottom: 3mm; }
.card.role .spec { margin-top: auto; font-size: 12px; } .card.role .spec b { font-size: 15px; }
.card.event .cbig { color: var(--accent); }
.organsheet { grid-template-columns: repeat(2, 1fr); }
.card.organ { min-height: auto; }
.card.organ .stages { margin-top: 2mm; display: grid; grid-template-columns: 1fr 1fr; gap: 3mm; }
.ostage { display: flex; align-items: center; gap: 2mm; border: 1px solid #ddd; border-radius: 2mm; padding: 2mm; }
.ostage svg { width: 13mm; height: 13mm; flex: 0 0 auto; }
.ostage-tx { font-size: 10px; line-height: 1.4; color: #1a1a1a; }
.ostage-tx .stg { color: var(--dim); font-size: 9px; }

/* Context track & tokens */
.track { display: flex; gap: 0; margin-top: 6mm; border: 1.5px solid var(--line); border-radius: 2mm; overflow: hidden; width: fit-content; }
.track .t { width: 13mm; height: 13mm; display: grid; place-items: center; border-right: 1px solid #ccc; font-weight: 700; font-size: 13px; }
.track .t:last-child { border-right: none; }
.tokrow { display: flex; flex-wrap: wrap; gap: 3mm; margin-top: 4mm; }
.tok { border: 1.5px solid var(--line); border-radius: 50%; width: 16mm; height: 16mm; display: grid; place-items: center; font-size: 10px; text-align: center; font-weight: 600; }

.legend { font-size: 12px; line-height: 1.8; }
.legend b { color: var(--accent); }

@media print {
  body { background: #fff; } .toolbar { display: none; }
  .pages { padding: 0; gap: 0; } .page { box-shadow: none; page-break-after: always; width: auto; min-height: auto; }
  .page:last-child { page-break-after: auto; }
}
@page { size: A4; margin: 0; }
