:root {
  --paper: #f1e8d4;
  --paper2: #e8dcc0;
  --card: #f8f2e3;
  --ink: #2b241b;
  --ink2: #6b5f4d;
  --line: #cdbf9f;
  --stamp: #b3382c;
  --blue: #2f4f6f;
  --link: #1b7fc4;
  --good: #3b6b45;
  --warn: #a8731c;
  --chip: #e3d6b7;
  --pin: #1478c0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #231f19;
    --paper2: #2d2820;
    --card: #2a251d;
    --ink: #eadfc8;
    --ink2: #a99d85;
    --line: #4a4234;
    --stamp: #d8695c;
    --blue: #8fb1d4;
    --link: #5cbcf2;
    --good: #7fb48a;
    --warn: #d6a24a;
    --chip: #3a3326;
    --pin: #54b6f2;
  }
}
:root[data-theme="dark"] {
  --paper: #231f19;
  --paper2: #2d2820;
  --card: #2a251d;
  --ink: #eadfc8;
  --ink2: #a99d85;
  --line: #4a4234;
  --stamp: #d8695c;
  --blue: #8fb1d4;
  --link: #5cbcf2;
  --good: #7fb48a;
  --warn: #d6a24a;
  --chip: #3a3326;
  --pin: #54b6f2;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.6 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif; }
h1, h2, h3 { font-family: "Noto Serif SC", "Songti SC", SimSun, serif; margin: 0; }
button { font: inherit; font-size: 13px; line-height: 1.4; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 4px; padding: 2px 9px; }
button:hover:not(:disabled) { border-color: var(--stamp); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--stamp); border-color: var(--stamp); color: #fff; }
button.ghost { background: transparent; }
button.danger { border-color: var(--stamp); color: var(--stamp); font-weight: 600; }
button.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--stamp) 12%, transparent); }
input, select { font: inherit; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--ink2); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

