:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #ddd;
  background: #111;
  --ink: #111;
  --muted: #929292;
  --line: #353535;
  --paper: #e6e6e6;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button,
a,
label.file-button {
  -webkit-tap-highlight-color: transparent;
}
button,
.file-button {
  border: 1px solid #474747;
  background: #1b1b1b;
  color: #ddd;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 12px;
}
button:hover,
.file-button:hover {
  background: #303030;
  border-color: #929292;
}
button:disabled {
  opacity: 0.4;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
canvas:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
button.primary {
  background: #ddd;
  color: #151515;
  border-color: #ddd;
  font-weight: 700;
}
button.primary:hover {
  background: #fff;
}
button span {
  float: right;
  margin-left: 18px;
}
button.full {
  width: 100%;
  text-align: left;
}
.full {
  width: 100%;
}
[hidden] {
  display: none !important;
}
.masthead {
  height: 86px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 34px;
  gap: 36px;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 23px;
  letter-spacing: -1px;
  font-weight: 900;
  color: #eee;
  text-decoration: none;
}
.wordmark img {
  width: 40px;
  height: 38px;
  object-fit: contain;
  margin-right: 14px;
}
.wordmark span {
  color: #888;
}
.edition,
.eyebrow,
.section-label {
  font-family: monospace;
  font-size: 10px;
  letter-spacing: 1.8px;
}
.edition {
  color: #888;
}
.masthead nav {
  display: flex;
  gap: 8px;
  margin-left: auto;
  height: 100%;
  align-items: center;
}
.nav {
  border: 0;
  background: none;
  padding: 14px 12px;
  color: #aaa;
}
.nav.active {
  color: #eee;
}
.nav.active:after {
  content: "";
  display: block;
  height: 1px;
  background: #eee;
  position: relative;
  top: 10px;
}
small {
  font: 9px monospace;
  color: #999;
  margin-left: 7px;
}
.eyebrow {
  color: #a3a3a3;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h2 {
  font-family: Georgia, serif;
  font-size: 26px;
  font-weight: normal;
}
h3 {
  font-family: Georgia, serif;
  font-weight: normal;
}
p {
  line-height: 1.7;
}
.muted {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.title-screen {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  max-width: 1180px;
  margin: 0 auto;
  padding: 66px 48px;
  gap: 90px;
}
.intro h1 {
  font-family: Georgia, serif;
  font-size: clamp(48px, 5vw, 78px);
  line-height: 1.08;
  letter-spacing: -2px;
  font-weight: normal;
  margin: 26px 0;
}
.intro h1 em {
  color: #9c9c9c;
  font-weight: normal;
}
.intro p {
  font-size: 14px;
  color: #999;
}
.intro-rule {
  width: 48px;
  height: 1px;
  background: #777;
  margin: 30px 0;
}
.title-mark {
  width: 140px;
  opacity: 0.5;
  margin-top: 38px;
}
.character-card {
  padding: 30px;
  border: 1px solid var(--line);
  align-self: start;
  background: #171717;
}
.character-card h2 {
  margin: 16px 0 28px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 11px;
  color: #a4a4a4;
}
input,
select {
  background: #111;
  border: 1px solid #444;
  border-radius: 0;
  padding: 11px 10px;
  color: #ddd;
  min-width: 0;
  width: 100%;
  font-size: 13px;
}
input:focus,
select:focus {
  border-color: #aaa;
}
.form-row {
  display: flex;
  gap: 12px;
  margin: 16px 0;
}
.form-row > * {
  flex: 1;
  min-width: 0;
}
#class-note {
  min-height: 41px;
  margin: 16px 0;
}
.saved-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin-top: 26px;
  padding-top: 20px;
}
.text-button {
  border: 0;
  background: none;
  padding: 4px 0;
  color: #aaa;
  font-size: 11px;
}
.save-list {
  max-height: 160px;
  overflow: auto;
  margin-top: 12px;
}
.save-row {
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.save-row small {
  display: block;
  line-height: 1.5;
  margin: 4px 0 0;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 12px;
  margin: 25px 0;
}
.stat {
  font: 9px monospace;
  color: #999;
  letter-spacing: 1px;
}
.stat strong {
  display: block;
  font:
    21px Georgia,
    serif;
  color: #ddd;
  margin-top: 7px;
}
.game-layout {
  display: grid;
  grid-template-columns: 226px minmax(420px, 1fr) 250px;
  min-height: calc(100vh - 86px);
}
.character {
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.character h2 {
  font-size: 26px;
  margin: 16px 0 5px;
  overflow-wrap: anywhere;
}
.character .stats {
  border-bottom: 1px solid var(--line);
  padding-bottom: 23px;
  margin-bottom: 8px;
}
.health-title {
  display: flex;
  justify-content: space-between;
  font: 10px monospace;
  margin: 21px 0 11px;
  color: #999;
}
.health-title strong {
  font-weight: normal;
  color: #ddd;
}
.health-track {
  height: 4px;
  background: #333;
}
.health-track div {
  height: 100%;
  background: #ddd;
}
.ledger {
  font-size: 11px;
}
.ledger > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 12px 0;
  color: #999;
}
.ledger strong {
  font-weight: normal;
  color: #ddd;
}
.section-label {
  font-size: 9px;
  margin-top: 26px;
  color: #777;
}
.charges {
  display: flex;
  justify-content: space-between;
  margin: 18px 0;
}
.charge {
  font: 11px monospace;
}
.charge small {
  display: block;
  margin: 0 0 8px;
  font-size: 9px;
}
.effects {
  font: 10px monospace;
  color: #aaa;
  line-height: 1.8;
  margin-top: 15px;
}
.character-bottom {
  margin-top: auto;
  padding-top: 35px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font: 9px monospace;
  color: #888;
}
.dungeon-section {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.map-heading {
  padding: 26px 28px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.map-heading h1 {
  font:
    30px Georgia,
    serif;
  margin: 9px 0 0;
}
.map-modes {
  display: flex;
  white-space: nowrap;
}
.map-modes button {
  font-size: 10px;
  padding: 10px;
}
.map-modes .selected {
  background: #d5d5d5;
  color: #171717;
}
.map-modes .selected small {
  color: #555;
}
.viewport {
  position: relative;
  flex: 1;
  min-height: 430px;
  overflow: hidden;
  background: #151515;
}
.viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
}
.canvas-tools {
  position: absolute;
  top: 18px;
  right: 22px;
  display: flex;
}
.canvas-tools button {
  padding: 7px 10px;
  font: 12px monospace;
  background: #191919;
}
.compass {
  position: absolute;
  bottom: 23px;
  right: 23px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  font: 9px monospace;
  color: #777;
  pointer-events: none;
}
.compass span:first-child {
  grid-column: 2;
}
.compass span:nth-child(2) {
  grid-row: 1;
  grid-column: 1;
}
.view-note {
  position: absolute;
  top: 20px;
  left: 26px;
  font: 10px monospace;
  color: #777;
  max-width: 48%;
  line-height: 1.8;
  pointer-events: none;
}
.journal-level {
  position: absolute;
  left: 26px;
  bottom: 22px;
  flex-direction: row;
  align-items: center;
}
.journal-level select {
  width: 112px;
  padding: 6px;
}
.map-footer {
  border-top: 1px solid #2d2d2d;
  border-bottom: 1px solid var(--line);
  padding: 14px 22px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font: 9px monospace;
  color: #888;
}
#map-hint {
  font-size: 9px;
  text-align: center;
}
.scene-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 80%;
  background: rgba(21, 21, 21, 0.9);
  padding: 34px 16px;
}
.scene-overlay h2 {
  font-size: 36px;
  margin: 16px 0 10px;
}
.scene-overlay p {
  font-size: 13px;
  color: #aaa;
  margin-bottom: 25px;
}
.encounter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 23px 26px;
  min-height: 139px;
}
.encounter h2 {
  font-size: 23px;
  margin: 9px 0;
}
.encounter p {
  margin: 0;
  max-width: 400px;
}
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 300px;
}
.action-buttons button {
  font-size: 11px;
  padding: 10px 12px;
}
.command-form {
  display: flex;
  margin: 0 26px 24px;
  border: 1px solid #444;
  align-items: center;
  background: #171717;
}
.command-form label {
  font: 9px monospace;
  letter-spacing: 1px;
  padding-left: 14px;
}
.command-form input {
  border: 0;
  background: none;
  font: 12px monospace;
  flex: 1;
}
.command-form button {
  border: 0;
  background: none;
  font-size: 20px;
  padding: 6px 12px;
}
.journal {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 86px);
  min-height: 650px;
}
.journal-heading {
  padding: 29px 21px 23px;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #272727;
}
.journal-heading span {
  color: #888;
}
.journal ol {
  padding: 0 22px;
  margin: 0;
  overflow: auto;
  flex: 1;
  list-style: none;
}
.journal li {
  font-size: 12px;
  line-height: 1.7;
  color: #999;
  padding: 17px 0;
  border-bottom: 1px solid #292929;
  overflow-wrap: anywhere;
}
.journal li:last-child {
  color: #eee;
}
.journal li span {
  display: block;
  font: 9px monospace;
  color: #606060;
  margin-bottom: 6px;
}
.journal-foot {
  padding: 25px 22px;
  border-top: 1px solid var(--line);
  font:
    italic 16px/1.7 Georgia,
    serif;
  color: #777;
}
.badge {
  font: 9px monospace;
  letter-spacing: 1px;
  padding: 10px;
  border: 1px solid #555;
  height: max-content;
}
.panel-screen {
  padding: 32px 40px;
  max-width: 1440px;
  margin: auto;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-heading h1 {
  font:
    44px Georgia,
    serif;
  margin: 14px 0;
}
.panel-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 36px;
  margin-top: 18px;
}
.panel-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.panel-controls .form-row {
  margin: 0;
}
.panel-controls p {
  margin: 0;
  font-size: 11px;
}
.file-button {
  display: block;
  text-align: center;
  color: #111;
  background: #ddd;
  font-weight: bold;
}
.file-button input {
  display: none;
}
.file-button.secondary {
  background: #222;
  color: #ccc;
}
.check {
  flex-direction: row;
  align-items: center;
}
.check input {
  width: auto;
}
.panel-canvas-wrap {
  position: relative;
  background: #1a1a1a;
  aspect-ratio: 1;
  max-height: 650px;
  border: 1px solid #454545;
  display: flex;
  align-items: center;
  justify-content: center;
}
.panel-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  touch-action: none;
}
#panel-empty {
  position: absolute;
  text-align: center;
  color: #999;
  padding: 30px;
  pointer-events: none;
}
#panel-empty p {
  font-size: 13px;
}
.panel-foot {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  font: 9px monospace;
  color: #999;
  line-height: 1.7;
  margin-top: 13px;
}
.connection-heading {
  margin-top: 35px;
}
.connection-heading h3 {
  margin-bottom: 10px;
}
.connector {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 11px monospace;
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.connector select {
  max-width: 230px;
}
.panel-caveat {
  margin-top: 25px;
}
.panel-controls output {
  float: right;
}
.panel-controls input[type="range"] {
  padding: 0;
  accent-color: #bbb;
}
dialog {
  background: #191919;
  color: #ddd;
  border: 1px solid #555;
  width: min(720px, 92vw);
  max-height: 85vh;
  padding: 28px;
}
dialog::backdrop {
  background: #000b;
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}
.dialog-heading h2 {
  margin: 0;
  font-size: 29px;
}
.dialog-heading button {
  padding: 6px 12px;
  font-size: 21px;
}
.spell {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.spell h3 {
  font-size: 18px;
  margin: 0 0 5px;
}
.spell p {
  margin: 0;
  font-size: 11px;
  color: #999;
}
.spell button {
  align-self: center;
  white-space: nowrap;
}
.spell-direction {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 25px;
}
.spell-direction select {
  width: 130px;
}
.guide {
  font-size: 13px;
  line-height: 1.8;
}
.guide kbd {
  padding: 3px 6px;
  border: 1px solid #555;
  background: #222;
}
.guide h3 {
  font-size: 22px;
  margin: 22px 0 10px;
}
#toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #e0e0e0;
  color: #111;
  border: 1px solid #fff;
  max-width: 90%;
  padding: 15px 24px;
  z-index: 10;
  font-size: 13px;
  box-shadow: 0 8px 35px #0008;
}
@media (min-width: 1500px) {
  .game-layout {
    grid-template-columns: 260px minmax(420px, 1fr) 290px;
  }
  .character {
    padding: 32px;
  }
  .viewport {
    min-height: 520px;
  }
  .masthead {
    padding: 0 40px;
  }
}
@media (max-width: 1120px) {
  .edition {
    display: none;
  }
  .game-layout {
    grid-template-columns: 190px minmax(360px, 1fr);
  }
  .journal {
    grid-column: 1/-1;
    max-height: 250px;
    min-height: 200px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .journal-heading {
    padding: 16px 22px;
  }
  .journal-foot {
    display: none;
  }
  .journal ol {
    display: flex;
    gap: 24px;
  }
  .journal li {
    min-width: 230px;
    max-width: 300px;
  }
  .title-screen {
    gap: 40px;
    padding: 45px 32px;
  }
  .map-heading {
    padding: 22px;
  }
  .map-heading h1 {
    font-size: 26px;
  }
  .character {
    padding: 24px 16px;
  }
  .panel-screen {
    padding: 28px;
  }
  .panel-layout {
    gap: 25px;
  }
}
@media (max-width: 720px) {
  .masthead {
    padding: 0 16px;
    height: auto;
    min-height: 75px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .wordmark {
    font-size: 20px;
  }
  .wordmark img {
    width: 32px;
  }
  .masthead nav {
    height: 55px;
    margin-left: 0;
    gap: 0;
  }
  .nav {
    padding: 10px;
    font-size: 11px;
  }
  .title-screen {
    grid-template-columns: 1fr;
    padding: 35px 22px;
    gap: 30px;
  }
  .intro h1 {
    font-size: 49px;
  }
  .intro p br {
    display: none;
  }
  .title-mark {
    display: none;
  }
  .intro-rule {
    margin: 20px 0;
  }
  .character-card {
    padding: 24px;
  }
  .game-layout {
    display: flex;
    flex-direction: column;
  }
  .character {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 20px;
  }
  .character > .eyebrow,
  .character > h2,
  .character > #player-subtitle {
    grid-column: 1;
  }
  .character h2 {
    margin: 7px 0 0;
  }
  .character .health-title {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: end;
    margin: 0;
  }
  .health-track {
    grid-column: 2;
    grid-row: 3;
    align-self: center;
  }
  .character .stats,
  .character .ledger,
  .character .section-label,
  .character .charges,
  .character .effects {
    display: none;
  }
  .character #spellbook {
    grid-column: 1;
    width: auto;
    font-size: 10px;
    margin-top: 12px;
  }
  .character-bottom {
    grid-column: 2;
    grid-row: 4;
    padding: 0;
    font-size: 9px;
  }
  .character-bottom .text-button {
    display: none;
  }
  .map-heading {
    padding: 22px 18px;
  }
  .map-heading h1 {
    font-size: 25px;
  }
  .map-modes button {
    font-size: 9px;
    padding: 8px;
  }
  .map-modes small {
    display: none;
  }
  .viewport {
    height: 440px;
    min-height: 440px;
  }
  .map-footer {
    padding: 12px 15px;
  }
  #map-hint {
    display: none;
  }
  .encounter {
    padding: 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .action-buttons {
    max-width: none;
    justify-content: flex-start;
  }
  .command-form {
    margin: 0 20px 20px;
  }
  .journal {
    max-height: 220px;
  }
  .panel-heading {
    align-items: flex-start;
    gap: 12px;
  }
  .panel-heading h1 {
    font-size: 34px;
  }
  .badge {
    font-size: 8px;
    padding: 7px;
    max-width: 100px;
    line-height: 1.5;
  }
  .panel-layout {
    grid-template-columns: 1fr;
  }
  .panel-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
  }
  .panel-controls > .form-row,
  .panel-controls > p,
  .panel-controls > .primary {
    grid-column: 1/-1;
  }
  .panel-screen {
    padding: 25px 20px;
  }
  .panel-foot {
    font-size: 8px;
  }
  .connector {
    flex-wrap: wrap;
  }
}

