﻿:root {
  --bg: #0d1017;
  --panel: rgba(18, 24, 36, 0.94);
  --panel2: rgba(27, 34, 49, 0.95);
  --text: #f5f7fb;
  --muted: #9aa7bd;
  --accent: #ff3b5c;
  --accent2: #ffcc33;
  --good: #30d158;
  --danger: #ff453a;
  --hp: #2ee59d;
  --hp2: #19b36a;
  --shadow: 0 18px 50px rgba(0,0,0,.38);
  --radius: 20px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.08), transparent 35%),
    linear-gradient(180deg, #111827 0%, #0b0f17 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.game-shell {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 10px;
}

.hud {
  position: relative;
  display: grid;
  grid-template-columns: .48fr 1.15fr 1.15fr;
  gap: 8px;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 160px 10px 10px;
}

.hud-actions {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: flex;
  gap: 8px;
  z-index: 4;
}

.icon-action {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.03));
  color: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
}

.icon-action.primary {
  background: linear-gradient(180deg, #ff4d6d, #e11d48);
  border-color: rgba(255,255,255,.16);
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  background: rgba(255,255,255,.03);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.06);
}

.hud-item:first-of-type {
  min-width: 0;
}

.hud-label {
  font-size: 12px;
  color: var(--muted);
}

.hud-value {
  font-size: 18px;
  font-weight: 800;
  margin-top: 4px;
}

.token-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  direction: ltr;
}

.token-value img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 50%;
  filter: drop-shadow(0 0 8px rgba(48,209,88,.45));
}

.battle-zone {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
}

.weapon-column,
.weapon-tray {
  display: flex;
  gap: 9px;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 9px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.08);
}

.weapon-tray {
  direction: rtl;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,204,51,.72) rgba(255,255,255,.06);
}

.weapon-tray::-webkit-scrollbar {
  height: 7px;
}

.weapon-tray::-webkit-scrollbar-track {
  background: rgba(255,255,255,.06);
  border-radius: 999px;
}

.weapon-tray::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 999px;
}

.weapon-btn {
  width: 86px;
  flex: 0 0 86px;
  height: 86px;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
  color: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease, box-shadow .15s ease, opacity .15s ease;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
  overflow: hidden;
  scroll-snap-align: center;
}

.weapon-btn img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.28));
}

.weapon-btn:active,
.weapon-btn.active {
  transform: scale(.95);
  filter: brightness(1.15);
  box-shadow: 0 0 0 2px rgba(255,59,92,.45), inset 0 0 0 1px rgba(255,255,255,.1);
}

.weapon-btn.locked {
  opacity: .38;
  filter: grayscale(1);
}

.enemy-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  background: var(--panel2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.08);
  padding: 12px;
  overflow: hidden;
  width: 100%;
}

.stage-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 12px;
  color: white;
  background: linear-gradient(90deg, rgba(255,59,92,.95), rgba(255,204,51,.9));
  padding: 8px 12px;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(0,0,0,.28);
}

.enemy-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 220px;
  display: block;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(circle at center, rgba(255,255,255,.1), transparent 45%),
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.0));
}

.enemy-sprite,
.enemy-fallback {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
  transition: filter .18s ease, transform .18s ease, opacity .18s ease;
}

.enemy-sprite {
  display: none;
  image-rendering: auto;
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: 100%;
}

.enemy-fallback {
  display: block;
  max-height: none;
}

.enemy-frame-0 {
  filter: saturate(1.02) contrast(1.02);
  transform: scale(1);
}

.enemy-frame-1 {
  filter: saturate(1.08) contrast(1.08) brightness(.96);
  transform: scale(1.012);
}

.enemy-frame-2 {
  filter: saturate(1.18) contrast(1.16) brightness(.9) sepia(.12);
  transform: scale(1.024);
}

.enemy-frame-3 {
  filter: saturate(1.28) contrast(1.22) brightness(.84) sepia(.2);
  transform: scale(1.036);
}

.enemy-frame-4 {
  filter: saturate(1.38) contrast(1.3) brightness(.78) sepia(.3);
  transform: scale(1.048);
  opacity: .94;
}

.enemy-frame-5 {
  filter: saturate(1.46) contrast(1.36) brightness(.74) sepia(.36);
  transform: scale(1.055);
  opacity: .94;
}

