/* ステージは 1280x720 固定。JS で transform: scale して画面にフィット */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: #05070d; overflow: hidden;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
#stage {
  position: absolute; left: 0; top: 0; width: 1280px; height: 720px;
  transform-origin: 0 0; overflow: hidden; background: #0b1020;
}
#gl, #gl canvas { position: absolute; inset: 0; width: 1280px; height: 720px; display: block; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; color: #fff; }
#scoreboard {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: stretch; gap: 0; filter: drop-shadow(0 4px 8px rgba(0,0,0,.5));
}
#scoreboard .team { display: flex; align-items: center; gap: 14px; padding: 6px 18px; font-weight: 900; }
#scoreboard .blue { background: linear-gradient(90deg,#1747c9,#2f7bff); border-radius: 14px 0 0 14px; }
#scoreboard .red  { background: linear-gradient(90deg,#ff4a3d,#c71e2b); border-radius: 0 14px 14px 0; }
#scoreboard .name { font-size: 18px; letter-spacing: 2px; opacity: .9; }
#scoreboard .score { font-size: 40px; min-width: 40px; text-align: center; }
#scoreboard .score.bump { animation: bump .5s; }
#scoreboard .center {
  background: #111a2e; padding: 4px 14px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; min-width: 120px;
}
#serveInfo { font-size: 13px; letter-spacing: 2px; color: #ffd84a; font-weight: 700; }
#matchPoint { font-size: 12px; color: #ff6b6b; font-weight: 900; letter-spacing: 1px; height: 14px; }
@keyframes bump { 0%{transform:scale(1)} 30%{transform:scale(1.6)} 100%{transform:scale(1)} }

