:root {
  --ink: #fff6e8;
  --ink-dim: #f0d4b0;
  --gold: #f6d56b;
  --gold-deep: #c7922a;
  --ruby: #ff4468;
  --night: #120814;
  --shadow: 0 10px 28px rgba(8, 0, 16, 0.45);
}

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

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

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

.back {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 100;
  color: #fff8ea;
  text-decoration: none;
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 800;
  padding: 8px 14px;
  background: rgba(18, 8, 20, 0.62);
  border-radius: 999px;
  box-shadow: inset 0 0 0 2px rgba(246, 213, 107, 0.6);
  text-shadow: 0 2px 0 #6a3a08;
}

.back:hover {
  color: var(--gold);
  background: rgba(18, 8, 20, 0.82);
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

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

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

.hidden {
  display: none !important;
}

.panel {
  background: url("../assets/ui/panel.png") center / 100% 100% no-repeat;
  padding: 56px 64px 48px;
  min-width: min(560px, 92vw);
  text-align: center;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.45));
}

.panel.wide {
  min-width: min(720px, 94vw);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.brand-en {
  letter-spacing: 0.28em;
  font-size: 13px;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(246, 213, 107, 0.6);
}

h1 {
  font-family: "Yusei Magic", "M PLUS Rounded 1c", sans-serif;
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1.05;
  color: #fff4dc;
  text-shadow:
    0 3px 0 #9a1830,
    0 8px 0 #5a0c1c,
    0 0 22px rgba(255, 90, 120, 0.55);
}

.subtitle {
  margin: 6px 0 22px;
  color: var(--gold);
  letter-spacing: 0.18em;
  font-weight: 800;
  text-shadow: 0 2px 0 #6a3a08;
}

.mascot-wrap {
  position: absolute;
  left: max(2vw, 12px);
  bottom: 4vh;
  width: min(340px, 36vw);
  pointer-events: none;
  z-index: 4;
}

.mascot-wrap img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 18px 16px rgba(0, 0, 0, 0.35));
  animation: puni 1.35s ease-in-out infinite;
  transform-origin: 50% 85%;
}

@keyframes puni {
  0%,
  100% {
    transform: translateY(0) scale(1, 1);
  }
  40% {
    transform: translateY(-18px) scale(1.05, 0.94);
  }
  55% {
    transform: translateY(4px) scale(0.96, 1.06);
  }
}

.col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.arcade-btn {
  appearance: none;
  border: 0;
  background: url("../assets/ui/button.png") center / 100% 100% no-repeat;
  color: #fff8ea;
  font-family: inherit;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.12em;
  min-width: 280px;
  height: 74px;
  padding: 0 28px 6px;
  cursor: pointer;
  text-shadow: 0 2px 0 #6a1020, 0 0 12px rgba(255, 80, 110, 0.5);
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.28));
  transition: transform 0.12s ease, filter 0.12s ease;
}

.arcade-btn:hover {
  filter: brightness(1.12) drop-shadow(0 8px 10px rgba(0, 0, 0, 0.28));
  transform: translateY(-2px) scale(1.03);
}

.arcade-btn:active {
  filter: brightness(0.88);
  transform: translateY(2px) scale(0.97);
}

.arcade-btn.small {
  min-width: 200px;
  height: 62px;
  font-size: 18px;
}

.hint {
  margin-top: 16px;
  color: var(--ink-dim);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.howto {
  text-align: left;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.75;
}

.howto b {
  color: var(--gold);
}

.krow {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 3px 0;
}

.keys {
  color: #ffd4a8;
  font-weight: 700;
}

.modes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.mode-btn {
  width: 100%;
}

.mode-desc {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  opacity: 0.85;
  font-weight: 700;
}

#hud {
  position: absolute;
  right: max(2vw, 16px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(250px, 24vw);
  pointer-events: none;
}

.hud-card {
  background: url("../assets/ui/panel.png") center / 100% 100% no-repeat;
  padding: 22px 22px 18px;
  text-align: center;
}

.hud-label {
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--gold);
  font-weight: 800;
}

.hud-value {
  font-family: "Yusei Magic", "M PLUS Rounded 1c", sans-serif;
  font-size: 34px;
  line-height: 1.15;
  color: #fff8e8;
  text-shadow: 0 2px 0 #6a1830;
}

.hud-value.small {
  font-size: 22px;
}

.next-box {
  display: flex;
  justify-content: center;
  gap: 10px;
  min-height: 92px;
  align-items: center;
}

.next-box canvas {
  width: 108px;
  height: 92px;
}

.danger {
  color: #ff6d7d;
  animation: pulse 0.55s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

#touch {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 7;
  display: none;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

#touch button {
  pointer-events: auto;
  width: 64px;
  height: 56px;
  border: 0;
  border-radius: 14px;
  background: rgba(20, 8, 24, 0.55);
  color: #fff4dc;
  font-size: 22px;
  font-weight: 800;
  backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 2px rgba(246, 213, 107, 0.45);
}

@media (pointer: coarse) {
  #touch {
    display: flex;
  }
  .mascot-wrap {
    width: min(220px, 34vw);
  }
}

#toast {
  position: absolute;
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  z-index: 8;
  font-family: "Yusei Magic", sans-serif;
  font-size: clamp(36px, 6vw, 72px);
  color: #fff7d8;
  text-shadow: 0 4px 0 #8a1830, 0 0 24px rgba(255, 210, 80, 0.7);
  pointer-events: none;
  opacity: 0;
}

.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 10px 0;
  color: var(--ink);
  font-weight: 700;
}

.slider-row input {
  flex: 1;
  accent-color: var(--ruby);
}

#boot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  background: rgba(10, 6, 16, 0.35);
  font-size: 22px;
  letter-spacing: 0.16em;
  font-weight: 800;
  text-shadow: 0 2px 12px #000;
}
