:root.ch,
:root.ch[data-theme] {
  color-scheme: light;
  --bg: #f1e7cf;
  --ink: #3a2a1b;
  --accent: #3a2a1b;
  --chevron: #3a2a1b;
  --rule: #3a2a1b;
  --ch-muted: rgba(58, 42, 27, 0.74);
  --ch-faint: rgba(58, 42, 27, 0.3);
  --ch-btn-hover: rgba(58, 42, 27, 0.08);
  --ch-serif: "IM Fell English", "Old Standard TT", Georgia, "Times New Roman", serif;
  --ch-num: "Old Standard TT", Georgia, "Times New Roman", serif;
  --ch-ocean: #b4c8c4;
  --ch-ocean-deep: #9db6b6;
  --ch-grat: rgba(84, 60, 38, 0.3);
  --ch-limb: #3a2a1b;
  --ch-glow: rgba(58, 42, 27, 0.16);
  --ch-border: #45301f;
  --ch-label: #3a2a1b;
  --ch-label-halo: rgba(243, 234, 211, 0.78);
  --ch-people: #6b5238;
  --ch-city: #4a3322;
  --ch-town: #5c4430;
  --ch-city-ring: #f3ead3;
  --ch-city-halo: rgba(243, 234, 211, 0.62);
  --ch-division: rgba(92, 64, 38, 0.62);
  --ch-front: #6e1d14;
  --ch-division-label: rgba(84, 60, 38, 0.8);
  --ch-select: #8c2a1a;
  --ch-hover: rgba(58, 42, 27, 0.1);
  --ch-paper: #f3ead3;
  --ch-people-fill: #ece0c4;
  --ch-water: rgba(52, 82, 90, 0.5);
  --ch-sea-label: rgba(38, 58, 66, 0.95);
  --ch-river: rgba(38, 88, 138, 0.9);
  --ch-c0: #f1e2ae;
  --ch-c1: #f0d5ae;
  --ch-c2: #e7d6b9;
  --ch-c3: #f0cbb9;
  --ch-c4: #eed0d8;
  --ch-c5: #e0d5e7;
  --ch-c6: #d4ddea;
  --ch-c7: #c9c3e3;
  --ch-c8: #d6e4ce;
  --ch-c9: #e5e8bf;
  --ch-b0: #c39a2e;
  --ch-b1: #c47a3c;
  --ch-b2: #957049;
  --ch-b3: #bd5a43;
  --ch-b4: #b45f7f;
  --ch-b5: #8768a6;
  --ch-b6: #5f7db0;
  --ch-b7: #5b5aa0;
  --ch-b8: #5f945a;
  --ch-b9: #8f9c3a;
  --ch-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.32 0 0 0 0 0.2 0 0 0 0.34 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --ch-corner: rgba(58, 42, 27, 0.72);
  --ch-lift: 0 1px 2px rgba(58, 42, 27, 0.14), 0 4px 12px -5px rgba(58, 42, 27, 0.3);
  --ch-gap: 10px;
  --ch-bar: 54px;
  --ch-seg: 44px;
  --ch-time-h: 80px;
}

body.ch-page {
  margin: 0;
  padding: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  background: radial-gradient(ellipse at 50% 45%, #f5ecd5 0%, #ecdfc0 60%, #dcc79d 100%);
  color: var(--ink);
  font-family: var(--ch-serif);
}

.ch-page .ch-globe,
.ch-page .ch-ctl,
.ch-page .ch-step,
.ch-page .ch-about-btn {
  -webkit-tap-highlight-color: transparent;
}

.ch-globe {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.ch-globe:active {
  cursor: grabbing;
}

.ch-globe.is-over {
  cursor: pointer;
}

.ch-globe:focus-visible {
  outline: none;
}

.ch-frame,
.ch-card,
.ch-time,
.ch-tip,
.ch-hover-tip,
.ch-load,
.ch-about-tip,
.ch-layers,
.ch-key {
  background-color: var(--bg);
  background-image: var(--ch-grain);
  background-size: 260px 260px;
}

.ch-frame,
.ch-card,
.ch-about-tip,
.ch-layers,
.ch-key {
  border: 1px solid var(--rule);
  box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px var(--ch-faint), var(--ch-lift);
}

.ch-top {
  position: fixed;
  z-index: 30;
  top: calc(var(--ch-gap) + env(safe-area-inset-top, 0px));
  left: calc(var(--ch-gap) + env(safe-area-inset-left, 0px));
  right: calc(var(--ch-gap) + env(safe-area-inset-right, 0px));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--ch-gap);
  pointer-events: none;
}

.ch-top > * {
  pointer-events: auto;
}

.ch-frame {
  box-sizing: border-box;
  height: var(--ch-bar);
}

.ch-head {
  grid-column: 1;
  position: relative;
  display: flex;
  align-items: stretch;
  min-width: 0;
  padding: 0 4px 0 0;
}

.ch-head-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 0 24px 1px 28px;
  text-align: center;
}