#banner {
  position: absolute; top: 210px; width: 100%; text-align: center; font-size: 92px; font-weight: 900;
  font-style: italic; letter-spacing: 4px; opacity: 0; transform: scale(.6);
  transition: opacity .2s, transform .25s cubic-bezier(.2,1.6,.4,1);
  -webkit-text-stroke: 3px #1a0f00; text-shadow: 0 6px 0 rgba(0,0,0,.35), 0 0 30px rgba(255,200,40,.6);
  color: #ffe14a;
}
#banner.show { opacity: 1; transform: scale(1); }
/* blue = チーム0（オレンジ系）, red = チーム1（ターコイズ系）。クラス名は互換のため据え置き */
#banner.blue { color: #ffa04a; text-shadow: 0 6px 0 rgba(0,0,0,.35), 0 0 30px rgba(255,130,30,.8); }
#banner.red  { color: #5fe6d6; text-shadow: 0 6px 0 rgba(0,0,0,.35), 0 0 30px rgba(40,200,190,.8); }
#subBanner {
  position: absolute; top: 320px; width: 100%; text-align: center; font-size: 30px; font-weight: 800;
  opacity: 0; transition: opacity .2s; text-shadow: 0 3px 6px rgba(0,0,0,.7);
}
#subBanner.show { opacity: 1; }
#hint {
  position: absolute; bottom: 26px; width: 100%; text-align: center; font-size: 26px; font-weight: 800;
  text-shadow: 0 2px 6px #000; color: #fff; opacity: 0; transition: opacity .15s;
}
#hint.show { opacity: 1; }
#hint .key { display: inline-block; background: #fff; color: #123; border-radius: 6px; padding: 0 10px; margin: 0 4px; }
#judge {
  position: absolute; left: 0; top: 0; font-size: 34px; font-weight: 900; font-style: italic;
  -webkit-text-stroke: 2px #000; transform: translate(-50%,-50%); opacity: 0; white-space: nowrap;
}
#judge.show { animation: judge .9s forwards; }
@keyframes judge { 0%{opacity:0;margin-top:10px} 15%{opacity:1;margin-top:0} 75%{opacity:1} 100%{opacity:0;margin-top:-30px} }
#demoTag {
  position: absolute; top: 22px; left: 22px; padding: 4px 12px; border: 2px solid #fff; border-radius: 6px;
  font-weight: 900; letter-spacing: 3px; font-size: 14px; animation: blink 1.4s infinite; display: none;
}
#demoTag.on { display: block; }
#hubLink { position: absolute; top: 22px; right: 22px; z-index: 5; display: none; padding: 4px 14px; border: 2px solid #fff; border-radius: 99px; background: rgba(0,0,0,.55); color: #fff; font-weight: 800; font-size: 14px; text-decoration: none; }
#demoTag.on ~ #hubLink { display: block; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------- オーバーレイ ---------- */
.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; transition: opacity .4s;
}
.overlay.hidden { opacity: 0; pointer-events: none; }
#title { background: radial-gradient(ellipse at 50% 40%, rgba(10,20,50,.15), rgba(0,0,0,.55)); pointer-events: none; }
#title .logo { display: flex; flex-direction: column; align-items: center; transform: rotate(-4deg); margin-top: -60px; }
#title .l1, #title .l2 {
  font-weight: 900; font-style: italic; line-height: .9; -webkit-text-stroke: 4px #0a1430;
  text-shadow: 0 8px 0 #0a1430, 0 0 40px rgba(255,255,255,.35);
}
#title .l1 { font-size: 130px; color: #ffe14a; letter-spacing: 6px; }
#title .l2 { font-size: 96px; color: #fff; letter-spacing: 10px; }
#title .tag { margin-top: 20px; font-size: 24px; letter-spacing: 8px; font-weight: 800; background: #ff4a3d; padding: 4px 22px; transform: rotate(-4deg); }
#title .press { margin-top: 46px; font-size: 30px; font-weight: 900; letter-spacing: 4px; animation: blink 1.1s infinite; text-shadow: 0 2px 8px #000; }
#title .howto { margin-top: 26px; background: rgba(0,0,0,.5); padding: 12px 26px; border-radius: 12px; font-size: 17px; line-height: 1.7; }
#title .howto b { color: #ffe14a; margin-right: 6px; }
.big { font-size: 96px; font-weight: 900; font-style: italic; -webkit-text-stroke: 3px #000; text-shadow: 0 6px 0 rgba(0,0,0,.4); }
.final { font-size: 48px; font-weight: 900; margin: 6px 0 20px; }
#pause, #result { background: rgba(0,0,0,.55); }
.menu { display: flex; gap: 24px; }
.keys { margin-top: 18px; font-size: 18px; opacity: .8; }
.menu button {
  font: inherit; font-size: 26px; font-weight: 800; padding: 12px 34px; border-radius: 40px; border: 3px solid #fff;
  background: #1747c9; color: #fff; cursor: pointer;
}
.menu button:hover, .menu button.sel { background: #ffe14a; color: #102; }

/* ---------- 仮想パッド ---------- */
#vpad { position: absolute; inset: 0; pointer-events: none; }
#vpad.hidden { display: none; }
#dpad { position: absolute; left: 40px; bottom: 40px; width: 240px; height: 240px; pointer-events: auto; touch-action: none; }
.dbtn {
  position: absolute; width: 84px; height: 84px; border-radius: 18px; background: rgba(255,255,255,.18);
  border: 3px solid rgba(255,255,255,.55); color: #fff; font-size: 34px; display: flex; align-items: center; justify-content: center;
}
.dbtn.on { background: rgba(255,225,74,.65); }
.dbtn.up { left: 78px; top: 0; } .dbtn.down { left: 78px; bottom: 0; }
.dbtn.left { left: 0; top: 78px; } .dbtn.right { right: 0; top: 78px; }
#abtn {
  position: absolute; right: 60px; bottom: 60px; width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a7d, #e02c2c); border: 5px solid rgba(255,255,255,.8);
  color: #fff; font-size: 64px; font-weight: 900; display: flex; align-items: center; justify-content: center;
  pointer-events: auto; box-shadow: 0 8px 0 rgba(0,0,0,.35); opacity: .85; touch-action: none;
}
#abtn.on { transform: translateY(6px); box-shadow: 0 2px 0 rgba(0,0,0,.35); }
#sysbtns { position: absolute; right: 24px; top: 80px; display: flex; gap: 14px; pointer-events: auto; }
.sbtn {
  width: 64px; height: 64px; border-radius: 50%; background: rgba(0,0,0,.45); border: 3px solid rgba(255,255,255,.7);
  color: #fff; font-size: 28px; display: flex; align-items: center; justify-content: center;
}
#soundNote {
  position: absolute; top: 62px; left: 22px; font-size: 14px; color: #fff; background: rgba(0,0,0,.5);
  padding: 4px 10px; border-radius: 6px; pointer-events: none; transition: opacity .5s;
}
#soundNote.hidden { opacity: 0; }
#rotate {
  display: none; position: fixed; inset: 0; background: #05070d; color: #fff; font-size: 28px; font-weight: 800;
  align-items: center; justify-content: center; z-index: 10;
}
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; } }
