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

html, body {
  height: 100%;
  background: #070B1B;
  color: #E8ECF8;
  font-family: 'Space Grotesk', -apple-system, 'Hiragino Sans', 'Yu Gothic', sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
html { overflow: hidden; }
body { overflow-y: auto; }

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(80,120,200,.15), transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(180,90,200,.10), transparent 55%),
    #070B1B;
  touch-action: none;
}

#vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 38%, rgba(7,11,27,.55) 78%, rgba(0,0,0,.92) 100%);
  pointer-events: none;
  z-index: 2;
}

/* ===== HUD ===== */
.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 5;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.badge {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}
.badge .label {
  color: #7A86A0;
  margin-right: 4px;
  font-size: .66rem;
}
.badge .val {
  color: #FFD178;
  font-variant-numeric: tabular-nums;
  font-family: 'Orbitron', sans-serif;
  font-size: .88rem;
  letter-spacing: .02em;
}

/* クリック可能なHUDボタン（情報バッジと区別） */
button.badge {
  cursor: pointer;
  font-family: inherit;
  color: #C8D4E8;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}
button.badge:hover {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.20);
  color: #FFFFFF;
}
button.badge:active {
  transform: scale(.94);
  background: rgba(255,209,120,.14);
  border-color: rgba(255,209,120,.4);
  color: #FFD178;
}
.badge svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
  pointer-events: none;
}

/* HUDアクション用のアイコン円形ボタン（情報バッジと視覚的に分離） */
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  color: #C8D4E8;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}
.icon-btn:hover {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.20);
  color: #FFFFFF;
}
.icon-btn:active {
  transform: scale(.92);
  background: rgba(255,209,120,.14);
  border-color: rgba(255,209,120,.4);
  color: #FFD178;
}
.icon-btn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* ===== Title Screen ===== */
@keyframes title-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,209,120,.6), 0 6px 28px rgba(255,209,120,.2); }
  55% { box-shadow: 0 0 0 16px rgba(255,209,120,0), 0 6px 28px rgba(255,209,120,.5); }
}

#overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 42%, rgba(16,26,56,.68) 0%, rgba(7,11,27,.88) 68%);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  transition: opacity .3s;
}
#overlay.hidden { opacity: 0; pointer-events: none; }

#overlay .title {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.title-en {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(3rem, 10vw, 5rem);
  font-weight: 900;
  letter-spacing: .12em;
  color: #FFFFFF;
  text-shadow:
    0 0 16px rgba(124,200,232,.95),
    0 0 42px rgba(124,200,232,.6),
    0 0 88px rgba(124,200,232,.25);
  animation: title-float 4.5s ease-in-out infinite;
  line-height: 1.1;
}
.title-en .accent {
  color: #FFD178;
  text-shadow:
    0 0 16px rgba(255,209,120,.95),
    0 0 42px rgba(255,209,120,.6),
    0 0 88px rgba(255,209,120,.25);
}

.title-ja {
  font-size: .78rem;
  letter-spacing: .42em;
  color: #7CC8E8;
  opacity: .72;
  margin-top: 8px;
  font-weight: 500;
}

.title-divider {
  width: 150px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124,200,232,.55) 35%, rgba(201,155,255,.55) 65%, transparent);
  margin: 22px auto 22px;
}

#overlay .sub {
  font-size: .84rem;
  color: #B8C2D6;
  max-width: 300px;
  text-align: center;
  line-height: 1.85;
  margin: 0 24px;
}

#overlay .start-btn {
  margin-top: 30px;
  background: linear-gradient(140deg, #FFE49E, #FFD178 52%, #FFC04A);
  color: #1A1408;
  border: none;
  border-radius: 999px;
  padding: 15px 46px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  animation: btn-pulse 2.8s ease-in-out infinite;
  transition: transform .1s, filter .15s;
  touch-action: manipulation;
}
.start-btn:active { transform: scale(.93); filter: brightness(.88); }
.start-btn:hover { filter: brightness(1.1); }

#watch-btn {
  margin-top: 12px;
  background: transparent;
  color: rgba(180,210,235,.82);
  border: 1.5px solid rgba(124,200,232,.32);
  border-radius: 999px;
  padding: 11px 30px;
  font-size: .82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  letter-spacing: .04em;
  transition: border-color .2s, color .2s;
}
#watch-btn:hover {
  border-color: rgba(124,200,232,.6);
  color: rgba(200,230,245,1);
}

.hint {
  font-size: .71rem;
  color: rgba(122,134,160,.65);
  margin-top: 16px;
  letter-spacing: .02em;
}

/* ===== Result overlay ===== */
#result-overlay {
  overflow: hidden;
}
#result-overlay.hidden { opacity: 0; }
#result-overlay.show { opacity: 1; }