@media (min-width: 721px) {
  .game-layout {
    height: max(620px, calc(100dvh - 86px));
    min-height: 0;
  }
  .character {
    overflow: auto;
    min-height: 0;
  }
  .dungeon-section {
    min-height: 0;
  }
  .viewport {
    min-height: 270px;
  }
  .journal {
    min-height: 0;
    max-height: none;
    overflow: hidden;
  }
  .encounter {
    min-height: 120px;
  }
  .map-heading {
    padding-top: 20px;
    padding-bottom: 16px;
  }
  .section-label {
    margin-top: 18px;
  }
  .character .stats {
    margin-top: 21px;
    padding-bottom: 18px;
  }
  .character-bottom {
    padding-top: 24px;
  }
}
@media (min-width: 721px) and (max-width: 1120px) {
  .game-layout {
    height: auto;
    min-height: calc(100dvh - 86px);
  }
  .dungeon-section {
    min-height: 670px;
  }
  .journal {
    min-height: 180px;
    max-height: 220px;
  }
}

.file-button:hover {
  color: #eee;
}
.file-button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.panel-standard {
  border: 1px solid #444;
  padding: 15px;
  line-height: 1.8;
  font-size: 12px;
}
.panel-standard p {
  margin: 12px 0;
}
.panel-standard a {
  display: block;
  color: #ddd;
  margin: 9px 0;
}
.panel-top {
  font: 10px monospace;
  letter-spacing: 1px;
  color: #bbb;
  text-align: center;
  padding: 12px;
  border: 1px solid #454545;
  border-bottom: 0;
}
@media (max-width: 720px) {
  .panel-standard {
    grid-column: 1/-1;
  }
}

