@font-face {
  font-family: "Cinzel";
  src: url("../fonts/cinzel-400.woff2?v=20261201-hx10") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cinzel";
  src: url("../fonts/cinzel-700.woff2?v=20261201-hx10") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/ebgaramond-400.woff2?v=20261201-hx10") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/ebgaramond-400i.woff2?v=20261201-hx10") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/ebgaramond-600.woff2?v=20261201-hx10") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/ebgaramond-700.woff2?v=20261201-hx10") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #2a2118; --ink-soft: #5c4f40;
  --parchment: #fbf6ec; --parchment-deep: #f3e8d4; --desk: #e7d8c0;
  --rule: #d7c4a4; --rule-strong: #8d7048;
  --oxblood: #6e2b33; --oxblood-deep: #521f26; --forest: #234237; --gold: #84632e; --gold-soft: #e4d2ae; --focus: #8d3b3b;
  --serif: "EB Garamond", "Palatino Linotype", Palatino, Georgia, serif;
  --display: "Cinzel", "Palatino Linotype", Palatino, serif;
  --shadow: 0 22px 50px rgba(62, 42, 24, 0.16);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--serif); font-size: 1.125rem; line-height: 1.45;
  background: linear-gradient(180deg, #f6ead6 0%, #e7d3b4 46%, #dcc6a4 100%); }
.skip { position: absolute; left: 1rem; top: -3rem; background: var(--oxblood); color: #f8f1e6; padding: .4rem .7rem; z-index: 5; }
.skip:focus { top: .6rem; }
.site-head, main, .site-foot { width: min(1080px, calc(100% - 2rem)); margin: 0 auto; }
.site-head { padding: 2.2rem 0 1.2rem; }
.brand { display: flex; gap: .9rem; align-items: center; }
.mark { width: 52px; height: 52px; flex: none; }
h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 4vw, 3.1rem); line-height: .95; letter-spacing: .04em; color: var(--oxblood-deep); }
.subtitle { margin: .2rem 0 0; font-family: var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.section-title, .cite { font-family: var(--display); letter-spacing: .08em; }
.section-title { color: var(--oxblood); font-size: 1.05rem; text-transform: uppercase; margin: 1.2rem 0 .6rem; }
.panel, .sheet { background: var(--parchment); border: 1px solid var(--rule); border-radius: 6px; box-shadow: var(--shadow); padding: 1.1rem 1.3rem; margin-bottom: 1.2rem; }
.panel-head h2 { margin: 0 0 .5rem; font-family: var(--display); color: var(--oxblood-deep); }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0; }
.filters button { font: inherit; padding: .35rem .8rem; border: 1px solid var(--rule-strong); background: var(--parchment-deep); border-radius: 999px; cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--oxblood); color: #fbf3e6; border-color: var(--oxblood-deep); }
.btn { font: inherit; padding: .45rem 1rem; border: 1px solid var(--rule-strong); border-radius: 4px; background: var(--parchment-deep); color: var(--ink); cursor: pointer; }
.btn-primary { background: var(--oxblood); border-color: var(--oxblood-deep); color: #fbf3e6; }
.btn-ghost { background: transparent; }
.btn-small { font-size: .85rem; padding: .2rem .6rem; }
.link { font: inherit; background: none; border: 0; padding: 0; color: var(--oxblood); text-decoration: underline; cursor: pointer; text-align: left; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input[type="search"] { font: inherit; width: 100%; padding: .4rem .6rem; border: 1px solid var(--rule-strong); border-radius: 4px; background: #fffaf3; }
.table-list { list-style: none; padding: 0; margin: .6rem 0 0; max-height: 22rem; overflow: auto; columns: 2 22rem; }
.table-list li { break-inside: avoid; margin: .15rem 0; }
.cite { font-size: .7rem; color: var(--ink-soft); white-space: nowrap; }
.roll { border-top: 1px solid var(--rule); padding: .6rem 0; }
.roll header { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.roll h3 { margin: 0; font-size: 1.05rem; color: var(--forest); }
.roll dl { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: .15rem .9rem; margin: .4rem 0; }
.roll dt { font-weight: 600; color: var(--ink-soft); }
.roll dd { margin: 0; }
.die { display: inline-block; min-width: 1.7rem; text-align: center; font-family: var(--display); font-size: .75rem; border: 1px solid var(--gold); border-radius: 3px; color: var(--gold); margin-left: .3rem; }
.seed { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 1.2rem; }
.flesh { padding-left: 1.1rem; }
.flesh strong { text-transform: capitalize; }
.status { min-height: 1.3em; color: var(--ink-soft); font-size: .9rem; }
.site-foot { font-size: .85rem; color: var(--ink-soft); padding-bottom: 2rem; }
.noscript { text-align: center; }

/* ---- Generator forms ---- */
.mode-choice { gap: .35rem; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: .55rem .9rem; margin: .7rem 0; }
.fields label, .impair label { display: flex; flex-direction: column; gap: .15rem; font-size: .92rem; color: var(--ink-soft); }
.fields label.check, .impair label.check { flex-direction: row; align-items: center; gap: .4rem; color: var(--ink); }
select, input[type="number"], .library-controls input[type="text"] { font: inherit; font-size: 1rem; padding: .3rem .45rem; border: 1px solid var(--rule-strong); border-radius: 4px; background: #fffaf3; color: var(--ink); min-width: 0; width: 100%; }
input[type="checkbox"] { accent-color: var(--oxblood); width: 1.05rem; height: 1.05rem; margin: 0; flex: none; }
select:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.impair { border: 1px solid var(--rule); border-radius: 4px; margin: .2rem 0 .8rem; padding: .4rem .8rem .6rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .25rem .9rem; }
.impair legend { font-family: var(--display); font-size: .8rem; letter-spacing: .08em; color: var(--oxblood); padding: 0 .3rem; }
.run-row { display: flex; flex-wrap: wrap; gap: .45rem; margin: .4rem 0 .2rem; }
.field-note { font-family: var(--serif); font-size: 1em; letter-spacing: normal; text-transform: none; color: var(--ink-soft); margin: .4rem 0; }
.field-hint { display: block; font-family: var(--serif); font-size: .78rem; line-height: 1.3; font-weight: 400; color: var(--ink-soft); max-width: 16rem; }
.packet-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---- Generator sections ---- */
.sec { border-top: 2px solid var(--rule); padding: .8rem 0 .6rem; }
.sheet > .sec:first-child, .sheet > .roll:first-child { border-top: 0; padding-top: .2rem; }
.sec header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .8rem; }
.sec h3 { margin: 0; font-family: var(--display); font-size: 1.2rem; color: var(--oxblood-deep); letter-spacing: .03em; }
.sec h4, .sec h5, .sec h6 { margin: 0; font-size: 1.02rem; color: var(--forest); }
.sec .sub { margin: 0; font-style: italic; color: var(--ink-soft); }
.sec-sub { border-top: 1px dotted var(--rule); margin-left: .9rem; padding: .5rem 0 .3rem; }
.sec-sub .sec-sub { margin-left: .7rem; }
.hook { background: var(--parchment-deep); border-left: 3px solid var(--gold); padding: .5rem .8rem; margin: .5rem 0; }
.lines { display: grid; grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr); gap: .2rem .9rem; margin: .45rem 0; }
.lines dt { font-weight: 600; color: var(--ink-soft); max-width: 24rem; }
.lines dd { margin: 0; overflow-wrap: anywhere; }
.die { white-space: nowrap; padding: 0 .25rem; vertical-align: .08em; max-width: 100%; }
.die.long, .lines dt .die { white-space: normal; overflow-wrap: anywhere; }
.notes { margin: .3rem 0; padding-left: 1.2rem; font-size: .95rem; color: var(--ink-soft); }
.flesh { margin: .4rem 0; padding-left: 0; font-size: .98rem; }
.flesh-label { font-family: var(--display); font-size: .75rem; letter-spacing: .08em; color: var(--gold); text-transform: uppercase; margin-right: .3rem; }
.roll-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 0; }
.art { display: flex; gap: 1.1rem; align-items: flex-start; }
.art > svg { flex: none; max-width: 100%; height: auto; }
.art-body { flex: 1; min-width: 0; }
svg.shield { width: 150px; }

@media (max-width: 640px) {
  body { font-size: 1.05rem; }
  .site-head, main, .site-foot { width: calc(100% - 1rem); }
  .panel, .sheet { padding: .9rem .8rem; }
  .fields { grid-template-columns: 1fr 1fr; }
  .roll dl, .lines { grid-template-columns: 1fr; gap: 0; }
  .lines dd, .roll dd { margin-bottom: .35rem; }
  .table-list { columns: 1; }
  .art { flex-direction: column; }
    .sec-sub { margin-left: .4rem; }
  .sec-sub .sec-sub { margin-left: .3rem; }
}

/* ---- Hexplore additions ---- */
.count { font-size: .8em; }
.dmap { margin: .7rem 0 .8rem; }
.dmap svg.hexmap-svg { display: block; width: 100%; max-width: 760px; height: auto; margin: 0 auto; border: 1px solid var(--rule); border-radius: 4px; background: #fcf9f0; }
.dmap .hx { cursor: pointer; }
.dmap .hx:hover { stroke: var(--oxblood); stroke-width: 2; }
.map-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .4rem 0 0; }
.art > svg.shield { width: 150px; flex: none; }
.art > svg.achievement { width: 270px; }
.sec-realm .art { align-items: flex-start; }
.sec-hex.on { background: #f6ead2; box-shadow: 0 0 0 3px #f6ead2; }
.sec-hex > header h4, .sec-hex > header h5 { font-family: var(--display); letter-spacing: .03em; color: var(--oxblood-deep); }
.optional-section { margin: .3rem 0 .2rem .9rem; }
.optional-section > summary { cursor: pointer; color: var(--ink-soft); font-size: .92rem; }
.compass { display: grid; grid-template-columns: repeat(3, 4.2rem); gap: .35rem; margin: .7rem 0; }
.compass .btn { font-family: var(--display); letter-spacing: .06em; }
.explore-controls { border-top: 1px dotted var(--rule); margin-top: .6rem; }
.roll-card .table-wrap { overflow-x: auto; }
.book-table { border-collapse: collapse; font-size: .95rem; margin: .3rem 0; }
.book-table th, .book-table td { border-bottom: 1px solid var(--rule); padding: .15rem .55rem; text-align: left; vertical-align: top; }
.book-table thead th { font-family: var(--display); font-size: .78rem; letter-spacing: .05em; color: var(--oxblood); }
.book-table tbody th { font-family: var(--display); font-size: .8rem; color: var(--gold); white-space: nowrap; }
.book-table tr.on { background: #f3e2bd; }
.table-full > summary { cursor: pointer; color: var(--oxblood); }
.die-note { border-style: dashed; }
.help summary { cursor: pointer; color: var(--oxblood); }
.help p { max-width: 62rem; }
.packet-item + .packet-item { border-top: 2px solid var(--rule); }
.result-print { display: none; }
@media (max-width: 640px) {
  .art > svg.shield, .art > svg.achievement { width: 60%; }
  .compass { grid-template-columns: repeat(3, 1fr); }
}
/* Glyphs, roads and labels sit on top of the hexes; let clicks fall through to the hex itself. */
.dmap svg.hexmap-svg * { pointer-events: none; }
.dmap svg.hexmap-svg .hx { pointer-events: auto; }

/* Explore: click or press Enter on a highlighted hex to move there */
.dmap svg.hexmap-svg .go { pointer-events: auto; cursor: pointer; outline: none; transition: fill-opacity .12s; }
.dmap svg.hexmap-svg .go:hover, .dmap svg.hexmap-svg .go:focus { fill-opacity: .24; }
.dmap svg.hexmap-svg .go:focus { stroke: #1b1712; stroke-width: 3.5; stroke-dasharray: none; }
.dmap svg.hexmap-svg .go-start { cursor: crosshair; }
.dmap svg.hexmap-svg .go-start:hover, .dmap svg.hexmap-svg .go-start:focus { fill-opacity: .18; }
@media print { .go-layer { display: none; } }
