@font-face {
  font-family: "Saira";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/Saira-Regular.ttf") format("truetype");
}

@font-face {
  font-family: "Saira";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/Saira-Italic.ttf") format("truetype");
}

@font-face {
  font-family: "HYWenHei";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/HYWenHei-55W.ttf") format("truetype");
}

* {
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
}

*,
*::before,
*::after {
  font-family: "Saira", "HYWenHei", sans-serif;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  text-indent: 0;
}

:root {
  --background-color: #FFFFFF;

  color: #252525;
  line-height: 1.125;
  font-size: 1rem;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--background-color);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.65rem 4%;
}

main>* {
  margin: 0.65rem 0;
  border: 1px solid transparent;
}

p {
  margin: 0.65rem 0;
}

/*----------------*/

.warning {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--background-color);
  z-index: 9999;
}

.warning p {
  max-width: 75vw;
}

.button {
  display: inline-block;
  padding: 6px 8px;
  min-width: 4rem;
  border: 1px solid #BFBFBF;
  transition: color 0.2s ease, border-color 0.2s ease;
  font-size: 0.9em;
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.button:active {
  color: #9898FF !important;
  border-color: #9898FF !important;
}

.input {
  width: 100%;
  height: 32px;
  margin: 0.65rem 0;
  padding: 4px 8px;
  outline: none;
  border: 1px solid #BFBFBF;
  background: none;
  transition: border-color 0.2s ease;
  font-size: 1em;
}

.input:focus {
  border-color: #9898FF;
}

.checkbox,
.radio {
  display: flex;
  align-items: center;
}

.checkbox label,
.radio label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
}

.checkbox .pattern,
.radio .pattern {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 1px solid #BFBFBF;
  transition: all 0.2s ease;
}

.radio .pattern {
  border-radius: 50%;
}

.checkbox input:checked+label .pattern,
.radio input:checked+label .pattern {
  background: #9898FF;
  box-shadow: inset 0 0 0 2px #9898FF;
}

.checkbox input:disabled+label,
.radio input:disabled+label {
  opacity: 0.5;
  cursor: default;
}

.dialog_background {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  opacity: 1;
  background: rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s ease;
}

.dialog_container.hidden .dialog_background {
  opacity: 0;
  pointer-events: none;
}

.dialog {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: fixed;
  top: 50%;
  left: 50%;
  max-height: 80vh;
  width: var(--dialog-width);
  opacity: 1;
  background: var(--background-color);
  transform: translateX(-50%) translateY(-50%) scale(1);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: initial;
}

.dialog_container.hidden .dialog {
  opacity: 0;
  transform: translateX(-50%) translateY(-50%) scale(0.9);
  pointer-events: none;
}

.dialog_title {
  padding: 0.65rem 0;
  width: 100%;
  text-align: center;
}

.dialog_content {
  flex: 1;
  overflow-x: hidden;
  overflow-y: scroll;
  width: 100%;
  padding: 0 0.65rem;
  background: #F6F6F6;
  text-align: center;
  word-wrap: break-word;
  font-size: 90%;
}

.dialog_content>* {
  margin: calc(var(--dialog-width) * 0.065) 0;
  line-height: 1.3;
}

.dialog_content>p {
  margin: calc(var(--dialog-width) * 0.065) 0;
  line-height: 1.5;
}

.dialog_content .input,
.dialog_content .checkbox,
.dialog_content .radio,
.dialog_content .button {
  margin: 0.55rem 0;
  width: calc(var(--dialog-width) * 0.75);
}

.dialog_content .input {
  text-align: center;
}

.dialog_buttons {
  display: flex;
  justify-content: space-around;
  padding: 0 0.65rem;
  width: 100%;
}

.dialog_buttons .button {
  flex: 1;
  max-width: 50%;
  margin: 0.65rem 0.35rem;
}

main>.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

main>.row .button {
  width: 24%;
}

.row.player_info {
  margin: 0;
}

.row.player_info>* {
  flex: 33.33%;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  white-space: nowrap;
}

#pid {
  text-align: left;
}

#cmr {
  text-align: right;
}

#record_list {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin: 0 auto;
  width: 100%;
  user-select: none;
}

#record_list.empty {
  flex: 1;
  justify-content: center;
  align-items: center;
}

#record_list.empty::before {
  content: "空空如也";
}

#record_list .record_box {
  margin: 4px 0;
  padding: 4px 8px;
  width: var(--record_box-width);
  border: 1px solid #BFBFBF;
  background: var(--background-color);
  line-height: 1.2rem;
  transition: border-color 0.2s ease;
}

.record_box * {
  pointer-events: none;
}

.record_box .row {
  display: flex;
  justify-content: space-between;
}

.record_box .title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.record_box .score,
.record_box .rank {
  font-size: 1.2rem;
  line-height: 1.3rem;
}

.record_box .rank {
  text-align: right;
  font-weight: bold;
}

.record_box .acc,
.record_box .rating,
.record_box .ranking {
  font-size: 0.8rem;
}

.record_box .ranking {
  text-align: right;
}

.record_box:active {
  border-color: #9898FF !important;
}

/*----------------*/

@media screen and (max-width: 575px) {
  :root {
    --dialog-width: 90%;
    --record_box-width: 49%;
  }
}

@media screen and (min-width: 576px) {
  :root {
    --dialog-width: 80%;
    --record_box-width: 32.22%;
  }
}

@media screen and (min-width: 768px) {
  :root {
    --dialog-width: 70%;
    --record_box-width: 24%;
  }
}

@media screen and (min-width: 992px) {
  :root {
    --dialog-width: 60%;
    --record_box-width: 19%;
  }
}

@media screen and (min-width: 1200px) {
  :root {
    --dialog-width: 50%;
    --record_box-width: 16%;
  }
}