.level-connector {
  border-top: 1px solid var(--line);
  padding: 16px 0;
  display: grid;
  gap: 10px;
}
.level-connector strong {
  font: 12px monospace;
}
.level-connector p {
  margin: 0;
}
.level-connector select {
  width: 100%;
  max-width: 100%;
}
.level-connector button {
  justify-self: start;
}

.panel-view-options {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 12px;
}

#cell-crop-results {
  margin-top: 24px;
}
#cell-crop-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}
#cell-crop-preview figure {
  margin: 0;
  padding: 12px;
  background: #333;
  text-align: center;
}
#cell-crop-preview canvas {
  width: 100px;
  height: 50px;
  max-width: 100%;
}
#cell-crop-preview figcaption {
  font: 10px monospace;
  margin-top: 8px;
}

/* Workshop overview: the art joins without gutters; editing stays in Panel view. */
.workshop-views {
  display: flex;
  gap: 6px;
  margin: 28px 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.workshop-views button {
  background: #222;
  color: #bbb;
  padding: 12px 22px;
}
.workshop-views button.active {
  background: #e6e6e6;
  color: #111;
}
#panel-overview {
  min-width: 0;
}
.overview-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}
.overview-toolbar label {
  margin: 0;
  font-size: 12px;
}
.overview-toolbar select {
  min-width: 180px;
}
.overview-zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.overview-zoom-controls output {
  min-width: 45px;
  text-align: center;
  font: 12px monospace;
}
.overview-viewport {
  position: relative;
  border: 1px solid #555;
  background: #111;
  min-height: 520px;
}
#panel-overview-map {
  display: block;
  width: 100%;
  height: 650px;
  max-height: 75vh;
  min-height: 450px;
  touch-action: none;
  cursor: grab;
}
#panel-overview-map:active {
  cursor: grabbing;
}
#panel-overview-map [data-panel] {
  cursor: pointer;
}
#panel-overview-map [data-panel]:focus {
  outline: none;
}
#panel-overview-map [data-panel]:focus > rect {
  stroke: #fff;
  stroke-width: 4;
}
#overview-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
}
.overview-selection {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}
.overview-selection p {
  flex: 1;
  font-size: 14px;
  min-width: 180px;
}
#overview-panel-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
#overview-panel-list button {
  font-size: 12px;
}
#overview-panel-list button[aria-pressed="true"] {
  border-color: #eee;
}
.overview-routes {
  margin-top: 24px;
  border-top: 1px solid #555;
  padding: 18px 0;
}
.overview-routes li {
  margin: 10px 0;
  color: #bbb;
  font-size: 13px;
  line-height: 1.6;
}
@media (max-width: 720px) {
  .workshop-views button {
    flex: 1;
    padding: 12px 8px;
    font-size: 12px;
  }
  .overview-toolbar {
    gap: 12px;
  }
  .overview-zoom-controls {
    margin-left: 0;
  }
  .overview-viewport {
    min-height: 450px;
  }
  #panel-overview-map {
    height: 520px;
  }
}

