html {
  --highlight-color: hsl(from var(--focus-color) calc(h - 10) s l / alpha);
  --button-border-width: 1px;
  --button-border-radius: 5px;
  line-height: 1.1;
  overscroll-behavior: contain;
}
/* html[data-mode="dark"],
html[data-mode="fantasy"] {
  --background: #0d0c15;
  --focus-color: deepskyblue;
} */
html[data-mode="vintage"] {
  --background: #e9dac5; /* #f3e7d7; */
}
html,
body {
  height: 100%;
  padding: 0;
  margin: 0;
}
body {
  display: flex;
  flex-direction: column;
}
.hidden {
  display: none;
}
#screen {
  flex: auto;
  overflow: hidden;
  position: relative;
}
#screen svg {
  font: inherit;
  color: var(--color);
  width: 100%;
  height: 100%;
}
#screen svg text {
  cursor: default;
  user-select: none;
}
#screen .stars {
  fill: currentColor;
  stroke: none;
  stroke-width: 0.75;
}
html[data-mode="vintage"] #screen .stars circle[data-p="1"] {
  fill: url(#v0);
}
#screen .p {
  fill: none;
  stroke-linecap: round;
}
#screen .grid {
  stroke: currentColor;
  stroke-width: 0.55;
  stroke-opacity: 0.09;
  fill: none;
}
html[data-mode="light"] #screen .grid {
  stroke-opacity: 0.12;
}
html[data-mode="vintage"] #screen .grid {
  stroke-opacity: 0.18;
}
#screen .star-labels {
  font-family: serif;
  fill: currentColor;
  fill-opacity: 0.5;
}
html[data-mode="vintage"] #screen .star-labels {
  font-weight: bold;
}
#screen .constellation-labels {
  font-size: 1rem;
  font-style: italic;
  letter-spacing: 0.2em;
  text-anchor: middle;
  text-transform: uppercase;
  fill: currentColor;
  fill-opacity: 0.15;
}
html[data-mode="light"] #screen .constellation-labels {
  fill-opacity: 0.18;
}
html[data-mode="vintage"] #screen .constellation-labels {
  font-size: 1.35rem;
  font-family: serif;
  /* font-family:
    "Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, serif; */
  font-weight: normal;
  font-style: normal;
  font-variant: small-caps;
  text-transform: none;
  fill-opacity: 0.25;
}
html[data-mode="vintage"][lang="ru"] #screen .constellation-labels {
  /* font-family: "Iowan Old Style", "URW Palladio L", P052, serif; */
  letter-spacing: 0.18em;
}
/* html[data-mode="fantasy"] #screen .constellation-labels {
  fill: #115170;
  fill-opacity: 1;
  text-shadow: 0 0 1em #29b2f4;
} */
#screen .constellation-labels text {
  --x: 0px;
  --y: 0px;
  transform: translate(var(--x), var(--y)) scaleY(0.9);
}
#screen .hint-lines {
  stroke: currentColor;
  stroke-width: 0.5;
  stroke-dasharray: 3 2;
  stroke-opacity: 0.3;
  fill: none;
}
html[data-mode="light"] #screen .hint-lines,
html[data-mode="vintage"] #screen .hint-lines {
  stroke-opacity: 0.5;
}
#screen .boundary-lines {
  stroke: currentColor;
  stroke-width: 0.5;
  stroke-dasharray: 1 2;
  stroke-opacity: 0.4;
  fill: none;
}
html[data-mode="light"] #screen .boundary-lines {
  stroke-opacity: 0.65;
}
html[data-mode="vintage"] #screen .boundary-lines {
  stroke-opacity: 0.75;
}
#screen .switch {
  display: flex;
  background: rgb(from var(--background) r g b / 0.75);
  padding: 0;
  margin: 0;
  position: absolute;
  inset: 1em auto auto 1em;
}
#screen .switch a {
  display: inline-block;
  padding: 0.4em 1.5em 0.35em;
  transition:
    color 0.25s,
    background 0.25s,
    border 0.25s;
}
#screen .switch a:link,
#screen .switch a:visited,
#screen .switch a:focus,
#screen .switch a:active {
  --b: transparent;
  --c: rgb(from var(--color) r g b / 0.65);
  text-decoration: none;
  color: var(--c);
  background: var(--b);
  border: var(--button-border-width) solid rgb(from var(--c) r g b / 0.3);
}
#screen .switch a:first-child {
  border-radius: var(--button-border-radius) 0 0 var(--button-border-radius);
}
#screen .switch a:last-child {
  border-radius: 0 var(--button-border-radius) var(--button-border-radius) 0;
}
#screen .switch a:not(:first-child) {
  border-left: none;
}
#screen .switch a:hover,
#screen .switch a[data-active="true"]:link,
#screen .switch a[data-active="true"]:visited,
#screen .switch a[data-active="true"]:focus,
#screen .switch a[data-active="true"]:hover,
#screen .switch a[data-active="true"]:active {
  --b: rgb(from var(--focus-color) r g b / 0.15);
  --c: rgb(from var(--focus-color) r g b / 0.95);
}
#screen .switch .sep {
  display: none;
}
@media (max-width: 600px) {
  #screen .switch a {
    padding: 0.6em 1em 0.5em;
  }
  #screen .constellation-labels {
    font-size: 0.85rem;
  }
  html[data-mode="vintage"] #screen .constellation-labels {
    font-size: 1rem;
  }
}

footer {
  --focus-color: rgb(from var(--color) r g b / 0.8);
  --active-link-color: var(--focus-color);
  --inactive-link-color: var(--focus-color);
  --visited-link-color: var(--focus-color);
  border-radius: 0.5em 0 0 0;
  position: absolute;
  padding: 0.2em 0.65em 0.3em 0.75em;
  right: 0;
  bottom: 0;
}

#screenmenu {
  --x: 0px;
  --y: 0px;
  color: rgb(from var(--background) r g b / 0.85);
  background: rgb(from var(--highlight-color) r g b / 0.95);
  position: absolute;
  z-index: 100;
  left: var(--x);
  top: var(--y);
}
html[data-mode="vintage"] #screenmenu {
  background: rgb(from var(--color) r g b / 0.65);
}
#screenmenu ul {
  display: inline-block;
  list-style: none;
  padding: 0;
  margin: 0;
}
#screenmenu table {
  border-collapse: collapse;
  border: none;
  margin: 0;
}
#screenmenu td {
  vertical-align: top;
  padding: 0.3em 0.5em 0.2em;
}
#screenmenu td:not(:first-child) {
  border-left: 0.05em solid rgb(from var(--background) r g b / 0.25);
}
#screenmenu li,
#screenmenu td {
  white-space: nowrap;
  border-bottom: 0.05em solid rgb(from var(--background) r g b / 0.85);
  box-sizing: border-box;
}
#screenmenu.wide li,
#screenmenu.wide td {
  white-space: normal;
}
#screenmenu.wide td.b {
  white-space: nowrap;
}
#screenmenu button {
  display: block;
  width: 100%;
  color: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
}
#screenmenu li,
#screenmenu button {
  padding: 0.3em 0.5em 0.2em;
  margin: 0;
  box-sizing: border-box;
}
#screenmenu .b {
  text-align: right;
}
#screenmenu .x {
  text-align: center;
  padding-left: 1em;
  padding-right: 1em;
}
