/* ============ JAN-KEN-IPPON! UI ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b0714;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif; user-select: none;
  -webkit-user-select: none; cursor: default; }
a-scene { position: fixed; inset: 0; }
.hidden { display: none !important; }

/* ---------- generic screens ---------- */
.screen { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; }

/* ---------- title ---------- */
#screen-title { background: radial-gradient(ellipse at 50% 65%, rgba(20,8,40,0.25), rgba(5,2,12,0.88) 75%); }
.title-inner { animation: riseIn 0.7s ease-out; }
.logo { font-size: clamp(3rem, 9vw, 7rem); font-weight: 900; letter-spacing: 0.06em;
  color: #fff; line-height: 0.95;
  text-shadow: 0 0 18px rgba(255,90,40,.85), 0 0 60px rgba(255,60,120,.45), 0 6px 0 #4a0f2e, 0 10px 24px rgba(0,0,0,.8); }
.logo-sub { color: #ffb347; letter-spacing: 0.9em; font-weight: 700; font-size: clamp(.6rem, 1.6vw, 1rem); margin-bottom: .6rem; text-indent: .9em; }
.logo-tag { color: #8fd8ff; letter-spacing: .5em; font-size: clamp(.55rem, 1.4vw, .9rem); margin-top: .8rem; text-indent: .5em; }
.triangle-hint { display: flex; gap: 1.2rem; margin: 2.2rem 0 2.6rem; justify-content: center; flex-wrap: wrap; }
.tri { padding: .45rem 1rem; border-radius: 4px; font-weight: 800; font-size: clamp(.6rem,1.4vw,.85rem); letter-spacing: .08em; border: 1px solid; }
.tri.strike { color: #ff7a5c; border-color: #ff7a5c66; background: #ff5a3c14; }
.tri.evade  { color: #6ce0a0; border-color: #6ce0a066; background: #3cff9c12; }
.tri.block  { color: #6cb4ff; border-color: #6cb4ff66; background: #3c96ff14; }
.press-start { color: #fff; font-weight: 800; letter-spacing: .25em; font-size: clamp(.7rem, 1.8vw, 1.05rem); }
.blink { animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .15; } }
@keyframes riseIn { from { transform: translateY(30px); opacity: 0; } }

/* ---------- select ---------- */
#screen-select { justify-content: flex-start; padding-top: 4vh; pointer-events: none; background: linear-gradient(to bottom, rgba(5,2,12,.75), rgba(5,2,12,0) 30%, rgba(5,2,12,0) 70%, rgba(5,2,12,.8)); }
.select-title { color: #fff; font-size: clamp(1.4rem, 4vw, 2.6rem); font-weight: 900; letter-spacing: .15em;
  text-shadow: 0 0 24px rgba(255,150,60,.6), 0 4px 12px #000; }
.select-hint { color: #b9a8d8; margin-top: .4rem; font-size: clamp(.6rem, 1.4vw, .85rem); letter-spacing: .1em; }
#select-cards { position: fixed; bottom: 3.5vh; left: 50%; transform: translateX(-50%);
  display: flex; gap: 2vw; pointer-events: auto; }
.scard { width: clamp(150px, 20vw, 260px); padding: .9rem 1.1rem 1rem; border: 2px solid #ffffff22;
  border-radius: 10px; background: linear-gradient(160deg, #17102bdd, #0b0714ee); cursor: pointer;
  transition: transform .18s ease, border-color .18s, box-shadow .18s; text-align: left; }
.scard .sc-name { font-size: clamp(1rem, 2.2vw, 1.6rem); font-weight: 900; letter-spacing: .06em; }
.scard .sc-type { font-size: clamp(.6rem, 1.3vw, .8rem); font-weight: 700; letter-spacing: .18em; opacity: .85; margin-bottom: .5rem; }
.scard .sc-desc { color: #cfc4e8; font-size: clamp(.58rem, 1.2vw, .76rem); line-height: 1.45; min-height: 3.2em; }
.scard .sc-special { margin-top: .5rem; font-size: clamp(.58rem, 1.2vw, .76rem); font-weight: 800; letter-spacing: .05em; }
.scard .sc-stats { margin-top: .55rem; display: grid; gap: .28rem; }
.stat { display: flex; align-items: center; gap: .5rem; font-size: .62rem; color: #a99cc9; font-weight: 700; letter-spacing: .1em; }
.stat .bar { flex: 1; height: 6px; background: #ffffff14; border-radius: 3px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; border-radius: 3px; }
.scard.active { transform: translateY(-10px) scale(1.05); border-color: var(--acc); box-shadow: 0 0 32px -4px var(--acc); }

/* ---------- VS ---------- */
#screen-vs { background: #05020cee; }
.vs-row { display: flex; align-items: center; gap: 4vw; }
.vs-card { min-width: clamp(160px, 24vw, 320px); padding: 1.4rem 2rem; border-radius: 8px;
  background: linear-gradient(160deg, #1d1335, #0b0714); border: 2px solid var(--acc, #888);
  box-shadow: 0 0 44px -8px var(--acc, #888); animation: vsSlideL .45s ease-out; }
#vs-p2 { animation: vsSlideR .45s ease-out; }
.vs-name { color: #fff; font-size: clamp(1.4rem, 3.4vw, 2.6rem); font-weight: 900; letter-spacing: .08em; }
.vs-type { color: var(--acc, #aaa); font-weight: 700; letter-spacing: .3em; font-size: clamp(.6rem, 1.4vw, .85rem); margin-top: .3rem; }
.vs-bang { color: #ffd23c; font-size: clamp(2.4rem, 7vw, 5.5rem); font-weight: 900; font-style: italic;
  text-shadow: 0 0 30px rgba(255,180,40,.8); animation: vsBang .45s cubic-bezier(.2,2.4,.4,1) .12s both; }
@keyframes vsSlideL { from { transform: translateX(-60vw); } }
@keyframes vsSlideR { from { transform: translateX(60vw); } }
@keyframes vsBang { from { transform: scale(4); opacity: 0; } }

/* ---------- pause / end ---------- */
#screen-pause, #screen-end { background: rgba(4,2,10,.82); backdrop-filter: blur(3px); }
.pause-title, #end-title { color: #fff; font-size: clamp(2rem, 6vw, 4rem); font-weight: 900; letter-spacing: .12em;
  text-shadow: 0 0 30px rgba(255,150,60,.55); }
#end-sub { color: #b9a8d8; margin: .6rem 0 0; letter-spacing: .15em; font-size: clamp(.7rem, 1.6vw, 1rem); }
.menu { display: flex; flex-direction: column; gap: .8rem; margin-top: 2.2rem; }
.menu-item { color: #e8e0ff; font-weight: 800; letter-spacing: .2em; padding: .7rem 3.2rem; cursor: pointer;
  border: 1px solid #ffffff2a; border-radius: 6px; background: #ffffff08; transition: all .15s; font-size: clamp(.7rem, 1.6vw, .95rem); }
.menu-item:hover { background: #ff8c3c22; border-color: #ff8c3c; color: #ffd9b0; transform: scale(1.04); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.topbar { position: absolute; top: 2.2vh; left: 2.5vw; right: 2.5vw; display: flex; align-items: flex-start; gap: 1.4vw; }
.side { flex: 1; }
.fname { color: #fff; font-weight: 900; letter-spacing: .12em; font-size: clamp(.7rem, 1.7vw, 1.05rem);
  text-shadow: 0 2px 6px #000; margin-bottom: .3rem; }
.side.p2 .fname { text-align: right; }
.hpwrap { position: relative; height: clamp(14px, 2.4vh, 22px); background: #000000aa; border: 2px solid #ffffff33;
  border-radius: 3px; overflow: hidden; transform: skewX(-14deg); }
.hpwrap.flip { transform: skewX(14deg); }
.hpbar, .hpghost { position: absolute; inset: 0; transform-origin: left; }
.hpwrap.flip .hpbar, .hpwrap.flip .hpghost { transform-origin: right; }
.hpbar { background: linear-gradient(180deg, #ffe45c, #ff9a3c 55%, #ff5a3c); transition: none; }
.hpbar.low { background: linear-gradient(180deg, #ff5a5a, #d21f3c); animation: hpPulse .5s infinite alternate; }
@keyframes hpPulse { to { filter: brightness(1.5); } }
.hpghost { background: #ff4d6d88; transition: transform .6s ease .25s; }
.pips { display: flex; gap: .4rem; margin-top: .35rem; }
.pips.right { justify-content: flex-end; }
.pips span { width: clamp(10px, 1.4vw, 16px); height: clamp(10px, 1.4vw, 16px); border-radius: 50%;
  border: 2px solid #ffd23c88; background: transparent; }
.pips span.won { background: #ffd23c; box-shadow: 0 0 10px #ffd23c; }
.timerwrap { width: clamp(56px, 7vw, 92px); }
#timer { color: #fff; font-size: clamp(1.5rem, 3.6vw, 2.7rem); font-weight: 900; text-align: center;
  text-shadow: 0 0 14px rgba(255,210,60,.6), 0 3px 8px #000; }
#timer.urgent { color: #ff5a5a; animation: hpPulse .4s infinite alternate; }
/* special meters: slim bars tucked under each health bar */
.meterwrap { width: 88%; margin: 3px auto 0; }
.meter { height: 6px; background: #000000aa; border: 1px solid #6cb4ff44; border-radius: 3px; overflow: hidden; transform: skewX(-14deg) scaleX(0.94); }
.meter.flip { transform: skewX(14deg) scaleX(0.94); }
.meterfill { height: 100%; width: 0%; transform-origin: left; background: linear-gradient(90deg, #2c7dff, #6ce0ff); }
.meter.flip .meterfill { transform-origin: right; margin-left: auto; }
.meterfill.ready { background: linear-gradient(90deg, #2c7dff, #6ce0ff, #fff); box-shadow: 0 0 14px #6ce0ff; animation: meterGlow .7s infinite alternate; }
@keyframes meterGlow { to { filter: brightness(1.6); } }
body:has(#touch-ui:not(.hidden)) #controls-hint { display: none; }
@media (max-height: 520px) {
  #tbtns { transform: scale(0.72); transform-origin: bottom right; }
}
#controls-hint { position: absolute; bottom: 2.4vh; left: 50%; transform: translateX(-50%);
  color: #cfc4e8; font-size: clamp(.58rem, 1.3vw, .8rem); letter-spacing: .04em; white-space: nowrap;
  background: #00000077; padding: .45rem 1.1rem; border-radius: 20px; transition: opacity 1s; }
#controls-hint b { color: #ffd23c; }
#controls-hint.faded { opacity: 0; }

/* ---------- announce ---------- */
#announce { position: fixed; top: 34%; left: 50%; transform: translate(-50%,-50%); z-index: 35;
  font-size: clamp(2.2rem, 8vw, 6rem); font-weight: 900; letter-spacing: .1em; color: #fff; pointer-events: none;
  text-shadow: 0 0 30px rgba(255,140,40,.9), 0 6px 0 #4a0f2e, 0 10px 24px #000; opacity: 0; white-space: nowrap; }
#announce.show { animation: annPop .9s cubic-bezier(.2,2,.3,1) forwards; }
#announce.hold { animation: annHold 1.4s ease forwards; }
@keyframes annPop { 0% { opacity: 0; transform: translate(-50%,-50%) scale(3); }
  25% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-50%) scale(.92); } }
@keyframes annHold { 0% { opacity: 0; transform: translate(-50%,-50%) scale(2.4); }
  18% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 82% { opacity: 1; } 100% { opacity: 0; } }
#subannounce { position: fixed; top: 46%; left: 50%; transform: translate(-50%,-50%); z-index: 35;
  font-size: clamp(.9rem, 2.6vw, 1.6rem); font-weight: 800; letter-spacing: .4em; color: #ffd23c;
  pointer-events: none; text-shadow: 0 0 18px rgba(255,210,60,.7), 0 3px 8px #000; opacity: 0; white-space: nowrap; }
#subannounce.show { animation: annHold 1.4s ease forwards; }

/* ---------- damage / event popups ---------- */
#popup-layer { position: fixed; inset: 0; z-index: 32; pointer-events: none; overflow: hidden; }
.popup { position: absolute; transform: translate(-50%,-50%); font-weight: 900; white-space: nowrap;
  text-shadow: 0 2px 0 #00000088, 0 0 14px currentColor; animation: popFloat .85s ease-out forwards; }
.popup.dmg     { color: #fff;    font-size: clamp(.9rem, 2vw, 1.4rem); }
.popup.chip    { color: #9fb8d8; font-size: clamp(.7rem, 1.5vw, 1rem); }
.popup.counter { color: #ff5a3c; font-size: clamp(1.1rem, 2.8vw, 2rem); letter-spacing: .08em; }
.popup.block   { color: #6cb4ff; font-size: clamp(.9rem, 2.2vw, 1.5rem); letter-spacing: .1em; }
.popup.dodge   { color: #6ce0a0; font-size: clamp(.8rem, 1.8vw, 1.2rem); letter-spacing: .1em; }
.popup.punish  { color: #ffd23c; font-size: clamp(1rem, 2.4vw, 1.7rem); letter-spacing: .08em; }
.popup.guard   { color: #ff9a3c; font-size: clamp(1rem, 2.5vw, 1.8rem); letter-spacing: .08em; }
.popup.special { color: #e06cff; font-size: clamp(1rem, 2.5vw, 1.8rem); letter-spacing: .1em; }
@keyframes popFloat { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.4); }
  18% { opacity: 1; transform: translate(-50%,-60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%,-160%) scale(.95); } }

/* hide A-Frame's VR/fullscreen button so it never overlaps the action buttons */
.a-enter-vr, .a-enter-ar, .a-orientation-modal { display: none !important; }

/* ============ TOUCH CONTROLS ============ */
#touch-ui { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
#touch-ui.hidden { display: none; }

/* floating analog pad — summoned where the thumb lands (bottom-left zone), 30% translucent */
#tpad { position: fixed; width: 150px; height: 150px; margin: -75px 0 0 -75px;
        display: none; pointer-events: none; }
#tpad.on { display: block; }
#tpad-ring { position: absolute; inset: 0; border-radius: 50%;
             background: rgba(140, 150, 220, 0.30);
             border: 2px solid rgba(220, 228, 255, 0.30);
             box-shadow: 0 0 24px rgba(120, 140, 255, 0.25) inset; }
#tpad-ring::after { content: ''; position: absolute; inset: 32%; border-radius: 50%;
                    border: 1px dashed rgba(255, 255, 255, 0.25); }
#tpad-thumb { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px;
              border-radius: 50%; transform: translate(-50%, -50%);
              background: rgba(235, 240, 255, 0.30);
              border: 2px solid rgba(255, 255, 255, 0.35); }

/* diamond of action buttons (bottom-right), 50% translucent, thumb-sized */
#tbtns { position: fixed; right: 18px; bottom: 22px; width: 228px; height: 228px;
         pointer-events: none; }
.tbtn { position: absolute; width: 74px; height: 74px; border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
        background: rgba(150, 160, 220, 0.5);
        border: 2px solid rgba(255, 255, 255, 0.45);
        pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none;
        font: 700 11px/1 'Orbitron', 'Arial Black', sans-serif; color: #fff;
        letter-spacing: .03em;
        text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.tbtn span { pointer-events: none; }
.tbtn.press { background: rgba(255, 255, 255, 0.6); transform: scale(0.92); }
.tb-up    { left: 77px; top: 0;    background: rgba(200, 120, 230, 0.5); }  /* special */
.tb-left  { left: 0;    top: 77px; background: rgba(90, 190, 255, 0.5); }   /* punch   */
.tb-right { left: 154px; top: 77px; background: rgba(255, 214, 90, 0.5); }  /* jump    */
.tb-down  { left: 77px; top: 154px; background: rgba(255, 160, 90, 0.5); }  /* kick    */
.tb-mid   { left: 73.5px; top: 73.5px; width: 81px; height: 81px;            /* block — center, 10% bigger */
            background: rgba(120, 220, 140, 0.5); font-size: 11px; }
@media (max-width: 700px) {
  #tbtns { transform: scale(0.86); transform-origin: bottom right; right: 10px; bottom: 12px; }
}