/* The layout runner owns only a temporary player, never the draft or game save. */
#playtest-controls {
  border: 1px solid #555;
  padding: 16px;
  margin-bottom: 16px;
}
.playtest-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.playtest-toolbar label {
  flex: 1 1 240px;
}
.playtest-directions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}
#playtest-west {
  grid-column: 1;
  grid-row: 1;
}
#playtest-north {
  grid-column: 2;
  grid-row: 1;
}
#playtest-south {
  grid-column: 1;
  grid-row: 2;
}
#playtest-east {
  grid-column: 2;
  grid-row: 2;
}
#playtest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#playtest-place[aria-pressed="true"] {
  background: #eee;
  color: #111;
}
#playtest-status {
  border-left: 3px solid #aaa;
  padding-left: 10px;
}
.workshop-views {
  flex-wrap: wrap;
}

.dungeon-library {
  border: 1px solid var(--line);
  padding: 18px;
  margin: 20px 0;
}
.dungeon-library h2 {
  margin-top: 0;
}
#dungeon-library-controls {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.dungeon-library-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin: 12px 0;
}
.dungeon-library-row > label:first-child {
  flex: 1 1 240px;
}
#dungeon-status {
  border-left: 3px solid #aaa;
  padding-left: 10px;
}
#dungeon-workspace[inert] {
  opacity: 0.6;
}

