:root {
  color-scheme: dark;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --page: #171c18;
  --panel: #202720;
  --panel-deep: #1b211c;
  --raised: #29322a;
  --line: #364238;
  --ink: #f4efdf;
  --muted: #acb6a8;
  --faint: #89988a;
  --gold: #e3bd7b;
  --forest: #a3c288;
  --danger: #f0aa9e;
  --display: Georgia, "Times New Roman", serif;
  background: var(--page);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea { border: 1px solid var(--line); border-radius: 8px; }
button { color: var(--ink); background: var(--raised); cursor: pointer; padding: 8px 12px; font-weight: 650; }
button:hover { filter: brightness(1.14); }
button:disabled { opacity: .45; cursor: default; filter: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { padding: 9px 11px; width: 100%; min-width: 0; color: var(--ink); background: #171d19; }
textarea { resize: vertical; }
input[type="checkbox"] { accent-color: var(--gold); width: 16px; height: 16px; margin: 0; }
input[type="file"] { padding: 7px 9px !important; font-size: 13px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
label { display: grid; gap: 6px; color: var(--ink); font-weight: 600; }
label small { display: inline; color: var(--faint); font-weight: 400; }
h1, h2, h3, p { margin: 0; }
h1 { font: normal clamp(30px, 3vw, 48px)/1.06 var(--display); letter-spacing: -.035em; }
h2 { font-size: 15px; }
h3 { font-size: 13px; }
small { font-size: 12px; }
.primary { background: var(--gold); color: #272015; border-color: transparent; }
.outline { background: transparent; }
.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.quiet[aria-pressed="true"] { color: var(--gold); }
.icon { font-size: 19px; line-height: 1; min-width: 32px; min-height: 32px; padding: 0 4px; }
.text-button { border: 0; padding: 4px 0; color: var(--gold); background: transparent; text-align: left; }
.wide { width: 100%; }
.muted { color: var(--muted); }
.hint, .empty-note { color: var(--muted); font-size: 12px; }
.empty-note { padding: 6px 0; }
.form-error:empty { display: none; }
.form-error { color: var(--danger); font-size: 12px; }
.loading { margin: 48px; color: var(--muted); }
.stack { display: grid; gap: 14px; }
.mark { width: 34px; height: 34px; flex: 0 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font: 21px var(--display); white-space: nowrap; }
.brand-button { display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; font: inherit; }
.eyebrow { color: var(--gold); letter-spacing: .16em; font-size: 10px; font-weight: 750; }
.tag { display: inline-flex; align-items: center; border: 1px solid #5b5136; background: #3b3424; border-radius: 999px; color: #f0cd93; padding: 2px 7px; font-weight: 700; font-size: 10px; line-height: 1.4; white-space: nowrap; }
.entry { display: grid; grid-template-columns: minmax(360px, .83fr) minmax(0, 1.17fr); min-height: 100svh; }
.entry-form { padding: 36px 44px; display: grid; grid-template-rows: auto 1fr; }
.entry-content { width: min(400px, 100%); justify-self: center; align-self: center; padding: 28px 0 56px; }
.entry-content .muted { margin: 14px 0 24px; }
.entry-art { min-height: 100%; background: linear-gradient(180deg, transparent 65%, #0e1613eb 100%), url('/assets/briarwatch.jpg') center / cover; display: flex; align-items: end; justify-content: start; padding: 43px; border-left: 1px solid var(--line); }
.entry-art div { display: grid; gap: 7px; }
.entry-art strong { font: 32px var(--display); }
.switch { background: #161c18; border: 1px solid var(--line); border-radius: 9px; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; gap: 3px; }
.switch button { border-color: transparent; color: var(--muted); padding: 6px 10px; background: transparent; }
.switch [aria-pressed="true"] { background: var(--raised); color: var(--ink); border-color: var(--line); }
.auth-tabs { margin-bottom: 17px; }
.top { height: 64px; display: flex; align-items: center; gap: 15px; padding: 0 19px; background: var(--panel-deep); border-bottom: 1px solid var(--line); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.top-campaign { display: flex; align-items: center; min-width: 0; gap: 12px; }
.top-campaign strong, .top-campaign small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-campaign small { color: var(--muted); }
.divider { display: block; width: 1px; height: 24px; background: var(--line); flex: none; }
.connection { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; margin-right: 5px; }
.connection i, .map-status span { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.connection.online i, .map-status.shared span { background: var(--forest); box-shadow: 0 0 12px #a3c28855; }
.lobby-main { max-width: 1120px; margin: 0 auto; padding: 56px 26px; }
.lobby-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 26px; }
.lobby-heading p, .join-card p { margin-top: 7px; }
.campaign-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 16px; }
.campaign-card { background: var(--panel); padding: 0; overflow: hidden; text-align: left; min-width: 0; }
.campaign-photo { height: 135px; background: linear-gradient(0deg, #19201755, transparent), url('/assets/briarwatch.jpg') center / cover; }
.campaign-copy { display: grid; justify-items: start; gap: 7px; padding: 16px; }
.campaign-copy strong { font: 24px var(--display); overflow-wrap: anywhere; }
.campaign-copy small { color: var(--muted); }
.empty-campaign { grid-column: 1 / -1; padding: 25px; border: 1px dashed var(--line); border-radius: 12px; }
.empty-campaign p { margin-top: 6px; }
.join-card { margin-top: 24px; border-radius: 12px; border: 1px solid var(--line); padding: 20px; background: var(--panel); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.join-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.join-form .form-error { grid-column: 1 / -1; }
.workspace { display: grid; grid-template-columns: 205px minmax(0, 1fr) 305px; min-height: calc(100svh - 64px); align-items: stretch; }
.rail, .desk { background: var(--panel); min-width: 0; }
.rail { border-right: 1px solid var(--line); padding: 15px 11px; overflow: auto; }
.rail-role { padding: 0 4px 13px; }
.rail-section { padding: 12px 0 16px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; min-height: 32px; margin-bottom: 6px; gap: 7px; }
.rail .section-heading { padding: 0 4px; }
.rail .section-heading h2, .history-title h2 { font-size: 12px; letter-spacing: .035em; }
.rail .empty-note { padding: 5px 4px; }
.scene-list, .party-list { display: grid; gap: 5px; }
.scene-row, .character-row { display: flex; align-items: center; gap: 8px; text-align: left; min-width: 0; background: transparent; border-color: transparent; padding: 7px 5px; width: 100%; }
.scene-row.active { border-color: #4a5545; background: var(--raised); }
.scene-thumb { width: 38px; height: 34px; background: #354036; border-radius: 5px; flex: 0 0 auto; border: 1px solid #ffffff24; background-image: linear-gradient(#ffffff13 1px, transparent 1px), linear-gradient(90deg, #ffffff13 1px, transparent 1px); background-size: 8px 8px; }
.scene-thumb.art { background-image: url('/assets/briarwatch.jpg'); background-size: cover; background-position: center; }
.scene-label, .character-row > span:nth-child(2) { display: grid; min-width: 0; }
.scene-label strong, .character-row strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scene-label small, .character-row small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chevron { margin-left: auto; color: var(--muted); }
.avatar { flex: 0 0 auto; display: inline-grid; place-items: center; height: 30px; width: 30px; background: var(--token, #596458); color: #171c18; font-size: 11px; font-weight: 850; border-radius: 50%; }
.amber { --token: #e4bd7c; }
.fern { --token: #a3c288; }
.sky { --token: #8fbbd0; }
.rose { --token: #e2a092; }
.violet { --token: #c2acd9; }
.stone { --token: #abb7a8; }
.count { font-weight: 500; color: var(--faint); }
.member-row { display: flex; align-items: center; gap: 7px; padding: 5px; font-size: 12px; overflow-wrap: anywhere; }
.member-row .avatar { width: 24px; height: 24px; font-size: 9px; }
.member-row small { color: var(--faint); }
.member-row .tag { margin-left: auto; }
.stage { display: flex; flex-direction: column; gap: 13px; padding: 17px 19px 19px; min-width: 0; background: radial-gradient(ellipse at 50% 0, #232c23, var(--page) 72%); }
.stage-heading { display: flex; justify-content: space-between; align-items: end; gap: 9px; }
.stage-heading h1 { font-size: clamp(27px, 3vw, 41px); overflow-wrap: anywhere; }
.stage-actions, .map-tools, .map-toolbar { display: flex; align-items: center; gap: 7px; }
.stage-actions button, .map-tools button { white-space: nowrap; }
.map-status { display: flex; align-items: center; gap: 6px; color: var(--gold); font-size: 11px; font-weight: 700; margin-bottom: 5px; }
.map-status.shared { color: var(--forest); }
.board-frame { background: #121713; border-radius: 10px; border: 1px solid #465244; overflow: auto; max-height: 72svh; }
.board { position: relative; isolation: isolate; container-type: inline-size; width: var(--zoom); aspect-ratio: var(--ratio); margin: auto; background-color: #2d392d; background-image: radial-gradient(ellipse, #3b4939, #293529); }
.board.placing { cursor: crosshair; }
.board.gridded::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background-image: linear-gradient(to right, #111b1b67 1px, transparent 1px), linear-gradient(to bottom, #111b1b67 1px, transparent 1px); background-size: calc(100% / var(--cols)) calc(100% / var(--rows)); }
.map-art { position: absolute; width: 100%; height: 100%; inset: 0; object-fit: fill; user-select: none; pointer-events: none; }
.map-treatment { position: absolute; z-index: 0; display: grid; place-items: center; overflow: hidden; pointer-events: none; color: #20271a; font-family: var(--display); font-weight: 700; line-height: 1; }
.token { position: absolute; z-index: 2; padding: 0; left: calc((var(--x) + .5) * 100% / var(--cols)); top: calc((var(--y) + .5) * 100% / var(--rows)); transform: translate(-50%, -50%); border-radius: 50%; width: min(calc(90% / var(--cols)), 43px); min-width: 14px; aspect-ratio: 1; border: clamp(1px, .18vw, 3px) solid #1d231e; background: var(--token); color: #151c18; box-shadow: 0 2px 6px #0f140ddd; font-size: clamp(9px, .9vw, 14px); font-weight: 900; }
.token[draggable="true"] { cursor: grab; }
.token.hidden-token { opacity: .65; border-style: dashed; }
.token.selected { z-index: 3; outline: 2px solid #fff4d8; outline-offset: 1px; }
.map-toolbar { justify-content: space-between; flex-wrap: wrap; color: var(--muted); }
.map-hint { font-size: 12px; }
.waiting { align-self: center; justify-self: center; margin: auto 0; padding: 80px 10px; display: grid; gap: 9px; justify-items: center; text-align: center; }
.waiting p { color: var(--muted); max-width: 35ch; }
.desk { border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.desk-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); padding: 0 11px; }
.desk-tabs button { border: 0; border-radius: 0; border-bottom: 2px solid transparent; padding: 12px 4px 10px; color: var(--muted); background: transparent; }
.desk-tabs [aria-pressed="true"] { color: var(--gold); border-color: var(--gold); }
.desk-content { display: flex; flex-direction: column; gap: 12px; padding: 13px; min-width: 0; }
.dice-choices { display: flex; flex-wrap: wrap; gap: 5px; }
.die { color: var(--gold); background: #222920; font: 650 11px ui-monospace, monospace; padding: 5px 6px; flex: auto; }
.roll-form, .chat-form { display: grid; gap: 9px; }
.roll-input { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.private { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; cursor: pointer; }
.private span { color: var(--faint); }
.history-title { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 12px; align-items: center; }
.history-title span { color: var(--faint); font-size: 11px; }
.log-scroll { min-width: 0; max-height: min(48svh, 510px); overflow: auto; }
.roll-entry { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: start; gap: 8px; padding: 8px 3px 9px 0; border-bottom: 1px solid var(--line); }
.roll-total { background: #3b3424; color: #f0cd93; border-radius: 7px; min-height: 34px; display: grid; place-items: center; font-size: 16px; font-weight: 750; overflow-wrap: anywhere; }
.roll-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; overflow-wrap: anywhere; }
.roll-head time { font-size: 10px; color: var(--faint); white-space: nowrap; }
.roll-detail { overflow-wrap: anywhere; font-size: 11px; color: var(--muted); }
.roll-tags { display: flex; gap: 6px; align-items: center; color: var(--faint); font-size: 10px; margin-top: 3px; }
.private-tag { padding: 0 4px; }
.physical { font-size: 12px; }
.chat-scroll { min-height: 100px; }
.message { padding: 8px 3px 8px 0; border-bottom: 1px solid var(--line); }
.message p { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.command-help { display: grid; gap: 3px; color: var(--muted); font-size: 11px; }
.command-help strong { color: var(--gold); }
.token-panel { display: grid; gap: 9px; padding: 13px; background: #283127; border-bottom: 1px solid var(--line); }
.token-head { display: flex; gap: 8px; align-items: center; }
.token-title { min-width: 0; flex: 1; display: grid; overflow-wrap: anywhere; }
.token-title small { color: var(--muted); }
.hp-line { display: flex; align-items: center; justify-content: space-between; color: var(--muted); }
.hp-line strong { color: var(--ink); font-size: 19px; }
.hp-line small { color: var(--muted); font-weight: 500; }
.hp-buttons { display: grid; grid-template-columns: minmax(40px, 1fr) auto auto; gap: 6px; }
.hp-buttons button { padding: 7px 8px; }
.danger { background: #4b2f2b; color: #ffc6bc; border-color: #74504a; }
.heal { background: #314332; color: #c9e9bd; border-color: #506655; }
.token-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.token-actions button { padding: 5px 8px; font-size: 12px; }
dialog { width: min(500px, calc(100% - 28px)); max-height: 90svh; overflow: auto; background: var(--panel); color: var(--ink); border: 1px solid #536252; padding: 19px; border-radius: 13px; box-shadow: 0 20px 65px #0009; }
dialog::backdrop { background: #111611bc; backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-bottom: 15px; }
.modal-head h2 { font: 27px var(--display); overflow-wrap: anywhere; }
.modal-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.two-fields, .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
[data-character-choice] { min-width: 0; }
[data-custom-choice] { margin-top: 7px; }
.ability-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.ability-fields legend { padding: 0; margin-bottom: 6px; color: var(--ink); font-weight: 700; }
.ability-fields label { font-size: 12px; }
@media (max-width: 420px) {
  .ability-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.field-row { grid-template-columns: 1fr 1fr 32px; margin-top: 7px; }
.menu-list { display: grid; gap: 8px; justify-items: start; margin-top: 15px; }
.invite-code { font: 650 16px/1.4 ui-monospace, monospace; background: #171d19; color: var(--gold); padding: 14px; margin: 10px 0; overflow-wrap: anywhere; border-radius: 7px; }
.color-field { border: 0; margin: 0; padding: 0; display: flex; align-items: center; gap: 8px; }
.color-field legend { margin-bottom: 5px; font-weight: 600; }
.swatch { display: inline-grid; position: relative; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { cursor: pointer; width: 25px; height: 25px; border-radius: 50%; background: var(--token); border: 2px solid var(--panel); }
.swatch input:checked + span, .swatch input:focus-visible + span { outline: 1px solid var(--ink); }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card-meta strong { margin-left: auto; color: var(--gold); }
dialog.character-sheet { width: min(690px, calc(100% - 28px)); padding: 0; }
.character-sheet .modal-head { position: sticky; z-index: 5; top: 0; height: 56px; margin: 0; padding: 0 19px; background: var(--panel); }
.character-sheet .modal-head h2 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.character-sheet form { padding: 0 19px; }
.character-sheet .modal-actions { position: sticky; z-index: 3; bottom: 0; margin: 0; padding: 8px 0 14px; background: var(--panel); }
.sheet-tabs { position: sticky; z-index: 4; top: 56px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sheet-tabs button { font-size: 12px; padding-inline: 5px; }
.class-level-summary:empty { display: none; }
.class-level-summary, .sheet-rank { color: var(--gold); }
.sheet-rank { font: 23px var(--display); }
.sheet-block { border: 1px solid var(--line); background: var(--panel-deep); border-radius: 9px; padding: 11px; }
.sheet-block .section-heading { min-height: 0; margin: 0; }
.attack-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.attack-total { display: grid; align-content: start; gap: 3px; padding: 7px 9px; border-radius: 7px; background: var(--raised); }
.attack-total span, .attack-total small { color: var(--muted); font-size: 11px; }
.attack-total strong { color: var(--gold); font-size: 20px; }
.sheet-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 13px; margin: 7px 0; }
.sheet-facts div { padding: 4px 0; border-bottom: 1px solid var(--line); }
.sheet-facts dt { color: var(--muted); font-size: 12px; }
.sheet-facts dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.sheet-list, .spell-list { margin: 5px 0; padding-inline-start: 20px; }
.sheet-list li, .spell-list li { padding: 2px 0; }
.spell-list { columns: 2; }
.spell-list li { break-inside: avoid; }
.spell-tier { border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; background: var(--panel); }
.spell-tier summary { cursor: pointer; }
.spell-tier summary span { color: var(--gold); margin-left: 7px; }
.sheet-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.selected-gear { margin: 0; padding: 0; list-style: none; }
.selected-gear li { display: flex; gap: 6px; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); }
.selected-gear strong { color: var(--gold); }
.selected-gear button { flex: none; }
@media (max-width: 470px) {
  .sheet-tabs { grid-template-columns: 1fr 1fr; }
  .spell-list { columns: 1; }
}
[data-creature] { display: grid; gap: 10px; }
.notice { position: fixed; z-index: 10; right: 17px; bottom: 17px; max-width: min(440px, calc(100% - 34px)); padding: 11px 14px; border-radius: 8px; background: #303d31; border: 1px solid #61765e; box-shadow: 0 5px 20px #0006; color: var(--ink); }
.notice.error { background: #4b2d2a; border-color: #9f635a; }
@media (max-width: 1120px) {
  .workspace { grid-template-columns: 175px minmax(0, 1fr) 272px; }
  .stage { padding-inline: 12px; }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 150px minmax(0, 1fr); }
  .desk { grid-column: 2; grid-row: 2; border-left: 0; border-top: 1px solid var(--line); }
  .rail { grid-row: 1 / span 2; }
  .board-frame { max-height: unset; }
}
@media (max-width: 590px) {
  .entry { grid-template-columns: 1fr; }
  .entry-form { min-height: 68svh; padding: 22px; }
  .entry-content { padding-bottom: 12px; }
  .entry-art { min-height: 32svh; padding: 16px; border-left: 0; }
  .entry-art strong { font-size: 23px; }
  .top { height: auto; min-height: 54px; padding: 8px 10px; gap: 8px; flex-wrap: wrap; }
  .table-top .brand-button span, .account, .divider, .top-campaign small { display: none; }
  .top-right { gap: 4px; }
  .connection { display: none; }
  .workspace { display: flex; flex-direction: column; min-height: auto; }
  .rail { order: 2; border: 0; border-top: 1px solid var(--line); }
  .stage { order: 0; padding: 11px 8px; }
  .desk { order: 1; }
  .stage-actions { flex-wrap: wrap; justify-content: end; }
  .stage-actions button { padding: 6px 7px; font-size: 12px; }
  .lobby-main { padding: 30px 14px; }
  .lobby-heading, .join-card { align-items: start; flex-direction: column; }
}
.command-result { color: var(--forest); font-size: 12px; overflow-wrap: anywhere; }
.npc-proposal { border-left: 2px solid var(--gold); padding: 6px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