.ch-title {
  margin: 0;
  font-size: 25px;
  font-weight: 400;
  letter-spacing: 0.34em;
  line-height: 1;
  padding-left: 0.34em;
}

.ch-about {
  position: static;
  display: flex;
}

.ch-ctls {
  grid-column: 3;
  justify-self: end;
  position: relative;
  display: flex;
  padding: 4px;
}

.ch-ctl,
.ch-step {
  position: relative;
  padding: 0;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.ch-ctl {
  flex: 0 0 auto;
  width: var(--ch-seg);
  height: 100%;
  border: 0;
  background: none;
}

.ch-head .ch-ctl,
.ch-ctl + .ch-ctl {
  border-left: 1px solid var(--ch-faint);
}

.ch-head .ch-ctl {
  margin: 4px 0;
  height: auto;
}

.ch-step {
  width: 34px;
  height: 34px;
  border: 1px solid var(--rule);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 3.6px 3.6px, var(--ch-corner) 0.95px, transparent 1.35px),
    radial-gradient(circle at calc(100% - 3.6px) 3.6px, var(--ch-corner) 0.95px, transparent 1.35px),
    radial-gradient(circle at 3.6px calc(100% - 3.6px), var(--ch-corner) 0.95px, transparent 1.35px),
    radial-gradient(circle at calc(100% - 3.6px) calc(100% - 3.6px), var(--ch-corner) 0.95px, transparent 1.35px),
    var(--ch-grain);
  background-size: auto, auto, auto, auto, 260px 260px;
}

.ch-ctl svg,
.ch-step svg {
  display: block;
  margin: 0 auto;
}

.ch-ico .h {
  stroke-width: 0.8;
}

.ch-ico .f {
  fill: currentColor;
  stroke: none;
}

.ch-ctl::after {
  content: "";
  position: absolute;
  inset: 2px;
  pointer-events: none;
}

.ch-ctl:hover::after,
.ch-ctl[aria-expanded="true"]::after,
.ch-about.is-open .ch-ctl::after {
  box-shadow: inset 0 0 0 0.7px rgba(58, 42, 27, 0.75);
  background: var(--ch-btn-hover);
}

.ch-ctl[aria-expanded="true"]::after,
.ch-about.is-open .ch-ctl::after {
  background: rgba(58, 42, 27, 0.13);
}

.ch-step:hover {
  box-shadow: inset 0 0 0 2px #ebdfc2, inset 0 0 0 2.7px rgba(58, 42, 27, 0.75);
}

.ch-ctl:focus-visible,
.ch-step:focus-visible,
.ch-card-close:focus-visible {
  outline: 1.5px solid var(--ink);
  outline-offset: -5px;
}

.ch-step:focus-visible {
  outline-offset: 2px;
}

.ch-step:disabled {
  color: var(--ch-faint);
  cursor: default;
  box-shadow: none;
}

.ch-ctl[aria-pressed="true"] .ch-icon-flat,
.ch-ctl[aria-pressed="false"] .ch-icon-globe,
.ch-play[aria-pressed="true"] .ch-icon-play,
.ch-play[aria-pressed="false"] .ch-icon-pause {
  display: none;
}

.ch-play[aria-pressed="true"] {
  box-shadow: inset 0 0 0 2px #ebdfc2, inset 0 0 0 2.7px rgba(58, 42, 27, 0.75);
}

.ch-about-tip,
.ch-layers {
  position: absolute;
  top: calc(100% + 9px);
  right: -5px;
  z-index: 7;
  box-sizing: border-box;
  color: var(--ch-muted);
  text-align: left;
}

.ch-about-tip {
  display: none;
  left: -1px;
  right: auto;
  width: min(360px, calc(100vw - 48px));
  padding: 13px 16px 9px;
  font-size: 13px;
  line-height: 1.45;
}

.ch-about-tip::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 14px;
}

.ch-about-tip p {
  margin: 0 0 7px;
}

.ch-about-tip a {
  color: var(--ink);
}

.ch-about-tip .ch-sources {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--rule) 30%, transparent);
}

.ch-about-tip .ch-keys {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--rule) 30%, transparent);
  font-size: 12px;
}

