@charset "utf-8";

:root {
  --enemy-scale: 1;
  --enemy-hop: 0px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: #fff8eb;
  background:
    radial-gradient(circle at 50% 12%, rgba(128, 32, 58, 0.34), transparent 24rem),
    linear-gradient(180deg, #221b1b 0%, #3b2f30 46%, #171312 100%);
  font-family: "Hiragino Kaku Gothic Pro", "Meiryo", sans-serif;
}

button,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 4px solid #ffe28a;
  outline-offset: 3px;
}

.screen {
  width: min(1100px, calc(100% - 24px));
  min-height: 100vh;
  margin: 0 auto;
}

.title-screen,
.result-screen {
  display: grid;
  align-items: center;
  padding: 24px 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  position: relative;
  overflow: hidden;
}

.title-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("./sozai/tati.png?v=20260824a");
  background-position: right 50% center;
  background-repeat: no-repeat;
  background-size: min(60vw, 60vh) auto;
  pointer-events: none;
  animation: titleMonbanIn 900ms cubic-bezier(.2,.82,.2,1) both;
}

.title-screen::after,
.result-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(12, 9, 9, 0.42);
  pointer-events: none;
}

.result-screen {
  background-image: var(--result-bg);
  background-position: right 50% center;
  background-size: min(60vw, 60vh) auto;
}

@keyframes titleMonbanIn {
  from {
    opacity: 0;
    transform: translateX(26%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.title-block,
.result-panel {
  position: relative;
  z-index: 1;
}

.title-block {
  width: 100%;
}

.result-panel {
  max-width: 900px;
}

.title-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(320px, 1fr);
  gap: clamp(18px, 4vw, 46px);
  align-items: center;
}

.title-copy {
  max-width: 600px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.72);
}

.eyebrow {
  margin: 0 0 10px;
  color: #ffc15d;
  font-weight: 800;
}

h1 {
  margin: 0 0 18px;
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 1;
}

h1 span {
  display: block;
  white-space: nowrap;
}

.howto {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 12px 0 0;
  padding-left: 1.3em;
  font-size: 0.9rem;
  line-height: 1.45;
  text-shadow: 0 2px 0 #000;
}

.title-rule {
  justify-self: end;
  width: min(520px, 100%);
}

.title-rule img {
  display: block;
  width: 100%;
  max-height: min(52vh, 520px);
  object-fit: contain;
  border: 2px solid rgba(255, 248, 235, 0.58);
  background: rgba(0, 0, 0, 0.36);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}

.level-picks,
.title-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 16px;
}

.level-button,
.command-button,
.text-link {
  min-height: 46px;
  border: 2px solid #fff8eb;
  color: #fff8eb;
  background: rgba(255, 248, 235, 0.08);
  padding: 10px 18px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.level-button.is-selected {
  color: #241411;
  background: #ffc15d;
  box-shadow: 0 0 0 4px rgba(255, 193, 93, 0.25);
}

.x-share {
  background: #111;
  color: #fff;
  text-decoration: none;
}

.command-button {
  background: #c43f4d;
}

.command-button.secondary {
  background: #4f4650;
}

.command-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.asset-status {
  min-height: 28px;
  margin-top: 12px;
  color: #ffdca1;
  line-height: 1.5;
}

.game-screen {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 10px;
  height: 100vh;
  min-height: 560px;
  padding: 12px 0;
}

.hud {
  display: grid;
  gap: 6px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-weight: 800;
  text-shadow: 0 2px 0 #000;
}

.hp-shell {
  height: 18px;
  border: 2px solid #fff8eb;
  background: rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  width: 100%;
  transition: width 0.12s linear;
}

.hp-enemy {
  background: linear-gradient(90deg, #d53a4a, #ffb24e);
}

.hp-player {
  background: linear-gradient(90deg, #3db7a8, #9be16a);
}

.arena {
  position: relative;
  min-height: 0;
  border: 2px solid rgba(255, 248, 235, 0.34);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), transparent 50%),
    radial-gradient(circle at 50% 72%, rgba(255, 193, 93, 0.13), transparent 22rem),
    #120f11;
  overflow: hidden;
  touch-action: none;
}

.spine-host {
  position: absolute;
  left: 50%;
  top: 51%;
  width: min(111vh, 126vw);
  height: min(111vh, 126vw);
  transform: translate(-50%, -50%) translateY(var(--enemy-hop)) scale(var(--enemy-scale));
  transform-origin: 50% 58%;
}

.spine-player {
  background: transparent !important;
}

.slash-layer,
.projectile-layer,
.damage-layer,
.flash-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.slash-effect {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.slash-effect polyline {
  fill: none;
  stroke: #fff;
  stroke-width: 15;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 12px #ffffff) drop-shadow(0 0 22px #9ff3ff);
  opacity: 0;
  animation: slashFade 0.26s ease-out forwards;
}

@keyframes slashFade {
  0% { opacity: 1; stroke-width: 18; }
  100% { opacity: 0; stroke-width: 2; }
}

.projectile {
  position: absolute;
  width: 26px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 16%, #d98cff 18% 35%, #7a25da 40% 65%, transparent 70%);
  box-shadow: 0 0 18px #bd5cff, 0 0 38px #7b2cff;
}

.projectile::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(198, 110, 255, 0.38), transparent 68%);
}

