/* ============ STAND WORLD — JoJo-inspired UI ============ */
:root {
  --gold: #ffc23d;
  --purple: #7b5cff;
  --magenta: #ff3d8b;
  --cyan: #59d8ff;
  --red: #ff4d5e;
  --ink: #0d0a1f;
  --panel: rgba(16, 11, 38, 0.82);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: var(--ink); font-family: 'Inter', system-ui, sans-serif; color: #fff; }
.hidden { display: none !important; }
.jp { font-family: 'Noto Sans JP', sans-serif; }

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

/* ---------- menacing background ---------- */
#menacing-bg { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
#menacing-bg span {
  position: absolute; font-family: 'Noto Sans JP', sans-serif; font-weight: 900;
  color: rgba(123, 92, 255, 0.28); text-shadow: 0 0 18px rgba(123, 92, 255, 0.5);
  animation: menace-float 7s ease-in-out infinite;
}
@keyframes menace-float {
  0%, 100% { transform: translateY(0) rotate(-6deg); opacity: .5; }
  50% { transform: translateY(-26px) rotate(4deg); opacity: 1; }
}

/* ---------- menu ---------- */
#menu {
  position: fixed; inset: 0; z-index: 10; overflow-y: auto;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 61, 139, 0.22), transparent 60%),
    radial-gradient(900px 700px at 10% 110%, rgba(89, 216, 255, 0.16), transparent 60%),
    repeating-linear-gradient(115deg, transparent 0 46px, rgba(255,255,255,0.022) 46px 48px),
    linear-gradient(160deg, #17103a 0%, #0d0a1f 55%, #1b0f33 100%);
  display: flex; align-items: flex-start; justify-content: center;
}
.menu-inner { width: min(1060px, 94vw); padding: 34px 0 46px; text-align: center; position: relative; z-index: 2; }

