@font-face {
  font-family: "Noto Serif";
  src: url("assets/noto-serif-latin-400-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Noto Serif";
  src: url("assets/noto-serif-latin-700-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Noto Serif";
  src: url("assets/noto-serif-latin-900-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: "Inconsolata";
  src: url("assets/inconsolata-latin-400-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inconsolata";
  src: url("assets/inconsolata-latin-700-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color: #171717;
  background: #e9e5dc;
  font-family: "Inconsolata", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body { margin: 0; min-height: 100vh; display: grid; grid-template-columns: 340px minmax(0, 1fr); }

.generator-panel {
  position: sticky; top: 0; height: 100vh; overflow: auto; padding: 28px 24px;
  background: #171817; color: #f7f3ea; border-right: 1px solid #000;
}
.back-link { display: inline-block; margin-bottom: 22px; color: #d3ad5c; font-size: 12px; font-weight: 800; text-decoration: none; }
.back-link:hover { color: #f0d79f; }
.eyebrow { margin: 0 0 8px; color: #c8aa69; font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.generator-heading h1 { margin: 0; font: 700 30px/1.05 "Noto Serif", serif; }
.generator-heading p:last-child { color: #b9bbb7; font-size: 14px; line-height: 1.5; }
.generator-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 22px 0; }
.mode-toggle { display: flex !important; align-items: center; gap: 8px; width: max-content; margin: -8px 0 18px; cursor: pointer; }
.mode-toggle input { width: 16px; height: 16px; margin: 0; accent-color: #d3ad5c; }
.generator-actions .primary { grid-column: 1 / -1; background: #d3ad5c; color: #181713; border-color: #e8ca88; }
button { appearance: none; border: 1px solid #5b5e59; border-radius: 7px; background: #30322f; color: white; padding: 10px 12px; font-weight: 750; cursor: pointer; }
button:hover { filter: brightness(1.12); }
button.quiet { color: #c8cbc5; }
.tool-link { grid-column: 1 / -1; display: block; border: 1px solid #5b5e59; border-radius: 7px; padding: 10px 12px; color: #f7f3ea; font-weight: 750; text-align: center; text-decoration: none; }
.tool-link:hover { background: #30322f; }
.generator-panel label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 800; }
#level-data, #map-data { width: 100%; height: 28vh; resize: vertical; border: 1px solid #575a55; border-radius: 8px; padding: 13px; background: #0f100f; color: #e9e6df; font: 11px/1.5 "Inconsolata", ui-monospace, monospace; tab-size: 2; }
.status { min-height: 20px; margin: 8px 0; color: #aeb2aa; font-size: 12px; }
.status.success { color: #a9d59d; }.status.error { color: #ff9d95; }
details { margin-top: 20px; border-top: 1px solid #3f413e; padding-top: 16px; color: #c8cbc5; font-size: 13px; line-height: 1.5; }
summary { cursor: pointer; font-weight: 800; }

.preview-area { min-width: 0; overflow: auto; }
.preview-toolbar { height: 48px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; color: #5f5b52; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.sheet-stage { padding: 0 22px 40px; min-width: 980px; }
.tracker-sheet {
  width: 11in; height: 8.5in; margin: 0 auto; padding: .08in; overflow: hidden;
  background: #fff; color: #090909; box-shadow: 0 8px 35px rgba(41, 35, 24, .23);
  font-family: "Inconsolata", ui-monospace, monospace;
}

.sheet-header { height: .64in; display: grid; grid-template-columns: .7in 3.1in 5.35in 1.3in; gap: .1in; align-items: center; }
.game-logo { display: block; width: .62in; height: .62in; object-fit: contain; }
.game-title { background: #111; color: white; padding: .08in .15in; font-size: 21px; line-height: 1; font-weight: 900; text-align: center; white-space: nowrap; clip-path: polygon(3% 0, 97% 0, 100% 20%, 98% 50%, 100% 80%, 97% 100%, 3% 100%, 0 80%, 2% 50%, 0 20%); }
.level-title { position: relative; border: 2px solid #111; padding: .08in .14in; text-align: center; font-size: 20px; font-weight: 900; line-height: 1.1; clip-path: polygon(3% 0, 97% 0, 100% 50%, 97% 100%, 3% 100%, 0 50%); }
.level-title span { font-size: 18px; }
.difficulty-badge { height: .5in; display: grid; align-content: center; justify-items: center; gap: .025in; border: 1.5px solid #111; border-radius: 7px; text-transform: uppercase; }
.difficulty-badge strong { font-size: 11px; line-height: 1; letter-spacing: .08em; }
.difficulty-dots { display: flex; gap: .055in; }
.difficulty-dots i { width: .09in; height: .09in; border: 1.3px solid #111; border-radius: 50%; }
.difficulty-dots i.filled { background: #111; }
.check-box { width: .15in; height: .13in; border: 1.3px solid #111; display: inline-block; }

.main-grid { height: 5.1in; display: grid; grid-template-columns: 3.05in 3.02in 4.48in; gap: .1in; }
.sheet-panel { border: 1.3px solid #111; border-radius: 8px; overflow: hidden; min-width: 0; }
.game-title, .level-title, .panel-title, .encounter-card h3, .difficulty-badge strong { font-family: "Noto Serif", serif; }
.panel-title { height: .28in; margin: 0; padding: 0 .055in; display: flex; align-items: center; gap: .045in; background: #111; color: white; font-size: 16px; line-height: 1; }
.sheet-icon { flex: 0 0 .27in; width: .27in; height: .27in; background-image: url("assets/deck-n-dice-dungeons-icons.png"); background-repeat: no-repeat; background-size: 900% 100%; }
.icon-party { background-position: 0% 50%; }
.icon-objectives { background-position: 12.5% 50%; }
.icon-enemies { background-position: 25% 50%; }
.icon-loot { background-position: 37.5% 50%; }
.icon-star { background-position: 50% 50%; }
.icon-notes { background-position: 62.5% 50%; }
.icon-dice { background-position: 75% 50%; }
.icon-people { background-position: 87.5% 50%; }
.icon-rewards { background-position: 100% 50%; }
.panel-body { height: calc(100% - .28in); padding: .07in; }

.party-panel .panel-body { display: grid; grid-template-rows: repeat(3, 1fr); gap: .06in; }
.hero-card { position: relative; min-height: 0; display: grid; grid-template-columns: .9in 1fr; gap: .09in; padding: .055in .05in .035in .065in; border: 1px solid #111; border-radius: 7px; }
.hero-number { position: absolute; top: 0; left: .055in; width: .29in; height: .4in; padding-top: .02in; background: #111; color: white; font: 900 18px/1 "Noto Serif", serif; text-align: center; clip-path: polygon(0 0,100% 0,100% 100%,50% 82%,0 100%); }
.card-write-field { display: grid; grid-template-rows: auto .19in auto auto auto auto; align-content: center; justify-items: stretch; padding-top: .11in; text-align: center; font-size: 10px; }
.card-write-field span { display: block; width: calc(100% - .06in); justify-self: start; border-bottom: 1.5px solid #111; }
.card-write-field small { margin-top: 2px; color: #333; font-size: 8px; }
.card-write-field .pool-instruction { margin-top: .04in; font-size: 8px; font-weight: 700; line-height: 1.05; white-space: nowrap; }
.card-write-field .pool-options { margin-top: 1px; font-size: 9px; font-weight: 700; line-height: 1.05; }
.card-write-field .minimum-hp { margin-top: 2px; font-size: 7.5px; font-weight: 700; line-height: 1; }
.hero-fields { display: grid; align-content: space-between; font-size: 10px; font-weight: 700; }
.write-line { display: flex; gap: .06in; align-items: end; }.write-line span { flex: 1; height: .12in; border-bottom: 1px solid #111; }
.stat-pair, .stat-trio { display: flex; align-items: center; justify-content: space-between; }
.stat-pair label, .stat-trio label { display: flex; gap: 3px; align-items: center; white-space: nowrap; }
.hero-fields i { display: inline-block; width: .22in; height: .21in; border: 1px solid #111; font-style: normal; }
.hero-fields .stat-wide i { width: .28in; }
.hp-row { display: flex; align-items: center; gap: .025in; }.hp-row strong { margin-right: .04in; }.hp-box { width: .14in; height: .14in; border: 1px solid #111; }

.middle-stack { display: grid; grid-template-rows: 1.02in 1.72in .83in 1.35in; gap: .06in; }
.check-list, .reward-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: flex; align-items: center; gap: .08in; margin-bottom: .035in; font-size: 12px; font-weight: 700; }
.check-list i, .reward-list i { flex: 0 0 auto; width: .14in; height: .14in; border: 1.2px solid #111; }
.upgrades-panel .panel-body { padding: .045in; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.upgrade-table { height: 100%; font-size: 9px; }.upgrade-table th,.upgrade-table td { border: 1px solid #222; padding: 1px 3px; }.upgrade-table th:nth-child(1){width:17%}.upgrade-table th:nth-child(2){width:41%}.upgrade-table th:nth-child(4){width:8%}.tiny-check{display:block;width:.11in;height:.11in;border:1px solid #111}
.carryover-panel .panel-title { font-size: 14px; }.carryover-list { padding-left: .12in; }
.note-lines { display: grid; gap: .09in; }.note-lines i { height: .11in; border-bottom: 1px solid #111; }

.encounters-panel .panel-body { display: grid; grid-template-rows: repeat(4, 1fr); gap: .1in; }
.encounter-card { min-height: 0; border: 1px solid #111; border-radius: 7px; overflow: hidden; }
.encounter-card header { height: .38in; display: grid; grid-template-columns: .4in 1fr; align-items: stretch; background: #eee; }
.encounter-card header b { align-self: stretch; display: grid; place-items: center; background: #111; color: white; font-size: 17px; clip-path: polygon(0 0, 85% 0, 100% 50%, 85% 100%, 0 100%); }
.encounter-heading { min-width: 0; display: grid; align-content: center; gap: 1px; padding: 1px .08in; }
.encounter-card h3 { margin: 0; font-size: 12px; line-height: 1; }
.encounter-heading span { min-width: 0; overflow: hidden; text-overflow: clip; white-space: nowrap; font-size: 9px; line-height: 1; }
.encounter-card table { height: calc(100% - .38in); font-size: 8px; }.encounter-card th,.encounter-card td { border: 1px solid #333; height: .17in; padding: 0 1px; text-align:center; }.encounter-card th:nth-child(1){width:10%}.encounter-card th:nth-child(2){width:18%}.encounter-card th:nth-child(3){width:7%}.encounter-card th:nth-child(4){width:8%}.encounter-card th:nth-child(5){width:6%}.encounter-card th:nth-child(6){width:6%}.encounter-card th:nth-child(7){width:7%}.encounter-card th:nth-child(8){width:7%}

.footer-grid { height: 2.52in; margin-top: .08in; display: grid; grid-template-columns: 2.3in 3.1in 2.4in 2.65in; gap: .1in; }
.footer-grid .panel-title { font-size: 14px; }
.footer-grid .panel-body { padding: .03in .06in; }
.quick-list { list-style: none; margin: 0; padding: 0; font-size: 9px; line-height: 1.15; }
.quick-list li { position: relative; padding-left: .1in; margin: .035in 0; }
.quick-list li::before { content: "•"; position: absolute; left: 0; }
.reference-table { height: 100%; font-size: 8px; }.reference-table th,.reference-table td { border: 1px solid #333; padding: 1px 2px; text-align:center; line-height: 1.05; }.reference-table td:last-child { text-align:left; }.reference-table .suit { font-size: 13px; }.hero-table th:last-child { width: 39%; }.hero-table th:nth-child(1) { width: 8%; }.hero-table th:nth-child(2) { width: 17%; }
.reward-list { display: grid; gap: .04in; font-size: 9px; line-height: 1.1; }.reward-list li { display: flex; gap: .06in; align-items: start; }.reward-list i { width: .13in; height: .13in; }

/* Ink-saving tracker palette. */
.tracker-sheet.light-mode .game-title,
.tracker-sheet.light-mode .panel-title,
.tracker-sheet.light-mode .hero-number,
.tracker-sheet.light-mode .encounter-card header b {
  background: #fff;
  color: #111;
  border: 1.5px solid #111;
}
.tracker-sheet.light-mode .game-title { border-width: 2px; }
.tracker-sheet.light-mode .panel-title { border-width: 0 0 1.3px; }
.tracker-sheet.light-mode .hero-number { border-width: 0 1.3px 1.3px 0; }
.tracker-sheet.light-mode .encounter-card header b { border-width: 0 1.3px 1.3px 0; }
.tracker-sheet.light-mode .sheet-icon { filter: invert(1); opacity: .58; }

@page { size: letter landscape; margin: 0; }
@media print {
  body { display: block; background: white; }
  .generator-panel, .preview-toolbar { display: none !important; }
  .preview-area, .sheet-stage { margin: 0; padding: 0; min-width: 0; overflow: visible; }
  .tracker-sheet { margin: 0; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .tracker-sheet, .map-sheet { break-after: page; page-break-after: always; }
  .map-sheet { break-after: auto; page-break-after: auto; }
}

@media (max-width: 900px) {
  body { display: block; }
  .generator-panel { position: static; width: 100%; height: auto; }
  #level-data, #map-data { height: 320px; }
}

.rules-preview{min-width:0;overflow:auto}.rules-app #rules-pages{display:grid;gap:24px;padding:0 28px 40px;justify-content:center}.rule-page{position:relative;width:8.5in;height:11in;padding:.55in .62in .52in;background:#fff;color:#171717;box-shadow:0 8px 35px #2923183b;font:10.5px/1.4 "Inconsolata",monospace;overflow:hidden;column-count:2;column-gap:.35in;column-rule:1px solid #bbb}.rule-page.cover{column-count:1;background:#20211e;color:#f7f3e8;display:grid;place-items:center;text-align:center}.cover h1{font:900 55px/1 "Noto Serif",serif;letter-spacing:.08em;margin:0}.cover .motto{font:700 17px "Noto Serif",serif;letter-spacing:.12em}.cover .hexmark{font-size:150px;color:#d3ad5c;line-height:.8}.cover .meta{border-top:1px solid #d3ad5c;padding-top:.2in}.rule-page h1,.rule-page h2{font-family:"Noto Serif",serif;break-after:avoid}.rule-page h1{column-span:all;margin:0 0 .18in;border-bottom:3px double;font-size:28px}.rule-page h2{margin:.12in 0 .05in;background:#222;color:white;padding:.04in .07in;font-size:15px}.rule-page p{margin:.04in 0}.rule-page ul,.rule-page ol{margin:.04in 0 .08in;padding-left:.2in}.rule-page li{margin:.025in 0}.rule-page table{font-size:9px;margin:.05in 0 .1in;background:white;break-inside:avoid}.rule-page th,.rule-page td{border:1px solid #555;padding:4px;vertical-align:top}.rule-page th{background:#e3e3e3}.callout,.formula{break-inside:avoid;border:1.5px solid #222;background:#f0f0f0;padding:.08in;margin:.08in 0}.formula{text-align:center;font:700 15px "Noto Serif",serif}.sequence{counter-reset:s}.sequence li{list-style:none;margin:.07in 0;padding-left:.28in;position:relative}.sequence li:before{counter-increment:s;content:counter(s);position:absolute;left:0;top:-1px;background:#222;color:white;width:.2in;height:.2in;border-radius:50%;text-align:center;line-height:.2in;font-weight:bold}.page-no{position:absolute;bottom:.24in;right:.4in;font-weight:bold}.page-no:before{content:"HEXPANSION · DRAFT RULES 0.1  •  "}@media print{@page{size:letter portrait;margin:0}body{display:block;background:white}.generator-panel,.preview-toolbar{display:none!important}.rules-preview,#rules-pages{display:block!important;padding:0!important}.rule-page{box-shadow:none;break-after:page;margin:0;print-color-adjust:exact;-webkit-print-color-adjust:exact}}

.rules-preview{min-width:0;overflow:auto}
.rules-app #rules-pages{display:grid;gap:24px;padding:0 28px 40px;justify-content:center}
.guide-page{position:relative;width:11in;height:8.5in;padding:.38in .45in .5in;background:#fff;color:#171717;box-shadow:0 8px 35px #2923183b;font:11.3px/1.4 "Inconsolata",monospace;overflow:hidden}
.guide-cols{display:grid;grid-template-columns:repeat(3,1fr);gap:0 .3in;height:100%}
.guide-cols article{min-width:0;padding:0 .15in 0 0;border-right:1px solid #c9c9c9}
.guide-cols article:last-child{border-right:0;padding-right:0}
.guide-page footer{position:absolute;left:.45in;right:.45in;bottom:.2in;display:flex;justify-content:space-between;font:700 8.5px "Inconsolata",monospace;letter-spacing:.08em;color:#555;border-top:1px solid #bbb;padding-top:.04in}
.guide-page h1,.guide-page h2{font-family:"Noto Serif",serif;margin:0}
.guide-page h1{font-size:25px;line-height:1.05;letter-spacing:.02em;padding-bottom:.05in;margin-bottom:.09in;border-bottom:3px double #111}
.guide-page h2{font-size:14px;margin:.14in 0 .05in;padding:.03in .07in;background:#222;color:#fff;break-after:avoid}
.guide-page p{margin:.04in 0}
.guide-page ul,.guide-page ol{margin:.04in 0;padding-left:.18in}
.guide-page li{margin:.03in 0}
.guide-page .lede{font:700 13.4px/1.3 "Noto Serif",serif;margin:.06in 0}
.guide-page .needs{border-top:1px solid #999;border-bottom:1px solid #999;padding:.04in 0}
.guide-page .small{font-size:10.2px}
.guide-page .title-card{display:block;width:2.7in;height:2.7in;margin:-.15in auto .02in;object-fit:contain}
.guide-page .callout,.guide-page .formula{border:1.6px solid #222;background:#f2f2f2;padding:.07in .09in;margin:.09in 0;break-inside:avoid}
.guide-page .formula{text-align:center;font:900 17px "Noto Serif",serif;background:#fff;border-width:2.5px;border-radius:3px}
.guide-page figure{margin:.08in 0;border:1.4px solid #222;padding:.05in;break-inside:avoid;background:#fff}
.guide-page figure img{display:block;width:100%;height:auto}
.guide-page figcaption{margin-top:.04in;font-size:10px;line-height:1.28}
.guide-page .key{list-style:none;padding:0}
.guide-page .key li{display:flex;align-items:center;gap:.1in;margin:.045in 0}
.guide-page .key img{flex:none;display:block;border:1.4px solid #222;background:#fff}
.guide-page .key img.swatch{width:.78in;height:auto}
.guide-page .key img.symbol{width:.9in;height:auto}
.guide-page .key b{display:block;font-size:11.6px}
.guide-page .steps{list-style:none;counter-reset:step;padding:0}
.guide-page .steps li{counter-increment:step;position:relative;padding-left:.3in;margin:.06in 0}
.guide-page .steps li:before{content:counter(step);position:absolute;left:0;top:-1px;width:.21in;height:.21in;border-radius:50%;background:#222;color:#fff;text-align:center;line-height:.21in;font-weight:900}
.guide-page table{width:100%;border-collapse:collapse;margin:.06in 0;break-inside:avoid;font-size:10.4px}
.guide-page th,.guide-page td{border:1.2px solid #444;padding:.03in .05in;text-align:left;vertical-align:top}
.guide-page thead th{background:#e1e1e1}
.guide-page .cost-table td:last-child,.guide-page .narrow td:last-child{font-weight:700}
.guide-page .matrix{font-size:9.4px}
.guide-page .matrix th:first-child{background:#f0f0f0}
.guide-page .matrix td{text-align:center}
.guide-page .score-table td{height:.27in}
.guide-page .score-table tr.total th{background:#222;color:#fff}
.guide-page .score-table th:last-child,.guide-page .score-table td:last-child{width:45%}
@media print{
  @page{size:letter landscape;margin:0}
  body{display:block;background:#fff}
  .generator-panel,.preview-toolbar{display:none!important}
  .rules-preview,#rules-pages{display:block!important;padding:0!important}
  .guide-page{box-shadow:none;break-after:page;margin:0;print-color-adjust:exact;-webkit-print-color-adjust:exact}
}
.guide-page .glance th{background:#f0f0f0;text-align:left}.guide-page .glance td{text-align:left}
.guide-page.roomy{font-size:12.4px}
.guide-page.roomy h2{font-size:15px}
.guide-page.roomy h1{font-size:28px}
.guide-page.roomy table{font-size:11.4px}
.guide-page.roomy .matrix{font-size:10.4px}
.guide-page.roomy figcaption{font-size:11px}
.guide-page.roomy .small{font-size:11px}
.guide-page.roomy .formula{font-size:20px}

body.rules-app { display: block !important; margin: 0; }
@media screen { .rules-app #rules-pages { padding-top: 24px; } }
@media screen and (max-width: 1100px) {
  .rules-preview { overflow: visible !important; }
  .rules-app #rules-pages { display: block !important; padding: 0 !important; }
  .guide-page { width: auto !important; height: auto !important; max-width: 760px; margin: 0 auto !important; padding: 16px !important; box-shadow: none; overflow: visible; font-size: 15px !important; }
  .guide-page .guide-cols { display: block; height: auto; }
  .guide-page .guide-cols article { padding: 0; border: 0; }
  .guide-page .title-card { max-width: 100%; height: auto !important; }
  .guide-page .small, .guide-page figcaption, .guide-page table { font-size: 13px !important; }
  .guide-page .key b { font-size: 15px; }
  .guide-page footer { display: none; }
}
