body {
  font-family: Verdana, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  height: 100%;
  margin: 0 8px;
  touch-action: manipulation; /* quick taps (e.g. on the zoom buttons) must not
                                 trigger iOS Safari's double-tap page zoom */
}

/* Japanese UI prefers Japanese fonts for kanji glyph shapes */
body:lang(ja) {
  font-family: Verdana, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans CJK JP", sans-serif;
}

/* Links: black instead of the browser's blue/purple */
a {
  color: #000;
}

#loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: x-small;
  color: #555;
}

#loading-spinner {
  width: 24px;
  height: 24px;
  margin-bottom: 8px;
  border: 3px solid #ddd;
  border-top-color: #555;
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

#lang-switch {
  position: relative;
  font-size: x-small;
  align-self: center;
}

#lang-current {
  color: #555;
  cursor: pointer;
}

#lang-current:hover {
  color: #000;
}

#lang-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: #fff;
  border: 1px solid #aaa;
  z-index: 100;
}

#lang-menu a {
  display: block;
  padding: 2px;
  color: #555;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}

#lang-menu a:hover {
  background: #eee;
  color: #000;
}

#lang-menu a.active {
  color: #000;
}

#timeline {
  height: calc(100% - 78px); /* leave room for the footer with the zoom control */
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -o-user-select: none;
  touch-action: none; /* touches drive the timeline (app.js), not page scroll/zoom */
}

#zoom-control {
  margin-left: auto; /* right edge flush with the timeline's */
  display: flex;
  align-items: flex-start;
  font-size: 10px;
  color: #555;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

#scale-bar {
  text-align: center;
  margin-right: 4px;
}

#scale-label {
  line-height: 1; /* keep the label tight against the scale line below */
}

/* Bottom line with end ticks, like a map scale */
#scale-line {
  height: 2px;
  margin: 0 auto;
  border: 1px solid #555;
  border-top: none;
}

#zoom-buttons {
  display: flex;
  align-self: center; /* vertically centered against the scale bar */
}

#zoom-buttons button {
  padding: 0 4px;
  background: none;
  border: none;
  color: #555;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

/* Plain text like the language switcher, not a button */
#help-button {
  margin-left: 4px;
  align-self: center;
  color: #555;
  font-size: 10px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

#help-button:hover {
  color: #000;
}

#help-modal {
  display: none; /* app.js switches this to flex */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000; /* above the timeline's own popups */
  background: rgba(0, 0, 0, 0.3);
  justify-content: center;
  align-items: center;
}

#help-panel {
  background: #fff;
  border: 1px solid #aaa;
  padding: 10px 12px;
  font-size: 11px; /* a notch above the x-small page chrome */
  min-width: 180px;
}

#help-title {
  margin-bottom: 6px;
}

#help-list {
  font-size: 11px; /* quirks-mode tables don't inherit the panel's size */
}

#help-list td {
  padding: 3px 0;
}

#help-list td:first-child {
  padding-right: 14px;
  white-space: nowrap;
}

/* Keys as plain text, not key-cap lookalikes */
#help-list kbd {
  font-family: inherit;
  font-size: 100%;
  color: #555;
}