.logo-block { margin-bottom: 22px; }
.logo-jp { font-family: 'Noto Sans JP', sans-serif; font-weight: 900; letter-spacing: .5em; color: var(--gold); font-size: clamp(11px, 1.6vw, 15px); opacity: .9; }
.logo {
  font-family: 'Russo One', sans-serif; font-size: clamp(44px, 8vw, 88px); line-height: .95;
  letter-spacing: .02em; transform: skewX(-6deg);
  background: linear-gradient(180deg, #fff 20%, var(--gold) 55%, #ff8a3d 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(123, 92, 255, .85)) drop-shadow(0 10px 26px rgba(255, 194, 61, .3));
}
.logo span { display: block; background: linear-gradient(180deg, #cdbcff 10%, var(--purple) 60%, #4a2fd0 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-sub { margin-top: 12px; font-size: clamp(10px, 1.4vw, 13px); letter-spacing: .28em; color: #b9aee6; font-weight: 600; }

.name-row { margin: 8px auto 20px; display: flex; flex-direction: column; gap: 6px; width: min(340px, 86vw); }
.name-row label { font-size: 11px; letter-spacing: .22em; color: var(--gold); font-weight: 800; }
#nick {
  background: rgba(255,255,255,.06); border: 2px solid rgba(123,92,255,.55); color: #fff;
  font: 600 17px 'Inter', sans-serif; padding: 11px 16px; text-align: center; outline: none;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
  transition: border-color .2s, background .2s;
}
#nick:focus { border-color: var(--gold); background: rgba(255,194,61,.08); }

.cards-title { font-family: 'Russo One'; font-size: 14px; letter-spacing: .3em; color: #fff; margin-bottom: 14px; text-shadow: 0 0 14px rgba(123,92,255,.8); }
#cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 24px; }

.card {
  position: relative; text-align: left; padding: 16px 16px 14px; cursor: pointer;
  background: var(--panel); border: 2px solid rgba(255,255,255,.1);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  transition: transform .18s, border-color .18s, box-shadow .18s; overflow: hidden;
}
.card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(160deg, var(--cc) 0%, transparent 46%); opacity: .16; pointer-events: none; }
.card::after {
  content: attr(data-jp); position: absolute; right: 6px; bottom: -12px; font-family: 'Noto Sans JP'; font-weight: 900;
  font-size: 74px; color: var(--cc); opacity: .12; pointer-events: none; line-height: 1;
}
.card:hover { transform: translateY(-4px) scale(1.015); border-color: var(--cc); }
.card.sel { border-color: var(--cc); box-shadow: 0 0 0 1px var(--cc), 0 0 34px color-mix(in srgb, var(--cc) 55%, transparent); transform: translateY(-4px); }
.card.sel .card-check { opacity: 1; transform: scale(1); }
.card-check {
  position: absolute; top: 10px; right: 12px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--cc); color: #0d0a1f; font-weight: 900; display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.4); transition: .2s; z-index: 2;
}
.card-portrait { font-size: 44px; line-height: 1; margin-bottom: 8px; filter: drop-shadow(0 0 12px var(--cc)); }
.card-name { font-family: 'Russo One'; font-size: 21px; color: #fff; }
.card-stand { font-size: 11px; font-weight: 800; letter-spacing: .18em; color: var(--cc); margin: 2px 0 8px; }
.card-desc { font-size: 12px; color: #cfc6ee; line-height: 1.45; min-height: 52px; }
.card-stats { margin-top: 10px; display: grid; gap: 4px; }
.stat { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 8px; font-size: 9px; letter-spacing: .14em; color: #9d92c9; font-weight: 800; }
.stat-track { height: 5px; background: rgba(255,255,255,.09); }
.stat-fill { height: 100%; background: linear-gradient(90deg, var(--cc), #fff); box-shadow: 0 0 8px var(--cc); }
.card-ab { margin-top: 10px; font-size: 11px; color: var(--gold); font-weight: 600; }
.card-ab b { color: #fff; }

#play {
  font-family: 'Russo One'; font-size: 22px; letter-spacing: .12em; color: #1a1030;
  background: linear-gradient(180deg, #ffe08a, var(--gold) 55%, #ff9a3d);
  border: none; padding: 15px 64px; cursor: pointer; transform: skewX(-8deg);
  clip-path: polygon(16px 0, 100% 0, calc(100% - 16px) 100%, 0 100%);
  box-shadow: 0 6px 0 #8a5a00, 0 14px 40px rgba(255,194,61,.35); transition: .15s;
}
#play:hover:not(:disabled) { transform: skewX(-8deg) translateY(-2px); box-shadow: 0 8px 0 #8a5a00, 0 18px 50px rgba(255,194,61,.5); }
#play:active:not(:disabled) { transform: skewX(-8deg) translateY(3px); box-shadow: 0 2px 0 #8a5a00; }
#play:disabled { filter: grayscale(.8) brightness(.6); cursor: not-allowed; }

.controls-hint { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; font-size: 12px; color: #a99cd8; }
.controls-hint b { color: var(--gold); font-weight: 800; }
.menu-note { margin-top: 14px; font-size: 11.5px; color: #7d71ad; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; font-size: 13px; }
#hud > div { pointer-events: none; }

#mission-panel {
  position: absolute; top: 16px; left: 16px; width: 280px; padding: 12px 16px;
  background: var(--panel); border-left: 4px solid var(--gold);
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
  backdrop-filter: blur(6px);
}
.m-label { font-size: 9px; letter-spacing: .3em; color: var(--gold); font-weight: 800; }
#m-title { font-family: 'Russo One'; font-size: 17px; margin: 3px 0 2px; }
#m-desc { font-size: 11px; color: #b9aee6; line-height: 1.4; }
.m-progress { margin-top: 8px; height: 7px; background: rgba(255,255,255,.1); }
#m-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--purple), var(--magenta)); box-shadow: 0 0 10px var(--magenta); transition: width .3s; }
#m-count { margin-top: 4px; font-size: 11px; font-weight: 800; color: #fff; text-align: right; }

#boss-bar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: min(520px, 60vw); text-align: center; }
.boss-name { font-family: 'Russo One'; font-size: 15px; color: var(--red); letter-spacing: .14em; text-shadow: 0 0 16px rgba(255,77,94,.8); margin-bottom: 5px; }
.boss-name .jp { font-size: 11px; opacity: .8; margin-left: 8px; }
.boss-track { height: 12px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,77,94,.6); clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }
#boss-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #7a0f22, var(--red), #ff8a3d); box-shadow: 0 0 14px var(--red); transition: width .2s; }

#players-panel { position: absolute; top: 16px; right: 16px; width: 210px; padding: 10px 14px; background: var(--panel); border-right: 4px solid var(--purple); clip-path: polygon(14px 0, 100% 0, 100% 100%, 0 100%); backdrop-filter: blur(6px); }
.p-label { font-size: 9px; letter-spacing: .24em; color: var(--purple); font-weight: 800; margin-bottom: 6px; }
.pl-row { display: flex; align-items: center; gap: 7px; padding: 3px 0; font-size: 12px; }
.pl-dot { width: 9px; height: 9px; border-radius: 2px; transform: rotate(45deg); flex: none; box-shadow: 0 0 8px currentColor; }
.pl-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pl-name.dead { opacity: .4; text-decoration: line-through; }
.pl-kills { color: var(--gold); font-weight: 800; font-size: 11px; }
.pl-me .pl-name { color: var(--gold); }

#killfeed { position: absolute; top: 118px; right: 16px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.kf { background: rgba(13,10,31,.75); padding: 4px 10px; font-size: 11px; border-right: 3px solid var(--magenta); animation: kf-in .25s ease-out; max-width: 300px; }
.kf b { color: var(--gold); }
@keyframes kf-in { from { transform: translateX(30px); opacity: 0; } }

#banner {
  position: absolute; top: 26%; left: 50%; transform: translateX(-50%) skewX(-6deg);
  font-family: 'Russo One'; font-size: clamp(24px, 4.4vw, 44px); text-align: center;
  color: var(--gold); text-shadow: 0 0 30px rgba(255,194,61,.7), 3px 3px 0 var(--purple);
  animation: banner-in .5s cubic-bezier(.2, 1.6, .4, 1); white-space: nowrap;
}
#banner small { display: block; font-size: .42em; color: #fff; letter-spacing: .2em; margin-top: 6px; text-shadow: 0 0 14px var(--purple); }
@keyframes banner-in { from { transform: translateX(-50%) skewX(-6deg) scale(2.4); opacity: 0; } }

#combo { position: absolute; top: 38%; right: 8%; font-family: 'Russo One'; font-size: 30px; color: var(--magenta); transform: rotate(-6deg); text-shadow: 0 0 20px rgba(255,61,139,.8), 2px 2px 0 #fff; }

#bottom-left { position: absolute; left: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
#hp-wrap { width: 300px; }
#hp-name { font-family: 'Russo One'; font-size: 13px; letter-spacing: .1em; margin-bottom: 4px; color: #fff; text-shadow: 0 0 10px var(--purple); }
#hp-track { position: relative; height: 20px; background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.25); clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
#hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #2ee6a8, #a8ff3d); box-shadow: 0 0 14px rgba(46,230,168,.6); transition: width .2s; }
#hp-fill.low { background: linear-gradient(90deg, #ff2d55, #ff8a3d); box-shadow: 0 0 14px rgba(255,45,85,.8); }
#hp-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; text-shadow: 0 1px 3px #000; }

#skills { display: flex; gap: 8px; }
.skill { position: relative; width: 58px; height: 58px; background: var(--panel); border: 2px solid rgba(123,92,255,.5); display: flex; align-items: center; justify-content: center; clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); overflow: hidden; }
.sk-icon { font-size: 24px; filter: drop-shadow(0 0 8px var(--purple)); }
.sk-key { position: absolute; bottom: 2px; right: 5px; font-size: 8px; font-weight: 800; color: #9d92c9; letter-spacing: .08em; }
.sk-name { position: absolute; top: 2px; left: 0; right: 0; text-align: center; font-size: 7px; font-weight: 800; letter-spacing: .14em; color: var(--gold); }
.sk-cd { position: absolute; inset: 0; background: rgba(10,6,26,.82); transform-origin: bottom; transform: scaleY(0); }
.skill.ready { border-color: var(--gold); box-shadow: 0 0 16px rgba(255,194,61,.45); }
.skill.flash { animation: sk-flash .3s; }
@keyframes sk-flash { 0% { background: rgba(255,194,61,.7); } }

#chat { position: absolute; left: 16px; bottom: 118px; width: min(360px, 60vw); pointer-events: none; }
#chat-log { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.chat-msg { background: rgba(13,10,31,.68); padding: 4px 10px; font-size: 12px; border-left: 3px solid var(--cyan); animation: kf-in .2s; word-break: break-word; }
.chat-msg b { color: var(--cyan); }
.chat-msg.sys { border-left-color: var(--gold); color: var(--gold); font-style: italic; }
#chat-input { pointer-events: auto; width: 100%; background: rgba(13,10,31,.9); border: 1px solid var(--cyan); color: #fff; font: 400 13px 'Inter'; padding: 8px 12px; outline: none; }

#crosshair { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 18px; color: rgba(255,255,255,.65); text-shadow: 0 0 6px #000; font-weight: 300; }
#hint-lock { position: absolute; top: 58%; left: 50%; transform: translateX(-50%); background: var(--panel); padding: 8px 18px; font-size: 13px; border: 1px solid var(--gold); color: var(--gold); }

#vignette { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 140px rgba(255, 20, 60, 0); transition: box-shadow .3s; }
#hit-flash { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 40%, rgba(255,30,60,.45)); opacity: 0; pointer-events: none; }
#hit-flash.on { animation: hf .35s; }
@keyframes hf { 0% { opacity: 1; } 100% { opacity: 0; } }

#timestop-overlay { position: absolute; inset: 0; background: rgba(40, 10, 80, .38); backdrop-filter: invert(.85) hue-rotate(180deg); display: flex; align-items: center; justify-content: center; }
.ts-text { font-family: 'Russo One'; font-size: clamp(34px, 6vw, 64px); color: var(--gold); text-shadow: 0 0 40px #000, 4px 4px 0 var(--purple); transform: skewX(-8deg); animation: banner-in .4s cubic-bezier(.2,1.6,.4,1); text-align: center; }
.ts-text span { display: block; font-family: 'Noto Sans JP'; font-size: .35em; color: #fff; letter-spacing: .4em; margin-top: 8px; }

#death-screen { position: absolute; inset: 0; background: rgba(10, 4, 20, .78); display: flex; flex-direction: column; align-items: center; justify-content: center; backdrop-filter: grayscale(.7); }
.death-jp { font-family: 'Noto Sans JP'; font-weight: 900; font-size: clamp(60px, 12vw, 130px); color: rgba(255,77,94,.35); line-height: 1; }
.death-title { font-family: 'Russo One'; font-size: clamp(30px, 5vw, 52px); color: var(--red); text-shadow: 0 0 30px rgba(255,77,94,.7); margin-top: -14px; }
.death-sub { margin-top: 14px; color: #cfc6ee; font-size: 15px; }
#respawn-count { color: var(--gold); font-weight: 800; }

#sound-toggle { position: absolute; right: 16px; bottom: 16px; width: 42px; height: 42px; background: var(--panel); border: 1px solid rgba(123,92,255,.5); display: flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer; pointer-events: auto !important; }

#loading { position: fixed; inset: 0; z-index: 20; background: var(--ink); display: flex; flex-direction: column; gap: 18px; align-items: center; justify-content: center; font-family: 'Russo One'; letter-spacing: .2em; color: var(--gold); }
.load-star { font-size: 54px; animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- touch ---------- */
#touch-ui { position: absolute; inset: 0; }
#joy-zone { position: absolute; left: 0; bottom: 0; width: 46%; height: 55%; pointer-events: auto; }
#joy-base { position: absolute; left: 40px; bottom: 110px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.07); border: 2px solid rgba(255,255,255,.22); }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: rgba(123,92,255,.65); box-shadow: 0 0 16px rgba(123,92,255,.8); }
#touch-buttons { position: absolute; right: 18px; bottom: 100px; display: flex; gap: 14px; align-items: flex-end; pointer-events: auto; }
.tbtn { width: 66px; height: 66px; border-radius: 50%; background: rgba(16,11,38,.8); border: 2px solid var(--gold); display: flex; align-items: center; justify-content: center; font-size: 26px; user-select: none; }
.tbtn:active { background: rgba(255,194,61,.4); }
#tb-ab { width: 78px; height: 78px; border-color: var(--purple); font-size: 32px; }

@media (max-width: 760px) {
  #mission-panel { width: 210px; padding: 8px 12px; }
  #m-desc { display: none; }
  #players-panel { width: 150px; }
  #hp-wrap { width: 210px; }
  #chat { bottom: 200px; }
  #crosshair { display: none; }
}
