* { box-sizing: border-box; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif; color: #e8ecf2; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#fade { position: fixed; inset: 0; background: #000; opacity: 1; pointer-events: none; z-index: 5; }
.hidden { display: none !important; }

/* 共通の画面 */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; z-index: 20; }
.btn { font: inherit; font-size: 18px; letter-spacing: .15em; color: #eaf0f7; background: rgba(20, 28, 38, .75); border: 1px solid rgba(200, 220, 255, .45); padding: 12px 38px; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover, .btn:focus-visible { background: rgba(60, 90, 130, .8); border-color: #bcd4ff; outline: none; }
.btn.small { font-size: 14px; padding: 7px 18px; letter-spacing: .05em; }
.btn:disabled { opacity: .4; cursor: default; }

/* タイトル */
#title { align-items: flex-start; justify-content: flex-end; padding: 0 6vw 9vh; background: linear-gradient(90deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 45%); }
#title .logo { align-items: flex-start; }
#title .logo .l2 { margin-right: 0; }
.logo { display: flex; flex-direction: column; align-items: center; line-height: 1; text-shadow: 0 0 24px rgba(0,0,0,.9); }
.logo .l1 { font-size: clamp(28px, 5vw, 60px); font-weight: 300; letter-spacing: .06em; color: #f3d7e8; }
.logo .l2 { font-size: clamp(34px, 6.4vw, 84px); font-weight: 800; letter-spacing: .22em; margin-right: -.35em; color: #dfe6ef; }
.tag { font-size: 16px; letter-spacing: .5em; color: #b9c3d0; margin-bottom: 18px; text-shadow: 0 0 10px #000; }
.small-note { font-size: 13px; color: #9aa6b4; text-shadow: 0 0 6px #000; }

/* 機体選び */
#select { align-items: flex-end; justify-content: center; padding: 16px 4vw; background: linear-gradient(90deg, rgba(0,0,0,0) 35%, rgba(0,0,0,.65) 100%); }
#select > * { width: min(460px, 100%); flex-shrink: 0; }
#select { gap: 9px; overflow-y: auto; }
#select .sel-head { position: static; transform: none; left: auto; top: auto; font-size: 16px; letter-spacing: .3em; }
#select .sel-row, #select .swatches { justify-content: flex-start; }
#select .sel-head { width: auto; }
.sel-head { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); font-size: 20px; letter-spacing: .4em; text-shadow: 0 0 8px #000; }
.sel-row { display: flex; gap: 12px; }
.mc { font: inherit; color: #dfe6ef; background: rgba(15, 22, 30, .7); border: 1px solid rgba(200,220,255,.3); padding: 10px 22px; min-width: 150px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mc b { font-size: 22px; letter-spacing: .12em; }
.mc span { font-size: 12px; color: #a9b4c2; }
.mc.on { border-color: #ffd27a; background: rgba(70, 55, 25, .7); }
.sel-info { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 13px; background: rgba(10, 14, 20, .6); padding: 10px 14px; border: 1px solid rgba(200,220,255,.15); }
.sel-info .bar { height: 6px; background: rgba(255,255,255,.12); margin-top: 3px; }
.sel-info .bar i { display: block; height: 100%; background: #9cc3ff; }
.sel-info .wp { grid-column: 1 / -1; color: #c9d3df; }
.sel-head2 { font-size: 13px; letter-spacing: .3em; color: #b9c3d0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 520px; }
.sw { width: 34px; height: 34px; border: 2px solid rgba(255,255,255,.25); cursor: pointer; padding: 0; }
.sw.on { border-color: #fff; box-shadow: 0 0 0 2px #ffd27a; }
.difs { display: flex; gap: 8px; }
#select .difs { justify-content: flex-start; }
.dif { font: inherit; font-size: 13px; color: #dfe6ef; background: rgba(15, 22, 30, .7); border: 1px solid rgba(200,220,255,.3); padding: 6px 16px; cursor: pointer; }
.dif.on { border-color: #ffd27a; background: rgba(70, 55, 25, .7); }
.sel-enemy { font-size: 13px; color: #c5ccd6; text-shadow: 0 0 6px #000; }
.howto { font-size: 11px; color: #9aa6b4; text-align: left; line-height: 1.7; max-width: 720px; text-shadow: 0 0 6px #000; }
.howto kbd { font-family: inherit; border: 1px solid #667; padding: 0 5px; border-radius: 3px; color: #d8dee8; }

/* ラウンドの合間 */
#between { background: rgba(0,0,0,.45); }
#between .big { font-size: clamp(34px, 8vw, 72px); font-weight: 800; letter-spacing: .2em; text-shadow: 0 0 20px #000; }
#between .sub { font-size: 18px; letter-spacing: .2em; color: #d0d8e2; }
#between .sub2 { font-size: 14px; color: #aab4c2; white-space: pre-line; text-align: center; line-height: 1.8; }

#pause { background: rgba(0,0,0,.6); }
#pause .big { font-size: 30px; letter-spacing: .3em; }
#pause .opt { font-size: 14px; display: flex; align-items: center; gap: 10px; }

#clickhint { position: fixed; left: 50%; top: 60%; transform: translateX(-50%); z-index: 30; background: rgba(0,0,0,.6); padding: 8px 16px; font-size: 14px; pointer-events: none; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#topbar { position: absolute; top: 34px; left: 50%; transform: translateX(-50%); text-align: center; text-shadow: 0 0 6px #000; }
#round-dots { font-size: 14px; letter-spacing: .1em; display: flex; gap: 12px; align-items: center; }
#round-dots .d { display: inline-block; width: 10px; height: 10px; border: 1px solid #ccd; margin: 0 2px; transform: rotate(45deg); }
#round-dots .d.w { background: #ffd27a; border-color: #ffd27a; }
#round-dots .d.l { background: #d04040; border-color: #d04040; }
#timer { font-size: 20px; font-variant-numeric: tabular-nums; margin-top: 2px; }
#compass { position: absolute; top: 8px; left: 50%; width: min(440px, 70vw); height: 22px; transform: translateX(-50%); overflow: hidden; border-bottom: 1px solid rgba(255,255,255,.25); -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent); mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent); }
#compass-strip { position: absolute; top: 0; left: 0; height: 100%; white-space: nowrap; font-size: 12px; }
#compass-strip span { position: absolute; top: 2px; transform: translateX(-50%); color: #cfd8e4; }
#compass-strip span.m { color: #7f8a98; font-size: 10px; top: 4px; }
#compass-strip span.snd { color: #ff5a4a; font-size: 13px; top: 1px; }
#compass-mark { position: absolute; left: 50%; bottom: 0; width: 2px; height: 7px; background: #ffd27a; transform: translateX(-50%); }

#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; --s: 10px; }
#crosshair i { position: absolute; background: rgba(240, 245, 255, .9); box-shadow: 0 0 2px #000; }
#crosshair .t, #crosshair .b { width: 2px; height: 9px; left: -1px; }
#crosshair .l, #crosshair .r { width: 9px; height: 2px; top: -1px; }
#crosshair .t { top: calc(-9px - var(--s)); } #crosshair .b { top: var(--s); }
#crosshair .l { left: calc(-9px - var(--s)); } #crosshair .r { left: var(--s); }
#crosshair .c { width: 2px; height: 2px; left: -1px; top: -1px; }
#crosshair.blocked i { background: rgba(255, 90, 80, .9); }
#hitmark { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; opacity: 0; background:
  linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%) , linear-gradient(-45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
  -webkit-mask: radial-gradient(circle, transparent 5px, #000 6px); mask: radial-gradient(circle, transparent 5px, #000 6px); transition: opacity .15s; }
#hitmark.on { opacity: 1; transition: none; }
#hitmark.kill { background: linear-gradient(45deg, transparent 45%, #ff5040 45%, #ff5040 55%, transparent 55%), linear-gradient(-45deg, transparent 45%, #ff5040 45%, #ff5040 55%, transparent 55%); }
#dmgdir { position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; margin: -130px 0 0 -130px; border-radius: 50%; border-top: 6px solid rgba(255, 50, 40, .85); opacity: 0; transition: opacity .6s; filter: blur(1px); }
#dmgdir.on { opacity: 1; transition: none; }
#lowhp { position: absolute; inset: 0; box-shadow: inset 0 0 160px rgba(160, 0, 0, .7); opacity: 0; transition: opacity .3s; }

#status, #enemyinfo { position: absolute; left: 16px; bottom: 16px; background: rgba(8, 12, 18, .55); border: 1px solid rgba(200,220,255,.18); padding: 8px 12px 10px; text-shadow: 0 0 4px #000; }
#enemyinfo { left: auto; right: 16px; bottom: auto; top: 70px; }
.st-name { font-size: 12px; letter-spacing: .2em; color: #b9c3d0; margin-bottom: 6px; }
.st-body { position: relative; width: 84px; height: 110px; margin: 0 auto; }
.st-body.small { transform: scale(.75); transform-origin: top center; height: 82px; }
.st-body .z { position: absolute; background: #53c26a; border: 1px solid rgba(0,0,0,.4); }
.st-body .head { left: 32px; top: 0; width: 20px; height: 16px; }
.st-body .torso { left: 24px; top: 19px; width: 36px; height: 40px; }
.st-body .armR { left: 4px; top: 19px; width: 17px; height: 44px; }
.st-body .armL { left: 63px; top: 19px; width: 17px; height: 44px; }
.st-body .legs { left: 24px; top: 62px; width: 36px; height: 46px; }
.st-body .z.dead { background: transparent !important; border: 1px dashed rgba(255,90,80,.8); }
.st-note { font-size: 11px; color: #ffb0a0; min-height: 14px; text-align: center; margin-top: 4px; }

#weapons { position: absolute; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; text-shadow: 0 0 4px #000; }
#weapons .w { background: rgba(8, 12, 18, .55); border: 1px solid rgba(200,220,255,.18); padding: 6px 12px; min-width: 190px; opacity: .55; }
#weapons .w.on { opacity: 1; border-color: rgba(255, 210, 122, .8); }
#weapons .w.lost { opacity: .35; text-decoration: line-through; }
#weapons .wn { font-size: 12px; color: #b9c3d0; letter-spacing: .05em; }
#weapons .wa { font-size: 24px; font-variant-numeric: tabular-nums; }
#weapons .wa small { font-size: 13px; color: #9aa6b4; }
#weapons .wbar { height: 3px; background: rgba(255,255,255,.12); margin-top: 3px; }
#weapons .wbar i { display: block; height: 100%; width: 0; background: #ffd27a; }

#feed { position: absolute; right: 16px; top: 34px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 14px; text-shadow: 0 0 6px #000, 0 0 2px #000; }
#feed div { background: rgba(0,0,0,.35); padding: 2px 8px; animation: feed 4s forwards; }
#feed div.good { color: #ffd27a; } #feed div.bad { color: #ff8a7a; }
@keyframes feed { 0% { opacity: 0; transform: translateX(10px); } 8% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
#bigmsg { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%); font-size: clamp(26px, 6vw, 56px); font-weight: 800; letter-spacing: .25em; text-shadow: 0 0 20px #000, 0 0 4px #000; text-align: center; white-space: nowrap; }
#bigmsg small { display: block; font-size: 16px; font-weight: 400; letter-spacing: .3em; margin-top: 8px; color: #c8d0da; }

/* スマホ */
#touch { position: absolute; inset: 0; pointer-events: auto; touch-action: none; }
#stick { position: absolute; left: 22px; bottom: 22px; width: 124px; height: 124px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.05); }
#stick-knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(255,255,255,.25); }
#look { position: absolute; left: 40%; right: 0; top: 0; bottom: 0; }
.tb { position: absolute; font: inherit; font-size: 12px; color: #fff; background: rgba(20,28,38,.55); border: 1px solid rgba(255,255,255,.35); border-radius: 50%; width: 54px; height: 54px; padding: 0; }
.tb.on { background: rgba(200, 150, 60, .6); }
.tb.big { width: 82px; height: 82px; font-size: 14px; right: 22px; bottom: 26px; }
#tb-aim { right: 116px; bottom: 22px; }
#tb-crouch { right: 116px; bottom: 88px; }
#tb-sw { right: 36px; bottom: 124px; }
#tb-reload { right: 182px; bottom: 22px; }
#tb-pause { right: 10px; top: 10px; width: 36px; height: 36px; font-size: 11px; }
body.touch #status { left: 8px; bottom: auto; top: 8px; transform: scale(.62); transform-origin: top left; }
body.touch #weapons { right: 54px; bottom: auto; top: 8px; flex-direction: row; transform: scale(.62); transform-origin: top right; }
body.touch #weapons .w { min-width: 150px; }
body.touch #enemyinfo { top: 62px; right: 8px; transform: scale(.62); transform-origin: top right; }
body.touch #feed { top: 88px; right: auto; left: 50%; transform: translateX(-50%); align-items: center; font-size: 12px; }
body.touch #compass { width: min(300px, 50vw); }
body.touch #bigmsg { top: 38%; font-size: 30px; }

@media (max-width: 700px) {
  #select { align-items: center; justify-content: flex-end; padding: 16px; background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,0,0,.75) 100%); }
  #select .sel-row, #select .swatches, #select .difs { justify-content: center; }
  .sel-info { grid-template-columns: 1fr; font-size: 12px; }
  .howto { display: none; }
  .mc { min-width: 120px; padding: 8px 12px; }
}

#rotate { display: none; position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 40; background: rgba(0,0,0,.75); padding: 12px 18px; font-size: 15px; pointer-events: none; }
@media (orientation: portrait) { body.touch.playing #rotate { display: block; } }

/* 背の低い画面（スマホの横向き）の機体選び */
@media (max-height: 520px) {
  #select { gap: 6px; justify-content: flex-start; overflow-y: auto; padding-top: 10px; padding-bottom: 10px; }
  #select .sel-head { display: none; }
  .mc { padding: 4px 14px; min-width: 110px; } .mc b { font-size: 17px; }
  .sel-info { grid-template-columns: 1fr 1fr; font-size: 11px; padding: 6px 10px; gap: 3px 12px; }
  .sel-info .wp { display: none; }
  .sel-head2 { display: none; }
  .dif { padding: 4px 12px; font-size: 12px; }
  .sw { width: 26px; height: 26px; }
  .btn { padding: 8px 30px; font-size: 16px; }
  .logo .l1 { font-size: 40px; } .logo .l2 { font-size: 64px; }
  .tag { margin-bottom: 4px; }
}

#loading { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: #000; font-size: 16px; letter-spacing: .3em; color: #b9c3d0; }

/* ステージ選び */
.stages { display: flex; gap: 6px; flex-wrap: wrap; }
.stg { font: inherit; font-size: 12px; color: #dfe6ef; background: rgba(15, 22, 30, .7); border: 1px solid rgba(200,220,255,.3); padding: 6px 10px; cursor: pointer; min-width: 84px; text-align: left; line-height: 1.4; }
.stg small { display: block; font-size: 10px; color: #9aa6b4; }
.stg.on { border-color: #ffd27a; background: rgba(70, 55, 25, .7); }
.stg.done { opacity: .45; cursor: default; text-decoration: line-through; }
.stg.final { border-color: #ff8a7a; }
.stage-desc { font-size: 12px; color: #c9d3df; line-height: 1.7; text-shadow: 0 0 6px #000; min-height: 20px; }
@media (max-height: 520px) { .stg { padding: 3px 8px; min-width: 70px; } .stg small { display: none; } .stage-desc { display: none; } }

/* ゲームオーバー・エンディングの文 */
#gameover { background: radial-gradient(ellipse at center, rgba(0,0,0,.25) 0%, rgba(0,0,0,.85) 100%); gap: 26px; }
.go-title { font-size: clamp(40px, 9vw, 96px); font-weight: 800; letter-spacing: .3em; margin-right: -.3em; color: #d8342c; text-shadow: 0 0 30px rgba(200,0,0,.6), 0 0 6px #000; opacity: 0; transition: opacity 2s; }
.go-title.on { opacity: 1; }
.story { max-width: min(1200px, 96vw); text-align: center; font-size: clamp(11px, 1.55vw, 19px); line-height: 2.2; color: #eef2f6; text-shadow: 0 0 8px #000, 0 0 2px #000; }
.story p { margin: 0 0 .6em; text-wrap: balance; opacity: 0; transition: opacity 1.6s; }
.story p.on { opacity: 1; }
.go-btns { display: flex; gap: 14px; align-items: center; }
#ending { background: rgba(0,0,0,.25); justify-content: center; }
#ending .story { background: rgba(0,0,0,.35); padding: 18px 26px; }
@media (min-width: 720px) { .story p { white-space: nowrap; } } /* 1 行を途中で折らない */
.credit { position: absolute; left: 7vw; top: 12vh; font-family: "Palatino Linotype", "Book Antiqua", Palatino, "Times New Roman", serif; font-style: italic; font-size: clamp(26px, 4.5vw, 54px); color: #ffe45a; text-shadow: 0 0 12px rgba(0,0,0,.9), 0 0 3px #000; opacity: 0; transition: opacity 1.4s; white-space: nowrap; }
.credit.on { opacity: 1; }
.credit.white { color: #fff; }
.credit.fin { left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: clamp(60px, 12vw, 150px); color: #ff5ad2; }
.skip { position: absolute; right: 18px; bottom: 14px; font-size: 12px; color: #9aa6b4; }

@media (max-height: 820px) {
  #select .sel-head { display: none; }
  .sel-info { padding: 6px 12px; gap: 4px 16px; }
  .howto { display: none; }
}
body.touch #weapons { top: auto; bottom: 6px; right: auto; left: 50%; transform: translateX(-50%) scale(.62); transform-origin: bottom center; }
body.touch #enemyinfo { top: 112px; }
body.touch #feed { top: 150px; }

#gate { background: #000; cursor: pointer; }
.gate-msg { font-size: 16px; letter-spacing: .3em; color: #b9c3d0; }
#prologue { background: linear-gradient(90deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.25) 70%, rgba(0,0,0,0) 100%); align-items: flex-start; cursor: pointer; }
.prolog { width: min(900px, 92vw); margin-left: max(4vw, 16px); font-size: clamp(12px, 1.45vw, 17px); line-height: 1.95; color: #eef2f6; text-shadow: 0 0 8px #000, 0 0 2px #000; }
.prolog p { margin: 0; min-height: 1em; opacity: 0; transition: opacity 1.2s; }
.prolog p.on { opacity: 1; }
#prologue .skip, #ending .skip { position: absolute; right: 18px; bottom: 14px; font-size: 12px; color: #9aa6b4; }

/* 紹介用の画像の題名 */
#poster { position: fixed; left: 50%; transform: translateX(-50%); top: 5%; z-index: 60; text-align: center; pointer-events: none; }
#poster .p1 { font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif; font-style: italic; font-size: 64px; color: #f7c9ea; letter-spacing: .04em; text-shadow: 0 0 18px rgba(230,120,210,.8), 0 2px 4px #000; margin-bottom: -14px; }
#poster .p2 { font-family: "Helvetica Neue", Arial, sans-serif; font-weight: 900; font-size: 104px; letter-spacing: .06em; line-height: 1;
  background: linear-gradient(180deg, #ffffff 0%, #cfe0f5 38%, #6f8fb8 52%, #e8f1ff 62%, #9fb6d6 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 2px rgba(20,40,80,.9); filter: drop-shadow(0 0 14px rgba(90,160,255,.8)) drop-shadow(0 4px 3px #000); }
#poster .p3 { display: inline-block; margin-top: 10px; font-size: 30px; font-weight: 700; letter-spacing: .5em; margin-right: -.5em; color: #fff; padding: 6px 22px; border-top: 2px solid rgba(255,200,120,.8); border-bottom: 2px solid rgba(255,200,120,.8); text-shadow: 0 0 10px rgba(255,140,60,.9), 0 2px 3px #000; }
