:root {
  --bg: #f7f5ee;
  --paper: #fffef9;
  --ink: #263f37;
  --green: #275a48;
  --muted: #7b8477;
  --rust: #9b5d3b;
  --line: #dde2d3;
  --pale: #eaf0e3;
  --serif: "Songti SC", "STSong", Georgia, serif;
  --sans:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  font: 14px/1.85 var(--sans);
  color: var(--ink);
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #65835e;
  outline-offset: 4px;
}
a {
  color: var(--green);
  text-underline-offset: 4px;
}
h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.5;
  margin: 0 0 14px;
}
h1 {
  font-size: 39px;
  letter-spacing: 2px;
}
h2 {
  font-size: 25px;
}
h3 {
  font-size: 20px;
}
h4 {
  font-size: 16px;
}
p {
  margin: 0 0 15px;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 235px;
  padding: 27px 23px;
  background: #eaf0e5;
  border-right: 1px solid #d5dece;
  display: flex;
  flex-direction: column;
  z-index: 10;
}
.brand {
  display: flex;
  gap: 13px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font: 29px var(--serif);
  letter-spacing: 3px;
}
.seal {
  width: 43px;
  height: 47px;
  border: 2px solid var(--rust);
  display: grid;
  place-items: center;
  color: var(--rust);
  border-radius: 3px;
}
.brand small {
  display: block;
  font: 10px var(--sans);
  letter-spacing: 1.3px;
  margin-top: 9px;
}
.sidebar-note {
  font-size: 10px;
  color: var(--muted);
  margin: 24px 0;
  line-height: 1.9;
}
nav {
  display: grid;
  gap: 6px;
}
nav button {
  display: flex;
  gap: 13px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 5px;
  font: 11px Georgia;
  color: #8c9786;
}
nav button span {
  font: 13px var(--sans);
  color: #475d4d;
}
nav button.active {
  background: var(--green);
  color: #ceddca;
}
nav button.active span {
  color: white;
}
.sidebar-context {
  border-top: 1px solid #cfd9c7;
  margin-top: 28px;
  padding-top: 18px;
}
.sidebar-context small {
  color: var(--rust);
  font-size: 10px;
  letter-spacing: 2px;
}
.sidebar-context strong {
  display: block;
  font-family: var(--serif);
  font-size: 19px;
  margin: 7px 0;
}
.sidebar-context p {
  font-size: 11px;
  color: var(--muted);
}
.sidebar-context .btn {
  padding: 5px 8px;
  font-size: 10px;
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 20px;
  font-size: 10px;
}
.sidebar-bottom button {
  font-size: 10px;
  padding: 0;
}
.sidebar-bottom span {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}
.workspace {
  margin-left: 235px;
}
.topbar {
  height: 76px;
  position: sticky;
  top: 0;
  z-index: 9;
  background: #f7f5eef5;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 44px;
}
.topbar > span {
  color: var(--muted);
  font-size: 12px;
}
.search {
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 350px;
  border-radius: 5px;
}
.search > span {
  font-size: 22px;
  line-height: 1;
}
.search input {
  border: 0;
  outline: none;
  background: none;
  width: 100%;
  font-size: 12px;
}
kbd {
  font: 11px var(--sans);
  color: #909889;
  border: 1px solid var(--line);
  padding: 0 5px;
  border-radius: 3px;
}
main {
  max-width: 1550px;
  margin: auto;
  padding: 42px 44px 60px;
  min-height: calc(100vh - 130px);
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--rust);
  margin-bottom: 12px;
  text-transform: uppercase;
}
.lead {
  font-size: 15px;
  color: #6c7b69;
  line-height: 2;
  max-width: 900px;
}
.hero {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 35px;
  padding-bottom: 29px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.hero-side {
  border-left: 1px solid var(--line);
  padding: 6px 0 0 30px;
}
.hero-side strong {
  display: block;
  font: 40px/1.7 var(--serif);
  color: #99aa8c;
  letter-spacing: 4px;
}
.hero-side small {
  color: var(--muted);
  font-size: 10px;
}
.stats {
  display: flex;
  gap: 25px;
  margin-top: 22px;
  font-size: 11px;
  color: var(--muted);
}
.stats strong {
  font: 24px Georgia;
  color: var(--green);
  margin-right: 5px;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.grid4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}
.card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  padding: 23px;
}
.card.clickable {
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: start;
  width: 100%;
}
.card.clickable:hover {
  border-color: #8ca382;
}
.card p {
  font-size: 13px;
  color: #677663;
}
.card h3 {
  font-size: 20px;
}
.card-foot {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  width: 100%;
  justify-content: space-between;
  font-size: 11px;
  color: var(--rust);
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  background: #eaf0e3;
  font-size: 10px;
  color: #58734f;
}
.badge.rust {
  background: #f2e7dd;
  color: var(--rust);
}
.badge.gray {
  background: #efefea;
  color: #7d8578;
}
.date {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 30px 0 17px;
}
.section-head h2 {
  margin: 0;
  font-size: 23px;
}
.link {
  font-size: 12px;
  color: var(--rust);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid #d2ddca;
  background: #fffef9;
  border-radius: 4px;
  font-size: 12px;
}
.btn.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.btn.active {
  background: #e4eddc;
  border-color: #8aa07b;
}
.actions,
.filters,
.chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
  margin: 18px 0;
}
.pill {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 11px;
  padding: 4px 11px;
}
.pill.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.note {
  font-size: 12px;
  line-height: 1.95;
  color: #7c816d;
  border-left: 2px solid #aebe9a;
  padding-left: 13px;
  margin: 18px 0;
}
.callout {
  padding: 23px 27px;
  background: #e9efdf;
  border-radius: 6px;
  border-left: 3px solid #71915d;
  margin: 22px 0;
}
.callout h3 {
  font-size: 22px;
}
.callout p {
  margin: 0;
  line-height: 2;
  font-size: 14px;
  color: #50624a;
}
.back {
  font-size: 12px;
  color: var(--rust);
  padding: 0;
  margin-bottom: 19px;
}
.detail-header {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 25px;
}
.detail-header h1 {
  font-size: 35px;
  margin-top: 12px;
}
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 25px;
}
.reading-body {
  max-width: 920px;
}
.reading-body section {
  border-bottom: 1px solid var(--line);
  padding: 21px 0;
}
.reading-body h2 {
  font-size: 23px;
}
.reading-body p {
  font-size: 15px;
  color: #4c614e;
  line-height: 2.1;
}
.reading-body .num {
  font: 12px Georgia;
  color: var(--rust);
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.reading-body .small {
  font-size: 12px;
}
.detail-aside {
  align-self: start;
  position: sticky;
  top: 100px;
}
.detail-aside .card {
  padding: 19px;
  margin-bottom: 17px;
}
.detail-aside h3 {
  font-size: 17px;
}
.detail-aside p {
  font-size: 12px;
}
.source {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.source a {
  font-size: 13px;
}
.source p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.9;
  margin: 5px 0 0;
}
.event-list .event-row {
  display: grid;
  grid-template-columns: 105px 1fr;
  gap: 18px;
  padding: 21px 0;
  border-bottom: 1px solid var(--line);
}
.event-row .year {
  font: 20px/1.7 Georgia;
  color: var(--rust);
}
.event-row h3 {
  margin: 6px 0 7px;
  font-size: 20px;
}
.event-row p {
  font-size: 13px;
  margin: 0;
  color: #6c7866;
  line-height: 1.95;
}
.event-row .open-event {
  text-align: left;
  display: block;
  width: 100%;
}
.event-badges {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.empty {
  text-align: center;
  padding: 50px 25px;
  color: var(--muted);
}
.result {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.result button {
  display: block;
  text-align: left;
  width: 100%;
}
.result h3 {
  margin: 7px 0;
}
.result p {
  font-size: 13px;
  color: var(--muted);
}
mark {
  background: #f0dfb4;
  color: inherit;
}
.relation-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.relation-row h3 {
  font-size: 21px;
}
.relation-row p {
  font-size: 14px;
  line-height: 2;
  color: #60705b;
}
.relation-pair {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0 12px;
}
.relation-pair b {
  font-size: 13px;
}
.relation-pair span {
  font-size: 11px;
  color: var(--rust);
}
.country-strip {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.country-strip span {
  border: 1px solid var(--line);
  padding: 5px 11px;
  border-radius: 4px;
  font-size: 11px;
  background: #fffef9;
}
.country-strip i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}
.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(255px, 1fr);
  gap: 22px;
}
.map-wrap {
  background: #edf3ef;
  border: 1px solid #d3dfcc;
  border-radius: 6px;
  overflow: hidden;
}
.map-toolbar {
  padding: 12px;
  background: #f8fbf3;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid #dbe4d3;
}
.map-toolbar .btn {
  font-size: 10px;
  padding: 4px 9px;
}
.map-canvas svg {
  display: block;
  width: 100%;
  height: auto;
}
.map-canvas .province {
  fill: #e7eedc;
  stroke: #aebb9e;
  stroke-width: 0.8;
  fill-opacity: 0.65;
}
.map-canvas .territory {
  stroke-width: 2;
  stroke-linejoin: round;
}
.map-canvas .province-name {
  font: 11px var(--sans);
  fill: #91a185;
  paint-order: stroke;
  stroke: #f3f6ec;
  stroke-width: 2px;
  letter-spacing: 1px;
  pointer-events: none;
}
.map-canvas .polity-name {
  font: 22px var(--serif);
  font-weight: 600;
  paint-order: stroke;
  stroke: #fcfaf1;
  stroke-width: 3px;
  letter-spacing: 2px;
  pointer-events: none;
}
.map-canvas .city {
  cursor: pointer;
}
.map-canvas .city .dot {
  stroke: #fff;
  stroke-width: 2;
  fill: #829a76;
}
.map-canvas .city.focus .dot {
  fill: #a9603d;
}
.map-canvas .city.selected .dot {
  fill: #204f42;
}
.map-canvas .city .hit {
  fill: transparent;
  stroke: none;
}
.map-canvas .city text {
  font: 14px var(--sans);
  fill: #526b4e;
  paint-order: stroke;
  stroke: #fffdf7;
  stroke-width: 3px;
  font-weight: 600;
  pointer-events: none;
}
.map-canvas .city.focus text {
  fill: #965132;
}
.map-canvas .city.selected text {
  fill: #204f42;
}
.map-canvas .leader {
  stroke: #9caa8f;
  stroke-width: 0.8;
  fill: none;
  pointer-events: none;
}
.map-canvas .heading {
  font: 17px var(--serif);
  fill: #38553f;
}
.map-canvas .subheading {
  font: 10px var(--sans);
  fill: #83927c;
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 15px;
  padding: 12px 15px;
  background: #f8fbf3;
  border-top: 1px solid #dbe4d3;
  font-size: 10px;
}
.map-legend i {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 5px;
  border-radius: 2px;
  vertical-align: middle;
}
.map-precision {
  padding: 13px 16px;
  background: #f5f0e5;
  border-top: 1px solid #e3dbc8;
  font-size: 11px;
  color: #897b60;
  line-height: 1.9;
}
.year-controls {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  margin: 20px 0;
}
.year-controls input[type="number"] {
  width: 90px;
  border: 1px solid var(--line);
  padding: 6px;
  background: white;
  border-radius: 4px;
}
.year-controls input[type="range"] {
  flex: 1;
  min-width: 150px;
  accent-color: var(--green);
}
.year-chip {
  font: 24px Georgia;
  color: var(--rust);
  min-width: 75px;
}
.year-summary {
  margin-bottom: 20px;
}
.year-summary h2 {
  margin: 0 0 10px;
}
.map-side .card {
  margin-bottom: 18px;
  padding: 20px;
}
.map-side p {
  font-size: 12px;
}
.map-side h3 {
  font-size: 18px;
}
.city-select {
  width: 100%;
  padding: 7px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-bottom: 12px;
}
.local-event {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  width: 100%;
}
.local-event strong {
  display: block;
  font-family: var(--serif);
  font-size: 16px;
  margin-bottom: 4px;
}
.local-event small {
  font-size: 11px;
  color: var(--muted);
}
.era-track {
  display: flex;
  gap: 5px;
  margin: 24px 0;
}
.era-track button {
  background: #edf1e5;
  border-bottom: 3px solid #becdae;
  padding: 10px;
  flex: 1;
  font-size: 11px;
  text-align: left;
}
.era-track button small {
  display: block;
  font-size: 10px;
  color: var(--muted);
}
.faq-card {
  min-height: 190px;
}
.person-card h3 {
  margin: 8px 0 5px;
  font-size: 23px;
}
.person-card .role {
  color: var(--rust);
  font-size: 11px;
  margin-bottom: 12px;
}
.gloss-item {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.gloss-item h3 {
  font-size: 22px;
}
.gloss-item p {
  font-size: 14px;
  line-height: 2;
  color: #5a6d55;
}
.gloss-item .confusion {
  font-size: 12px;
  background: #f1f0e7;
  padding: 10px 13px;
  border-radius: 4px;
}
.mini-routes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}
.mini-routes button {
  padding: 17px;
  background: #edf1e5;
  border-radius: 5px;
  text-align: left;
}
.mini-routes strong {
  display: block;
  font-family: var(--serif);
  font-size: 18px;
  margin-bottom: 6px;
}
.mini-routes small {
  color: var(--muted);
  font-size: 11px;
}
.wide-table {
  width: 100%;
  border-collapse: collapse;
  background: #fffef9;
  font-size: 12px;
}
.wide-table td,
.wide-table th {
  border: 1px solid var(--line);
  padding: 14px;
  text-align: left;
  vertical-align: top;
}
.wide-table th {
  background: #edf1e5;
  font-weight: 500;
}
.table-scroll {
  overflow: auto;
}
.license {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 10px;
  background: #f0f1e8;
  padding: 14px;
}
.reading .reading-body p {
  font-size: 18px;
  line-height: 2.2;
}
footer {
  border-top: 1px solid var(--line);
  padding: 18px 44px;
  font-size: 10px;
  color: #84907b;
}
footer span {
  margin-left: 20px;
}
#toast {
  position: fixed;
  left: 55%;
  bottom: 30px;
  transform: translateX(-50%);
  background: var(--green);
  color: white;
  padding: 9px 20px;
  border-radius: 5px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
}
#toast.show {
  opacity: 1;
}
@media (min-width: 1700px) {
  main {
    padding-top: 52px;
  }
  .hero h1 {
    font-size: 45px;
  }
}
@media (max-width: 1200px) {
  .sidebar {
    width: 210px;
    padding: 23px 17px;
  }
  .workspace {
    margin-left: 210px;
  }
  .topbar {
    padding: 0 28px;
  }
  main {
    padding: 32px 28px;
  }
  .grid4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .map-layout {
    grid-template-columns: 1fr;
  }
  .detail-grid {
    grid-template-columns: minmax(0, 1fr) 235px;
  }
  .hero {
    grid-template-columns: 1fr 190px;
  }
  .hero-side {
    padding-left: 20px;
  }
  .hero-side strong {
    font-size: 32px;
  }
}
@media (max-width: 850px) {
  .sidebar {
    position: static;
    width: 100%;
    padding: 16px;
  }
  .brand {
    font-size: 25px;
  }
  .sidebar-note,
  .sidebar-context,
  .sidebar-bottom {
    display: none;
  }
  nav {
    display: flex;
    overflow: auto;
    margin-top: 16px;
  }
  nav button {
    padding: 8px;
    white-space: nowrap;
  }
  nav button span {
    font-size: 11px;
  }
  .workspace {
    margin: 0;
  }
  .topbar {
    height: 65px;
    padding: 0 18px;
  }
  .topbar > span {
    display: none;
  }
  .search {
    width: 100%;
  }
  main {
    padding: 24px 18px;
  }
  .hero {
    grid-template-columns: 1fr;
  }
  .hero-side {
    display: none;
  }
  h1 {
    font-size: 32px;
  }
  .grid3,
  .grid2,
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .detail-aside {
    position: static;
  }
  .mini-routes {
    grid-template-columns: 1fr;
  }
  .stats {
    gap: 17px;
  }
  .event-list .event-row {
    grid-template-columns: 70px 1fr;
    gap: 10px;
  }
  .event-row .year {
    font-size: 16px;
  }
  .relation-row {
    grid-template-columns: 65px 1fr;
    gap: 12px;
  }
  .era-track {
    overflow: auto;
  }
  .era-track button {
    min-width: 110px;
  }
  .detail-header h1 {
    font-size: 29px;
  }
  .wide-table {
    min-width: 660px;
  }
  footer {
    padding: 18px;
  }
  footer span {
    display: block;
    margin: 0;
  }
}
@media print {
  .sidebar,
  .topbar,
  footer,
  .actions,
  .back {
    display: none;
  }
  .workspace {
    margin: 0;
  }
  main {
    padding: 0;
    max-width: none;
  }
  .detail-grid {
    display: block;
  }
  .detail-aside {
    position: static;
  }
  .card {
    break-inside: avoid;
  }
  body {
    background: white;
  }
  .reading-body {
    max-width: none;
  }
}
.event-row .year small {
  display: block;
  font-size: 13px;
  color: #9a967f;
  line-height: 1.5;
}
.event-row p.date {
  font-size: 11px;
  line-height: 1.85;
  color: #8b917f;
  margin: 0 0 7px;
}
.map-canvas .polity-name {
  font-size: 20px;
}
.map-canvas .territory {
  fill-rule: evenodd;
}