/* スキャンライン: 横長の光帯が画面を上から下へスーッと通過 */
#result-overlay::before,
#result-overlay::after {
  content: '';
  position: absolute;
  left: -10%;
  right: -10%;
  height: 6vh;
  pointer-events: none;
  filter: blur(8px);
  opacity: 0;
}
#result-overlay::before {
  background: linear-gradient(180deg, transparent, rgba(255,209,120,.45), transparent);
}
#result-overlay::after {
  height: 1px;
  background: linear-gradient(90deg, transparent 10%, rgba(255,231,165,.95) 50%, transparent 90%);
  filter: blur(1px);
  box-shadow: 0 0 18px rgba(255,209,120,.7);
}
@keyframes scanline-soft {
  0% { top: -8vh; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 110vh; opacity: 0; }
}
@keyframes scanline-sharp {
  0% { top: -2vh; opacity: 0; }
  20% { opacity: 1; }
  100% { top: 102vh; opacity: 0; }
}
#result-overlay.show::before { animation: scanline-soft 1.0s ease-out; }
#result-overlay.show::after { animation: scanline-sharp 0.6s ease-out 0.05s; }

@keyframes result-title-enter {
  0% {
    opacity: 0;
    transform: scale(.55) translateY(18px);
    letter-spacing: .32em;
    filter: blur(10px);
  }
  55% {
    opacity: 1;
    transform: scale(1.08) translateY(-2px);
    letter-spacing: .1em;
    filter: blur(0);
  }
  100% {
    transform: scale(1) translateY(0);
    letter-spacing: .06em;
  }
}
@keyframes result-glow-pulse {
  0%, 100% {
    text-shadow:
      0 0 30px currentColor,
      0 0 60px currentColor;
  }
  50% {
    text-shadow:
      0 0 50px currentColor,
      0 0 100px currentColor,
      0 0 150px currentColor;
  }
}
@keyframes result-sub-fade {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

#result-title {
  position: relative;
  z-index: 1;
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(2rem, 7vw, 2.8rem);
  font-weight: 900;
  letter-spacing: .06em;
  text-shadow: 0 0 30px currentColor, 0 0 60px currentColor;
}
#result-sub {
  position: relative;
  z-index: 1;
  font-size: .85rem;
  color: #B8C2D6;
  text-shadow: 0 0 10px rgba(0,0,0,.8);
}
#result-overlay.show #result-title {
  animation:
    result-title-enter .6s cubic-bezier(.18, .89, .25, 1.3),
    result-glow-pulse 1.8s ease-in-out infinite .6s;
}
#result-overlay.show #result-sub {
  animation: result-sub-fade .5s ease-out .35s backwards;
}

/* ===== Controls ===== */
.controls {
  position: fixed;
  bottom: 16px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  padding: 0 12px;
  z-index: 6;
  pointer-events: none;
  gap: 8px;
}
.controls > * { pointer-events: auto; }

.ctrl-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  border: 1.5px solid rgba(255,255,255,.14);
  color: #C8D4E8;
  font-size: 1.4rem;
  font-weight: 800;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 2px 12px rgba(0,0,0,.4);
  transition: background .1s, border-color .1s, color .1s, box-shadow .1s, transform .08s;
}
.ctrl-btn:active { transform: scale(.92); }
.ctrl-btn svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.ctrl-btn.active {
  background: rgba(255, 209, 120, .18);
  border-color: rgba(255, 209, 120, .5);
  color: #FFD178;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 0 14px rgba(255,209,120,.3);
}

@keyframes fire-ready {
  0%, 100% {
    box-shadow:
      0 0 18px rgba(255,209,120,.45),
      0 0 6px rgba(255,209,120,.75),
      inset 0 1px 0 rgba(255,255,255,.4);
  }
  50% {
    box-shadow:
      0 0 32px rgba(255,209,120,.85),
      0 0 12px rgba(255,209,120,1),
      inset 0 1px 0 rgba(255,255,255,.5);
  }
}

.fire-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #FFE49E, #FFD178 52%, #FFC04A);
  border: 2.5px solid rgba(255,255,255,.85);
  color: #1A1408;
  font-size: .9rem;
  font-weight: 900;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: .05em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  animation: fire-ready 1.6s ease-in-out infinite;
  transition: transform .08s, filter .1s, opacity .25s;
}
.fire-btn:active { transform: scale(.93); filter: brightness(.88); }
.fire-btn:disabled {
  opacity: .35;
  filter: grayscale(.6) brightness(.85);
  cursor: not-allowed;
  animation: none;
  box-shadow: 0 0 6px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.15);
}
