/* The Spire portal.
   Ink on bone paper for the working surface (Jam's sketch sheets), the aubergine night of
   the card back for the sidebar and the cards themselves. Layout discipline follows Qorx:
   a quiet sidebar, flat surfaces, small uppercase table headers, data never bold. */

@font-face { font-family: "Plus Jakarta Sans"; font-weight: 400; font-display: swap; src: url("../fonts/PlusJakartaSans-400.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 500; font-display: swap; src: url("../fonts/PlusJakartaSans-500.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 600; font-display: swap; src: url("../fonts/PlusJakartaSans-600.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 700; font-display: swap; src: url("../fonts/PlusJakartaSans-700.woff2") format("woff2"); }

@font-face { font-family: "Grenze"; font-weight: 500; font-display: swap; src: url("../fonts/Grenze-500.woff2") format("woff2"); }
@font-face { font-family: "Grenze"; font-weight: 600; font-display: swap; src: url("../fonts/Grenze-600.woff2") format("woff2"); }
@font-face { font-family: "Grenze"; font-weight: 700; font-display: swap; src: url("../fonts/Grenze-700.woff2") format("woff2"); }

:root {
  --paper: #f3efe6;
  --surface: #fbf9f4;
  --line: #ddd5c6;
  --line-strong: #c4baa8;
  --ink: #1f1a1d;
  --ink-soft: #5f565c;
  --night: #150b24;
  --night-2: #21143a;
  --violet: #55358a;
  --violet-deep: #38215c;
  --bone: #ece7db;
  --gold: #a39156;
  --blood: #a81f26;
  --moss: #4d7a4f;
  --sidebar-width: 236px;
  --radius: 8px;
  --display: "Grenze", "Plus Jakarta Sans", serif;
}

[data-bs-theme="light"] {
  --bs-body-bg: var(--paper);
  --bs-body-color: var(--ink);
  --bs-body-font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --bs-body-font-size: .9375rem;
  --bs-body-line-height: 1.55;
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--ink-soft);
  --bs-secondary-bg: #e9e3d6;
  --bs-tertiary-bg: var(--surface);
  --bs-link-color: var(--violet);
  --bs-link-color-rgb: 85, 53, 138;
  --bs-link-hover-color: var(--violet-deep);
  --bs-link-hover-color-rgb: 56, 33, 92;
  --bs-code-color: #6b2f52;
  --bs-border-radius: var(--radius);
  --bs-danger-rgb: 168, 31, 38;
}

html { scrollbar-color: var(--line-strong) transparent; }
body { min-height: 100vh; caret-color: var(--violet); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
::selection { background: #d9cdea; color: var(--ink); }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.sidebar :focus-visible { outline-color: var(--bone); }

h1, h2, h3 { font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
h1 { font-family: var(--display); font-weight: 600; font-size: 2.3rem; line-height: 1.05; letter-spacing: 0; }
h2 { font-size: 1.0625rem; letter-spacing: -.01em; margin-bottom: .75rem; }
.muted { color: var(--ink-soft); }
.lede { color: var(--ink-soft); margin: .35rem 0 0; max-width: 70ch; }
.num { font-variant-numeric: tabular-nums; }
.overdue { color: var(--blood); font-weight: 600; }
.shadow, .shadow-sm { box-shadow: none !important; }

/* ---------------------------------------------------------------- buttons, forms */
.btn { --bs-btn-border-radius: var(--radius); --bs-btn-font-weight: 600; --bs-btn-font-size: .875rem; --bs-btn-padding-y: .45rem; --bs-btn-padding-x: .95rem; }
.btn:hover { text-decoration: none; }
.btn-sm { --bs-btn-font-size: .8125rem; --bs-btn-padding-y: .28rem; --bs-btn-padding-x: .65rem; }
.btn-primary {
  --bs-btn-bg: var(--violet-deep); --bs-btn-border-color: var(--violet-deep); --bs-btn-color: var(--bone);
  --bs-btn-hover-bg: var(--night-2); --bs-btn-hover-border-color: var(--night-2); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--night); --bs-btn-active-border-color: var(--night); --bs-btn-active-color: #fff;
  --bs-btn-disabled-bg: var(--violet-deep); --bs-btn-disabled-border-color: var(--violet-deep);
  --bs-btn-focus-shadow-rgb: 85, 53, 138;
}
.btn-outline-secondary {
  --bs-btn-color: var(--ink); --bs-btn-border-color: var(--line-strong); --bs-btn-bg: transparent;
  --bs-btn-hover-bg: var(--surface); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--ink);
  --bs-btn-active-bg: #e9e3d6; --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: var(--ink);
  --bs-btn-focus-shadow-rgb: 85, 53, 138;
}
.btn-outline-danger {
  --bs-btn-color: var(--blood); --bs-btn-border-color: #d8b3b1; --bs-btn-hover-bg: var(--blood);
  --bs-btn-hover-border-color: var(--blood); --bs-btn-active-bg: var(--blood); --bs-btn-active-border-color: var(--blood);
}
.btn-link { --bs-btn-font-weight: 500; }
.form-label { font-weight: 600; font-size: .8125rem; margin-bottom: .3rem; }
.form-control, .form-select { background-color: #fffdf9; border-color: var(--line-strong); color: var(--ink); }
.form-control::placeholder { color: #7a7177; }
.form-control:focus, .form-select:focus { background-color: #fff; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(85, 53, 138, .18); }
.form-text { color: var(--ink-soft); }
.alert { --bs-alert-border-radius: var(--radius); border-width: 1px; }

/* ---------------------------------------------------------------- shell */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); z-index: 20;
  display: flex; flex-direction: column; padding: 1.5rem .875rem 1rem; color: var(--bone);
  background:
    linear-gradient(to bottom, var(--night) 46%, rgba(21, 11, 36, .78) 70%, rgba(21, 11, 36, .9)),
    url("../img/card-back.jpg") center bottom / 100% auto no-repeat, var(--night);
}
.sidebar .brand { display: block; padding: 0 .5rem 1.5rem; }
.sidebar .brand img { width: 118px; height: auto; display: block; }
.sidebar .nav { gap: 2px; }
.sidebar .nav-link { color: #b9b0c9; font-weight: 500; font-size: .9rem; border-radius: 6px; padding: .5rem .7rem; transition: background-color .15s, color .15s; }
.sidebar .nav-link:hover { color: #fff; background: rgba(236, 231, 219, .07); text-decoration: none; }
.sidebar .nav-link.active { color: var(--night); background: var(--bone); font-weight: 600; }
.sidebar .who { margin-top: auto; padding: .75rem .5rem 0; font-size: .8125rem; display: flex; align-items: center; gap: .6rem; }
.sidebar .who img { width: 30px; height: auto; flex: none; opacity: .9; }
.sidebar .who a { color: var(--bone); font-weight: 600; display: block; }
.sidebar .who .btn-link { color: #b9b0c9; font-size: .78rem; text-decoration: none; }
.sidebar .who .btn-link:hover { color: #fff; text-decoration: underline; }

.main-content { margin-left: var(--sidebar-width); padding: 2.25rem 2.75rem 5rem; max-width: 1480px; }
.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.75rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.page-head h1 { margin: 0; }
.crumbs { font-size: .8125rem; color: var(--ink-soft); margin-bottom: .6rem; }
.crumbs a { color: var(--ink-soft); }
.crumbs a:hover { color: var(--violet); }

@media (max-width: 900px) {
  .sidebar { position: static; width: auto; flex-direction: row; align-items: center; gap: .5rem; padding: .6rem .75rem; background: var(--night); }
  .sidebar .brand { padding: 0 .5rem 0 0; flex: none; } .sidebar .brand img { width: 62px; }
  .sidebar .nav { flex-direction: row !important; flex-wrap: nowrap; overflow-x: auto; flex: 1; scrollbar-width: none; padding-right: 1.5rem;
    -webkit-mask: linear-gradient(to right, #000 calc(100% - 2rem), transparent); mask: linear-gradient(to right, #000 calc(100% - 2rem), transparent); }
  .sidebar .nav-link { white-space: nowrap; padding: .4rem .6rem; }
  .sidebar .who { margin: 0; padding: 0; flex: none; } .sidebar .who img, .sidebar .who .who-name { display: none; }
  .main-content { margin-left: 0; padding: 1.25rem 1rem 3rem; }
  h1 { font-size: 1.9rem; }
}

/* ---------------------------------------------------------------- surfaces */
.card { --bs-card-bg: var(--surface); --bs-card-border-color: var(--line); --bs-card-border-radius: 10px; --bs-card-spacer-x: 1.25rem; --bs-card-spacer-y: 1.25rem; }
.block { margin-bottom: 2.5rem; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.rows > * { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.rows > *:first-child { border-top: 0; }
.rows .when { color: var(--ink-soft); font-size: .8125rem; white-space: nowrap; }
dl.row dt { font-weight: 600; font-size: .8125rem; color: var(--ink-soft); }
.list-group { --bs-list-group-bg: transparent; --bs-list-group-border-color: var(--line); --bs-list-group-action-hover-bg: var(--surface); --bs-list-group-color: var(--ink); --bs-list-group-border-radius: 10px; }
.list-group-item:hover { text-decoration: none; }

/* tables, the Qorx way: small caps headers, roomy rows, plain-weight data */
table.table { --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-border-color: var(--line); --bs-table-hover-bg: rgba(85, 53, 138, .05); margin-bottom: 0; }
.table > thead th { font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); border-bottom-color: var(--line-strong); padding: .55rem .75rem; white-space: nowrap; }
.table > tbody td { padding: .8rem .75rem; vertical-align: middle; font-weight: 400; }
.table-sm > tbody td { padding: .6rem .75rem; }
.table > tbody tr:last-child td { border-bottom: 0; }
.table td:first-child, .table th:first-child { padding-left: 0; }
.table td:last-child, .table th:last-child { padding-right: 0; }

/* status: a dot and a word, never a coloured slab */
.tone-secondary { --tone: #91878d; } .tone-light { --tone: #b9b0a2; } .tone-info { --tone: #7b62b5; }
.tone-primary { --tone: var(--violet-deep); } .tone-warning { --tone: var(--gold); } .tone-success { --tone: var(--moss); }
.tone-danger { --tone: var(--blood); } .tone-dark { --tone: var(--ink); }
.status { display: inline-flex; align-items: center; gap: .4rem; font-size: .8125rem; color: var(--ink); white-space: nowrap; }
.status::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--tone, #91878d); flex: none; }
.status + .status { margin-left: .9rem; }
.swatch { display: inline-block; width: .6rem; height: .6rem; border-radius: 2px; margin-right: .5rem; background: var(--frame, #91878d); transform: rotate(45deg); vertical-align: 1px; }

.pipeline { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; background: #e4ddcf; margin-bottom: .9rem; }
.pipeline > span { background: var(--tone); min-width: 4px; }
.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; }
.legend li { display: inline-flex; align-items: baseline; gap: .45rem; }
.legend a { color: inherit; }
.legend .num { color: var(--ink-soft); font-size: .8125rem; }

/* Jam's class marks, drawn with a mask so they take the colour of the text around them */
.mark { display: inline-block; width: 1.5em; height: 1.5em; vertical-align: -.42em; background: currentColor; flex: none;
  -webkit-mask: var(--mark) center / contain no-repeat; mask: var(--mark) center / contain no-repeat; }
.mark:not([class*="mark-"]) { display: none; }
.mark-defender { --mark: url("../img/class-defender.png"); } .mark-warrior { --mark: url("../img/class-warrior.png"); }
.mark-aggressor { --mark: url("../img/class-aggressor.png"); } .mark-veteran { --mark: url("../img/class-veteran.png"); }
.klass { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }

.nav-pills { --bs-nav-pills-link-active-bg: var(--ink); --bs-nav-pills-link-active-color: var(--bone); --bs-nav-link-color: var(--ink-soft); --bs-nav-link-hover-color: var(--ink); --bs-nav-link-padding-y: .3rem; --bs-nav-link-padding-x: .8rem; --bs-nav-pills-border-radius: 999px; font-size: .875rem; font-weight: 500; gap: .25rem; }
.nav-pills .nav-link:hover { text-decoration: none; }

/* ---------------------------------------------------------------- world */
.realm > header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding-bottom: .6rem; border-bottom: 2px solid var(--frame, var(--ink)); }
.realm h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.7rem; line-height: 1.1; letter-spacing: 0; }
.realm h2 a { color: inherit; }
.realm .about { font-size: .8125rem; color: var(--ink-soft); margin: .6rem 0 0; min-height: 2.5em; }
.realm .group { font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); margin: 1.5rem 0 0; }
.god { padding: .7rem 0 .6rem; border-bottom: 1px solid var(--line); }
.god-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.god-head a { font-family: var(--display); font-weight: 600; color: var(--ink); font-size: 1.25rem; line-height: 1.2; }
.count { font-size: .8125rem; color: var(--ink-soft); white-space: nowrap; }
.champs { list-style: none; margin: .6rem 0 0; padding: 0; }
.champs li { display: flex; align-items: center; gap: .55rem; padding: .3rem 0; }
.champs .mark { width: 1.6rem; height: 1.6rem; color: var(--ink); }
.champs .who-class { color: var(--ink-soft); font-size: .8125rem; }
.champs .count { margin-left: auto; }
.slot { display: block; border: 1px dashed var(--line-strong); border-radius: 6px; padding: .4rem .7rem; color: var(--ink-soft); font-size: .8125rem; margin-top: .5rem; }
.slot:hover { border-color: var(--violet); color: var(--violet); text-decoration: none; background: var(--surface); }
.statline { display: flex; flex-wrap: wrap; margin: 0 0 1.75rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.statline > div { flex: 1; min-width: 5.5rem; padding: .8rem 1rem .8rem 0; }
.statline dt { font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); }
.statline dd { margin: 0; font-family: var(--display); font-size: 2rem; font-weight: 600; line-height: 1.1; }

/* ---------------------------------------------------------------- set plan */
.plan-section { margin-bottom: 2.5rem; scroll-margin-top: 5rem; }
.plan-section h3.group { margin-top: 1.25rem; }
.slots { list-style: none; padding: 0; margin: 0 0 .5rem; columns: 17rem auto; column-gap: 2.5rem; }
.slots li { break-inside: avoid; display: flex; align-items: baseline; gap: .6rem; padding: .34rem 0; border-bottom: 1px solid var(--line); font-size: .875rem; }
.slots .no { flex: none; width: 2.4rem; color: var(--ink-soft); font-size: .8125rem; }
.slots .kind { margin-left: auto; padding-left: .5rem; color: var(--ink-soft); font-size: .75rem; white-space: nowrap; }
.slots li { scroll-margin-top: 6rem; }
.slots li:target { background: color-mix(in srgb, var(--gold) 18%, transparent); }
.slots .open-slot { color: #7a7177; text-decoration: none; }
.slots a.open-slot:hover { color: var(--violet-deep); text-decoration: underline; }
.slots a.fill { color: var(--violet-deep); font-weight: 600; text-decoration: none; }
.slots a.stand-in { text-decoration: none; }
.slots a.stand-in:hover, .slots a.fill:hover { text-decoration: underline; }
.gap-chips { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: flex-end; }
.gap-chips .status { white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 1.5rem 0 1rem; }
.pager-pages { display: flex; flex-wrap: wrap; justify-content: center; gap: .15rem; }
.pager-pages a, .pager-here { min-width: 2.25rem; padding: .35rem .5rem; text-align: center; border-radius: .4rem; text-decoration: none; font-variant-numeric: tabular-nums; }
.pager-pages a:hover { background: color-mix(in srgb, var(--violet-deep) 10%, transparent); }
.pager-here { background: var(--violet-deep); color: #fff; font-weight: 600; }
.plan-section h3.group { display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem; }
.plan-section h3.group .gap-task { margin-left: auto; font-family: var(--bs-body-font-family); letter-spacing: 0; text-transform: none; }
.next-up { border: 1px solid var(--line); border-left: 4px solid var(--violet-deep); border-radius: .5rem; padding: 1.25rem 1.5rem; margin-bottom: 2.5rem; background: color-mix(in srgb, var(--violet-deep) 4%, transparent); }
.next-up .eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.next-up h2 { margin: .15rem 0 .25rem; font-size: 1.6rem; }
.next-up .brief { max-width: 70ch; margin: .75rem 0 1rem; }
.queue .pos { flex: none; width: 2rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.queue > div { align-items: baseline; }
.queue .brief-line { max-width: 75ch; }
.digest-preview { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8125rem; }
.pt-notes > div { display: grid; grid-template-columns: minmax(0, 1.2fr) 11rem minmax(0, 2fr); gap: .5rem; padding: .4rem 0; }
@media (max-width: 767.98px) { .pt-notes > div { grid-template-columns: minmax(0, 1fr) 9.5rem; padding: .6rem 0; border-top: 1px solid var(--line); } .pt-notes > div > :last-child { grid-column: 1 / -1; } }
.naming > div { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) minmax(0, 1.6fr) 10rem; gap: .25rem 1rem; align-items: start; }
.naming .error { grid-column: 3 / -1; color: var(--blood); }
@media (max-width: 767.98px) { .naming > div { grid-template-columns: 3.5rem minmax(0, 1fr); } .naming > div > .field, .naming .error { grid-column: 1 / -1; } }
.briefs > div { display: grid; grid-template-columns: 2rem minmax(0, 1fr) minmax(0, 1.4fr); gap: .25rem 1rem; align-items: start; }
.briefs .about { max-width: 60ch; }
@media (max-width: 767.98px) { .briefs > div { grid-template-columns: 2rem minmax(0, 1fr); } .briefs textarea { grid-column: 1 / -1; } }
.bulk td { vertical-align: top; }
.bulk .n { width: 4.6rem; }
.bulk select { min-width: 7.5rem; }
.bulk textarea { min-width: 14rem; }
.bulk-bar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding: .75rem 0; background: var(--paper, var(--bs-body-bg)); border-top: 1px solid var(--line); }
@media (max-width: 991.98px) { .bulk-bar { bottom: calc(3.75rem + env(safe-area-inset-bottom)); } }
.idea-list { max-height: 34rem; overflow-y: auto; }
.slots .stand-in { color: #8a5a00; font-weight: 600; }

/* ---------------------------------------------------------------- boards */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 1.5rem; overflow-x: auto; align-items: start; padding-bottom: 1rem; }
.board-col > header { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: .5rem; border-bottom: 2px solid var(--tone, var(--ink)); font-weight: 700; font-size: .875rem; }
.board-col > header .count { font-weight: 400; }
.board-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .8rem; margin-top: .6rem; font-size: .875rem; }
.board-item { position: relative; transition: border-color .15s, background-color .15s; }
.board-item > a { font-weight: 600; color: var(--ink); }
.board-item > a.open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }  /* the whole card is the link */
.board-item:has(> a.open):hover { border-color: var(--violet); background: #fff; cursor: pointer; }
.board-item:has(> a.open:focus-visible) { outline: 2px solid var(--violet); outline-offset: 2px; }
.board-item:hover > a.open { color: var(--violet); }
.board-item .cue { color: var(--violet); font-weight: 500; margin-top: .15rem; }
.board-item .acts { position: relative; z-index: 1; width: fit-content; }
.checks { display: flex; flex-wrap: wrap; gap: .4rem; }
.check-chip { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .75rem; border: 1px solid var(--line-strong); border-radius: 999px; background: #fffdf9; cursor: pointer; font-size: .875rem; min-height: 38px; }
.check-chip input { accent-color: var(--violet-deep); width: 1.05em; height: 1.05em; margin: 0; }
.check-chip:has(input:checked) { border-color: var(--violet-deep); background: #efeaf6; font-weight: 600; }
.check-chip:has(input:focus-visible) { outline: 2px solid var(--violet); outline-offset: 2px; }
.board-item img { border-radius: 5px; }
.board-empty { color: var(--ink-soft); font-size: .8125rem; margin: .75rem 0 0; }

.prose { max-width: 72ch; line-height: 1.7; }
.prose h1, .prose h2, .prose h3 { margin-top: 1.6em; }
.prose > :first-child { margin-top: 0; } .prose > :last-child { margin-bottom: 0; }
.prose blockquote { border-left: 1px solid var(--gold); padding-left: 1.1rem; color: var(--ink-soft); font-style: italic; }
.prose table { width: 100%; margin-bottom: 1rem; } .prose th, .prose td { border-bottom: 1px solid var(--line); padding: .4rem .6rem .4rem 0; text-align: left; }
.comment { padding: .8rem 0; border-top: 1px solid var(--line); }
.comment .by { font-size: .8125rem; color: var(--ink-soft); margin-bottom: .2rem; }
.comment .by b { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------------- phone and tablet: the app shell
   Built to be installed to a home screen: a slim top bar, the main places as a bar at the thumb,
   everything else under More, and room left for notches and the home indicator. */
.tabbar, .more-sheet { display: none; }
body.has-shell { -webkit-tap-highlight-color: transparent; }
.api-sample { background: var(--night); color: var(--bone); border-radius: var(--radius); padding: .8rem 1rem; font-size: .8125rem; overflow-x: auto; }
.api-sample code { color: inherit; }
@media (max-width: 900px) {
  .sidebar { position: sticky; top: 0; z-index: 30; justify-content: space-between;
    padding: calc(.55rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .55rem max(1rem, env(safe-area-inset-left)); }
  .sidebar .nav, .sidebar .who form { display: none !important; }
  .sidebar .who .who-name { display: block; font-size: .8125rem; padding: .5rem 0; }
  .main-content { padding: 1.25rem max(1rem, env(safe-area-inset-right)) calc(5.5rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
  .page-head { align-items: flex-start; }

  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 30; background: var(--night);
    border-top: 1px solid rgba(236, 231, 219, .14); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; min-height: 58px; padding: 0;
    color: #b9b0c9; font-size: .6875rem; font-weight: 600; letter-spacing: .01em; background: none; border: 0; text-decoration: none; }
  .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar .active { color: var(--bone); box-shadow: inset 0 2px 0 var(--gold); }
  .tabbar :focus-visible { outline: 2px solid var(--bone); outline-offset: -4px; }

  .offcanvas.more-sheet { display: flex; --bs-offcanvas-height: auto; height: auto; max-height: 82vh; background: var(--paper); border: 0; border-radius: 14px 14px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .more-sheet .offcanvas-title { font-family: var(--display); font-weight: 600; font-size: 1.4rem; letter-spacing: 0; margin: 0; }
  .more-sheet .offcanvas-body { padding-top: 0; }
  .more-sheet .offcanvas-body a, .more-sheet .offcanvas-body button { display: flex; justify-content: space-between; align-items: baseline; width: 100%; min-height: 52px; padding: .9rem .25rem;
    border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font-weight: 600; text-align: left; text-decoration: none; }
  .more-sheet .offcanvas-body .muted { font-weight: 400; font-size: .8125rem; }
  .more-sheet .offcanvas-body .active { color: var(--violet); }
  .more-sheet form button { border-bottom: 0 !important; color: var(--blood) !important; }

  /* 16px inputs stop iOS zooming the page on focus; taller controls for fingers */
  .form-control, .form-select, .form-control-sm { font-size: 1rem; min-height: 44px; }
  .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .btn-sm { min-height: 38px; }
  .btn-link.p-0 { min-height: 0; }
  .form-check-input { width: 1.25em; height: 1.25em; }

  .board { grid-auto-columns: 84vw; gap: 1rem; scroll-snap-type: x mandatory; scroll-padding-left: 0; }
  .board-col { scroll-snap-align: start; }
  .map-wrap { max-height: 62vh; }
}
@media (max-width: 700px) {
  /* tables with class "stack" read as a list: the name on its own line, the rest as small labelled facts */
  table.stack, table.stack tbody { display: block; }
  table.stack thead { display: none; }
  table.stack tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .9rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
  table.stack td { display: block; padding: 0 !important; border: 0; font-size: .8125rem; color: var(--ink-soft); text-align: left !important; white-space: normal !important; }
  table.stack td:first-child { flex: 0 0 100%; font-size: 1rem; color: var(--ink); }
  table.stack td:empty { display: none; }
  table.stack td[data-label]::before { content: attr(data-label) " "; font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #7a7177; }
  table.stack td.actions { flex: 0 0 100%; margin-top: .45rem; display: flex; flex-wrap: wrap; gap: .4rem; }
  table.stack td[colspan] { flex: 0 0 100%; text-align: center !important; }
}
@media (display-mode: standalone) {
  body.has-shell { overscroll-behavior-y: none; }
}

/* ---------------------------------------------------------------- map */
.map-wrap { overflow: auto; border: 1px solid var(--line-strong); border-radius: 10px; background: #bfeee9; max-height: 78vh; }
.map-stage { position: relative; width: 100%; line-height: 0; }
.map-wrap.can-pan { cursor: grab; }
.map-wrap.panning { cursor: grabbing; user-select: none; }
.map-wrap.panning .pin { pointer-events: none; }
.map-stage img { width: 100%; height: auto; display: block; user-select: none; }
.map-wrap .map-stage.placing { cursor: crosshair; }
.map-stage.placing .pin { pointer-events: none; opacity: .55; }
.pin { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; padding: 0; border: 2px solid var(--ink); border-radius: 2px;
  background: var(--frame, var(--ink)); box-shadow: 0 0 0 2px var(--bone); transform: rotate(45deg); cursor: pointer; transition: transform .15s; }
.pin::before { content: ""; position: absolute; inset: -14px; }  /* larger touch target */
.pin:hover, .pin:focus-visible, .pin.on { transform: rotate(45deg) scale(1.35); z-index: 3; }
.pin.on { box-shadow: 0 0 0 2px var(--bone), 0 0 0 5px var(--violet); }
.pin-label { position: absolute; left: 50%; top: 50%; transform: rotate(-45deg) translate(14px, -50%); transform-origin: 0 0; white-space: nowrap; pointer-events: none;
  font: 600 .75rem/1.2 "Plus Jakarta Sans", sans-serif; color: var(--bone); background: var(--night); padding: .2rem .45rem; border-radius: 4px; opacity: 0; transition: opacity .15s; }
.pin:hover .pin-label, .pin:focus-visible .pin-label, .pin.on .pin-label { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .pin, .pin-label { transition: none; } }
.map-hint { background: var(--night); color: var(--bone); border-radius: var(--radius); padding: .6rem .9rem; margin-bottom: 1rem; font-weight: 500; }
.pin-detail .pin-title { font-family: var(--display); font-weight: 600; font-size: 1.7rem; line-height: 1.1; letter-spacing: 0; margin-bottom: .25rem; }
.pin-art { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 1rem; display: block; }
#pin-list .btn-link { font-weight: 500; text-decoration: none; }
#pin-list .btn-link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- sign-in */
.login-art { position: fixed; inset: 0 50% 0 0; background: var(--night) url("../img/card-back.jpg") center 38% / cover no-repeat; }
.login-panel { margin-left: 50%; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 3rem clamp(1.5rem, 7vw, 6rem); }
.login-panel .inner { width: 100%; max-width: 360px; }
.login-panel .logo { width: 190px; height: auto; margin-bottom: 2.25rem; display: block; }
.login-panel .maker { margin-top: 3rem; display: flex; align-items: center; gap: .75rem; font-size: .8125rem; color: var(--ink-soft); }
.login-panel .maker img { width: 34px; height: auto; }
@media (max-width: 760px) {
  .login-art { position: static; height: 30vh; }
  .login-panel { margin-left: 0; min-height: 0; padding: 2rem 1.25rem; }
  .login-panel .logo { width: 150px; margin-bottom: 1.5rem; }
}

/* ------------------------------------------------------------ card face
   Sized in --u so the same markup works on screen and at true size in
   print (1u = 1mm, card = 63 x 88mm). Night body, realm-coloured edge and
   a thin gold inset line, after Jam's card back. */
.tcg-card {
  --u: 4.4px; --frame: #6b7280; --card-bg: #17101f; --card-ink: #ece7db; --card-dim: #b3a9bd; --card-rule: var(--gold); --card-well: #22172f;
  width: calc(63 * var(--u)); height: calc(88 * var(--u)); box-sizing: border-box; flex: none;
  border-radius: calc(3 * var(--u)); padding: calc(3.2 * var(--u));
  background: var(--card-bg); color: var(--card-ink);
  border: calc(.9 * var(--u)) solid var(--frame);
  box-shadow: inset 0 0 0 calc(.9 * var(--u)) var(--card-bg), inset 0 0 0 calc(1.1 * var(--u)) var(--card-rule);
  display: flex; flex-direction: column; gap: calc(1.3 * var(--u));
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif; font-size: calc(2.5 * var(--u)); line-height: 1.3; overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.tcg-card.small { --u: 2.6px; transition: transform .18s cubic-bezier(.2, .7, .2, 1); }
a:hover > .tcg-card.small { transform: translateY(-4px) rotate(-.6deg); }
@media (prefers-reduced-motion: reduce) { .tcg-card.small { transition: none; } a:hover > .tcg-card.small { transform: none; } }
.tcg-top { display: flex; align-items: center; justify-content: space-between; gap: calc(1.5 * var(--u)); }
.tcg-name { flex: 1; font-family: var(--display); font-weight: 600; font-size: calc(4.6 * var(--u)); line-height: 1; overflow-wrap: anywhere; }
.tcg-box {
  flex: 1; text-align: center; font-family: var(--display); font-weight: 600; font-size: calc(5.2 * var(--u)); line-height: 1.05;
  border: calc(.25 * var(--u)) solid var(--card-rule); border-radius: calc(1 * var(--u)); padding: calc(.8 * var(--u)) 0;
}
.tcg-box small { font-family: "Plus Jakarta Sans", sans-serif; display: block; font-size: calc(1.8 * var(--u)); font-weight: 600; color: var(--card-dim); letter-spacing: .1em; }
.tcg-corner { flex: none; min-width: calc(10 * var(--u)); padding: calc(.7 * var(--u)) calc(1.5 * var(--u)); font-size: calc(4.8 * var(--u)); }
.tcg-pip {
  flex: none; min-width: calc(9 * var(--u)); height: calc(9 * var(--u)); border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: calc(3.8 * var(--u));
  border: calc(.25 * var(--u)) solid var(--card-rule);
}
.tcg-pip > span { text-align: center; line-height: 1; }
.tcg-pip small { display: block; font-size: calc(1.5 * var(--u)); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--card-dim); }
.tcg-heart { border-color: #c8454c; }
.tcg-art {
  height: calc(26 * var(--u)); flex: none; border-radius: calc(1 * var(--u)); overflow: hidden;
  background: var(--card-well); display: grid; place-items: center; color: var(--card-dim);
}
.tcg-art img { width: 100%; height: 100%; object-fit: cover; }
.tcg-art .mark { width: calc(17 * var(--u)); height: calc(17 * var(--u)); opacity: .34; }
.tcg-type { display: flex; align-items: center; gap: calc(1 * var(--u)); font-size: calc(2.1 * var(--u)); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--card-dim); border-bottom: calc(.2 * var(--u)) solid color-mix(in srgb, var(--card-rule) 60%, transparent); padding-bottom: calc(.9 * var(--u)); }
.tcg-type .mark { width: calc(4 * var(--u)); height: calc(4 * var(--u)); color: var(--card-ink); }
.tcg-text { flex: 1; overflow: hidden; display: flex; flex-direction: column; gap: calc(1 * var(--u)); }
.tcg-keywords { font-weight: 700; }
.tcg-rules { white-space: pre-line; }
.tcg-flavour { font-style: italic; color: var(--card-dim); font-size: calc(2.2 * var(--u)); white-space: pre-line; margin-top: auto; }
.tcg-keywords:empty, .tcg-flavour:empty, .tcg-rules:empty { display: none; }
.tcg-bottom { display: flex; align-items: center; justify-content: space-between; gap: calc(1 * var(--u)); }
.tcg-class { text-align: center; font-size: calc(2 * var(--u)); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--card-dim); }

/* print sheet: ink on white so a prototype run doesn't drain a cartridge */
.print-sheet { display: grid; grid-template-columns: repeat(3, 63mm); gap: 0; justify-content: center; }
.print-sheet .tcg-card {
  --u: 1mm; --card-bg: #fff; --card-ink: #111; --card-dim: #444; --card-rule: #111; --card-well: #f0f0f0;
  border-radius: 0; border-color: #111; break-inside: avoid; outline: .2mm dashed #999;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
@media print {
  @page { size: A4; margin: 10mm; }
  .sidebar, .tabbar, .more-sheet, .no-print { display: none !important; }
  .main-content { margin: 0; padding: 0; max-width: none; }
  body { background: #fff !important; }
}
.crumbs a + a::before { content: "/"; margin: 0 .45rem; color: var(--ink-soft); display: inline-block; }