#top { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--paper2); }
.brand { display: flex; gap: 12px; align-items: center; }
.logo { display: inline-block; width: 40px; height: 40px; flex: none; }
.logo img { display: block; width: 100%; height: 100%; }
#top h1 { font-size: 20px; }
#top .brand-version { font: 600 12px/1.2 system-ui, sans-serif; color: var(--ink2); white-space: nowrap; }
#lang { margin-left: 8px; }
#header-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.about { max-width: 760px; }
.about-version { font-size: 22px; line-height: 1.35; font-weight: 700; }
.release-notes { margin: 8px 0; }
.release-notes section + section { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
.release-notes h4 { margin: 0 0 4px; }
.release-notes pre { margin: 4px 0; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.about h3 { margin: 24px 0 10px; padding-bottom: 4px; font-size: 17px; font-weight: 700; letter-spacing: .06em; border-bottom: 2px solid var(--line); }
.about h3::before { content: ''; display: inline-block; width: 4px; height: 1em; background: var(--stamp); margin-right: 8px; vertical-align: -2px; border-radius: 2px; }
.jumps { margin: 10px 0 12px; padding: 8px 10px; background: var(--paper2); border-radius: 4px; line-height: 1.9; }
.about p { margin: 6px 0; }
/* the tabs are their own row under the header, left aligned, all the same large size, so none of them moves when the clock row changes */
#navrow { flex: 1 0 100%; order: 10; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 6px; }
#tabs { flex: 1 1 auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-start; }
#office-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-left: auto; min-width: 0; }
#res { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 15px; }
#res .rv { display: inline-flex; align-items: baseline; gap: 4px; cursor: default; }
#res .rv b { font: 600 18px "Noto Serif SC", serif; white-space: nowrap; }
#res .rv .muted { font-size: 12px; }
#tabs button { border-color: transparent; background: transparent; font-size: 15px; padding: 4px 18px; min-width: 88px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
#tabs button.on { border-color: var(--ink); background: var(--card); font-weight: 600; }

#view { max-width: 980px; margin: 0 auto; padding: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.card.on { border-color: var(--stamp); box-shadow: 0 0 0 1px var(--stamp) inset; }
.card h3 { font-size: 15px; margin-bottom: 4px; }
.sec { margin: 24px 0 10px; font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: .06em; border-bottom: 2px solid var(--line); padding-bottom: 4px; }
.sec::before { content: ''; display: inline-block; width: 4px; height: 1em; background: var(--stamp); margin-right: 8px; vertical-align: -2px; border-radius: 2px; }
.muted { color: var(--ink2); font-size: 13px; }
.chip { display: inline-block; font-size: 12px; padding: 0 7px; border-radius: 10px; background: var(--chip); margin-right: 4px; }
.chip.history { background: #d9c9a2; color: #5a4210; }
.chip.branch { background: #c6d6e6; color: #1f3f5f; }
.chip.trait { background: #e6cfd0; color: #6a2a2e; }
.chip.param { background: #d6e0cf; color: #2f4f2f; }
.chip.warn { background: var(--warn); color: #fff; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.sp { justify-content: space-between; }
.bar { height: 8px; background: var(--chip); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--stamp); }
.bar.ok > i { background: var(--good); }
.bar.over > i { background: var(--warn); }
.card.mini { display: flex; align-items: center; gap: 12px; padding: 8px 14px; }
.card.mini .bar { flex: 1; min-width: 60px; }
.statrow { margin-top: 12px; }
.stat { font: 600 22px "Noto Serif SC", serif; }
.stamp { display: inline-block; border: 3px double var(--stamp); color: var(--stamp); padding: 2px 12px; font: 700 18px "Noto Serif SC", serif; transform: rotate(-3deg); border-radius: 4px; letter-spacing: .1em; }
.quote { border-left: 3px solid var(--stamp); padding: 2px 12px; font-family: "Noto Serif SC", serif; font-size: 17px; margin: 10px 0; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.item .nm { font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 28px; padding: 2px 0; }
.stepper .n { min-width: 36px; text-align: center; font-variant-numeric: tabular-nums; }
.tl { list-style: none; padding: 0; margin: 0; }
/* The record is one list in time order around a time axis: history on the left, leaning towards the axis, the employee on the right,
   the date on the axis between them. The one emphasis is a won star. On a narrow screen both sides stand right of the axis, so the employee has a thin frame. */
.tl { position: relative; }
.tl::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--line); }
.tl li { position: relative; display: grid; grid-template-columns: 1fr 7.6em 1fr; align-items: start; padding: 4px 0; line-height: 1.6; }
.tl li .what.l { text-align: right; padding-right: 2px; }
.tl li .what.r { text-align: left; padding-left: 2px; }
.tl li .when { position: relative; z-index: 1; margin: 2px auto 0; padding: 0 6px; font-size: 11.5px; color: var(--ink2); background: var(--paper); border-radius: 9px; text-align: center; font-variant-numeric: tabular-nums; max-width: 100%; line-height: 1.35; }
.tl li .when:empty { width: 9px; height: 9px; padding: 0; margin-top: 8px; border-radius: 50%; background: var(--line); }
.tl li.year { display: block; text-align: center; padding: 12px 0 4px; }
.tl li.year .when { display: inline-block; font-size: 13px; font-weight: 700; color: var(--ink); letter-spacing: .08em; padding: 1px 10px; border: 1px solid var(--line); }
.tl.f-history li.travel, .tl.f-travel li.history { display: none; }
@media (max-width: 560px) {
  .tl::before { left: 2.6em; }
  .tl li { grid-template-columns: 5.2em 1fr; }
  .tl li .what.l:empty, .tl li .what.r:empty { display: none; }
  .tl li .when { grid-column: 1; grid-row: 1; margin-left: 0; }
  .tl li .what.l, .tl li .what.r { grid-column: 2; grid-row: 1; text-align: left; padding: 0 0 0 4px; }
  .tl li .bubble { display: block; border: 1px solid var(--line); border-radius: 4px 12px 12px 12px; padding: 2px 8px; }
}
/* the shift of the timeline: a card of its own, the left column the dim paper of what was, the right the bright card of this timeline */
.shiftcard { margin: 18px 0 8px; border: 1px solid var(--line); border-top: 3px solid var(--stamp); border-radius: 8px; background: var(--card); padding: 12px 14px 10px; }
.shiftcard.desync { border-top-color: var(--warn); }
.shifthead { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.shifttitle { font-size: 18px; font-weight: 700; letter-spacing: .12em; }
.shiftsub { font-size: 13px; color: var(--stamp); font-weight: 600; }
.shiftcard.desync .shiftsub { color: var(--warn); }
.shift { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0 6px; }
.shift th { text-align: left; font-weight: 600; font-size: 12px; letter-spacing: .12em; color: var(--ink2); padding: 0 10px; }
.shift td { vertical-align: top; padding: 8px 10px; line-height: 1.6; }
.shift td:first-child { background: var(--paper2); color: var(--ink2); border-radius: 6px 0 0 6px; }
.shift td:last-child { background: var(--paper); border-left: 3px solid var(--stamp); border-radius: 0 6px 6px 0; font-weight: 500; }
.shift tr.desync td:last-child { border-left-color: var(--warn); }
.shift tr.held td:last-child { border-left-color: var(--good); color: var(--ink2); }
.shift tr.all td { font-weight: 700; }
.iflines li { margin: 4px 0; }
.iflines .from { font-size: 12px; opacity: .7; }
.tl li.after .what { opacity: 0.85; }
p.saying { font-style: italic; margin: 10px 0 4px; }
.tl .why { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: var(--ink2); opacity: 0.85; margin-top: 1px; word-break: break-word; }
tr.points td { padding-top: 0; }
tr.points ul.sync { margin: 0; }
sup.fnref { font-size: 10px; color: var(--ink2); margin-left: 1px; }
ol.notes { padding-left: 20px; margin: 4px 0; font-size: 12px; }
.tlf .chipbtn { font-weight: 400; }
details.nums > summary { cursor: pointer; }
.fn { cursor: pointer; color: var(--blue); font-size: 12px; margin-left: 4px; user-select: none; }
.fntext { font-size: 12px; color: var(--ink2); margin: 2px 0 0; }
svg.chart { width: 100%; height: auto; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
svg.chart text { fill: var(--ink2); font-size: 11px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink2); margin: 4px 0; flex-wrap: wrap; }
.legend i { display: inline-block; width: 18px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 4px; }
.legend .lg { background: none; border: 1px solid transparent; border-radius: 4px; padding: 1px 6px; font: inherit; color: inherit; cursor: pointer; }
.legend .lg:hover { border-color: var(--ink2); }
.legend .lg.off { opacity: .4; text-decoration: line-through; }
pre.yaml { max-height: 420px; overflow: auto; background: var(--card); border: 1px solid var(--line); padding: 10px; font-size: 12px; line-height: 1.45; }
.scroll { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.hint { padding: 8px 12px; background: var(--paper2); border-radius: 6px; margin: 6px 0; }
.delta.up { color: var(--good); }
.delta.down { color: var(--stamp); }

.stage { display: grid; grid-template-columns: minmax(240px, 380px) 1fr; gap: 14px; align-items: start; }
@media (max-width: 720px) { .stage { grid-template-columns: 1fr; } }
svg.map, svg.axis { width: 100%; height: auto; display: block; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
svg.map .grid line { stroke: var(--line); stroke-width: .6; opacity: .6; }
svg.map .land polygon { fill: url(#dots); stroke: var(--ink2); stroke-width: 1; stroke-linejoin: round; }
svg.map pattern circle { fill: var(--ink2); }
svg .pt { cursor: pointer; }
svg .pt .hit { fill: transparent; }
svg .pt text { pointer-events: none; }
svg .pt .dot { fill: var(--pin); stroke: var(--card); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; transition: transform .12s; }
svg .pt text { fill: var(--ink); font-size: 12px; font-weight: 600; paint-order: stroke; stroke: var(--card); stroke-width: 3px; }
svg .pt.locked .dot { opacity: .7; }
.card.locked { opacity: .65; border-style: dashed; }
svg .pt:hover .dot { transform: scale(1.35); }
svg .pt.on .dot { fill: var(--stamp); transform: scale(1.25); }
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.9); opacity: 0; } }
svg.axis { cursor: grab; touch-action: none; }
svg.axis .ax { stroke: var(--ink2); stroke-width: 2; }
svg.axis .tick { stroke: var(--ink2); stroke-width: 1.5; }
svg.axis text.yr, svg.axis text.edge { fill: var(--ink2); font-size: 11px; }
@media (max-width: 560px) { #view { padding: 12px; } .item { grid-template-columns: 1fr; } }

.hero { display: flex; gap: 16px; align-items: center; margin: 8px 0 12px; }
.logo.big { width: 72px; height: 72px; }
.lead { font: 600 18px/1.7 "Noto Serif SC", "Songti SC", SimSun, serif; margin: 8px 0 4px; }
#view > .lead:first-child { margin-top: 24px; }
.gobtn { display: grid; gap: 2px; text-align: left; padding: 12px 14px; }
.gobtn b { font-family: "Noto Serif SC", serif; font-size: 16px; }
.refs { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 6px; font-size: 12px; }
.ref { color: var(--ink2); }
details summary { cursor: pointer; color: var(--blue); font-size: 13px; }

.wiki { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 720px) { .wiki { grid-template-columns: 1fr; } }
.wside { position: sticky; top: 8px; max-height: calc(100vh - 24px); overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: var(--card); }
.wside input[type=search] { width: 100%; margin: 8px 0; }
.wmain { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 14px 18px; min-height: 240px; }
.wmain h2 { margin-bottom: 6px; }
.wcat summary { cursor: pointer; font-weight: 600; padding: 4px 0; color: var(--ink); }
.wcount { margin-inline-start: .25em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wrow { padding: 3px 8px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.wrow:hover { background: var(--paper2); }
.wrow.on { background: var(--chip); font-weight: 600; }
.wrow.locked { color: var(--ink2); cursor: default; }
a.wl, .about a { color: var(--link); cursor: pointer; text-decoration: underline dotted; }
.wrap { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tagbar { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.chipbtn { font-size: 12px; padding: 0 8px; border-radius: 10px; background: var(--chip); border: 1px solid transparent; }
.chipbtn.on { background: var(--stamp); color: #fff; }
.mapwrap { position: relative; }
.zoombtns { position: absolute; top: 8px; right: 8px; display: grid; gap: 4px; }
.zoombtns button { width: 30px; padding: 2px 0; }
svg.map { touch-action: none; cursor: grab; }
svg.map .land polygon { vector-effect: non-scaling-stroke; }
svg.map .grid line { vector-effect: non-scaling-stroke; }
svg.map .pt text { font-size: 5px; }
svg.map .pt .dot { r: 3px; stroke-width: 1.2px; }
.evrow { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; margin: 4px 0; cursor: pointer; background: var(--card); }
.evrow.on { border-color: var(--stamp); box-shadow: 0 0 0 1px var(--stamp) inset; }
svg.map .pt .city { display: none; }
svg.map.labels .pt .city { display: block; }
@media (hover: hover) {
  svg.map .pt:hover .city { display: block; }
}

svg .pt.sel .dot { fill: var(--stamp); transform: scale(1.25); }
.lbox { border: 1px solid var(--line); border-radius: 6px; background: var(--card); display: flex; flex-direction: column; overflow: hidden; }
.lpin { background: var(--paper2); border-bottom: 2px solid var(--stamp); }
.lpintitle { font-size: 11px; color: var(--stamp); padding: 2px 8px 0; letter-spacing: .1em; }
.lscroll { overflow: auto; }
.lscroll.pad { padding: 8px 12px; }
.ltable { table-layout: fixed; width: 100%; font-size: 13px; }
.ltable th { position: sticky; top: 0; background: var(--paper2); z-index: 1; }
.ltable td { vertical-align: middle; overflow: hidden; }
.ltable tr.dim { opacity: .7; }
.sortbtn { border: none; background: transparent; padding: 0; font-weight: 600; color: var(--ink2); }
.sortbtn:hover { color: var(--stamp); }
.lfoot { padding: 6px 10px; border-top: 1px solid var(--line); background: var(--paper2); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.oneline { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
#tip { position: fixed; display: none; z-index: 50; max-width: 320px; background: var(--ink); color: var(--paper); padding: 6px 10px; border-radius: 6px; font-size: 12px; line-height: 1.5; white-space: pre-line; pointer-events: none; }
a.chip.tr { cursor: pointer; text-decoration: none; color: inherit; }
a.chip.tr:hover { background: var(--stamp); color: #fff; }
.tagfold summary { cursor: pointer; color: var(--blue); font-size: 13px; padding: 2px 0; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 24px; padding: 0; }

#clock .day { font: 600 14px "Noto Serif SC", serif; white-space: nowrap; }
.badge { display: inline-block; margin-left: 5px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--stamp); color: #fff; font-size: 11px; text-align: center; line-height: 18px; animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .45; } }
.pulse { animation: blink 1.2s ease-in-out infinite; }
button.alert { box-shadow: 0 0 0 0 var(--stamp); animation: ring 1.6s ease-out infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(179, 56, 44, .6); } 100% { box-shadow: 0 0 0 10px rgba(179, 56, 44, 0); } }
@media (prefers-reduced-motion: reduce) { .badge, .pulse, button.alert { animation: none; } }
.favor { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.fbar { display: inline-block; width: 40px; height: 6px; background: var(--chip); border-radius: 3px; overflow: hidden; }
.fbar i { display: block; height: 100%; background: var(--stamp); }
ul.stages { list-style: none; padding: 0; margin: 4px 0; }
ul.stages li { padding: 2px 0 2px 18px; position: relative; font-size: 14px; }
ul.stages li::before { content: "○"; position: absolute; left: 0; color: var(--ink2); }
ul.stages li.done::before { content: "●"; color: var(--good); }
ul.stages li.cur::before { content: "▶"; color: var(--stamp); }
ul.stages li.dim { color: var(--ink2); }
#music { display: flex; align-items: center; gap: 4px; }
#music .ico { border-color: transparent; background: transparent; padding: 2px 5px; font-size: 14px; line-height: 1.4; }
#music .ico:hover { background: var(--card); }
#music .trk { font-size: 12px; color: var(--ink2); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 4px; }
@media (max-width: 1320px) { #music .trk { display: none; } }
.small { font-size: 12px; }
.settings .srow { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 0; border-bottom: 1px dotted var(--line); }
.settings .slabel { flex: 1; }
.settings .sctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.settings h4 { margin: 18px 0 4px; font-family: "Noto Serif SC", serif; }
.settings input[type=range] { width: 160px; accent-color: var(--stamp); }
.share canvas { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
.share-actions { margin: 12px 0; }
#quote { flex: 1 1 160px; min-width: 0; font: italic 13px/1.45 "Noto Serif SC", serif; color: var(--ink2); overflow-wrap: anywhere; transition: opacity .6s; }
#quote.fade { opacity: 0; }
#quote .quote-source { display: inline-block; max-width: 100%; color: var(--link); font-size: 12px; font-style: normal; text-decoration: underline dotted; }
#clock { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
#clock .chipwrap:empty { display: none; }
#clock .ctl { display: flex; align-items: center; gap: 8px; }
#clock select.spd { padding: 3px 4px; }
#clock .autochk { display: flex; flex-direction: column; font-size: 12px; line-height: 1.3; }
#clock .autochk label { cursor: pointer; white-space: nowrap; }
#clock .autochk input { margin: 0 3px 0 0; vertical-align: -2px; accent-color: var(--stamp); }
#tabs .ic { font-size: 16px; }
#tabs .navbtns { display: inline-flex; gap: 2px; margin-right: 10px; }
#tabs .navbtns button { min-width: 0; padding: 4px 10px; font-size: 13px; }
@media (max-width: 560px) { #tabs button { flex: 1 1 0; min-width: 0; padding: 4px 4px; } #tabs .tx { display: none; } }
@media (max-width: 760px) { #quote { order: 1; flex: 1 0 100%; } }

/* the dispatch desk: story, who goes, what they carry */
.cols3 { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 980px) { .cols3 { grid-template-columns: 1fr; } }
.pickrow { padding: 8px 6px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.pickrow.on { background: var(--paper2); }
.cand { display: flex; flex-direction: column; gap: 6px; }
.candname { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.skin { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--ink2); display: inline-block; }
.traitline { font-size: 13px; line-height: 1.45; }
.traitline .pro { color: var(--pin); }
.traitline .con { color: var(--stamp); }

/* the story beside the map, who goes and what they carry in a half each */
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 980px) { .cols2 { grid-template-columns: 1fr; } }
.logtable td, .logtable th { padding: 6px 8px; }
.logtable { overflow-wrap: anywhere; }
.log-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.logtable .outrow { background: var(--paper2); }

/* the events of the picked place under the map, next to its story */
.cols2.below { margin-top: 12px; align-items: start; }
.cols2.below .storycol .lscroll { max-height: 520px !important; }

/* the events of a place as an accordion */
.evitem { margin-bottom: 4px; }
.evcaret { display: inline-block; width: 1em; color: var(--ink2); }
.evstory { margin: 4px 0 8px; }
.evstory .lscroll { max-height: 560px !important; }
/* who goes and what they carry are two boxes of one height, the employees as compact two line cards */
.desk .lbox { height: 340px; display: flex; flex-direction: column; }
.desk .lbox .lscroll { flex: 1; max-height: none !important; }
.pickrow { gap: 2px; padding: 6px 6px; }
.pickrow .pr1, .pickrow .pr2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pickrow .pr2 { font-size: 13px; }
.grow { flex: 1; }
.pickrow .pr1 { flex-wrap: nowrap; align-items: flex-start; }
.pickrow .pstats { font-size: 12px; flex: 1 1 0; min-width: 0; line-height: 1.35; }

@media (max-width: 760px) { #office-status { margin-left: 0; width: 100%; } }

/* stars: bronze, silver, gold */
.stars { letter-spacing: 1px; white-space: nowrap; }
.stars.s0 { color: var(--ink2); opacity: .6; }
.stars.s1 { color: #b0783a; }
.stars.s2 { color: #8f9aa6; }
.stars.s3 { color: #d4a017; }
.pt.star1 .dot { fill: #b0783a; }
.pt.star2 .dot { fill: #8f9aa6; }
.pt.star3 .dot { fill: #d4a017; }
.pt.on .dot, .pt.sel .dot { fill: var(--stamp); }

/* sync points in a report */
.sync { list-style: none; padding: 0; margin: 4px 0 8px; }
.sync li { padding: 3px 0; }
.sync li.hit { color: #8a6a00; font-weight: 600; }
.sync li.miss { color: var(--ink2); }
.tl li.star .what { font-weight: 600; }
.starmark { color: #d4a017; }
.warnline { color: var(--stamp); font-weight: 600; }

/* the log of dispatches scrolls inside its box, the head stays in view */
.logtable thead th { position: sticky; top: 0; background: var(--paper); z-index: 1; }
/* the trips that came home from one place */
.trips { list-style: none; padding: 0; margin: 4px 0 0; }
.trips li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px dotted var(--line, #cdbf9f); }
.trip-controls { justify-content: space-between; }

/* the pop-up over the page: a click on the dark ground closes it */
.modalbg { position: fixed; inset: 0; background: #0007; z-index: 60; overflow: auto; display: flex; padding: 24px 12px; }
body.modal-open { overflow: hidden; }
.mwrap { position: relative; width: min(1000px, 100%); margin: auto; }
.mbox { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.mbox.wide .desk .lbox { height: 300px; }
.mclose { position: absolute; top: 8px; right: 8px; z-index: 2; }
.mwrap:has(.sharebox) { width: min(560px, 100%); }

/* one row is one line in the lists, and the two groups of tabs of the agency page */
.nowrap { white-space: nowrap; }
.ltable td .oneline { display: block; }
/* The event and its paged trip history use the pop-up's scroll area. */
.storyfull .lscroll { max-height: none !important; overflow: visible; }

/* settings and about are pop-ups opened from two icons at the right of the bar */
#tools { display: flex; gap: 4px; }
#tools button { border-color: transparent; background: transparent; font-size: 18px; padding: 2px 8px; }
#tools button:hover { background: var(--card); }

/* the filters are one slim row above the map, the panel of the rest opens in the page, the events of a place fill a grid of columns */
.mapbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 6px; }
.mapbar #map-q { width: 220px; }
.mapbar .check { font-size: 13px; display: inline-flex; gap: 4px; align-items: center; }
.fpanel { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 0 0 6px; padding: 6px 8px; background: var(--paper2); border-radius: 6px; }
.pager { display: flex; justify-content: flex-end; margin: 2px 0 4px; padding: 0 4px; gap: 8px; align-items: center; font-size: 13px; }
.helpq { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; cursor: help; }
svg.map .pt text.cnt { display: block; font-size: 5px; font-weight: 700; }
.evgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 10px; }
.evgrid .evrow { margin: 3px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tally { font-weight: 700; }
a.tallylink { cursor: pointer; text-decoration: none; white-space: nowrap; }
a.tallylink:hover .tally { text-decoration: underline; }
tr.archived td, li.archived, .archived { opacity: .55; }
.logbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 0 4px; }
.logbar .pager { margin: 0; }
.logtools { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.logtools .check { font-size: 13px; display: inline-flex; gap: 4px; align-items: center; }

/* the wiki in a pop-up: the list keeps to the height of the screen, the article runs on */
.wikibox .wside { max-height: 78vh; overflow: auto; position: sticky; top: 0; }

/* settings and about are pop-ups that fit their text, centred, not a narrow column at the left of a wide box */
.mwrap:has(.mbox.narrow) { width: min(820px, 100%); }
.mbox .about { max-width: none; }

/* the filter of a table is its own row above the table */
.lfilterbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.lfilterbar .fq { width: 150px; }

/* the star of the five attributes */
.radarwrap { float: right; margin: 0 0 8px 16px; }
.radar .ring { fill: none; stroke: var(--line); }
.radar .axis { stroke: var(--line); }
.radar .area { fill: color-mix(in srgb, var(--stamp) 28%, transparent); stroke: var(--stamp); stroke-width: 2; }
.radar text { font-size: 11px; fill: var(--ink2); }

/* Employee status cards in two columns, one line per card. */
.pendgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin-bottom: 4px; }
@media (max-width: 760px) { .pendgrid { grid-template-columns: 1fr; } }
.pend { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 8px 10px; background: var(--paper2); border: 1px solid var(--line); border-radius: 6px; min-width: 0; overflow: hidden; white-space: nowrap; }
.pend-person { display: flex; align-items: baseline; gap: 6px; flex: 1 1 0; min-width: min(7em, 25%); }
.pend-staff, .pend-place, .pend-meta > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pend-place { flex: 1 1 0; color: var(--ink2); font-size: 12px; }
.pend-meta { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pend-meta > button { flex: none; }
.pend-status { font-size: 13px; }
.pend-progress { position: absolute; inset: auto 0 0; height: 4px; background: var(--chip); }
.pend-progress > i { display: block; height: 100%; background: var(--link); }
.pend-resting .pend-progress > i { background: var(--warn); }
.pend-ready .pend-progress > i { background: var(--good); }
.pend-ready .pend-status { color: var(--good); font-weight: 600; }

/* the welcome of a new game */
.welcomebox { padding: 0; overflow: hidden; }
.welcome { display: flex; flex-direction: column; max-height: calc(100dvh - 50px); line-height: 1.45; }
.welcome > header { padding: 12px 18px 8px; }
.welcome-content { overflow: auto; padding: 12px 18px; overflow-wrap: anywhere; }
.welcome-content:focus-visible { outline-offset: -2px; }
.welcome-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.welcome-office > section + section { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.welcome h3 { font-size: 15px; margin-bottom: 5px; }
.welcome #welcome-title { font-size: 19px; margin-bottom: 10px; }
.welcome p { margin: 0 0 8px; }
.welcome p.welcome-how { margin-bottom: 16px; }
.welcome p:last-child { margin-bottom: 0; }
.welcome .startplaces { margin: 0 0 8px; padding-inline-start: 1.3em; }
.welcome .startplaces li + li { margin-top: 4px; }
.welcome .startstaff { list-style: none; margin: 0 0 8px; padding: 0; }
.welcome .startstaff li + li { margin-top: 9px; }
.welcome .startstaff li button { min-width: 26px; padding: 0 6px; }
.welcome-notice { border: 1px solid var(--stamp); border-radius: 6px; background: var(--card); padding: 12px 14px; }
.welcome-notice a { color: var(--link); }
.welcome-nav { border-top: 1px solid var(--line); padding: 9px 18px; background: var(--paper2); }
.welcome-nav button { padding: 5px 14px; }
.welcome-nav .primary { margin-inline-start: auto; }
@media (max-width: 600px) {
  .modalbg:has(.welcomebox) { padding: 8px; }
  .welcome { max-height: calc(100dvh - 18px); }
  .welcome-columns { grid-template-columns: 1fr; }
}

/* the day ring in the clock, and the notes that show a return */
#clock .ring { width: 16px; height: 16px; vertical-align: -3px; margin-right: 5px; }
#clock .ring .rb { fill: none; stroke: var(--line, #cdbf9f); stroke-width: 2; }
#clock .ring .rf { fill: none; stroke: var(--stamp); stroke-width: 2; stroke-linecap: round; }
#toasts { position: fixed; right: 14px; bottom: 14px; z-index: 40; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.toast { position: relative; overflow: hidden; pointer-events: auto; background: var(--card, #f8f2e3); border: 1px solid var(--line, #cdbf9f); border-radius: 6px; padding: 7px 10px 9px; box-shadow: 0 2px 8px rgba(0,0,0,.18); font-size: 13px; }
.toast i { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--stamp); transform-origin: left; animation-name: toastbar; animation-timing-function: linear; animation-fill-mode: forwards; }
@keyframes toastbar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
/* the night on the map: a soft shade over the land, under the pins, that never catches a click */
svg.map .night path { fill: #0d1b3d; opacity: .3; pointer-events: none; filter: blur(16px); }
@media (prefers-color-scheme: dark) { svg.map .night path { opacity: .42; } }
:root[data-theme="dark"] svg.map .night path { opacity: .42; }
:root[data-theme="light"] svg.map .night path { opacity: .26; }

/* the status page of an employee */
.mbox table.attrs { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.mbox table.attrs th, .mbox table.attrs td { padding: 2px 6px; }
.mbox table.gear { width: 100%; border-collapse: collapse; }
.mbox table.gear td { padding: 3px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
.mbox b.up { color: var(--ok, #2f7d4a); }

/* the founder form of the welcome pop-up */
.founder-identity { display: grid; gap: 6px; margin-bottom: 10px; }
.founder input[type=text] { width: min(11em, 100%); }
.founder .skinpick { width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 2px solid transparent; margin-right: 3px; vertical-align: middle; }
.founder .skinpick.on { border-color: var(--ink, #2b241b); }
.founderattrs { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.founderattrs li { display: grid; grid-template-columns: minmax(0, 9em) auto 2ch auto; align-items: center; justify-content: start; gap: 4px; }
.founderattrs b { text-align: center; }
.founderattrs button { padding: 0 7px; line-height: 1.3; }
.founder .chip { border: 0; cursor: pointer; margin-bottom: 4px; }
.founder .chip.on { background: var(--ink, #2b241b); color: var(--paper, #f1e8d4); }

/* the portrait on the page of a person */
.personpic { float: right; margin: 0 0 8px 12px; max-width: 34%; }
.personpic img { width: 100%; height: auto; display: block; border: 1px solid var(--ink2); }


/* The settlement at the head of a report: the stars and what the trip brought, a row each, then the echo, the recorded line of the person, large.
   The rows come in one after another and the echo last; --gone is the time already passed, so a page drawn again goes on where it was. */
.settle { margin: 14px 0 6px; }
.settlerows { list-style: none; padding: 0; margin: 0; }
.settlerows li { font-size: 16px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.settlerows li.hit { color: var(--stamp); font-weight: 700; }
.settlerows li.miss { color: var(--ink2); }
.settlerows li.gain { font-size: 14px; }
.settlerows li.shiftrow { border-bottom: none; padding: 12px 0 0; font-size: inherit; }
.echo { margin: 28px auto 10px; max-width: 640px; text-align: center; }
.echo blockquote { margin: 0; font-family: "Noto Serif SC", "Songti SC", SimSun, serif; font-size: 26px; line-height: 1.55; font-weight: 700; color: var(--ink); }
.echo .echosaid { margin-top: 6px; font-size: 13px; color: var(--ink2); }
.echo figcaption { margin-top: 10px; font-size: 13px; color: var(--ink2); }
.echo-sources { margin-top: 6px; overflow-wrap: anywhere; }
.echo-sources summary { cursor: pointer; }
.echo-sources ul { text-align: start; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .echo-sources a[href] { color: var(--link); }
}
:root[data-theme="dark"] .echo-sources a[href] { color: var(--link); }
.settle.moving { cursor: pointer; }
.settle.moving .settlerows li { opacity: 0; animation: settle-in var(--item) ease-out forwards; animation-delay: calc(var(--i) * var(--step) - var(--gone)); }
.settle.moving .echo { opacity: 0; animation: echo-in var(--echo) cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: calc(var(--echo-at) - var(--gone)); }
@keyframes settle-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes echo-in { 0% { opacity: 0; transform: scale(1.12); letter-spacing: .08em; } 55% { opacity: 1; } 100% { opacity: 1; transform: scale(1); letter-spacing: normal; } }
@media (prefers-reduced-motion: reduce) { .settle.moving .settlerows li, .settle.moving .echo { animation: none; opacity: 1; } }
.recordbtn { margin-top: 4px; }
/* the words of a person on their page: an echo not yet heard keeps its place as question marks, with the tier that brings it */
.quotelist { list-style: none; padding: 0; }
.quotelist li { margin: 10px 0; }
.quotelist .q { font-family: "Noto Serif SC", "Songti SC", SimSun, serif; font-size: 16px; }
.quotelist .locked .q { color: var(--ink2); letter-spacing: .2em; }
