:root {
  --c: #39ff6a;          /* HUD の色（JS が差し替える） */
  --cd: rgba(57,255,106,.35);
  --bg: #000;
  --mono: 'Share Tech Mono', ui-monospace, Consolas, monospace;
  --orb: 'Orbitron', 'Share Tech Mono', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--c); overflow: hidden;
  font-family: var(--mono); user-select: none; -webkit-user-select: none; touch-action: none; }
button { font-family: var(--orb); color: var(--c); cursor: pointer; }

/* ---------- カメラ＋HUD ---------- */
#stage { position: fixed; inset: 0; overflow: hidden; background: #000; }
body[data-map="1"] #stage { right: 44%; }
@media (orientation: portrait) { body[data-map="1"] #stage { right: 0; bottom: 46%; } }
#cam { position: absolute; left: 50%; top: 50%; width: 100%; height: 100%; object-fit: cover;
  transform: translate(-50%,-50%); transform-origin: 50% 50%; }
#hud { position: absolute; inset: 0; width: 100%; height: 100%;
  filter: drop-shadow(0 0 1.5px rgba(0,0,0,.95)) drop-shadow(0 0 4px var(--cd)); }
/* 走査線と周辺減光：レンズを覗いている感じ */
#fx { position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.13) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0,0,0,.55) 100%); }
#flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .35s; }
#flash.on { opacity: .85; transition: none; }

/* ---------- 操作ボタン ---------- */
.hb { background: rgba(0,12,4,.45); border: 1px solid var(--c); padding: 7px 10px; min-width: 54px;
  font-size: 11px; font-weight: 700; letter-spacing: .12em;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  text-shadow: 0 0 4px var(--cd); backdrop-filter: blur(2px); }
.hb:active, .hb.on { background: var(--c); color: #000; text-shadow: none; }
.hb.sm { min-width: 40px; padding: 6px 8px; font-size: 14px; }
.hb.big { font-family: var(--mono); font-size: 17px; padding: 12px 22px; letter-spacing: .06em; }

#rail { position: fixed; z-index: 20; right: calc(10px + env(safe-area-inset-right)); top: 50%;
  transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 9px; }
#btnClr { display: none; font-size: 10px; margin-left: 10px; }
#btnClr.on { display: block; background: rgba(0,12,4,.45); color: var(--c); }
#zoomRd { font-size: 13px; text-shadow: 0 0 4px var(--cd), 0 0 2px #000; }
.shot { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--c); background: rgba(0,0,0,.3);
  display: grid; place-items: center; margin-bottom: 6px; box-shadow: 0 0 10px var(--cd); }
.shot span { width: 46px; height: 46px; border-radius: 50%; background: var(--c); opacity: .85;
  box-shadow: inset 0 0 0 3px #000; }
.shot:active span { transform: scale(.88); }

/* ---------- 地図 ---------- */
#mapwrap { position: fixed; z-index: 10; display: none; background: #000; border-left: 1px solid var(--c); }
#mapwrap.split { display: block; right: 0; top: 0; bottom: 0; width: 44%; }
#mapwrap.full { display: block; inset: 0; border: 0; }
@media (orientation: portrait) {
  #mapwrap.split { left: 0; right: 0; top: auto; width: auto; height: 46%; border-left: 0; border-top: 1px solid var(--c); }
}
#map { position: absolute; inset: 0; background: #020802; }
#mapfx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 500;
  filter: drop-shadow(0 0 1.5px rgba(0,0,0,.95)) drop-shadow(0 0 3px var(--cd)); }
#mapinfo { position: absolute; z-index: 600; left: 8px; top: 8px; font-size: 12px; line-height: 1.35;
  background: rgba(0,0,0,.55); padding: 6px 9px; border-left: 2px solid var(--c); pointer-events: none;
  text-shadow: 0 0 3px var(--cd); max-width: calc(100% - 90px); }
#mapinfo b { font-family: var(--orb); font-size: 10px; letter-spacing: .15em; opacity: .75; font-weight: 500; }
#btnRecenter { position: absolute; z-index: 600; left: 8px; bottom: 30px; display: none; }
#pip { position: absolute; z-index: 600; left: 8px; bottom: 30px; width: 30%; max-width: 260px; aspect-ratio: 16/9;
  object-fit: cover; border: 1px solid var(--c); display: none; }