.enemy-frame-6 {
  filter: saturate(1.54) contrast(1.42) brightness(.7) sepia(.42);
  transform: scale(1.062);
  opacity: .93;
}

.enemy-frame-7 {
  filter: saturate(1.62) contrast(1.5) brightness(.66) sepia(.5) drop-shadow(0 0 18px rgba(255,59,92,.34));
  transform: scale(1.07);
  opacity: .92;
}

.damage-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.float-damage {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: clamp(18px, 3.6vw, 34px);
  font-weight: 900;
  color: #ffd166;
  text-shadow: 0 0 12px rgba(0,0,0,.85), 0 0 24px rgba(255,209,102,.35);
  animation: floatUp 900ms ease-out forwards;
  will-change: transform, opacity;
}

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(1); }
}

.shake {
  animation: shake .32s linear;
}

@keyframes shake {
  0% { transform: translate(0,0); }
  10% { transform: translate(-4px, 2px); }
  20% { transform: translate(4px, -2px); }
  30% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, 2px); }
  50% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  70% { transform: translate(-2px, 1px); }
  80% { transform: translate(2px, -1px); }
  100% { transform: translate(0,0); }
}

.hp-panel {
  position: absolute;
  top: 14px;
  bottom: 14px;
  right: 14px;
  width: 18px;
  z-index: 5;
  background: rgba(0,0,0,.30);
  border-radius: 999px;
  padding: 3px;
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 0 16px rgba(0,0,0,.25);
}

.hp-top,
.hp-meta {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
}

.hp-top span:first-child {
  font-weight: 900;
  color: var(--accent2);
}

.hp-bar {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
  border: 0;
}

.hp-fill {
  width: 100%;
  height: 100%;
  position: absolute;
  bottom: 0;
  left: 0;
  background: linear-gradient(0deg, var(--hp), var(--hp2));
  border-radius: inherit;
  transition: height .12s linear, background .2s linear;
}

.hint {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: -4px;
}

.action-btn {
  border: 0;
  border-radius: 18px;
  padding: 14px 16px;
  font-weight: 800;
  cursor: pointer;
  color: white;
  box-shadow: var(--shadow);
}

.action-btn.primary {
  background: linear-gradient(180deg, #ff4d6d, #e11d48);
}

.action-btn.ghost {
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.09);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.62);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}

.hidden {
  display: none !important;
}

.modal-card {
  position: relative;
  overflow: hidden;
  width: min(92vw, 420px);
  background: #111827;
  border-radius: 24px;
  padding: 22px;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: var(--shadow);
  text-align: center;
}

.victory-card {
  background:
    radial-gradient(circle at 50% 0%, rgba(255,204,51,.24), transparent 35%),
    radial-gradient(circle at 18% 18%, rgba(48,209,88,.18), transparent 30%),
    linear-gradient(145deg, #111827, #191f2d 58%, #241329);
  border-color: rgba(255,204,51,.32);
  animation: victoryPop .42s cubic-bezier(.2,1.4,.45,1) both;
}

.victory-burst {
  position: absolute;
  inset: -45%;
  background: conic-gradient(from 0deg, transparent 0 18deg, rgba(255,204,51,.16) 18deg 25deg, transparent 25deg 48deg);
  animation: victorySpin 5s linear infinite;
  pointer-events: none;
}

.victory-medal {
  position: relative;
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,204,51,.35), rgba(255,59,92,.13));
  box-shadow: 0 0 30px rgba(255,204,51,.25);
  font-size: 36px;
  animation: medalFloat 1.4s ease-in-out infinite alternate;
}

.victory-card h2,
.victory-card p,
.victory-card .modal-actions {
  position: relative;
  z-index: 1;
}

.victory-lock-hint {
  font-size: 12px;
  color: #ffd166 !important;
  margin-top: -8px !important;
}

#victoryModal.modal-locked .modal-actions {
  pointer-events: none;
  opacity: .42;
  filter: grayscale(.35);
}

#victoryModal.modal-locked .victory-lock-hint {
  display: block;
}

#victoryModal:not(.modal-locked) .victory-lock-hint {
  display: none;
}

