* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body {
  width:100%; height:100%; overflow:hidden; background:#0a1020;
  font-family:"Arial Black", "Helvetica Neue", Arial, sans-serif;
  touch-action:none; user-select:none; -webkit-user-select:none;
  overscroll-behavior:none; position:fixed;
}
#gl { position:absolute; inset:0; width:100%; height:100%; display:block; pointer-events:none; }
#cv { position:absolute; inset:0; width:100%; height:100%; display:block; }

.hidden { display:none !important; }

.screen {
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  background:radial-gradient(ellipse at 50% 30%, #16305a 0%, #0a1020 70%);
  z-index:20; padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.card {
  text-align:center; padding:24px 28px; max-width:440px; width:92%;
  max-height:96%; overflow-y:auto; -webkit-overflow-scrolling:touch;
}
.card.wide { max-width:720px; }

.logo {
  font-size:44px; color:#fff; letter-spacing:2px; font-style:italic;
  text-shadow:0 0 18px #ffae00, 3px 3px 0 #b32020; margin-bottom:6px;
}
.logo span { color:#ffd34d; }
.tag { color:#9fb6e0; font-size:13px; letter-spacing:3px; margin-bottom:26px; font-family:Arial, sans-serif; }

button {
  display:block; width:100%; margin:10px auto; padding:15px 18px;
  font-family:inherit; font-size:18px; font-weight:900; letter-spacing:1px;
  color:#fff; background:linear-gradient(180deg,#ff9d1c,#e2580e);
  border:0; border-radius:12px; cursor:pointer;
  box-shadow:0 4px 0 #8a3208, 0 6px 14px rgba(0,0,0,.5);
}
button:active { transform:translateY(3px); box-shadow:0 1px 0 #8a3208; }
button.alt { background:linear-gradient(180deg,#2a6fd6,#1b4aa0); box-shadow:0 4px 0 #0e2a60, 0 6px 14px rgba(0,0,0,.5); }
button.alt:active { box-shadow:0 1px 0 #0e2a60; }
button:disabled { filter:grayscale(.8) brightness(.6); }
button.small { width:auto; display:inline-block; padding:10px 18px; font-size:14px; }
button.ghost { background:transparent; box-shadow:none; color:#7e95c4; border:2px solid #2c4470; }
.hint { color:#6f86b5; font-size:12px; margin-top:18px; font-family:Arial, sans-serif; line-height:1.6; }

h2 { color:#ffd34d; font-style:italic; letter-spacing:1px; margin-bottom:16px; text-shadow:2px 2px 0 #00000088; }

#teamGrid {
  display:grid; grid-template-columns:repeat(4, 1fr); gap:10px; margin-bottom:14px;
}
.teamCell {
  background:#15264a; border:2px solid #2c4470; border-radius:12px;
  padding:10px 4px; cursor:pointer; color:#cfe0ff; text-align:center;
}
.teamCell:active { background:#234277; }
.teamCell .fl { font-size:34px; line-height:1.1; }
.teamCell .nm { font-size:11px; font-weight:900; letter-spacing:.5px; margin-top:4px; }
.teamCell .sq { font-size:8px; color:#7e95c4; margin-top:3px; font-family:Arial, sans-serif; line-height:1.3; }

.code {
  font-size:52px; color:#ffd34d; letter-spacing:14px; margin:14px 0;
  text-shadow:0 0 20px #ffae0088;
}
.codeInput {
  display:block; width:220px; margin:14px auto; padding:14px;
  font-family:inherit; font-size:34px; text-align:center; letter-spacing:10px;
  color:#ffd34d; background:#0c1830; border:2px solid #2c4470; border-radius:12px;
  text-transform:uppercase; outline:none;
}
.endScore { font-size:40px; color:#fff; margin:12px 0 4px; }

/* touch controls */
#touchUI { position:absolute; right:0; bottom:0; z-index:15; padding:0 max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) 0; }
.tbtn {
  position:absolute; right:0; bottom:0;
  width:84px; height:84px; border-radius:50%;
  display:flex; align-items:center; justify-content:center; flex-direction:column;
  font-size:15px; font-weight:900; color:#fff; text-align:center; line-height:1.1;
  background:radial-gradient(circle at 35% 30%, #ffffff33, #ffffff0d 60%), #1b4aa0cc;
  border:2px solid #ffffff55; z-index:15;
}
.tbtn small { font-size:9px; opacity:.8; }
.tbtn.on { background:radial-gradient(circle at 35% 30%, #ffffff55, #ffffff22 60%), #e2580ecc; }
#btnShoot { right:max(16px, env(safe-area-inset-right)); bottom:max(96px, calc(env(safe-area-inset-bottom) + 88px));
  background:radial-gradient(circle at 35% 30%, #ffffff33, #ffffff0d 60%), #b3202ccc; }
#btnPass  { right:max(108px, calc(env(safe-area-inset-right) + 100px)); bottom:max(16px, env(safe-area-inset-bottom)); }
#btnTurbo { right:max(16px, env(safe-area-inset-right)); bottom:max(16px, env(safe-area-inset-bottom)); width:72px; height:72px; font-size:12px;
  background:radial-gradient(circle at 35% 30%, #ffffff33, #ffffff0d 60%), #1d8a3acc; }

#gameTopBtns { position:absolute; top:max(8px, env(safe-area-inset-top)); right:max(8px, env(safe-area-inset-right)); z-index:15; display:flex; gap:8px; }
.iconbtn {
  width:38px; height:38px; border-radius:10px; background:#0c1830aa; border:1px solid #2c4470;
  color:#cfe0ff; display:flex; align-items:center; justify-content:center; font-size:17px; cursor:pointer;
}

#rotateHint {
  display:none; position:absolute; inset:auto 0 12px 0; text-align:center; z-index:30;
  color:#ffd34d; font-size:14px; pointer-events:none; text-shadow:1px 1px 2px #000;
}
@media (orientation:portrait) and (max-width:600px) { #rotateHint { display:block; } }
