:root {
  --util-height: 35px;
  --header-height: calc(90px + var(--util-height));
  --card-gap: 10px;
  --max-content-width: 90vw;
  --backdrop-blur: blur(6px);
  --background-color: white;
  --header-background-color: rgba(255, 255, 255, .3);
  --stroke-color: black;
  --default-choice-color: lime;
  --opposite-choice-color: red;
  --comment-color: grey;
  --comment-select-background: rgba(10, 110, 189, .5);
  --comment-select-background-inactive: rgba(178, 178, 178, .3);
  --shape-name-color: blueviolet;
  --emphasize-color: crimson;
  --slash-count-color: blue;
  --mirror-opacity: .6;
  --split-color: rgba(0, 0, 0, 0.3);
  --link-color: blue;
}

@media (prefers-color-scheme: dark) {
  /* Dark theme styles go here */
  :root {
    --background-color: black;
    --header-background-color: rgba(0, 0, 0, .3);
    --stroke-color: white;
    --mirror-opacity: .7;
    --slash-count-color: yellow;
    --split-color: rgba(255, 255, 255, 0.3);
    --link-color: yellow;
  }
}


html {
  box-sizing: border-box;
  font-size: 16px;
  -webkit-text-size-adjust: none;
  -moz-text-size-adjust: none;
  text-size-adjust: none;
  touch-action: pan-y;
  font-family: -apple-system, 'Helvetica Neue', Helvetica, 'Nimbus Sans L', Arial, 'Liberation Sans', 'PingFang SC', 'Hiragino Sans GB',
  'Source Han Sans CN', 'Source Han Sans SC', 'Microsoft YaHei', 'Wenquanyi Micro Hei', 'WenQuanYi Zen Hei', 'ST Heiti', SimHei,
  'WenQuanYi Zen Hei Sharp', sans-serif;
  height: 100%;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body, h1, h2, h3, h4, h5, h6, p, ol, ul {
  margin: 0;
  padding: 0;
  font-weight: normal;
}

body {
  background-color: var(--background-color);
  color: var(--stroke-color);
  height: 100%;
}

h1, label, .alg-slash-count {
  -webkit-user-select: none;
  user-select: none;
}

header {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: var(--header-height);
  text-align: center;
  background-color: var(--header-background-color);
  z-index: 10;
  -webkit-backdrop-filter: var(--backdrop-blur);
  backdrop-filter: var(--backdrop-blur);
}

#wrapper {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: space-between;
  gap: 30px;
}

footer {
  margin: 0 auto 15px;
}

footer a {
  color: var(--link-color);
}

h1 {
  margin-block-start: .67em;
  margin-block-end: .67em;
}

#utils {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--util-height);
  display: flex;
  flex-flow: row nowrap;
  justify-content: center;
  gap: 30px;
  max-width: var(--max-content-width);
  margin: 0 auto;
  z-index: 10;
  padding-bottom: calc(var(--util-height) - 25px);
}

#shape-list {
  display: flex;
  flex-flow: row wrap;
  justify-content: space-evenly;
  gap: var(--card-gap);
  max-width: var(--max-content-width);
  margin: calc(var(--header-height) + var(--card-gap)) auto 20px;
}

.anchor {
  position: absolute;
  height: calc(var(--header-height) + var(--card-gap));
  left: 0;
  right: 0;
  bottom: 100%;
  visibility: hidden;
}

.item {
  display: flex;
  flex-flow: column nowrap;
  justify-content: space-between;
  width: 350px;
  border: 1px solid var(--stroke-color);
  border-radius: 5px;
  padding: 10px;
  position: relative;
}

@media screen and (max-width: 800px) {
  .item {
    width: 96vw;
    max-width: 400px;
  }
}

.item.mirrored:before {
  content: 'Mirrored';
  color: var(--comment-color);
  position: absolute;
  left: 5px;
  top: 5px;
}

html[lang=zh] .item.mirrored:before {
  content: '倒置';
}

.hide {
  display: none !important;
}

.item.mirrored {
  opacity: var(--mirror-opacity);
}

.shape {
  display: flex;
  flex-flow: row nowrap;
  justify-content: space-evenly;
}

.top, .bottom {
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
  flex: 0 0 35%;
}

.bottom svg {
  transform: rotate(-30deg);
}

.slice {
  stroke: grey;
}

.layer {
  stroke: var(--stroke-color);
  fill: transparent;
}

.default-count {
  stroke: var(--stroke-color);
  fill: var(--default-choice-color);
}

.other-count {
  stroke: var(--stroke-color);
  fill: var(--opposite-choice-color);
}

.name {
  font-weight: bold;
}

.algs {
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
  justify-content: space-evenly;
  gap: 5px;
  flex-grow: 1;
}

.alg {
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
  margin: 0 5px;
  text-align: center;
  gap: 2px;
}

.alg-text {
  font-weight: bold;
  word-break: break-all;
}

.alg-slash-count {
  font-weight: normal;
  color: var(--slash-count-color);
}

.even:before {
  content: 'Even';
  color: var(--default-choice-color);
}

html[lang=zh] .even:before {
  content: '偶数';
}

.odd:before {
  content: 'Odd';
  color: var(--opposite-choice-color);
}

html[lang=zh] .odd:before {
  content: '奇数';
}

.split {
  border-top: 1px solid var(--split-color);
  width: 80%;
  margin: 5px auto;
}

.comment {
  color: var(--comment-color);
  font-style: italic;
  font-weight: 300;
}

.comment::selection {
  background-color: var(--comment-select-background);
}

.comment::selection:window-inactive {
  background-color: var(--comment-select-background-inactive);
}

.comment:before {
  content: 'Note: ';
}

.shape-name {
  color: var(--shape-name-color);
}

.emphasize {
  font-weight: bold;
  color: var(--emphasize-color);
}

html[lang=zh] .comment:before {
  content: '备注：';
}

.mirrored .comment {
  display: none;
}
