html, body {
  height: 100%;
  background-color: black;
  overflow: hidden;
}

main {
  width: 100%;
  height: 100%;
  transition: opacity 1s;
}


/* 地图选取框架开始 */

/* 地图选取窗口状态A：初始选取 */

.map-select {
  position: absolute;
  height: 80%;
  width: 50%;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  background-color: grey;
  border-radius: 5px;
  font-family: "STXihei", "Source Han Sans", "Microsoft YaHei", "SimHei", sans-serif;
  text-align: center;
  transform: translateX(-50%) translateY(-50%);
  transition: all 0.5s cubic-bezier(.17, .84, .44, 1), opacity 0.5s linear;
  user-select: none;
  -webkit-user-select: none;
  z-index: 1;
}

.map-select > :first-child {
  display: none;
}

.map-select > header {
  margin: 1.5rem auto;
  font-size: x-large;
  letter-spacing: 1rem;
}

.chapter { /* 各章节标题 */
  padding-bottom: 0.5rem;
  letter-spacing: 0.1rem;
  background-color: transparent;
  transition: color 0.5s, background-color 0.5s;
  border-top: thin solid currentColor;
  cursor: pointer;
}

.chapter:hover { /* 当前章标题变色 */
  background: linear-gradient(to right, transparent -25%, DimGray, transparent 125%);
  color: WhiteSmoke;
  transition: none;
  border-bottom: thin solid currentColor;
  border-image: linear-gradient(to right, DimGray -25%, currentColor, DimGray 125%) 1 1;
}

.chapter:hover + section { /* 下个章标题隐藏上边框 */
  border-top: none;
}

.chapter:last-child { /* 末章标题下边框 */
  border-bottom: thin solid currentColor;
}

.chapter header { /* 章标题名 */
  cursor: pointer;
  padding: 0.5rem;
}

.map-item { /* 章地图集 */
  opacity: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 0.5rem;
  overflow: hidden;
  padding: 0 1rem;
  max-height: 0;
  cursor: default;
  transition: max-height 0.5s, opacity 0.5s;
}

.map-item.map-item-clicked { /* 点击章节标题切换显示 */
  opacity: 1;
  max-height: 27rem;
  transition: max-height 0.5s, opacity 0.5s;
}

.map-item figure {
  margin: 0;
  padding: 4%;
  border: thin solid transparent;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.5s;
}

.map-item figure:hover {
  border-color: currentColor;
  transition: none;
}

.map-item img {
  width: 100%;
}

.map-item figcaption {
  letter-spacing: 0;
  font-size: smaller;
}

.map-select::after {
  content: "Ver.0.7.14";
  margin-top: auto;
  margin-bottom: 2%;
  font-size: small;
}

/* 地图选取窗口状态B：左侧边栏 */

.map-select.side-bar {
  height: 100%;
  width: 20%;
  min-width: 15rem;
  top: 0;
  left: 0;
  transform: translateX(-90%);
  border-radius: 0 5px 5px 0;
}

.map-select.side-bar:hover {
  transform: translateX(0);
}

/* 隐藏渐显标题侧边说明 */
.map-select.side-bar > :first-child {
  position: absolute;
  display: block;
  right: 2%;
  top: 15%;
  opacity: 1;
  transition: opacity 0.4s, top 0.4s;
  writing-mode: vertical-lr;
  letter-spacing: 1.5rem;
  font-size: large;
}

.map-select.side-bar:hover > :first-child {
  top: 10%;
  opacity: 0;
}

.map-select.side-bar .chapter {
  transform: translateX(-50%);
  transition: transform 0.5s;
}

.map-select.side-bar:hover .chapter {
  transform: translateX(0);
  transition: transform 0.5s, color 0.5s, background-color 0.5s;
}

.map-select.side-bar:hover .chapter:hover {
  transition: none;
}

.map-select.side-bar .map-item {
  grid-template-columns: repeat(3, 1fr);
}

/* 地图选取框架结束 */


/* 主游戏框架开始 */

.game-frame {
  width: 100%;
  height: 100%;
  display: none;
  opacity: 0;
  transition: opacity 1s;
}

/* 画布规格 */
.main, .select-overlay {
  width: 100%;
  height: 100%;
}

/* 顶部UI */
.ui-top {
  position: absolute;
  top: 6%;
  left: 50%;
  width: 100%;
  transform: translateX(-50%);
  pointer-events: none;
}