#mapwrap.full #pip { display: block; }
#mapwrap.full #btnRecenter { bottom: calc(30px + min(30vw, 260px) * 9 / 16 + 10px); }
.leaflet-container { background: #020802; font-family: var(--mono); }
.leaflet-control-attribution { background: rgba(0,0,0,.55) !important; color: #9a9 !important; font-size: 9px !important; }
.leaflet-control-attribution a { color: #bcb !important; }
.leaflet-control-zoom { display: none; }

/* ---------- 起動画面 ---------- */
#boot { position: fixed; inset: 0; z-index: 50; background: radial-gradient(circle at 50% 40%, #031a09, #000 70%);
  display: grid; place-items: center; }
#boot::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.25) 0 1px, transparent 1px 3px); }
.bootbox { width: min(92vw, 520px); text-align: center; position: relative; }
.logo { font-family: var(--orb); font-weight: 900; font-size: clamp(38px, 10vw, 64px); letter-spacing: .12em;
  text-shadow: 0 0 12px var(--c), 0 0 30px var(--cd); }
.logo span { opacity: .8; }
.sub { font-family: var(--orb); font-size: 11px; letter-spacing: .35em; opacity: .8; margin-top: 4px; }
#bootlog { text-align: left; font-size: 12px; height: 9.5em; overflow: hidden; margin: 18px auto; padding: 8px 12px;
  border: 1px solid var(--cd); background: rgba(0,20,6,.4); white-space: pre-wrap; }
#btnEngage { font-size: 18px; font-weight: 900; letter-spacing: .4em; padding: 14px 34px 14px 42px;
  background: transparent; border: 2px solid var(--c); box-shadow: 0 0 16px var(--cd), inset 0 0 16px var(--cd);
 }
#btnEngage:active { background: var(--c); color: #000; }
@keyframes pulse { 50% { box-shadow: 0 0 4px var(--cd), inset 0 0 4px var(--cd); } }
.note { font-size: 11px; opacity: .6; margin-top: 12px; }

/* ---------- 撮影結果 ---------- */
#shotview { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.88); display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 14px; }
#shotview.on { display: flex; }
#shotimg { max-width: 100%; max-height: calc(100% - 80px); border: 1px solid var(--c); box-shadow: 0 0 20px var(--cd); }
#shotview .row { display: flex; gap: 14px; }
#shotHint { font-size: 13px; max-width: 560px; text-align: center; line-height: 1.5; opacity: .85; }
/* iPhone で写真を長押しして保存できるように */
#shotimg { -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; pointer-events: auto; }
#sebar { position: fixed; z-index: 20; left: calc(66px + env(safe-area-inset-left)); top: calc(118px + env(safe-area-inset-top));
  display: flex; gap: 6px; }
body[data-map="2"] #sebar { display: none; }
.hb.se { min-width: 44px; font-size: 16px; padding: 7px 0; }

/* ---------- 設定 ---------- */
#setp { position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.7); display: none; place-items: center; }
#setp.on { display: grid; }
#setp .panel { width: min(94vw, 460px); max-height: 92vh; overflow: auto; background: rgba(0,14,5,.92);
  border: 1px solid var(--c); padding: 16px 18px; box-shadow: 0 0 24px var(--cd);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); }
#setp .ttl { font-family: var(--orb); font-weight: 700; letter-spacing: .3em; margin-bottom: 12px; }
#setp label { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: 13px; padding: 8px 0; border-bottom: 1px dashed var(--cd); }
#setp input, #setp select { background: #000; color: var(--c); border: 1px solid var(--c); font: 16px var(--mono);
  padding: 4px 6px; width: 92px; }
#setp select { width: auto; }
#setp .dim { font-size: 11px; opacity: .7; margin: 10px 0 14px; line-height: 1.5; white-space: pre-line; }

#toast { position: fixed; z-index: 60; left: 50%; top: 18%; transform: translateX(-50%); padding: 8px 16px;
  background: rgba(0,0,0,.8); border: 1px solid var(--c); font-size: 14px; display: none; text-align: center; }
#toast.on { display: block; }

#bootfail { position: fixed; inset: 0; z-index: 99; background: #200; color: #f66; display: none;
  place-items: center; align-items: center; justify-content: center; font: 16px monospace; text-align: center; }
#bootfail pre { font-size: 11px; white-space: pre-wrap; max-width: 90vw; }
#bootfail button { font-size: 16px; padding: 10px 20px; color: #f66; background: none; border: 1px solid #f66; }

/* 切り欠き・ホームバーの幅を JS で測るための見えない箱 */
#safeprobe { position: fixed; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none;
  padding-left: env(safe-area-inset-left, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
/* 撮った写真は大きく出す（長押しで保存しやすい） */
#shotimg { max-height: calc(100% - 110px); }