.feature-toolbar {
  border: 1px solid var(--line);
  padding: 14px;
  margin-bottom: 16px;
}
.feature-toolbar h3 {
  margin-top: 0;
}
.feature-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
}
.feature-actions label {
  flex: 1 1 180px;
}
.feature-actions button[aria-pressed="true"] {
  background: #eee;
  color: #111;
}
.selected-feature {
  outline: 2px solid #ddd;
  outline-offset: 2px;
}
#panel-features-heading {
  scroll-margin-top: 20px;
}

/* Authentication keeps game controls unavailable until the account is known. */
.signed-out #title-screen, .signed-out #game-screen, .signed-out #panel-screen,
.signed-out .masthead nav { display: none !important; }
.account-card { max-width: 540px; margin: 6vh auto; padding: 24px; }
.account-card h1 { font-size: clamp(30px, 5vw, 48px); }
.account-card form, #account-password-form { display: grid; gap: 18px; }
.account-card label, #account-password-form label { display: grid; gap: 8px; }
#account-controls { margin-left: auto; font-size: 13px; }
#account-controls button { padding: 7px 10px; }
#account-dialog { max-width: 480px; }

.encounter-list { display: grid; gap: 6px; margin-top: 12px; }
.encounter-list button { text-align: left; white-space: normal; }
.encounter-list button[aria-pressed="true"] { border-color: #fff; background: #333; }
#encounter-editor input[type="number"] { width: 90px; }

.encounter-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; align-items: end; margin: 16px 0; }
#encounter-monster-fields { display: contents; }
#encounter-editor input[type="number"] { width: 100%; }

