:root {
  color-scheme: dark;
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  background: #050607;
  color: #f7f4e8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #050607;
}

button {
  font: inherit;
}

.shell {
  width: 100vw;
  height: 100dvh;
  display: grid;
  place-items: center;
  background: #050607;
}

.stage {
  position: relative;
  width: min(100vw, calc(100dvh * 816 / 624));
  aspect-ratio: 816 / 624;
  max-width: 816px;
  max-height: 624px;
  overflow: hidden;
  background: #11170d;
  image-rendering: pixelated;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #18200f;
}

.hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.status-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
  color: #fff6bf;
  font-size: 15px;
  text-shadow: 0 2px 2px #000;
}

.meter {
  width: min(360px, 60%);
  height: 13px;
  border: 1px solid rgba(243, 230, 168, 0.85);
  background: rgba(18, 20, 17, 0.82);
  opacity: 0;
}

.meter.active {
  opacity: 1;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #df6155, #ffe17c);
}

.rhythm {
  position: absolute;
  top: 36px;
  right: 0;
  width: 250px;
  height: 56px;
  opacity: 0;
}

.rhythm.active {
  opacity: 1;
}

.rhythm::before {
  content: "";
  position: absolute;
  left: 118px;
  top: 4px;
  width: 14px;
  height: 48px;
  border: 2px solid #fff2a6;
  background: rgba(255, 242, 166, 0.16);
}

.rhythm span {
  position: absolute;
  top: 13px;
  width: 30px;
  height: 30px;
  border: 2px solid #fbf4d7;
  background: #c64e5a;
  box-shadow: 0 0 14px rgba(238, 95, 91, 0.7);
}

.rhythm span.burn {
  background: #f0993c;
}

.rhythm span.dodge {
  background: #61a8c4;
}

.dialogue {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 26px;
  min-height: 138px;
  padding: 18px 22px;
  border: 3px solid #e7dfc7;
  background: rgba(18, 22, 24, 0.94);
  box-shadow: inset 0 0 0 2px #343836, 0 10px 26px rgba(0, 0, 0, 0.45);
}

.speaker {
  min-height: 24px;
  color: #ffe67a;
  font-size: 18px;
  font-weight: 700;
}

.message {
  margin-top: 8px;
  white-space: pre-line;
  color: #fffdf2;
  font-size: 24px;
  line-height: 1.55;
  letter-spacing: 0;
  text-shadow: 0 2px 0 #000;
}

.controls {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}

.controls.active {
  pointer-events: auto;
  opacity: 1;
}

@media (min-width: 721px) {
  .stage.dialogue-open .controls.active {
    bottom: 178px;
  }
}

.controls button {
  min-width: 48px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #e6ddb8;
  color: #fff9d9;
  background: rgba(27, 31, 31, 0.9);
}

.controls button:focus-visible {
  outline: 3px solid #87d7ff;
  outline-offset: 2px;
}

.controls button:active,
.controls button.pressed {
  transform: translateY(1px);
  background: #414436;
}

@media (max-width: 720px) {
  .dialogue {
    left: 12px;
    right: 12px;
    bottom: 72px;
    min-height: 126px;
    padding: 14px 16px;
  }

  .message {
    font-size: 19px;
  }

  .controls {
    bottom: 10px;
  }
}