.ch-about-tip .ch-keys-head {
  margin: 0 0 5px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ch-muted);
}

.ch-about-tip .ch-keys dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 0;
  align-items: baseline;
}

.ch-about-tip .ch-keys dt {
  white-space: nowrap;
}

.ch-about-tip .ch-keys dd {
  margin: 0;
}

.ch-about-tip kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0 4px;
  border: 1px solid color-mix(in srgb, var(--rule) 45%, transparent);
  border-radius: 3px;
  font: inherit;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.ch-about-tip .ch-donate {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--ink);
  font-size: 11px;
  letter-spacing: 0.1em;
  line-height: 1.6;
  text-decoration: none;
}

.ch-about-tip .ch-donate:hover,
.ch-about-tip .ch-donate:focus-visible {
  background: var(--ink);
  color: var(--bg);
}

.ch-about:hover .ch-about-tip,
.ch-about:focus-within .ch-about-tip,
.ch-about.is-open .ch-about-tip {
  display: block;
}

.ch-about.is-shut .ch-about-tip {
  display: none;
}

.ch-layers {
  right: -1px;
  width: 236px;
  padding: 12px 16px 12px;
  font-size: 14.5px;
  line-height: 1.3;
}

.ch-layers[hidden] {
  display: none;
}

.ch-search {
  position: absolute;
  top: calc(100% + 9px);
  right: -1px;
  z-index: 7;
  box-sizing: border-box;
  width: 300px;
  max-width: calc(100vw - 2 * var(--ch-gap));
  padding: 12px 14px 10px;
  border: 1px solid var(--rule);
  box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px var(--ch-faint), var(--ch-lift);
  background-color: var(--bg);
  background-image: var(--ch-grain);
  background-size: 260px 260px;
  color: var(--ink);
  text-align: left;
  font-size: 14.5px;
  line-height: 1.3;
}

.ch-search[hidden] {
  display: none;
}

.ch-search .ch-layers-title {
  display: block;
  margin-bottom: 7px;
}

.ch-search-input {
  box-sizing: border-box;
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: color-mix(in srgb, var(--bg) 70%, #fff);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.ch-search-input:focus-visible {
  outline: 2px solid var(--ch-select, #8c2a1a);
  outline-offset: 1px;
}

.ch-search-list {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.ch-search-hit {
  display: flex;
  flex-direction: column;
  padding: 5px 7px;
  cursor: pointer;
}

.ch-search-hit small {
  color: var(--ch-muted);
  font-size: 12.5px;
}

.ch-search-hit.is-on,
.ch-search-hit:hover {
  background: color-mix(in srgb, var(--rule) 9%, transparent);
}

.ch-search-none {
  margin: 8px 2px 2px;
  color: var(--ch-muted);
  font-size: 13px;
}

.ch-ctl:disabled {
  cursor: default;
  opacity: 0.4;
}

.ch-layers-title {
  margin: 0 0 2px;
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ch-muted);
}

.ch-layer-set {
  margin: 0;
  padding: 6px 0 2px;
  border: 0;
}

.ch-layer-set + .ch-layer-set {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--rule) 30%, transparent);
}

.ch-layer-set legend {
  float: left;
  width: 100%;
  margin: 0 0 3px;
  padding: 0;
  font-size: 13px;
  font-style: italic;
  color: var(--ch-muted);
}

.ch-layer {
  clear: both;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  color: var(--ink);
  cursor: pointer;
}

.ch-layer input {
  flex: 0 0 auto;
  position: relative;
  width: 15px;
  height: 15px;
  margin: 0;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ch-paper);
  box-shadow: inset 0 0 0 2px var(--ch-paper), inset 0 0 0 2.6px var(--ch-faint);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.ch-layer input:checked {
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M3.4 8.4 6.6 11.6 12.8 3.6' fill='none' stroke='%233a2a1b' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / 13px 13px no-repeat var(--ch-paper);
  box-shadow: none;
}

.ch-layer input:focus-visible {
  outline: 1.5px solid var(--ink);
  outline-offset: 2px;
}

.ch-save {
  width: 276px;
  max-width: calc(100vw - 2 * var(--ch-gap));
}

.ch-save-btn {
  display: block;
  width: 100%;
  margin: 8px 0 4px;
  padding: 7px 10px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: color-mix(in srgb, var(--bg) 70%, #fff);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--bg) 70%, #fff), inset 0 0 0 2.6px var(--ch-faint);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  cursor: pointer;
}

.ch-save-btn:hover:not(:disabled) {
  background: var(--ch-paper);
}

.ch-save-btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.ch-save-btn:focus-visible,
.ch-save-input:focus-visible,
.ch-save-cancel:focus-visible {
  outline: 1.5px solid var(--ink);
  outline-offset: 2px;
}

.ch-save-set {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--rule) 30%, transparent);
}