#party-form { display: grid; gap: .6rem; margin: 1rem 0; }
#party-form input, #party-form select { width: 100%; min-width: 0; }
.party-card { border-top: 1px solid #aaa; padding: 1rem 0; overflow-wrap: anywhere; }
.party-card button { margin: .25rem .5rem .25rem 0; }
#party-status { overflow-wrap: anywhere; }

#directory-dialog { width: min(740px, calc(100% - 24px)); max-height: 85vh; overflow: auto; }
.directory-search-row { display: flex; gap: .6rem; margin-top: .5rem; }
.directory-search-row input { min-width: 0; flex: 1; }
.directory-card { border-top: 1px solid #666; padding: 1rem 0; overflow-wrap: anywhere; }
.directory-card h3 { margin: 0 0 .5rem; }
.directory-card p { white-space: pre-wrap; }
.listing-editor { border-top: 1px solid #666; margin-top: 1rem; padding-top: 1rem; display: grid; gap: 1rem; }
.listing-editor label { display: grid; gap: .5rem; }
.listing-editor input, .listing-editor textarea { width: 100%; min-width: 0; }
.listing-editor button { margin: 0 .5rem .5rem 0; }
#directory-open { white-space: normal; }
#account-dialog { max-height: 85vh; overflow: auto; }
#at-publishing { border-top: 1px solid #666; margin-top: 1rem; padding-top: 1rem; }
#publishing-form { display: grid; gap: 1rem; margin-bottom: 1rem; }
#publishing-form label { display: grid; gap: .5rem; }
#publishing-form .publishing-consent { display: flex; align-items: baseline; }
#publishing-consent { width: auto; }

.directory-card small, .directory-card a { display: block; overflow-wrap: anywhere; margin-top: .5rem; }
