:root {
  --orange: #ff7a1a;
  --blue: #2e7bff;
  --ink: #141a2e;
  --ink2: #1e2744;
  --paper: #f4f6fb;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--paper);
  font-family: var(--font); touch-action: none; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
input, select { -webkit-user-select: text; user-select: text; font-family: var(--font); }
button { font-family: var(--font); cursor: pointer; touch-action: manipulation; }

.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: block; }

/* ---------- 背景のパネル模様 ---------- */
.tiles {
  position: absolute; inset: -40px; z-index: 0;
  background:
    linear-gradient(135deg, rgba(20,26,46,.86), rgba(20,26,46,.94)),
    conic-gradient(from 0deg at 50% 50%, var(--orange) 0 25%, var(--blue) 0 50%, var(--orange) 0 75%, var(--blue) 0) 0 0 / 80px 80px;
  animation: tiles 30s linear infinite;
}
.tiles.dim { opacity: .7; }
@keyframes tiles { to { background-position: 0 0, 160px 80px; } }

/* ---------- ボタン ---------- */
.btn {
  border: none; border-radius: 14px; padding: 10px 16px; font-weight: 900; font-size: 15px;
  color: #fff; background: #3a4566; box-shadow: 0 4px 0 rgba(0,0,0,.35); transition: transform .08s;
  letter-spacing: .02em;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.35); }