/* 时间轴UI相关 */
.time-axis {
  width: 60%;
  min-width: 30rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  pointer-events: auto;
}

.time-axis canvas {
  position: relative;
  height: 3rem;
  width: 85%;
}

/*.mark-icon {
  position: absolute;
  height: 100%;
  width: 0.5%;
  max-width: 4px;
  min-width: 2px;
}*/

/*.detail {
  position: relative;
  top: -3.8rem;
  width: 4rem;
  text-align: center;
  font-size: small;
  transform: translateX(-50%);
  border-radius: 0.3rem;
  background-color: white;
  display: none;
  z-index: 1;
}

.detail-arrow {
  position: relative;
  background-color: white;
  width: 0.5rem;
  height: 0.5rem;
  transform: translateX(-50%) rotate(45deg);
  top: -4.2rem;
  display: none;
}*/

/* 时间轴按钮样式 */
.time-axis-controller {
  padding: 0 0.3rem;
  margin: 0 auto;
  font-size: larger;
}


/* 底部UI */
.ui-bottom {
  position: absolute;
  display: flex;
  bottom: 0;
  left: 50%;
  width: 100%;
  height: 35%;
  flex-direction: column;
  justify-content: flex-end;
  transform: translateX(-50%);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* cost计数器元素 */
.cost {
  width: 6.5%;
  margin-left: auto;
  color: white;
  font-size: 2vw;
  background: rgba(0, 0, 0, 0.8);
}

.cost::before {
  content: "";
  display: inline-block;
  margin-left: 0.5vw;
  width: 1.5vw;
  height: 1.5vw;
  background: no-repeat url("res/img/misc/cost_icon.svg");
  background-size: contain;
}

.cost-counter {
  width: 60%;
  height: 2vw;
}

/* cost进度条画布 */
.cost-bar {
  display: block;
  width: 100%;
  height: 0.3vw;
  background-color: dimgrey;
  box-shadow: inset 0 0 2px black;
}

/* 剩余可部署单位数量 */
.operator-counter {
  width: 10%;
  margin-left: auto;
  color: white;
  padding: 0.3vw;
  margin-bottom: 1vw;
  font-size: 1vw;
  background-color: rgba(0, 0, 0, 0.5);
  text-align: center;
}

.operator-counter canvas {
  height: 1vw;
  width: 6%;
}

/* 干员卡栏 */
.operator-cards {
  width: 90%;
  margin-left: auto;
  display: flex;
  justify-content: flex-end;
}

/* 每张干员卡 */
.operator-cards > div {
  position: relative;
  /* 等比调整宽度和padding-bottom以调整图标尺寸 */
  width: 8%;
  /* padding-bottom是相对ui-bottom的宽度确定的 */
  padding-bottom: 8%;
  box-sizing: border-box;
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.5);
  border-bottom: 0.3vw solid;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.2s;
}

.operator-cards > div.chosen {
  border-left: 1px solid white;
  border-top: 1px solid white;
  border-right: 1px solid white;
  padding-bottom: calc(8% - 1px);
  transform: translateY(-10%);
}

/* 干员卡的背景图元素 */
.operator-cards > div :first-child {
  width: 100%;
  height: 100%;
  position: absolute;
}

/* 再部署冷却倒计时元素 */
.operator-cards > div canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* 干员cost元素 */
.operator-cards > div :last-child {
  position: absolute;
  top: 0;
  right: 30%;
  width: 22%;
  height: 21%;
  color: white;
  background-color: black;
  font-size: 1.3vw;
  text-align: center;
}

.ui-overlay#withdraw {
  display: none;
  position: absolute;
  transform: translate(-50%, -50%);
  width: 3vw;
  z-index: 1;
  user-select: none;
  -webkit-user-select: none;
}


/* 方向/干员选择画布叠加层 */
.select-overlay {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
}


/* 加载画面 */
#loading {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  display: none;
  opacity: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  transition: opacity 0.5s;
}

#container {
  width: 100%;
  height: 3px;
  margin-bottom: 10%;
  background-color: yellow;
  user-select: none;
  -webkit-user-select: none;
}

#bar {
  top: -1.5rem;
  height: 1.7rem;
  position: relative;
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  background-color: black;
  color: yellow;
  transition: width 0.5s linear;
}

.percentage {
  margin: 0 0.5rem;
  position: absolute;
  text-align: center;
}

#right {
  right: 0;
}