.ch-save-row {
  clear: both;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  color: var(--ink);
}

.ch-save-row label {
  font-size: 13.5px;
}

.ch-save-input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 4px 7px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: color-mix(in srgb, var(--bg) 70%, #fff);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
}

select.ch-save-input {
  padding-right: 4px;
}

.ch-save-input:disabled {
  opacity: 0.55;
}

.ch-save-note {
  clear: both;
  min-height: 1.3em;
  margin: 6px 0 0;
  color: var(--ch-muted);
  font-size: 12.5px;
  line-height: 1.35;
}

.ch-save-prog {
  margin: 8px 0 2px;
}

.ch-save-prog[hidden] {
  display: none;
}

.ch-save-prog progress {
  display: block;
  width: 100%;
  height: 8px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: color-mix(in srgb, var(--bg) 70%, #fff);
  -webkit-appearance: none;
  appearance: none;
}

.ch-save-prog progress::-webkit-progress-bar {
  background: color-mix(in srgb, var(--bg) 70%, #fff);
}

.ch-save-prog progress::-webkit-progress-value {
  background: var(--ink);
}

.ch-save-prog progress::-moz-progress-bar {
  background: var(--ink);
}

.ch-save-progrow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 5px;
  color: var(--ch-muted);
  font-size: 12.5px;
}

.ch-save-cancel {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* While a video is being made, the map and the timeline are left alone, so every frame is framed the same. */
:root.ch-exporting .ch-globe,
:root.ch-exporting .ch-time,
:root.ch-exporting .ch-year-box,
:root.ch-exporting #search-btn,
:root.ch-exporting #flat-btn,
:root.ch-exporting #layers-btn,
:root.ch-exporting .ch-head {
  pointer-events: none;
}

.ch-layer:hover span {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.ch-layer input:not(:checked) + span {
  color: var(--ch-muted);
}

.ch-time {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 22px;
  box-sizing: border-box;
  padding: 12px calc(20px + env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) calc(20px + env(safe-area-inset-left, 0px));
  border-top: 1px solid var(--rule);
  box-shadow: inset 0 3px 0 var(--bg), inset 0 4px 0 var(--ch-faint), 0 -4px 12px -6px rgba(58, 42, 27, 0.3);
}

.ch-when {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ch-step {
  width: 34px;
  height: 34px;
}

.ch-play-back .ch-icon-play {
  transform: scaleX(-1);
}

/* The date sits at the top, in the middle of the page, in a frame like the title's. */
.ch-top > .ch-year-box {
  position: absolute;
  top: 0;
  left: 50%;
  translate: -50% 0;
  display: flex;
  align-items: center;
  width: 210px;
  padding: 0 12px;
}

.ch-year {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px dotted transparent;
  background: none;
  color: var(--ink);
  font-family: var(--ch-num);
  font-size: 19px;
  letter-spacing: 0.02em;
  line-height: 1.66;
  text-align: center;
  font-variant-numeric: oldstyle-nums;
}

.ch-year:hover {
  border-bottom-color: var(--ch-muted);
}

.ch-year:focus {
  outline: none;
  border-bottom: 1px solid var(--ink);
}

.ch-track {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 56px;
}

.ch-ticks {
  position: absolute;
  left: 9px;
  right: 9px;
  top: 14px;
  height: 18px;
  border-top: 1.5px solid var(--ink);
  pointer-events: none;
}

.ch-ticks::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 3px;
  height: 1px;
  background: var(--ink);
}

.ch-ticks span {
  position: absolute;
  top: 4px;
  width: 1px;
  height: 7px;
  margin-left: -0.5px;
  background: var(--ink);
}

.ch-ticks span.is-major {
  height: 11px;
}

.ch-ticks span.is-map {
  top: -6px;
  height: 5px;
  width: 3px;
  margin-left: -1.5px;
  background: var(--ch-muted);
}

.ch-ticks span.is-change {
  top: -4px;
  height: 3px;
  width: 1px;
  margin-left: -0.5px;
  background: var(--ch-muted);
  opacity: 0.55;
}

.ch-ticks span.is-map.is-now {
  background: var(--ch-select);
}

.ch-ticks span.is-change.is-now {
  top: -6px;
  height: 5px;
  background: var(--ch-select);
  opacity: 1;
}

.ch-eras {
  position: absolute;
  left: 9px;
  right: 9px;
  top: 32px;
  height: 18px;
  pointer-events: none;
}

.ch-ticks,
.ch-eras {
  clip-path: inset(-12px 0 -12px 0);
}

.ch-eras {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 22px, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 22px, #000 calc(100% - 22px), transparent);
}

.ch-strip {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  will-change: transform;
}

.ch-eras span {
  position: absolute;
  translate: -50% 0;
  font-family: var(--ch-num);
  font-size: 11.5px;
  color: var(--ch-muted);
  white-space: nowrap;
  font-variant-numeric: oldstyle-nums;
}

.ch-range {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  width: 100%;
  height: 34px;
  margin: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.ch-range::-webkit-slider-runnable-track {
  height: 34px;
  background: none;
}

.ch-range::-moz-range-track {
  height: 34px;
  background: none;
}

.ch-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 30px;
  margin-top: 2px;
  border: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 30'><path d='M9 1v28' stroke='%238c2a1a' stroke-width='1.6'/><path d='M3 4h12L9 13z' fill='%238c2a1a'/></svg>") center / 18px 30px no-repeat;
  cursor: grab;
}

.ch-range::-moz-range-thumb {
  width: 18px;
  height: 30px;
  border: 0;
  border-radius: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 30'><path d='M9 1v28' stroke='%238c2a1a' stroke-width='1.6'/><path d='M3 4h12L9 13z' fill='%238c2a1a'/></svg>") center / 18px 30px no-repeat;
  cursor: grab;
}

.ch-range.is-off::-webkit-slider-thumb {
  visibility: hidden;
}

.ch-range.is-off::-moz-range-thumb {
  visibility: hidden;
}

/* On touch screens the bar is swiped and the marker dragged by app.js, not by the range input. */
@media (hover: none) and (pointer: coarse) {
  .ch-range {
    pointer-events: none;
  }

  .ch-track {
    touch-action: none;
  }
}

.ch-range:focus {
  outline: none;
}

.ch-range:focus-visible {
  outline: 1px dotted var(--ink);
  outline-offset: 2px;
}

.ch-key {
  position: fixed;
  z-index: 21;
  left: calc(var(--ch-gap) + env(safe-area-inset-left, 0px));
  bottom: calc(var(--ch-time-h) + var(--ch-gap));
  box-sizing: border-box;
  max-width: calc(100vw - 2 * var(--ch-gap));
  color: var(--ink);
}

.ch-key-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  margin: 0;
  padding: 6px 12px 6px 13px;
  border: 0;
  background: none;
  color: var(--ch-muted);
  font: inherit;
  font-size: 12.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ch-key-btn svg {
  flex: 0 0 auto;
  margin-left: auto;
  transition: rotate 0.15s;
}

.ch-key-btn[aria-expanded="true"] svg {
  rotate: 180deg;
}

.ch-key-btn:hover {
  color: var(--ink);
}

.ch-key-btn:focus-visible {
  outline: 1.5px solid var(--ink);
  outline-offset: -4px;
}

.ch-key-list {
  margin: 0 4px;
  padding: 1px 10px 9px 8px;
  list-style: none;
  border-top: 1px solid color-mix(in srgb, var(--rule) 30%, transparent);
}

.ch-key-list[hidden],
.ch-key-row[hidden] {
  display: none;
}

.ch-key-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 0 2px;
  font-size: 13.5px;
  line-height: 1.2;
}

.ch-key-row small {
  display: block;
  max-width: 200px;
  margin-top: 1px;
  font-size: 11.5px;
  font-style: italic;
  line-height: 1.25;
  color: var(--ch-muted);
}

.ch-key-it {
  font-style: italic;
}

.ch-key-sample {
  flex: 0 0 auto;
  display: block;
  align-self: flex-start;
  margin-top: 0.5px;
  outline: 1px solid var(--ch-faint);
  outline-offset: -0.5px;
}

.ch-key-sample .k-halo { fill: var(--ch-city-halo); }
.ch-key-sample .k-ring { fill: none; stroke: var(--ch-city); stroke-width: 0.85; }
.ch-key-sample .k-city { fill: var(--ch-city); }
.ch-key-sample .k-town { fill: var(--ch-town); }
.ch-key-sample .k-c1 { fill: var(--ch-c1); }
.ch-key-sample .k-stripes { fill: url(#k-stripes); }
.ch-key-sample .k-hatch { fill: url(#k-hatch); }
.ch-key-sample .k-hatch-line { fill: #3d8a3a; fill-opacity: 0.75; }
.ch-key-sample .k-front { fill: none; stroke: var(--ch-front); stroke-width: 1.4; }
.ch-key-sample .k-c3 { fill: var(--ch-c3); }
.ch-key-sample .k-c6 { fill: var(--ch-c6); }
.ch-key-sample .k-c8 { fill: var(--ch-c8); }
.ch-key-sample .k-band { fill: none; stroke-width: 2.2; opacity: 0.6; }
.ch-key-sample .k-soft-band { stroke-width: 3.3; opacity: 0.4; }
.ch-key-sample .k-b1 { stroke: var(--ch-b1); }
.ch-key-sample .k-b6 { stroke: var(--ch-b6); }
.ch-key-sample .k-hard { fill: none; stroke: var(--ch-border); stroke-width: 1.15; }
.ch-key-sample .k-soft { fill: none; stroke: var(--ch-border); stroke-width: 1.45; stroke-linecap: round; stroke-dasharray: 0.1 3.05; }
.ch-key-sample .k-kin { fill: none; stroke: var(--ch-border); stroke-width: 0.6; opacity: 0.55; }
.ch-key-sample .k-people { fill: var(--ch-people-fill); }
.ch-key-sample .k-people-name { fill: var(--ch-people); font-family: var(--ch-serif); font-size: 11px; font-style: italic; text-anchor: middle; }
.ch-key-sample .k-band-name { fill: var(--ch-people); font-family: var(--ch-serif); font-size: 11px; font-style: italic; text-anchor: middle; opacity: 0.72; }
.ch-key-sample .k-division { fill: none; stroke: var(--ch-division); stroke-width: 0.8; stroke-dasharray: 3.4 2.1; }
.ch-key-sample .k-member { fill: none; stroke: var(--ch-border); stroke-width: 0.8; stroke-dasharray: 3.4 2.1; opacity: 0.7; }
.ch-key-sample .k-paper { fill: var(--ch-paper); }
.ch-key-sample .k-marsh-wash { fill: var(--ch-ocean); opacity: 0.4; }
.ch-key-sample .k-marsh { fill: none; stroke: var(--ch-river); stroke-width: 0.75; stroke-linecap: round; }

.ch-card {
  position: fixed;
  z-index: 22;
  top: calc(var(--ch-bar) + 2 * var(--ch-gap) + env(safe-area-inset-top, 0px));
  right: calc(var(--ch-gap) + env(safe-area-inset-right, 0px));
  width: min(360px, calc(100vw - 2 * var(--ch-gap)));
  max-height: calc(100vh - var(--ch-bar) - 3 * var(--ch-gap) - var(--ch-time-h));
  max-height: calc(100dvh - var(--ch-bar) - 3 * var(--ch-gap) - var(--ch-time-h));
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 22px 18px;
}

.ch-card-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  padding: 7px;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
}

.ch-card-close svg {
  display: block;
}

.ch-card-kind {
  margin: 2px 32px 0 0;
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ch-muted);
}

.ch-card-kind:empty {
  display: none;
}

.ch-card-name {
  margin: 6px 24px 0 0;
  font-size: 27px;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.ch-card-div {
  margin: 6px 0 0;
  font-size: 14.5px;
  font-style: italic;
  line-height: 1.4;
  color: var(--ch-muted);
}

.ch-card-div[hidden] {
  display: none;
}

.ch-card-divnote {
  margin: 4px 0 0;
}

.ch-card-divnote[hidden],
.ch-card-divnote .ch-wiki-text[hidden],
.ch-card-divnote .ch-wiki-by[hidden] {
  display: none;
}

.ch-card-divnote .ch-wiki-text {
  margin: 6px 0 0;
}

.ch-card-divnote .ch-wiki-by {
  margin: 4px 0 0;
}

.ch-card-facts {
  margin: 10px 0 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ch-muted);
}

.ch-card-facts:empty {
  display: none;
}

.ch-fact {
  display: block;
}

.ch-fact[hidden] {
  display: none;
}

.ch-flag {
  display: inline-block;
  height: 14px;
  width: auto;
  max-width: 32px;
  vertical-align: -2px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  box-sizing: content-box;
}

.ch-card-facts a,
.ch-card-facts button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.ch-wiki {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--rule) 30%, transparent);
}

.ch-wiki:has(.ch-wiki-text:empty) {
  display: none;
}

.ch-wiki-img {
  float: right;
  max-width: 108px;
  max-height: 130px;
  margin: 3px 0 8px 14px;
  border: 1px solid var(--ch-faint);
  filter: sepia(0.55) saturate(0.8) contrast(0.95);
}

.ch-wiki-text {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.55;
}

.ch-wiki-text.is-quiet {
  font-size: 14px;
  font-style: italic;
  color: var(--ch-muted);
}

.ch-wiki-text.is-writing {
  animation: ch-writing 1.6s ease-in-out infinite alternate;
}

@keyframes ch-writing {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ch-wiki-text.is-writing {
    animation: none;
  }
}

.ch-wiki-by {
  margin: 8px 0 0;
  font-size: 13px;
  font-style: italic;
  color: var(--ch-muted);
}

.ch-wiki-ask {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-style: italic;
  text-align: left;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.ch-wiki-ask:focus-visible {
  outline: 1px dotted var(--ink);
  outline-offset: 2px;
}

.ch-wiki-more {
  clear: both;
  margin: 10px 0 0;
  font-size: 13.5px;
}

.ch-wiki-more a {
  color: var(--ink);
}

.ch-tip {
  position: fixed;
  z-index: 25;
  pointer-events: none;
  padding: 5px 9px;
  border: 1px solid var(--rule);
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  transform: translate(14px, -50%);
}

.ch-tip-ico {
  width: 15px;
  height: 15px;
  margin-right: 6px;
  vertical-align: -2.5px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ch-tip-ico [stroke-dasharray] {
  stroke-width: 1.7;
}

.ch-tip.has-ico small {
  padding-left: 21px;
}

.ch-tip small {
  display: block;
  font-size: 12.5px;
  font-style: italic;
  color: var(--ch-muted);
}

.ch-hover-tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 60;
  max-width: 250px;
  padding: 5px 8px 6px;
  border: 1px solid var(--rule);
  font-size: 12.5px;
  line-height: 1.35;
  pointer-events: none;
  opacity: 0;
}

.ch-hover-tip.is-on {
  opacity: 1;
}

.ch-load {
  position: fixed;
  inset: 0;
  z-index: 19;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-style: italic;
  pointer-events: none;
}

.ch-load.is-gone {
  display: none;
}

@media (max-width: 800px) {
  :root.ch,
  :root.ch[data-theme] {
    --ch-bar: 46px;
  }

  .ch-title {
    font-size: 21px;
    letter-spacing: 0.3em;
    padding-left: 0.3em;
  }

  .ch-head-text {
    padding: 0 18px 1px 22px;
  }
}

@media (max-width: 880px) {
  .ch-top > .ch-year-box {
    top: calc(var(--ch-bar) + var(--ch-gap));
  }
}

@media (max-width: 640px) {
  .ch-top > .ch-year-box {
    width: 200px;
    height: 40px;
  }

  :root.ch,
  :root.ch[data-theme] {
    --ch-gap: 8px;
    --ch-bar: 44px;
    --ch-seg: 40px;
  }

  .ch-top {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 5px;
  }

  .ch-head {
    grid-column: 1 / 3;
  }

  .ch-head-text {
    flex: 1 1 auto;
    padding: 0 3px 1px 5px;
  }

  .ch-title {
    font-size: 14.5px;
    letter-spacing: 0.12em;
    padding-left: 0.12em;
  }

  .ch-head .ch-ctl {
    width: 36px;
  }

  .ch-about {
    position: static;
  }

  .ch-about-tip {
    position: fixed;
    top: auto;
    left: 12px;
    right: 12px;
    bottom: calc(var(--ch-time-h) + 12px);
    width: auto;
    max-height: calc(100vh - var(--ch-time-h) - var(--ch-bar) - 40px);
    max-height: calc(100dvh - var(--ch-time-h) - var(--ch-bar) - 40px);
    overflow-y: auto;
    z-index: 40;
  }

  .ch-about-tip::before {
    display: none;
  }

  .ch-layers {
    width: min(250px, calc(100vw - 16px));
  }

  .ch-layer {
    padding: 7px 0;
  }

  .ch-time {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "back date fwd" "track track track";
    align-items: center;
    gap: 2px 8px;
    padding: 8px calc(14px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) calc(14px + env(safe-area-inset-left, 0px));
  }

  .ch-when-back {
    grid-area: back;
  }

  .ch-when-fwd {
    grid-area: fwd;
  }

  .ch-time > .ch-year-box {
    grid-area: date;
    display: flex;
    align-items: center;
    justify-self: center;
    box-sizing: border-box;
    width: 100%;
    max-width: 200px;
    min-width: 0;
    height: 40px;
    padding: 0 8px;
  }

  .ch-track {
    grid-area: track;
  }

  .ch-key-btn {
    padding: 5px 10px 5px 11px;
    font-size: 12px;
  }

  .ch-card:not([hidden]) ~ .ch-key {
    display: none;
  }

  .ch-step {
    width: 40px;
    height: 40px;
  }

  .ch-year {
    font-size: 18px;
    line-height: 1.54;
  }

  .ch-track {
    height: 52px;
  }

  .ch-card {
    top: auto;
    left: 0;
    right: 0;
    bottom: var(--ch-time-h);
    width: auto;
    max-height: 46vh;
    max-height: 46dvh;
    padding: 12px 16px 14px;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    box-shadow: inset 0 3px 0 var(--bg), inset 0 4px 0 var(--ch-faint), 0 -4px 12px -6px rgba(58, 42, 27, 0.3);
  }

  .ch-card-name {
    font-size: 23px;
  }

  .ch-card-close {
    width: 44px;
    height: 44px;
    padding: 13px;
    top: 2px;
    right: 2px;
  }
}

@media (max-width: 369px) {
  .ch-title {
    font-size: 12.5px;
    letter-spacing: 0.08em;
    padding-left: 0.08em;
  }
}

@media (prefers-reduced-motion: no-preference) {
  :root.ch:not(.ch-ready) .ch-globe {
    visibility: hidden;
  }
  :root.ch:not(.ch-ready) .ch-top {
    translate: 0 calc(-100% - 20px);
  }
  :root.ch:not(.ch-ready) .ch-time {
    translate: 0 105%;
  }
  :root.ch:not(.ch-ready) .ch-key,
  :root.ch:not(.ch-ready) .ch-load {
    opacity: 0;
  }
  :root.ch-intro .ch-top {
    animation: ch-dropin 1000ms cubic-bezier(0.3, 0.7, 0.4, 1) 1350ms both;
  }
  :root.ch-intro .ch-time {
    animation: ch-pullup 1000ms cubic-bezier(0.3, 0.7, 0.4, 1) 1350ms both;
  }
  :root.ch-intro .ch-key {
    animation: ch-fade 600ms ease 2300ms both;
  }
  :root.ch-intro .ch-ctl {
    animation: ch-pop 420ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
    animation-delay: calc(2250ms + var(--ch-i, 0) * 90ms);
  }
  :root.ch-intro .ch-ctls .ch-ctl:nth-child(2) { --ch-i: 1; }
  :root.ch-intro .ch-ctls .ch-ctl:nth-child(3) { --ch-i: 2; }
  :root.ch-intro .ch-ctls .ch-ctl:nth-child(4) { --ch-i: 3; }
  :root.ch-intro .ch-ctls .ch-ctl:nth-child(5) { --ch-i: 4; }
  .ch-roll {
    position: fixed;
    inset: 0;
    z-index: 19;
    pointer-events: none;
    background: inherit;
    will-change: translate;
    animation: ch-unroll 1300ms cubic-bezier(0.5, 0.05, 0.25, 1) 150ms both;
  }
  .ch-roll::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -22px;
    width: 44px;
    border-radius: 22px / 10px;
    background:
      linear-gradient(90deg, rgba(58, 42, 27, 0.55), rgba(58, 42, 27, 0) 18%, rgba(255, 250, 235, 0.55) 42%, rgba(58, 42, 27, 0) 62%, rgba(58, 42, 27, 0.6)),
      #e6d5ad;
    box-shadow: 10px 0 18px -6px rgba(58, 42, 27, 0.45), -2px 0 6px rgba(58, 42, 27, 0.25);
  }
}

@keyframes ch-unroll {
  0% { translate: 0 0; }
  88% { opacity: 1; }
  100% { translate: 100% 0; opacity: 0; }
}

@keyframes ch-dropin {
  0% { translate: 0 calc(-100% - 20px); }
  55% { translate: 0 6px; }
  72% { translate: 0 -3px; }
  86% { translate: 0 1px; }
  100% { translate: 0 0; }
}

@keyframes ch-pullup {
  0% { translate: 0 105%; }
  55% { translate: 0 -4%; }
  72% { translate: 0 2%; }
  86% { translate: 0 -0.8%; }
  100% { translate: 0 0; }
}

@keyframes ch-pop {
  from { opacity: 0; scale: 0.6; translate: 0 8px; }
  to { opacity: 1; scale: 1; translate: 0 0; }
}

@keyframes ch-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (hover: none) and (pointer: coarse) {
  .ch-about-tip .ch-keys {
    display: none;
  }
}