.btn.big { font-size: 19px; padding: 14px 20px; border-radius: 18px; transform: skewX(-6deg); }
.btn.big:active { transform: skewX(-6deg) translateY(3px); }
.btn.small { font-size: 13px; padding: 7px 11px; border-radius: 10px; }
.btn.orange { background: linear-gradient(180deg, #ff9a45, var(--orange)); }
.btn.blue { background: linear-gradient(180deg, #5b98ff, var(--blue)); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.btn.danger { background: #e5484d; }
.btn:disabled { opacity: .45; }

/* ---------- タイトル ---------- */
.title-inner {
  position: relative; z-index: 1; height: 100%; display: flex; gap: 18px;
  padding: calc(14px + var(--safe-t)) calc(16px + var(--safe-r)) calc(14px + var(--safe-b)) calc(16px + var(--safe-l));
  overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y;
}
.col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.col.left { flex: 0 0 min(360px, 42%); }
.col.right { flex: 1; }
.logo { line-height: 1; margin: 4px 0 4px; }
.logo-main { font-weight: 900; font-style: italic; font-size: clamp(30px, 6vw, 48px); letter-spacing: -.02em; display: flex; gap: 6px; flex-wrap: wrap; }
.logo-main span { display: inline-block; padding: 2px 8px; border-radius: 10px; transform: skewX(-8deg) rotate(-2deg); text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.logo-main .o { background: var(--orange); }
.logo-main .w { background: #fff; color: var(--ink); transform: skewX(-8deg) rotate(2deg); }
.logo-main .b { background: var(--blue); }
.logo-sub { margin-top: 8px; font-weight: 800; opacity: .85; letter-spacing: .2em; font-size: 13px; }
.field { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.08); padding: 8px 12px; border-radius: 12px; }
.field span { font-weight: 800; font-size: 13px; opacity: .8; }
.field input { flex: 1; min-width: 0; background: transparent; border: none; color: #fff; font-size: 17px; font-weight: 800; outline: none; }
.menu { display: flex; flex-direction: column; gap: 10px; }
.join { display: flex; gap: 8px; }
.join input {
  flex: 1; min-width: 0; font-size: 20px; font-weight: 900; letter-spacing: .25em; text-align: center; text-transform: uppercase;
  border-radius: 12px; border: 2px solid rgba(255,255,255,.25); background: rgba(0,0,0,.25); color: #fff; padding: 8px;
}
.chk { font-size: 13px; opacity: .9; display: flex; align-items: center; gap: 6px; }
.settings { background: rgba(255,255,255,.06); border-radius: 12px; padding: 8px 12px; font-size: 13px; }
.settings summary { font-weight: 800; cursor: pointer; }
.settings label { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.settings input[type=range] { flex: 1; }
.settings select { background: #2a3352; color: #fff; border: none; border-radius: 8px; padding: 4px 8px; }
.hint { font-size: 11.5px; opacity: .65; line-height: 1.6; margin: 0; }
.sec-title { font-weight: 900; font-size: 13px; letter-spacing: .2em; opacity: .7; }

.charlist { flex-shrink: 0; display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; touch-action: pan-x; -webkit-overflow-scrolling: touch; }
.charcard {
  flex: 0 0 auto; width: 92px; border: none; border-radius: 14px; padding: 6px 6px 8px; color: #fff;
  background: rgba(255,255,255,.08); display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.08); transition: transform .1s;
}
.charcard img { width: 76px; height: 76px; border-radius: 10px; display: block; }
.charcard b { font-size: 13px; }
.charcard span { font-size: 10px; opacity: .7; white-space: nowrap; }
.charcard.sel { background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 3px var(--a); transform: translateY(-2px); }
.charcard.small { width: 70px; }
.charcard.small img { width: 56px; height: 56px; }
.chardetail { background: rgba(0,0,0,.28); border-radius: 16px; padding: 12px 14px; font-size: 13px; }
.cd-head { display: flex; align-items: baseline; gap: 10px; }
.cd-head b { font-size: 22px; font-weight: 900; font-style: italic; color: var(--a); }
.cd-head span { opacity: .75; font-weight: 700; }
.cd-desc { margin: 6px 0 8px; opacity: .9; line-height: 1.5; }
.cd-row { display: grid; grid-template-columns: 52px 1fr; gap: 2px 8px; margin: 6px 0; align-items: baseline; }
.cd-row em { font-style: normal; font-size: 11px; font-weight: 800; background: rgba(255,255,255,.12); border-radius: 6px; text-align: center; padding: 2px 0; grid-row: span 2; align-self: start; }
.cd-row b { font-size: 15px; }
.cd-row small { opacity: .75; line-height: 1.45; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin-top: 8px; }
.stat { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.stat span { width: 64px; opacity: .8; }
.stat i { flex: 1; height: 8px; background: rgba(255,255,255,.12); border-radius: 4px; overflow: hidden; }
.stat em { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), #ffd23f); border-radius: 4px; }
.cd-foot { margin-top: 8px; font-size: 11px; opacity: .6; }

@media (max-aspect-ratio: 1/1) {
  .title-inner { flex-direction: column; }
  .col.left { flex: none; }
}

/* ---------- ロビー ---------- */
.lobby-inner {
  position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; gap: 10px;
  padding: calc(10px + var(--safe-t)) calc(14px + var(--safe-r)) calc(10px + var(--safe-b)) calc(14px + var(--safe-l));
  overflow-y: auto; touch-action: pan-y;
}
.lobby-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.roombox { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.35); border-radius: 14px; padding: 6px 10px; }
.roombox span { font-size: 11px; opacity: .7; font-weight: 800; }
.roombox b { font-size: 26px; letter-spacing: .18em; font-weight: 900; color: #ffd23f; }
.roombox b.offline { font-size: 18px; letter-spacing: .05em; color: #fff; }
.lobby-info { flex: 1; display: flex; flex-direction: column; font-size: 12px; opacity: .85; min-width: 120px; }
.teams { display: grid; grid-template-columns: 1fr 1fr 0.7fr; gap: 10px; }
.team { background: rgba(0,0,0,.3); border-radius: 14px; padding: 8px; min-height: 80px; }
.team h3 { margin: 0 0 6px; font-size: 14px; font-weight: 900; font-style: italic; padding: 3px 10px; border-radius: 8px; display: inline-block; }
.team.t1 h3 { background: var(--orange); }
.team.t2 h3 { background: var(--blue); }
.team.spec h3 { background: #5b6584; }
.team ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.team li { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.07); border-radius: 10px; padding: 4px 6px; font-size: 13px; }
.team li img { width: 34px; height: 34px; border-radius: 8px; }
.team li div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.team li b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team li small { font-size: 10.5px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team li em { font-style: normal; font-size: 10px; font-weight: 900; background: rgba(255,255,255,.2); border-radius: 6px; padding: 1px 5px; }
.team li em.you { background: #ffd23f; color: var(--ink); }
.team li em.cpu { background: #5b6584; }
.team li.cpu-slot { opacity: .45; border: 1px dashed rgba(255,255,255,.4); background: transparent; padding-left: 12px; }
.team li.empty { opacity: .5; justify-content: center; background: transparent; }
.mine { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.25); border-radius: 14px; padding: 6px 10px; }
.mine .charlist { flex: 1; padding-bottom: 4px; }
.mine-btns { display: flex; flex-direction: column; gap: 6px; }
.hostctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hostctl label { display: flex; flex-direction: column; font-size: 11px; font-weight: 800; gap: 2px; opacity: .9; }
.hostctl select { background: #2a3352; color: #fff; border: none; border-radius: 10px; padding: 7px 8px; font-size: 14px; font-weight: 700; }
.hostctl #btnStart { margin-left: auto; }
.waitmsg { text-align: center; font-weight: 800; opacity: .8; animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
@media (max-aspect-ratio: 1/1) { .teams { grid-template-columns: 1fr 1fr; } .team.spec { grid-column: span 2; } .mine { flex-direction: column; align-items: stretch; } .mine-btns { flex-direction: row; } }

/* ---------- 試合 ---------- */
#game { background: #000; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#touch { position: absolute; inset: 0; z-index: 1; touch-action: none; }
#hud { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
#hud button { pointer-events: auto; touch-action: none; }

#tags { position: absolute; inset: 0; overflow: hidden; }
.nametag {
  position: absolute; left: 0; top: 0; padding: 2px 8px; border-radius: 9px; font-size: 11px; font-weight: 900;
  background: var(--c); color: #fff; white-space: nowrap; text-shadow: 0 1px 0 rgba(0,0,0,.3); box-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.nametag.stunned::after { content: " 💫"; }

#menuBtn {
  position: absolute; left: calc(10px + var(--safe-l)); top: calc(8px + var(--safe-t)); width: 40px; height: 40px; border-radius: 12px;
  border: none; background: rgba(0,0,0,.4); color: #fff; font-size: 22px; font-weight: 900;
}
.scorebox { position: absolute; left: 50%; top: calc(8px + var(--safe-t)); transform: translateX(-50%); width: min(44vw, 380px); }
.sb { height: 12px; background: rgba(255,255,255,.35); border-radius: 8px; overflow: hidden; position: relative; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.sbfill { position: absolute; top: 0; bottom: 0; transition: width .3s; }
.sbfill.a { left: 0; background: var(--orange); }
.sbfill.b { right: 0; background: var(--blue); }
.sbtext { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; font-weight: 900; text-shadow: 0 2px 0 rgba(0,0,0,.45); }
.sbtext span { font-size: 13px; }
.sbtext span.a { color: #ffb37a; } .sbtext span.b { color: #9cc0ff; }
#timer { font-size: 26px; font-style: italic; letter-spacing: .02em; }
#timer.hurry { color: #ff5a5a; animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.15); } }

#mapwrap {
  position: absolute; right: calc(10px + var(--safe-r)); top: calc(8px + var(--safe-t)); pointer-events: auto;
  height: 34vh; aspect-ratio: var(--ar, 2/3); border-radius: 10px; overflow: hidden;
  box-shadow: 0 0 0 3px rgba(255,255,255,.85), 0 4px 10px rgba(0,0,0,.35); background: #222;
  transition: height .2s;
}
#mapwrap.big { height: 78vh; }
#minimap { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
@media (max-aspect-ratio: 1/1) { #mapwrap { height: auto; width: 24vw; } #mapwrap.big { width: 60vw; } .scorebox { width: 46vw; } }

#feed { position: absolute; left: calc(10px + var(--safe-l)); top: calc(56px + var(--safe-t)); display: flex; flex-direction: column; gap: 3px; }
.feedline { font-size: 12px; font-weight: 800; background: rgba(0,0,0,.45); padding: 3px 8px; border-radius: 8px; display: flex; gap: 6px; align-items: center; animation: slidein .25s; transition: opacity .4s; }
.feedline i { font-style: normal; opacity: .7; }
.feedline span { opacity: .8; font-size: 11px; }
.feedline.out, .toast.out { opacity: 0; }
@keyframes slidein { from { transform: translateX(-20px); opacity: 0; } }

#toasts { position: absolute; left: 50%; top: calc(58px + var(--safe-t)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.toast { background: rgba(0,0,0,.6); border-left: 5px solid var(--c); padding: 5px 12px; border-radius: 8px; font-size: 13px; font-weight: 800; white-space: nowrap; animation: dropin .25s; transition: opacity .4s; }
@keyframes dropin { from { transform: translateY(-10px); opacity: 0; } }

#myinfo { position: absolute; left: calc(12px + var(--safe-l)); bottom: calc(8px + var(--safe-b)); font-size: 11px; opacity: .85; text-shadow: 0 1px 2px #000; display: flex; gap: 8px; align-items: baseline; }
#myinfo b { font-size: 13px; }

#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#crosshair i { position: absolute; left: -12px; top: -12px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255,255,255,.9); box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
#crosshair i::after { content: ""; position: absolute; left: 9px; top: 9px; width: 2px; height: 2px; background: #fff; border-radius: 50%; }
#chargeRing { position: absolute; left: -24px; top: -24px; width: 48px; height: 48px; border-radius: 50%; opacity: 0;
  background: conic-gradient(#fff calc(var(--p, 0) * 1%), rgba(255,255,255,.15) 0);
  -webkit-mask: radial-gradient(circle, transparent 19px, #000 20px); mask: radial-gradient(circle, transparent 19px, #000 20px); }
#chargeRing.full { background: #ffd23f; animation: pulse .2s infinite alternate; }
#hitmarker { position: absolute; left: -16px; top: -16px; width: 32px; height: 32px; opacity: 0; }
#hitmarker::before, #hitmarker::after { content: ""; position: absolute; left: 15px; top: 0; width: 3px; height: 32px; background: #fff; border-radius: 2px; box-shadow: 0 0 3px #000; }
#hitmarker::before { transform: rotate(45deg); } #hitmarker::after { transform: rotate(-45deg); }
#hitmarker.on { animation: hit .3s ease-out; }
@keyframes hit { 0% { opacity: 1; transform: scale(1.3); } 100% { opacity: 0; transform: scale(.9); } }

#countdown { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: 96px; font-weight: 900; font-style: italic; opacity: 0;
  text-shadow: 0 6px 0 rgba(0,0,0,.3), 0 0 30px rgba(0,0,0,.3); white-space: nowrap; }
#countdown.show { animation: cd 1s ease-out forwards; }
#countdown.go { color: #ffd23f; }
#countdown.finish { color: #fff; animation: cdfin 2.2s ease-out forwards; }
@keyframes cd { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.85); } }
@keyframes cdfin { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2.5) rotate(-6deg); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-6deg); } 90% { opacity: 1; } 100% { opacity: 0; } }

#padBase { position: absolute; left: 0; top: 0; width: 124px; height: 124px; margin: -62px 0 0 -62px; border-radius: 50%; display: none;
  background: radial-gradient(circle, rgba(255,255,255,.08), rgba(255,255,255,.18)); border: 3px solid rgba(255,255,255,.45); }
#padKnob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  background: rgba(255,255,255,.85); box-shadow: 0 3px 8px rgba(0,0,0,.35); }

#fireBtn {
  position: absolute; right: calc(22px + var(--safe-r)); bottom: calc(26px + var(--safe-b)); width: 96px; height: 96px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.85); background: rgba(255,90,60,.55); color: #fff; font-weight: 900; font-size: 17px;
  box-shadow: 0 4px 12px rgba(0,0,0,.35); text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
#fireBtn.on { background: rgba(255,90,60,.85); transform: scale(.94); }
#skillBtn {
  --p: 0; --c: #ffd23f;
  position: absolute; right: calc(132px + var(--safe-r)); bottom: calc(70px + var(--safe-b)); width: 70px; height: 70px; border-radius: 50%; border: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(0,0,0,.45) 0); color: #fff; font-weight: 900; font-size: 13px; padding: 0;
  box-shadow: 0 3px 10px rgba(0,0,0,.35);
}
#skillBtn span { position: absolute; inset: 7px; border-radius: 50%; background: rgba(20,26,46,.82); display: flex; align-items: center; justify-content: center; }
#skillBtn.ready { animation: ready .6s ease-in-out infinite alternate; }
#skillBtn.ready span { background: var(--c); color: var(--ink); font-size: 14px; }
#skillBtn.active span { background: rgba(255,255,255,.2); font-size: 11px; }
@keyframes ready { from { transform: scale(1); box-shadow: 0 0 0 0 var(--c); } to { transform: scale(1.1); box-shadow: 0 0 22px 4px var(--c); } }

#specUI { position: absolute; right: calc(16px + var(--safe-r)); bottom: calc(18px + var(--safe-b)); display: none; flex-direction: column; align-items: flex-end; gap: 8px; }
#specUI button { border: none; border-radius: 14px; padding: 12px 16px; background: rgba(0,0,0,.5); color: #fff; font-weight: 900; font-size: 14px; min-width: 96px; }
#specLabel { background: rgba(0,0,0,.5); padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 800; }
#hud.spectator #specUI { display: flex; }
#hud.spectator #fireBtn, #hud.spectator #skillBtn, #hud.spectator #crosshair { display: none; }

#stunOverlay { position: absolute; inset: 0; opacity: 0; transition: opacity .2s;
  background: radial-gradient(ellipse at center, transparent 45%, var(--c, #ff000088) 100%); }
#stunOverlay.on { opacity: 1; }
.stun-text { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); font-size: 24px; font-weight: 900; font-style: italic; text-shadow: 0 2px 0 rgba(0,0,0,.4); animation: wobble .35s ease-in-out infinite alternate; }
.stun-barwrap { position: absolute; left: 50%; top: calc(62% + 38px); transform: translateX(-50%); width: 160px; height: 8px; background: rgba(0,0,0,.4); border-radius: 4px; overflow: hidden; }
#stunBar { height: 100%; background: #fff; width: 100%; }
@keyframes wobble { from { transform: translateX(-50%) rotate(-4deg); } to { transform: translateX(-50%) rotate(4deg); } }

#fxLayer { position: absolute; inset: 0; overflow: hidden; }
.splat { position: absolute; opacity: .75; animation: splat 1.4s ease-out forwards; filter: blur(.5px); }
@keyframes splat { 0% { transform: scale(.3); opacity: .9; } 12% { transform: scale(1); } 70% { opacity: .65; } 100% { opacity: 0; transform: scale(1.05) translateY(20px); } }
#flash { position: absolute; inset: 0; opacity: 0; }

/* スキルのカットイン */
.cutin { position: absolute; inset: 0; pointer-events: none; }
.ci-band { position: absolute; left: -10%; right: -10%; top: 30%; height: 34%; background: var(--c); transform: rotate(-6deg) translateX(-110%);
  animation: band 1.7s cubic-bezier(.2,.9,.2,1) forwards; box-shadow: 0 0 0 6px #fff, 0 10px 30px rgba(0,0,0,.35); overflow: hidden; }
.ci-lines { position: absolute; inset: 0; background: repeating-linear-gradient(100deg, rgba(255,255,255,.18) 0 10px, transparent 10px 40px); animation: lines .3s linear infinite; }
@keyframes lines { to { background-position: 80px 0; } }
@keyframes band { 0% { transform: rotate(-6deg) translateX(-110%); } 18% { transform: rotate(-6deg) translateX(0); } 78% { transform: rotate(-6deg) translateX(2%); } 100% { transform: rotate(-6deg) translateX(110%); } }
.cutin img { position: absolute; left: 6%; top: 22%; height: 52%; border-radius: 18px; border: 5px solid #fff; transform: rotate(-6deg); animation: ciimg 1.7s ease-out forwards; box-shadow: 0 8px 20px rgba(0,0,0,.35); }
@keyframes ciimg { 0% { opacity: 0; transform: rotate(-6deg) translateX(-80px) scale(.8); } 20% { opacity: 1; transform: rotate(-6deg) translateX(0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: rotate(-6deg) translateX(40px); } }
.ci-text { position: absolute; left: 0; right: 0; top: 34%; height: 26%; display: flex; flex-direction: column; justify-content: center; align-items: center; transform: rotate(-6deg); padding-left: 18%;
  animation: citext 1.7s ease-out forwards; }
.ci-char { font-size: clamp(16px, 3.5vw, 26px); font-weight: 900; letter-spacing: .2em; color: var(--a); text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.ci-skill { font-size: clamp(34px, 8vw, 72px); font-weight: 900; font-style: italic; color: #fff; text-shadow: 0 4px 0 rgba(0,0,0,.35), 0 0 18px rgba(0,0,0,.25); white-space: nowrap; }
@keyframes citext { 0% { opacity: 0; transform: rotate(-6deg) translateX(120px); } 22% { opacity: 1; transform: rotate(-6deg) translateX(0); } 80% { opacity: 1; transform: rotate(-6deg) translateX(-10px); } 100% { opacity: 0; transform: rotate(-6deg) translateX(-120px); } }

/* ---------- リザルト ---------- */
.result-inner { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: calc(14px + var(--safe-t)) 16px calc(14px + var(--safe-b)); overflow-y: auto; touch-action: pan-y; }
.res-title { font-size: clamp(40px, 9vw, 80px); font-weight: 900; font-style: italic; color: var(--c, #fff); text-shadow: 0 5px 0 rgba(0,0,0,.35); animation: restitle .6s cubic-bezier(.2,1.6,.4,1); }
.res-title.lose { color: #b8c0d6; }
@keyframes restitle { from { transform: scale(2.2) rotate(-8deg); opacity: 0; } }
.resbar { width: min(92vw, 720px); height: 54px; background: rgba(255,255,255,.18); border-radius: 18px; position: relative; overflow: hidden; box-shadow: 0 0 0 4px #fff; }
.resbar .fill { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; font-weight: 900; font-size: 22px; font-style: italic; white-space: nowrap; }
.resbar .fill.a { left: 0; background: var(--orange); justify-content: flex-start; padding-left: 12px; }
.resbar .fill.b { right: 0; background: var(--blue); justify-content: flex-end; padding-right: 12px; }
.resneutral { font-size: 12px; opacity: .7; }
.resplayers { width: min(92vw, 720px); display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rp { display: grid; grid-template-columns: 38px 1fr auto auto; align-items: center; gap: 8px; background: rgba(0,0,0,.3); border-radius: 12px; padding: 5px 10px 5px 5px; font-size: 13px; border-left: 5px solid var(--orange); }
.rp.t2 { border-left-color: var(--blue); }
.rp.me { background: rgba(255,255,255,.16); }
.rp img { width: 38px; height: 38px; border-radius: 8px; }
.rp b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp span { font-weight: 900; font-size: 15px; text-align: right; }
.rp small { font-size: 10px; opacity: .7; margin-left: 2px; font-weight: 700; }
.res-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
@media (max-aspect-ratio: 1/1) { .resplayers { grid-template-columns: 1fr; } }

/* ---------- モーダル・トースト ---------- */
#modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; background: rgba(8,10,20,.6); }
#modal.on { display: flex; }
.modal-card { background: var(--ink2); border-radius: 18px; padding: 18px 20px; min-width: 260px; max-width: 86vw; box-shadow: 0 0 0 3px rgba(255,255,255,.15), 0 20px 40px rgba(0,0,0,.4); text-align: center; }
.modal-card p { margin: 6px 0 14px; line-height: 1.6; font-weight: 700; word-break: break-all; }
#modalBtns { display: flex; gap: 10px; justify-content: center; }
.spinner { width: 36px; height: 36px; margin: 4px auto; border-radius: 50%; border: 5px solid rgba(255,255,255,.2); border-top-color: var(--orange); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#apptoast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: rgba(0,0,0,.8); padding: 8px 16px; border-radius: 12px; font-weight: 800; font-size: 13px; opacity: 0; transition: .25s; z-index: 60; pointer-events: none; }
#apptoast.on { opacity: 1; transform: translate(-50%, 0); }
#bootError { display: none; position: fixed; inset: 20px; z-index: 99; background: #300; color: #fff; padding: 20px; border-radius: 12px; font-weight: 700; }

@media (max-height: 460px) {
  .logo-main { font-size: 30px; }
  .logo-sub { margin-top: 4px; font-size: 11px; }
  .btn.big { font-size: 17px; padding: 11px 18px; }
  .charcard img { width: 64px; height: 64px; }
  .charcard { width: 80px; }
  #mapwrap.big { height: 70vh; }
}
