:root {
  --cream: #f3e4c4;
  --cream-deep: #e4cd9a;
  --ink: #3a2415;
  --red: #e23b2e;
  --red-deep: #b82a22;
  --ok: #3aa35a;
  --superb: #e07a14;
  --blue: #3d6ec9;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a120c;
  color: var(--ink);
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f3e4c4;
}

.back {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 40;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 8px 14px;
  background: rgba(243, 228, 196, 0.88);
  border: 3px solid var(--ink);
  border-radius: 999px;
}

.back:hover {
  background: #fff6e4;
}

body[data-screen="play"] .back,
body[data-screen="boot"] .back {
  display: none;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.screen > * {
  pointer-events: auto;
}

.hidden {
  display: none !important;
}

#screen-title {
  background:
    linear-gradient(180deg, rgba(243, 228, 196, 0.72), rgba(243, 228, 196, 0.88)),
    url("../assets/bg/title.jpg") center / cover no-repeat;
}

#screen-howto,
#screen-select,
#screen-pause,
#screen-result,
#screen-boot {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 244, 220, 0.55), transparent 55%),
    rgba(243, 228, 196, 0.82);
}

#screen-play {
  background: transparent;
  align-items: flex-start;
  justify-content: stretch;
}

.boot-card,
.panel,
.title-hero,
.select-wrap {
  text-align: center;
}

.boot-card {
  width: min(420px, 86vw);
}

.boot-track {
  margin-top: 16px;
  height: 14px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: #fff6e4;
}

#boot-bar {
  display: block;
  width: 0;
  height: 100%;
  background: var(--red);
}

.logo {
  font-size: clamp(3.4rem, 12vw, 7rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--red);
  -webkit-text-stroke: 10px var(--ink);
  paint-order: stroke fill;
  text-shadow: 6px 8px 0 #c4a574;
}

.logo span {
  display: inline-block;
  animation: bounce 1.15s ease-in-out infinite;
}

.logo span:nth-child(2) {
  animation-delay: 0.08s;
}
.logo span:nth-child(3) {
  animation-delay: 0.16s;
}
.logo span:nth-child(4) {
  animation-delay: 0.24s;
}
.logo span:nth-child(5) {
  animation-delay: 0.32s;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }
  50% {
    transform: translateY(-10px) rotate(3deg);
  }
}

.logo-sub {
  margin-top: 6px;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.4em;
}

.eyebrow {
  font-weight: 800;
  letter-spacing: 0.28em;
  font-size: 0.78rem;
  color: var(--red-deep);
  margin-bottom: 8px;
}

.tag {
  margin: 14px 0 8px;
  font-weight: 700;
  font-size: 1.05rem;
}

.cast {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  height: 110px;
  margin: 10px 0 6px;
}

.cast img {
  height: 100%;
  width: auto;
  filter: drop-shadow(3px 4px 0 rgba(58, 36, 21, 0.18));
}

.title-best {
  font-weight: 800;
  color: var(--superb);
  margin-bottom: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

.rh-btn {
  appearance: none;
  border: 4px solid var(--ink);
  background: #fff6e4;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  font-size: 1.15rem;
  padding: 12px 28px;
  border-radius: 999px;
  box-shadow: 0 5px 0 var(--ink);
  cursor: pointer;
}

.rh-btn:hover {
  transform: translateY(-1px);
  background: #fff;
}

.rh-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--ink);
}

.rh-btn.ghost {
  background: transparent;
  box-shadow: none;
  border-width: 3px;
}

.panel {
  width: min(560px, 92vw);
  background: #fff6e4;
  border: 5px solid var(--ink);
  border-radius: 28px;
  padding: 28px 28px 24px;
  box-shadow: 8px 10px 0 rgba(58, 36, 21, 0.2);
}

.panel h2 {
  font-size: 1.8rem;
  margin-bottom: 14px;
}

.panel ul {
  text-align: left;
  list-style: none;
  display: grid;
  gap: 10px;
  font-weight: 700;
  line-height: 1.5;
}

.panel li b {
  color: var(--red);
}

.select-wrap {
  width: min(860px, 94vw);
}

.select-wrap h2 {
  font-size: 1.8rem;
  margin-bottom: 16px;
}

.stage-list {
  display: grid;
  gap: 12px;
}

.stage-card {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 4px solid var(--ink);
  background: #fff6e4;
  border-radius: 22px;
  padding: 16px 18px 14px;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "no name"
    "no en"
    "no hint"
    "no best";
  column-gap: 14px;
  box-shadow: 0 5px 0 var(--ink);
}

.stage-card:hover {
  background: #fff;
  transform: translateY(-1px);
}

.stage-no {
  grid-area: no;
  font-weight: 900;
  font-size: 1.8rem;
  color: var(--red);
  line-height: 1;
}

.stage-name {
  grid-area: name;
  font-weight: 900;
  font-size: 1.35rem;
}

.stage-en {
  grid-area: en;
  font-weight: 800;
  opacity: 0.55;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.stage-hint {
  grid-area: hint;
  font-weight: 700;
  margin-top: 4px;
}

.stage-best {
  grid-area: best;
  font-weight: 800;
  color: var(--superb);
  margin-top: 4px;
  font-size: 0.9rem;
}

.play-top {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px;
  pointer-events: none;
}

.play-top > span {
  display: none;
}

.play-tools {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.icon-btn {
  appearance: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: rgba(255, 246, 228, 0.9);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.result-rank {
  font-size: clamp(2.4rem, 8vw, 4rem);
  font-weight: 900;
  line-height: 1.1;
  -webkit-text-stroke: 6px var(--ink);
  paint-order: stroke fill;
}

.result-rank[data-rank="tryagain"] {
  color: var(--blue);
}
.result-rank[data-rank="ok"] {
  color: var(--ok);
}
.result-rank[data-rank="superb"] {
  color: var(--superb);
}
.result-rank[data-rank="perfect"] {
  color: var(--red);
}

.result-en {
  font-weight: 800;
  letter-spacing: 0.2em;
  margin: 4px 0 16px;
}

.result-stage {
  font-weight: 800;
  opacity: 0.65;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.result-grid b {
  display: block;
  font-size: 1.4rem;
}

.result-grid span {
  font-size: 0.75rem;
  font-weight: 800;
  opacity: 0.65;
}

@media (max-width: 720px) {
  .logo {
    -webkit-text-stroke: 7px var(--ink);
  }
  .result-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .back {
    top: 8px;
    left: 8px;
  }
}