@keyframes victoryPop {
  from { opacity: 0; transform: translateY(18px) scale(.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes victorySpin {
  to { transform: rotate(360deg); }
}

@keyframes medalFloat {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-5px) scale(1.04); }
}

.modal-card.danger {
  border-color: rgba(255,69,58,.3);
}

.modal-card h2 {
  margin: 0 0 10px;
  font-size: 28px;
}

.modal-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.modal-actions {
  display: grid;
  gap: 10px;
}

.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(17, 24, 39, .96);
  color: #fff;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: var(--shadow);
  font-size: 13px;
}

@media (max-width: 760px) {
  .battle-zone {
    display: flex;
  }

  .hud {
    grid-template-columns: 42px minmax(0, 1fr) minmax(0, 1fr);
    padding: 8px 128px 8px 8px;
    gap: 6px;
  }

  .hud-actions {
    right: 8px;
    gap: 6px;
  }

  .icon-action {
    width: 34px;
    height: 36px;
    border-radius: 11px;
    font-size: 15px;
  }

  .hud-item {
    min-height: 48px;
    border-radius: 13px;
    padding: 4px;
  }

  .hud-item:first-of-type {
    min-width: 42px;
    max-width: 42px;
  }

  .hud-item:first-of-type .hud-label {
    display: none;
  }

  .hud-label {
    font-size: 10px;
  }

  .hud-value {
    font-size: 13px;
  }

  .token-value img {
    width: 18px;
    height: 18px;
  }

  .weapon-tray {
    padding: 7px;
    gap: 8px;
  }

  .weapon-btn {
    width: 76px;
    height: 76px;
    flex-basis: 76px;
    border-radius: 17px;
  }

  .weapon-btn img {
    width: 92%;
    height: 92%;
  }

  .enemy-stage {
    padding: 8px;
  }

  .enemy-wrap {
    min-height: 0;
  }

  .hint {
    display: none;
  }

  .stage-badge {
    top: 8px;
    left: 8px;
    font-size: 10px;
    padding: 6px 9px;
  }

  .hp-panel {
    top: 12px;
    bottom: 12px;
    right: 10px;
    width: 16px;
  }
}

/* Prompt Hard-Revenge UX2 - 2026-07-14 */
.enemy-wrap,
.enemy-stage,
.battle-zone,
.weapon-tray,
.weapon-btn {
  touch-action: manipulation;
}
.enemy-wrap {
  -webkit-user-select: none;
  user-select: none;
}
#victoryModal.final-victory .victory-card {
  background:
    radial-gradient(circle at 50% -8%, rgba(255,255,255,.38), transparent 28%),
    radial-gradient(circle at 20% 20%, rgba(255,216,107,.34), transparent 34%),
    radial-gradient(circle at 80% 22%, rgba(96,165,250,.25), transparent 32%),
    linear-gradient(145deg, #08111f, #18213b 48%, #3a2409) !important;
  border-color: rgba(255,216,107,.62) !important;
  box-shadow: 0 28px 90px rgba(0,0,0,.62), 0 0 70px rgba(255,216,107,.28) !important;
}
#victoryModal.final-victory .victory-burst {
  background:
    conic-gradient(from 0deg, rgba(255,216,107,.28), transparent 12deg 32deg, rgba(96,165,250,.18) 32deg 45deg, transparent 45deg 70deg),
    radial-gradient(circle, transparent 36%, rgba(255,255,255,.12) 37%, transparent 39%);
  animation: justiceSpin 2.8s linear infinite;
}
#victoryModal.final-victory .victory-medal {
  background: radial-gradient(circle, #fff7cc, #ffd86b 48%, #b45309) !important;
  color: #2b1700;
  box-shadow: 0 0 38px rgba(255,216,107,.65), 0 0 90px rgba(96,165,250,.25) !important;
  animation: justiceMedal 1.05s ease-in-out infinite alternate;
}
#victoryModal.final-victory .victory-medal::after {
  content: '⚖️';
  position: absolute;
  right: -18px;
  top: -14px;
  font-size: 30px;
  filter: drop-shadow(0 0 12px rgba(255,255,255,.45));
}
#victoryModal.final-victory .victory-lock-hint {
  display: none !important;
}
@keyframes justiceSpin {
  to { transform: rotate(360deg) scale(1.05); }
}
@keyframes justiceMedal {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-7px) scale(1.12); }
}
@media (hover: none) and (pointer: coarse) {
  .enemy-wrap { cursor: pointer; }
  .modal { touch-action: manipulation; }
}
