:root {
  --bg: #f8838a;
  --ink: #111111;
  --panel: #ffd4d7;
  --white: #ffffff;
  --accent: #ff4d73;
  --soft: rgba(255, 255, 255, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "DotGothic16", monospace;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: var(--app-height, 100dvh);
  padding: 4px 6px;
  overflow: hidden;
}

#game {
  width: min(100%, 430px);
  height: calc(var(--app-height, 100dvh) - 8px);
  max-height: 820px;
  background: var(--bg);
  border: 5px solid var(--ink);
  overflow: hidden;
  position: relative;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
  padding: 16px;
  text-align: center;
  position: relative;
}

.screen.active {
  display: block;
}

button {
  font-family: "DotGothic16", monospace;
  border: 4px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  cursor: pointer;
  line-height: 1.2;
}

button:active {
  transform: translate(4px, 4px);
  box-shadow: 1px 1px 0 var(--ink);
}

button:disabled {
  opacity: 0.75;
  cursor: default;
}

/* TITLE */

.titleInner {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
  padding-top: 24px;
}

.titleLogo {
  width: min(92%, 360px);
  max-height: 300px;
  object-fit: contain;
  image-rendering: pixelated;
  cursor: pointer;
  margin-top: 4px;
}

.ruleText {
  margin: 0;
  font-size: 17px;
  line-height: 1.65;
  background: var(--soft);
  border: 3px solid var(--ink);
  padding: 10px 12px;
  width: min(92%, 360px);
}

.mainButton {
  font-size: 22px;
  padding: 12px 20px;
  min-width: 240px;
}

/* PLAY */

.backButton {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 30;
  font-size: 12px;
  padding: 5px 9px;
  border: 3px solid var(--ink);
  background: var(--white);
  box-shadow: none;
}

.djArea {
  width: 100%;
  height: 250px;
  border: 4px solid var(--ink);
  background: var(--bg);
  overflow: hidden;
  margin: 34px auto 12px;
}

.djGif {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: pixelated;
}

.trackRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 2px;
}

#trackTitle {
  font-size: 20px;
  margin: 0;
}

#timeText {
  font-size: 16px;
}

.noteLane {
  position: relative;
  height: 185px;
  border: 4px solid var(--ink);
  overflow: hidden;
  margin: 10px 0;
  background: rgba(255, 255, 255, 0.12);
}

#notesContainer {
  position: absolute;
  inset: 0;
}

.note {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 42%;
  height: 12px;
  background: var(--white);
  border-radius: 999px;
}

.note.hit {
  background: var(--accent);
}

.judgeLine {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 22px;
  height: 4px;
  background: var(--ink);
}

.cueText {
  min-height: 32px;
  font-size: 24px;
  margin: 10px 0;
}

.cueText.good {
  color: var(--white);
}

.cueText.miss {
  opacity: 0.7;
}

#pushButton {
  width: 86%;
  margin: 8px auto 16px;
  display: block;
  font-size: 30px;
  padding: 12px 18px;
}

.gaugeBox {
  margin-top: 6px;
  text-align: left;
}

.gaugeLabel {
  font-size: 16px;
  margin-bottom: 6px;
}

.gaugeOuter {
  height: 20px;
  border: 3px solid var(--ink);
  background: var(--white);
}

.gaugeInner {
  height: 100%;
  width: 0%;
  background: var(--ink);
}

/* RESULT */

.resultInner {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 6px;
}

.resultCharacter {
  width: min(44%, 170px);
  max-height: 170px;
  object-fit: contain;
  image-rendering: pixelated;
  margin-top: 4px;
}

.resultTitle {
  margin: 4px 0 2px;
  font-size: 32px;
  line-height: 1.2;
}

.resultComment {
  margin: 2px 0 6px;
  font-size: 16px;
  line-height: 1.45;
}

.resultScore {
  margin: 4px 0 8px;
  font-size: 17px;
  line-height: 1.5;
  background: var(--soft);
  border: 3px solid var(--ink);
  padding: 8px 10px;
  width: min(92%, 350px);
}

.resultButtons {
  width: min(92%, 360px);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 8px;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.resultButtons.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.resultButton {
  width: 100%;
  min-height: 58px;
  font-size: 18px;
  padding: 10px 8px;
  background: var(--white);
}

/* EFFECT */

.screenShake {
  animation: shake 0.12s;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

@media (max-height: 760px) {
  .screen {
    padding: 10px 12px;
  }

  .titleInner {
    gap: 12px;
    padding-top: 16px;
  }

  .titleLogo {
    max-height: 250px;
  }

  .ruleText {
    font-size: 15px;
    line-height: 1.5;
    padding: 8px 10px;
  }

  .mainButton {
    font-size: 20px;
    padding: 10px 18px;
  }

  .djArea {
    height: 210px;
    margin-top: 30px;
    margin-bottom: 8px;
  }

  .noteLane {
    height: 170px;
    margin: 8px 0;
  }

  .cueText {
    min-height: 26px;
    font-size: 21px;
    margin: 6px 0;
  }

  #pushButton {
    font-size: 26px;
    padding: 9px 16px;
    margin: 6px auto 10px;
  }

  .resultCharacter {
    width: min(38%, 140px);
    max-height: 140px;
  }

  .resultTitle {
    font-size: 27px;
  }

  .resultScore {
    font-size: 15px;
    line-height: 1.4;
  }

  .resultButton {
    min-height: 52px;
    font-size: 16px;
    padding: 8px 6px;
  }
}

@media (max-height: 680px) {
  .screen {
    padding: 8px 10px;
  }

  .titleLogo {
    max-height: 220px;
  }

  .djArea {
    height: 180px;
    margin-top: 28px;
  }

  .noteLane {
    height: 155px;
  }

  #trackTitle {
    font-size: 17px;
  }

  #timeText {
    font-size: 13px;
  }

  .cueText {
    font-size: 19px;
    margin: 5px 0;
  }

  #pushButton {
    font-size: 24px;
    padding: 8px 14px;
    margin-bottom: 8px;
  }

  .resultCharacter {
    width: min(32%, 110px);
    max-height: 110px;
  }

  .resultTitle {
    font-size: 23px;
  }

  .resultComment {
    font-size: 14px;
  }

  .resultScore {
    font-size: 13px;
    line-height: 1.3;
    margin-bottom: 6px;
  }

  .resultButton {
    min-height: 46px;
    font-size: 14px;
    padding: 7px 5px;
  }
}