.projectile.is-reflectable {
  background: radial-gradient(circle, #fff 0 22%, #f6e9ff 24% 36%, #d071ff 42% 65%, transparent 72%);
  box-shadow: 0 0 26px #ffffff, 0 0 54px #e3a3ff, 0 0 86px #8f41ff;
}

.projectile.is-reflectable::after {
  inset: -24px;
  background: radial-gradient(circle, rgba(255,255,255,0.62), rgba(216,128,255,0.35) 42%, transparent 72%);
}

.damage-number {
  position: absolute;
  transform: translate(-50%, -50%);
  color: #fff;
  font-weight: 900;
  font-size: clamp(1.4rem, 5vw, 3rem);
  text-shadow: 0 3px 0 #000, 0 0 16px currentColor;
  animation: damageRise 0.75s ease-out forwards;
}

.damage-counter {
  color: #ffe060;
  font-size: clamp(2rem, 7vw, 4rem);
}

.damage-reflect {
  color: #d18aff;
}

.damage-taken {
  color: #ff5360;
}

@keyframes damageRise {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.75); }
  20% { opacity: 1; transform: translate(-50%, -6px) scale(1.06); }
  100% { opacity: 0; transform: translate(-50%, -54px) scale(0.92); }
}

.purple-burst {
  position: absolute;
  width: 120px;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.9), rgba(191,94,255,0.7) 28%, transparent 68%);
  animation: burst 0.45s ease-out forwards;
}

@keyframes burst {
  to { opacity: 0; transform: translate(-50%, -50%) scale(1.8); }
}

.explosion-effect {
  position: absolute;
  z-index: 3;
  width: clamp(150px, 25vw, 300px);
  height: auto;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: explosionFade 1s linear forwards;
}

@keyframes explosionFade {
  0%, 78% { opacity: 1; }
  100% { opacity: 0; }
}

.red-flash {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: rgba(210, 32, 48, 0.32);
  animation: flash 0.22s ease-out forwards;
}

.guard-flash {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: rgba(148, 238, 255, 0.36);
  box-shadow: inset 0 0 80px rgba(255,255,255,0.45);
  animation: flash 0.22s ease-out forwards;
}

@keyframes flash {
  to { opacity: 0; }
}

.guard-aura {
  position: absolute;
  inset: 0;
  border: 5px solid rgba(108, 227, 255, 0.7);
  box-shadow: inset 0 0 32px rgba(108, 227, 255, 0.25), 0 0 22px rgba(108, 227, 255, 0.25);
}

.status-row {
  display: flex;
  gap: 10px;
  min-height: 28px;
}

.meter-badge {
  min-width: 150px;
  border: 1px solid rgba(255, 248, 235, 0.6);
  background: rgba(0,0,0,0.34);
  font-size: 0.8rem;
  font-weight: 900;
}

.meter-badge span {
  display: block;
  padding: 4px 8px 2px;
}

.meter-badge i {
  display: block;
  height: 4px;
  width: 100%;
  background: #73e6ff;
}

.meter-badge.counter i {
  background: #ffe060;
}

.result-panel h2 {
  margin: 0 0 18px;
  font-size: clamp(2.4rem, 10vw, 6rem);
}

.result-list {
  display: grid;
  gap: 10px;
  max-width: 540px;
}

.result-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.3);
  padding-bottom: 8px;
}

.result-list dt {
  font-weight: 700;
}

.result-list dd {
  margin: 0;
}

.debug-panel {
  position: fixed;
  right: 8px;
  bottom: 8px;
  z-index: 50;
  max-width: min(360px, calc(100% - 16px));
  white-space: pre-wrap;
  padding: 10px;
  background: rgba(0,0,0,0.76);
  color: #d9ffb9;
  font: 12px/1.45 Consolas, monospace;
}

@media (max-width: 720px) {
  .title-screen {
    align-items: start;
    padding-top: 18px;
  }

  .title-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .title-copy {
    max-width: none;
  }

  h1 {
    font-size: clamp(2rem, 10vw, 3.6rem);
  }

  .title-rule {
    justify-self: center;
  }

  .title-rule img {
    max-height: 34vh;
  }

  .howto {
    grid-template-columns: 1fr;
  }

  .game-screen {
    min-height: 100svh;
    height: 100svh;
  }

  .spine-host {
    width: min(138vw, 87vh);
    height: min(138vw, 87vh);
  }
}
