:root {
  --bg: #0b0d12;
  --ink: #f4f5f7;
  --ink-2: #c3c7cf;
  --muted: #8a909b;
  --glass: rgba(16, 18, 24, 0.62);
  --line: rgba(255, 255, 255, 0.22);
  --red: #ff3b3b;
  --gold: #ffc861;
  --blue: #2f8cff;
  --green: #4dff8a;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  -webkit-user-select: none; user-select: none; touch-action: none; overscroll-behavior: none;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.red { color: var(--red); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button, #stick-zone { pointer-events: auto; }
.pill {
  background: var(--glass); border-radius: 10px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; font-variant-numeric: tabular-nums;
}
.hud-top-left { position: absolute; left: calc(12px + var(--safe-l)); top: calc(10px + var(--safe-t)); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.main-pill { font-size: 22px; font-weight: 500; letter-spacing: 0.02em; padding: 7px 16px; }
.main-pill .ico { font-size: 20px; filter: grayscale(1) brightness(2); }
.main-pill .sep { width: 1px; height: 24px; background: var(--line); margin: 0 6px; }
.sub-row { display: flex; gap: 6px; }
.prize-pill { font-size: 15px; color: var(--gold); font-weight: 700; padding: 4px 12px; }
.icon-btn { font-size: 13px; font-weight: 800; padding: 4px 12px; color: var(--ink-2); }
.tracker {
  background: rgba(30, 20, 6, 0.72); border: 1px solid rgba(255, 200, 97, 0.55); border-radius: 10px;
  padding: 6px 10px; min-width: 210px; max-width: 280px; animation: glowBorder 1.2s ease-in-out infinite alternate;
}
.tracker.green { background: rgba(6, 30, 14, 0.72); border-color: rgba(77, 255, 138, 0.55); }
.tr-title { font-size: 13px; font-weight: 700; display: flex; gap: 6px; align-items: center; }
.tr-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); margin-top: 2px; font-variant-numeric: tabular-nums; }
.tr-meta #tr-time { color: var(--gold); font-weight: 700; }
@keyframes glowBorder { from { box-shadow: 0 0 0 rgba(255, 200, 97, 0); } to { box-shadow: 0 0 14px rgba(255, 200, 97, 0.35); } }
.lockbar { background: rgba(120, 10, 10, 0.85); color: #fff; font-weight: 800; font-size: 13px; padding: 5px 12px; border-radius: 8px; border: 1px solid rgba(255, 80, 80, 0.7); }
.lockbar.danger { animation: pulseBg 0.5s ease-in-out infinite alternate; }
@keyframes pulseBg { from { background: rgba(160, 10, 10, 0.9); } to { background: rgba(255, 40, 40, 0.95); } }
.carry { background: rgba(255, 200, 97, 0.9); color: #2a1b00; font-weight: 800; font-size: 12px; padding: 4px 10px; border-radius: 999px; }

.hud-top-right { position: absolute; right: calc(12px + var(--safe-r)); top: calc(10px + var(--safe-t)); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.map-btn {
  width: 64px; height: 64px; border-radius: 14px; background: var(--glass); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border: 1px solid var(--line);
}
.map-btn span { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; }
.map-btn.on { background: rgba(47, 140, 255, 0.55); }
.mapview { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 12; background: rgba(0, 0, 0, 0.35); }
.mv-card {
  pointer-events: auto; background: rgba(14, 16, 22, 0.94); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px 10px;
  display: flex; flex-direction: column; gap: 6px; animation: mvIn 0.18s ease-out;
}
@keyframes mvIn { from { transform: scale(0.92); opacity: 0; } }
.mv-head { display: flex; align-items: center; gap: 10px; }
.mv-head b { letter-spacing: 0.2em; }
.mv-note { font-size: 11px; color: var(--gold); flex: 1; }
#btn-map-close { width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); font-size: 15px; }
#minimap { display: block; width: min(62vh, 78vw); height: min(62vh, 78vw); border-radius: 6px; image-rendering: auto; }
.mv-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--ink-2); }
.mv-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.effect-pill { font-size: 17px; font-weight: 600; padding: 4px 12px; }
.effect-pill.warn #effect-time { color: var(--gold); }

#toasts { position: absolute; left: calc(12px + var(--safe-l)); top: 46%; display: flex; flex-direction: column; gap: 6px; }
.toast {
  background: var(--glass); border-left: 3px solid var(--red); border-radius: 6px; padding: 6px 12px; font-size: 13px;
  animation: toastIn 0.3s ease-out, toastOut 0.5s ease-in 3s forwards;
}
.toast.good { border-left-color: var(--green); }
.toast.info { border-left-color: var(--gold); }
@keyframes toastIn { from { transform: translateX(-20px); opacity: 0; } }
@keyframes toastOut { to { transform: translateX(-20px); opacity: 0; } }

/* スティック */
#stick-zone { position: absolute; left: 0; bottom: 0; width: 50%; height: 62%; touch-action: none; }
#stick-base {
  position: absolute; left: calc(36px + var(--safe-l)); bottom: calc(24px + var(--safe-b)); width: 124px; height: 124px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55); background: rgba(20, 22, 28, 0.25); transition: opacity 0.2s;
}
#stick-base.float { transition: none; }
#stick-knob {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #f2f2f2, #b9bcc2); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.ar { position: absolute; width: 0; height: 0; border: 6px solid transparent; opacity: 0.55; }
.ar.u { left: 50%; top: 8px; margin-left: -6px; border-bottom-color: #fff; border-top: 0; }
.ar.d { left: 50%; bottom: 8px; margin-left: -6px; border-top-color: #fff; border-bottom: 0; }
.ar.l { top: 50%; left: 8px; margin-top: -6px; border-right-color: #fff; border-left: 0; }
.ar.r { top: 50%; right: 8px; margin-top: -6px; border-left-color: #fff; border-right: 0; }

#btn-sprint {
  position: absolute; right: calc(28px + var(--safe-r)); bottom: calc(28px + var(--safe-b)); width: 96px; height: 96px; border-radius: 50%;
  background: rgba(20, 22, 28, 0.45); touch-action: none;
  --st: 100%;
}
#btn-sprint::before { /* スタミナの輪 */
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  background: conic-gradient(var(--ring, #fff) var(--st), rgba(255, 255, 255, 0.15) 0);
  -webkit-mask: radial-gradient(circle, transparent 50px, #000 51px); mask: radial-gradient(circle, transparent 50px, #000 51px);
}
#btn-sprint.low { --ring: var(--red); }
#btn-sprint.boost { --ring: var(--green); }
#btn-sprint.on { background: rgba(255, 255, 255, 0.18); transform: scale(0.96); }
.runner-ico { width: 54px; height: 54px; }

#sense { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.sense {
  position: absolute; left: -22px; top: -16px; width: 44px; height: 32px; opacity: 0; transition: opacity 0.2s;
  background: radial-gradient(ellipse at 70% 50%, rgba(255, 40, 40, 0.9), rgba(255, 40, 40, 0) 70%);
  clip-path: polygon(0 0, 100% 50%, 0 100%, 30% 50%);
}
#btn-action {
  position: absolute; right: calc(40px + var(--safe-r)); bottom: calc(140px + var(--safe-b)); min-width: 72px; height: 72px; border-radius: 36px;
  padding: 0 14px; background: rgba(255, 200, 97, 0.92); color: #2a1b00; font-weight: 900; font-size: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; touch-action: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); animation: actPop 0.25s ease-out;
}
#btn-action #act-icon { font-size: 24px; line-height: 1.1; }
#btn-action.in { background: rgba(160, 120, 80, 0.95); color: #fff; }
@keyframes actPop { from { transform: scale(0.6); opacity: 0; } }
#btn-crouch {
  position: absolute; width: 62px; height: 62px; border-radius: 50%; background: rgba(20, 22, 28, 0.5); border: 2px solid rgba(255, 255, 255, 0.5);
  display: flex; flex-direction: column; align-items: center; justify-content: center; touch-action: none;
}
#btn-crouch { right: calc(140px + var(--safe-r)); bottom: calc(30px + var(--safe-b)); }
#btn-crouch span { font-size: 22px; line-height: 1; }
#btn-crouch small { font-size: 9px; font-weight: 800; margin-top: 2px; }
#btn-crouch.on { background: rgba(47, 140, 255, 0.6); border-color: #9fd0ff; }
#call-fx { position: absolute; inset: 0; box-shadow: inset 0 0 120px 30px rgba(40, 160, 80, 0.5); display: flex; align-items: center; justify-content: center; }
#call-fx span { background: rgba(0, 0, 0, 0.6); padding: 8px 18px; border-radius: 999px; font-size: 16px; font-weight: 800; }
#call-fx b { color: #7dffa0; font-size: 22px; }
#hide-fx { position: absolute; inset: 0; box-shadow: inset 0 0 160px 60px rgba(40, 25, 10, 0.85); display: flex; align-items: flex-end; justify-content: center; }
#hide-fx span { margin-bottom: calc(24px + var(--safe-b)); background: rgba(0, 0, 0, 0.5); padding: 6px 14px; border-radius: 999px; font-size: 13px; }
#vignette { position: absolute; inset: 0; opacity: 0; transition: opacity 0.3s; box-shadow: inset 0 0 120px 30px rgba(255, 0, 0, 0.55); }
#vignette.on { animation: pulse 0.6s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.35; } to { opacity: 0.9; } }
#spotted {
  position: absolute; left: 50%; top: 24%; transform: translateX(-50%); font-size: 30px; font-weight: 900; color: #fff;
  text-shadow: 0 0 12px var(--red), 0 2px 0 #900; letter-spacing: 0.1em; animation: pop 1.2s ease-out forwards;
}
@keyframes pop { 0% { transform: translateX(-50%) scale(1.8); opacity: 0; } 15% { transform: translateX(-50%) scale(1); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
#freeze-fx { position: absolute; inset: 0; box-shadow: inset 0 0 100px 20px rgba(120, 200, 255, 0.45); }

/* ミッション通知 */
.notice {
  position: fixed; left: 50%; top: calc(12px + var(--safe-t)); transform: translateX(-50%); width: min(420px, 62vw);
  background: rgba(245, 246, 248, 0.96); color: #111; border-radius: 16px; padding: 10px 14px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: drop 0.45s cubic-bezier(.2, 1.4, .4, 1); z-index: 20;
}
.notice.green .n-head span:first-child { color: #0a8a3a; }
@keyframes drop { from { transform: translate(-50%, -140%); } }
.n-head { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; color: #c41a1a; letter-spacing: 0.06em; }
.n-head span:last-child { color: #777; font-weight: 600; }
.n-title { font-size: 17px; font-weight: 900; margin-top: 3px; }
.n-body { font-size: 13px; line-height: 1.5; margin-top: 3px; color: #333; }

.center-msg {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: 64px; font-weight: 900; letter-spacing: 0.08em;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 0, 0, 0.6); z-index: 15; white-space: nowrap; pointer-events: none;
}
.center-msg.caught { color: #fff; font-size: 96px; text-shadow: 0 0 30px var(--red), 0 6px 0 #7a0000; animation: slam 0.35s cubic-bezier(.2, 1.6, .4, 1); }
.center-msg.small { font-size: 34px; }
.center-msg.anim { animation: slam 0.35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes slam { from { transform: translate(-50%, -50%) scale(2.2); opacity: 0; } }

/* ---------- 画面（タイトル・モーダル） ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 30; padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l)); }
#title { background: linear-gradient(90deg, rgba(5, 6, 10, 0.92) 0%, rgba(5, 6, 10, 0.55) 55%, rgba(5, 6, 10, 0.1) 100%); justify-content: flex-start; }
.title-inner { display: flex; flex-direction: column; gap: 14px; max-width: 420px; width: 100%; padding-left: 4vw; }
.logo-sub { font-size: 12px; letter-spacing: 0.3em; color: var(--ink-2); }
.logo-main { font-size: clamp(54px, 11vw, 84px); font-weight: 900; line-height: 1; letter-spacing: 0.04em; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.6); }
.logo-main .red { text-shadow: 0 0 24px rgba(255, 59, 59, 0.6), 0 4px 0 #6a0000; }
.logo-tag { margin-top: 6px; color: var(--ink-2); font-size: 15px; }
.diff { display: flex; background: rgba(255, 255, 255, 0.08); border-radius: 12px; padding: 4px; gap: 4px; }
.diff button { flex: 1; padding: 10px 0; border-radius: 9px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.diff button.on { background: #fff; color: #111; }
.btn-primary, .btn-warn, .btn-ghost { width: 100%; padding: 14px; border-radius: 12px; font-size: 18px; font-weight: 800; }
.btn-primary { background: linear-gradient(180deg, #ff4d4d, #d81f1f); color: #fff; box-shadow: 0 4px 0 #7d0b0b, 0 8px 20px rgba(255, 40, 40, 0.3); }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #7d0b0b; }
.btn-warn { background: var(--gold); color: #2a1b00; }
.btn-ghost { background: rgba(255, 255, 255, 0.1); font-size: 15px; padding: 11px; }
.title-row { display: flex; gap: 8px; }
.best { font-size: 13px; color: var(--muted); min-height: 1em; }
.rotate-hint { font-size: 12px; color: var(--muted); display: none; }
@media (orientation: portrait) {
  .rotate-hint { display: block; }
  #title { background: linear-gradient(180deg, rgba(5, 6, 10, 0.25), rgba(5, 6, 10, 0.92) 45%); align-items: flex-end; justify-content: center; }
  .title-inner { padding-left: 0; }
  .notice { width: calc(100vw - 32px); top: calc(150px + var(--safe-t)); }
  .center-msg { font-size: 44px; }
  .center-msg.caught { font-size: 72px; }
  #stick-zone { width: 55%; height: 45%; }
  #minimap { width: min(80vw, 46vh); height: min(80vw, 46vh); }
  .main-pill { font-size: 17px; padding: 5px 11px; gap: 6px; }
  .main-pill .sep { margin: 0 2px; }
}

.modal { background: rgba(4, 5, 8, 0.75); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.card {
  background: #15171d; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 18px; padding: 20px; width: min(560px, 100%);
  max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; touch-action: pan-y;
}
.card.small { width: min(360px, 100%); }
.card h2 { margin: 0 0 4px; font-size: 22px; }
.rules { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.rules b { color: var(--ink); }
.items { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.items div { background: rgba(255, 255, 255, 0.05); border-radius: 10px; padding: 8px 10px; display: grid; grid-template-columns: 32px 1fr; column-gap: 6px; }
.items span { grid-row: span 2; font-size: 24px; align-self: center; }
.items b { font-size: 14px; }
.items small { font-size: 11px; color: var(--muted); }
.kb { font-size: 12px; color: var(--muted); margin: 0; }
.muted { color: var(--ink-2); margin: 0 0 6px; font-size: 14px; }
.muted b { color: var(--gold); }

.result { text-align: center; align-items: stretch; width: min(420px, 100%); }
.r-label { font-size: 12px; letter-spacing: 0.3em; color: var(--muted); }
.r-title { font-size: 40px; font-weight: 900; }
.r-title.win { color: var(--gold); text-shadow: 0 0 20px rgba(255, 200, 97, 0.4); }
.r-title.lose { color: var(--red); }
.r-prize { font-size: 44px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.r-prize.zero { color: var(--muted); text-decoration: line-through; }
.r-new { color: #111; background: var(--gold); border-radius: 999px; padding: 3px 12px; align-self: center; font-weight: 800; font-size: 13px; }
.r-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 4px 0 6px; }
.r-stats div { background: rgba(255, 255, 255, 0.05); border-radius: 10px; padding: 8px; font-size: 12px; color: var(--muted); }
.r-stats b { display: block; font-size: 17px; color: var(--ink); margin-top: 2px; }

#loading { background: var(--bg); z-index: 50; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.15); border-top-color: var(--red); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 小さい横画面（スマホ横）向けの詰め */
@media (max-height: 430px) {
  .main-pill { font-size: 18px; padding: 5px 12px; }
  .map-btn { width: 54px; height: 54px; }
  #minimap { width: min(60vh, 70vw); height: min(60vh, 70vw); }
  #stick-base { width: 112px; height: 112px; left: calc(28px + var(--safe-l)); bottom: calc(16px + var(--safe-b)); }
  #btn-sprint { width: 84px; height: 84px; right: calc(24px + var(--safe-r)); bottom: calc(20px + var(--safe-b)); }
  #btn-action { bottom: calc(118px + var(--safe-b)); right: calc(30px + var(--safe-r)); height: 64px; min-width: 64px; }
  #btn-crouch { width: 54px; height: 54px; right: calc(122px + var(--safe-r)); }
  #btn-crouch { bottom: calc(24px + var(--safe-b)); }
  #btn-sprint::before { -webkit-mask: radial-gradient(circle, transparent 44px, #000 45px); mask: radial-gradient(circle, transparent 44px, #000 45px); }
  .title-inner { gap: 9px; }
  .logo-main { font-size: 52px; }
  .btn-primary { padding: 11px; }
  .card { padding: 14px; gap: 8px; }
  .r-title { font-size: 30px; }
  .r-prize { font-size: 34px; }
}

/* ---------- 協力モード ---------- */
.btn-coop { width: 100%; padding: 12px; border-radius: 12px; font-size: 15px; font-weight: 800; background: rgba(59, 140, 255, 0.22); border: 1px solid rgba(110, 170, 255, 0.6); color: #dbe9ff; }
.lobby { gap: 8px; }
.lb-label { font-size: 12px; color: var(--muted); }
.lb-input { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); color: var(--ink); font-size: 17px; -webkit-user-select: text; user-select: text; }
.lb-input.code { text-align: center; letter-spacing: 0.4em; font-size: 22px; font-weight: 800; }
.lb-or { font-size: 12px; color: var(--muted); text-align: center; margin: 6px 0 2px; }
.lb-joinrow { display: flex; gap: 8px; }
.lb-joinrow .btn-warn { width: 96px; flex: none; }
.lb-codebox { text-align: center; font-size: 12px; color: var(--muted); }
.lb-codebox b { display: block; font-size: 46px; letter-spacing: 0.25em; color: var(--gold); }
.lb-members { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lb-members li { background: rgba(255, 255, 255, 0.06); border-radius: 10px; padding: 9px 12px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.lb-members i, .mp-row i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid rgba(255, 255, 255, 0.5); }
.lb-members small { margin-left: auto; font-size: 11px; color: var(--gold); }
.lb-status { min-height: 1em; font-size: 13px; color: var(--gold); margin: 0; text-align: center; }
.spec { position: absolute; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%); background: rgba(10, 12, 18, 0.8); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px 8px 14px; display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.spec span { font-size: 13px; display: flex; flex-direction: column; }
.spec small { color: var(--muted); font-size: 11px; }
.spec button { background: #3b8cff; color: #fff; font-weight: 800; font-size: 13px; padding: 8px 12px; border-radius: 10px; }
.r-stats .mp-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; text-align: left; font-size: 14px; color: var(--ink); }
.r-stats .mp-row b { margin-left: auto; font-size: 15px; display: inline; margin-top: 0; }
.r-stats .mp-row.me { background: rgba(255, 200, 97, 0.15); }

/* ---------- 変身かくれんぼ ---------- */
.btn-henshin { width: 100%; padding: 12px; border-radius: 12px; font-size: 15px; font-weight: 800; background: rgba(255, 120, 200, 0.18); border: 1px solid rgba(255, 150, 210, 0.6); color: #ffe0f2; }
.hs-bar { position: absolute; right: calc(132px + var(--safe-r)); bottom: calc(24px + var(--safe-b)); display: none; gap: 8px; }
body.mode-henshin .hs-bar { display: flex; }
body.mode-henshin #btn-crouch, body.mode-henshin .inv { display: none !important; }
.hs-bar button { width: 64px; height: 64px; border-radius: 16px; background: rgba(20, 22, 28, 0.6); border: 2px solid rgba(255, 150, 210, 0.6); display: flex; flex-direction: column; align-items: center; justify-content: center; touch-action: none; }
.hs-bar button span { font-size: 22px; line-height: 1; }
.hs-bar button small { font-size: 9px; font-weight: 800; margin-top: 3px; white-space: nowrap; }
.hs-bar button.off { opacity: 0.35; }
@media (max-height: 430px) { .hs-bar { right: calc(116px + var(--safe-r)); bottom: calc(18px + var(--safe-b)); } .hs-bar button { width: 56px; height: 56px; } }
@media (orientation: portrait) { .hs-bar { bottom: calc(140px + var(--safe-b)); right: calc(16px + var(--safe-r)); flex-direction: column; } }

.mapsel button { position: relative; font-size: 13px; }
.mapsel button small { position: absolute; top: -6px; right: 4px; background: var(--red); color: #fff; font-size: 9px; padding: 1px 5px; border-radius: 6px; }

/* 持ち物（タップで使う） */
.inv { position: absolute; right: calc(130px + var(--safe-r)); bottom: calc(100px + var(--safe-b)); display: flex; gap: 8px; }
.inv button { position: relative; width: 54px; height: 54px; border-radius: 14px; background: rgba(20, 22, 28, 0.62); border: 2px solid rgba(255, 211, 107, 0.75); display: flex; flex-direction: column; align-items: center; justify-content: center; touch-action: none; color: #fff; }
.inv button span { font-size: 24px; line-height: 1; }
.inv button small { font-size: 8.5px; font-weight: 800; margin-top: 2px; white-space: nowrap; }
.inv button.empty { border-style: dashed; border-color: rgba(255, 255, 255, 0.25); background: rgba(20, 22, 28, 0.3); }
.inv button.empty span { opacity: 0.25; font-size: 16px; }
.inv button:active:not(.empty) { transform: scale(0.92); }
body.role-hunter .inv, body.role-hunter #btn-crouch { display: none !important; }
@media (max-height: 430px) { .inv { right: calc(112px + var(--safe-r)); bottom: calc(86px + var(--safe-b)); gap: 6px; } .inv button { width: 48px; height: 48px; } }
@media (orientation: portrait) { .inv { bottom: calc(140px + var(--safe-b)); right: calc(16px + var(--safe-r)); flex-direction: column-reverse; } }

/* ロビー：モードと役 */
.lb-seg { display: flex; gap: 6px; margin: 4px 0 10px; }
.lb-seg button { flex: 1; padding: 9px 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); border: 2px solid rgba(255, 255, 255, 0.15); color: #fff; font-weight: 800; font-size: 13px; }
.lb-seg button.on { background: rgba(255, 196, 0, 0.22); border-color: #ffc400; }
.lb-seg.locked button:not(.on) { opacity: 0.35; }
.lb-label small { font-weight: 400; opacity: 0.7; margin-left: 4px; }
.lb-members .role { margin-left: auto; font-size: 11px; padding: 2px 7px; border-radius: 9px; background: rgba(255, 255, 255, 0.12); }
.lb-members .role.hunter { background: rgba(255, 60, 60, 0.35); }

/* ハンター役 */
#btn-shoot { display: none; position: absolute; right: calc(132px + var(--safe-r)); bottom: calc(26px + var(--safe-b)); width: 74px; height: 74px; border-radius: 50%; background: rgba(200, 30, 30, 0.75); border: 3px solid #ffb4b4; color: #fff; flex-direction: column; align-items: center; justify-content: center; touch-action: none; }
#btn-shoot span { font-size: 28px; line-height: 1; }
#btn-shoot small { font-size: 10px; font-weight: 800; }
#btn-shoot.off { opacity: 0.4; }
#btn-shoot:active { transform: scale(0.93); }
body.role-hunter.mode-henshin #btn-shoot { display: flex; }
body.role-hunter .hs-bar { display: none !important; }
#blindfold { position: absolute; inset: 0; background: #050608; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #fff; z-index: 5; pointer-events: none; }
#blindfold b { font-size: 26px; }
#blindfold span { opacity: 0.7; font-size: 13px; }
#blindfold i { font-style: normal; font-size: 120px; line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; color: #fff; text-shadow: 0 0 30px rgba(255, 255, 255, 0.25); }
#blindfold i.last { color: #ff5a4a; text-shadow: 0 0 34px rgba(255, 60, 40, 0.6); }
#blindfold i.tick { animation: bfTick 0.5s ease-out; }
@keyframes bfTick { 0% { transform: scale(1.25); opacity: 0.4; } 100% { transform: scale(1); opacity: 1; } }
.whistle-ping { position: absolute; left: 50%; top: 50%; margin: -16px 0 0 -16px; font-size: 28px; animation: wping 1.5s ease-out forwards; }
@keyframes wping { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
@media (max-height: 430px) { #btn-shoot { right: calc(116px + var(--safe-r)); bottom: calc(20px + var(--safe-b)); width: 64px; height: 64px; } }
@media (orientation: portrait) { #btn-shoot { bottom: calc(140px + var(--safe-b)); right: calc(20px + var(--safe-r)); } }

/* ショップ */
.card.shop { width: min(560px, 100%); max-height: 92vh; display: flex; flex-direction: column; }
.shop-head { display: flex; align-items: center; gap: 10px; }
.shop-head h2 { flex: 1; }
.shop-head .close { position: static; }
.wallet { font-weight: 800; color: var(--gold); white-space: nowrap; }
.shop-tabs { display: flex; gap: 6px; margin: 6px 0; }
.shop-tabs button { flex: 1; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); color: #fff; font-weight: 800; border: 2px solid transparent; }
.shop-tabs button.on { border-color: var(--gold); background: rgba(255, 196, 0, 0.15); }
.shop-tabs small { font-weight: 400; font-size: 10px; opacity: 0.7; }
.shop-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; flex: 1; }
.shop-sec { font-size: 12px; color: var(--muted); margin: 6px 2px 0; }
.shop-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); }
.shop-item .ic { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; background: rgba(255, 255, 255, 0.08); flex: none; }
.shop-item .tx { flex: 1; min-width: 0; }
.shop-item .tx b { display: block; font-size: 14px; }
.shop-item .tx small { display: block; font-size: 11px; opacity: 0.75; }
.shop-item button { flex: none; min-width: 84px; padding: 8px 10px; border-radius: 10px; font-weight: 800; background: var(--gold); color: #1a1300; }
.shop-item button.own { background: rgba(255, 255, 255, 0.14); color: #fff; }
.shop-item button.eq { background: #2f8cff; color: #fff; }
.shop-item button:disabled { opacity: 0.4; }
.muted.small { font-size: 11px; margin: 6px 0 0; }
.r-earn { font-size: 13px; color: var(--gold); font-weight: 800; text-align: center; }
.r-prize.hunter .yen { display: none; }
body.mode-henshin .only-normal { display: none; }
#vignette.dark { opacity: 1 !important; background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 10, 0.72) 85%); }

/* ---------- タイトル画面（2026-11-02 組み直し：モードをタブで選ぶ・見切れない） ---------- */
#title { overflow-y: auto; -webkit-overflow-scrolling: touch; }
#title .title-inner { display: flex; flex-direction: column; gap: 16px; max-width: 440px; width: 100%; padding-left: 4vw; margin: auto 0; }
.t-brand { display: flex; flex-direction: column; gap: 10px; }
.t-panel { display: flex; flex-direction: column; gap: 10px; background: rgba(10, 12, 18, 0.55); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 18px; padding: 12px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modetabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.modetabs button { padding: 11px 6px; border-radius: 12px; font-size: 15px; font-weight: 900; color: var(--ink-2); background: rgba(255, 255, 255, 0.06); border: 1px solid transparent; white-space: nowrap; }
.modetabs button[data-mode="normal"].on { color: #fff; background: rgba(255, 70, 70, 0.22); border-color: rgba(255, 110, 110, 0.7); }
.modetabs button[data-mode="henshin"].on { color: #fff; background: rgba(255, 120, 200, 0.2); border-color: rgba(255, 150, 210, 0.7); }
.t-sec { display: flex; flex-direction: column; gap: 6px; }
.t-lab { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; color: var(--muted); padding-left: 2px; }
.t-note { font-size: 12px; color: var(--ink-2); padding: 2px 2px 0; }
#title .diff button { padding: 9px 2px; font-size: 13px; white-space: nowrap; }
#title .mapsel button small { top: -7px; right: 2px; }
#btn-start { margin-top: 2px; padding: 14px; font-size: 19px; }
#btn-start.hs { background: linear-gradient(180deg, #ff6fbf, #d6338f); box-shadow: 0 4px 0 #7a1650, 0 8px 20px rgba(255, 80, 170, 0.3); }
#title .title-row { display: grid; grid-template-columns: 1.25fr 1fr 1.15fr 0.55fr; gap: 6px; }
#title .title-row .btn-ghost { padding: 10px 4px; font-size: 13px; white-space: nowrap; }
#title .title-row .coop { background: rgba(59, 140, 255, 0.2); border: 1px solid rgba(110, 170, 255, 0.55); color: #dbe9ff; }
#title .title-row .snd { font-size: 16px; }
#title .best { font-size: 12px; }
@media (orientation: portrait) {
  #title .title-inner { padding-left: 0; margin: auto auto 0; }
  #title .rotate-hint { text-align: center; }
}
/* 横向きのスマホ：左にロゴ、右に操作。縦が低くても見切れない */
@media (orientation: landscape) and (max-height: 520px) {
  #title { align-items: center; justify-content: center; padding-top: calc(10px + var(--safe-t)); padding-bottom: calc(10px + var(--safe-b)); }
  #title .title-inner { flex-direction: row; align-items: center; gap: 24px; max-width: 780px; padding-left: 0; margin: auto; }
  .t-brand { flex: 1; min-width: 0; }
  .t-panel { flex: 0 0 min(400px, 52vw); gap: 7px; padding: 10px; }
  #title .logo-main { font-size: clamp(40px, 9vh, 60px); }
  #title .logo-tag { font-size: 13px; }
  .modetabs button { padding: 8px 4px; font-size: 14px; }
  #title .diff button { padding: 7px 2px; font-size: 12px; }
  .t-lab { display: none; }
  #btn-start { padding: 10px; font-size: 17px; }
  #title .title-row .btn-ghost { padding: 8px 2px; font-size: 12px; }
}

/* ---------- 三つどもえ ---------- */
.modetabs { grid-template-columns: 1fr 1fr; }
.modetabs button { position: relative; font-size: 13px; padding: 10px 2px; }
.modetabs button small { position: absolute; top: -7px; right: 2px; background: var(--red); color: #fff; font-size: 9px; padding: 1px 5px; border-radius: 6px; }
.modetabs button[data-mode="tag3"].on { color: #fff; background: linear-gradient(90deg, rgba(229, 57, 53, 0.3), rgba(47, 111, 224, 0.3), rgba(242, 193, 46, 0.3)); border-color: rgba(255, 255, 255, 0.55); }
.t3team button[data-t="red"].on { background: #e53935; color: #fff; }
.t3team button[data-t="blue"].on { background: #2f6fe0; color: #fff; }
.t3team button[data-t="yellow"].on { background: #f2c12e; color: #2a1c00; }
#btn-start.t3 { background: linear-gradient(90deg, #e53935, #2f6fe0 55%, #e0a91e); box-shadow: 0 4px 0 #222a55, 0 8px 20px rgba(80, 120, 255, 0.3); }
.t3-board { display: none; gap: 6px; margin-top: 6px; }
body.mode-tag3 .t3-board { display: flex; }
body.mode-tag3 .prize-pill { display: none; }
.t3c { display: flex; align-items: center; gap: 5px; background: rgba(10, 12, 18, 0.7); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 10px; padding: 4px 8px; }
.t3c i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.t3c.red i { background: #ff4a3d; } .t3c.blue i { background: #3b8cff; } .t3c.yellow i { background: #ffd23a; }
.t3c b { font-size: 16px; font-weight: 900; min-width: 1ch; text-align: center; }
.t3c small { font-size: 10px; color: var(--ink-2); }
.t3c.me { border-color: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5); }
@media (orientation: landscape) and (max-height: 520px) { .modetabs button { font-size: 12px; } }
.t3team button[data-v="red"].on { background: #e53935; color: #fff; }
.t3team button[data-v="blue"].on { background: #2f6fe0; color: #fff; }
.t3team button[data-v="yellow"].on { background: #f2c12e; color: #2a1c00; }
.role.t3 { font-weight: 800; }
.role.t3.red { color: #ff6b60; } .role.t3.blue { color: #6aa8ff; } .role.t3.yellow { color: #ffd23a; }
.t3spec { position: absolute; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; z-index: 6;
  background: rgba(10, 12, 18, 0.78); border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 12px; padding: 7px 8px 7px 14px; font-size: 13px; font-weight: 700; white-space: nowrap; pointer-events: auto; }
.t3spec button { background: rgba(255, 255, 255, 0.14); border-radius: 9px; padding: 6px 10px; font-size: 12px; font-weight: 800; }
@media (orientation: portrait) { .t3spec { top: calc(120px + var(--safe-t)); font-size: 12px; } }
/* 三つどもえの点数：赤▶青▶黄▶赤（矢印の先を捕まえる） */
body.mode-tag3 .t3-board { flex-direction: column; gap: 4px; }
.t3row { display: flex; align-items: center; gap: 3px; }
.t3a { font-size: 11px; color: rgba(255, 255, 255, 0.7); display: flex; align-items: center; gap: 2px; }
.t3a i, .t3me i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.t3a i.red, .t3me i.red { background: #ff4a3d; } .t3me i.blue { background: #3b8cff; } .t3me i.yellow { background: #ffd23a; }
.t3c em { font-style: normal; font-size: 11px; font-weight: 800; }
.t3c { padding: 3px 7px; gap: 4px; }
.t3me { display: flex; gap: 6px; font-size: 11px; font-weight: 800; }
.t3me span { background: rgba(10, 12, 18, 0.7); border-radius: 8px; padding: 3px 7px; display: flex; align-items: center; gap: 4px; }
.t3me .hunt { color: #9dffb8; } .t3me .run { color: #ffb0a8; }
/* 三つどもえ：ピン・役割の技・役割を選ぶ画面・シャッフル */
.t3-pins { position: absolute; right: calc(12px + var(--safe-r)); top: calc(78px + var(--safe-t)); display: flex; flex-direction: column; gap: 6px; z-index: 6; }
body:not(.mode-tag3) .t3-pins, body:not(.mode-tag3) .t3-skill { display: none !important; }
.t3-pins button { width: 50px; height: 46px; border-radius: 12px; background: rgba(10, 12, 18, 0.72); border: 1px solid rgba(255, 255, 255, 0.2); font-size: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; touch-action: none; }
.t3-pins button small { font-size: 9px; font-weight: 800; margin-top: 2px; color: var(--ink-2); }
.t3-pins button:active { transform: scale(0.94); background: rgba(255, 255, 255, 0.2); }
.t3-skill { position: absolute; right: calc(30px + var(--safe-r)); bottom: calc(132px + var(--safe-b)); width: 66px; height: 66px; border-radius: 50%; z-index: 6; background: rgba(20, 22, 28, 0.6); border: 2px solid rgba(255, 255, 255, 0.25); display: flex; flex-direction: column; align-items: center; justify-content: center; touch-action: none; }
.t3-skill span { font-size: 24px; line-height: 1; }
.t3-skill small { font-size: 9px; font-weight: 800; margin-top: 2px; }
.t3-skill.ready { border-color: #9fd8ff; box-shadow: 0 0 14px rgba(120, 200, 255, 0.6); }
@media (max-height: 430px) { .t3-skill { bottom: calc(112px + var(--safe-b)); right: calc(26px + var(--safe-r)); width: 58px; height: 58px; } .t3-pins { top: calc(70px + var(--safe-t)); } .t3-pins button { height: 40px; } }
/* 縦向き：持ち物の列（右はし）と重ならないよう、技ボタンはその左に置く */
@media (orientation: portrait) { .t3-pins { top: auto; bottom: calc(224px + var(--safe-b)); right: calc(84px + var(--safe-r)); flex-direction: row; gap: 5px; } .t3-pins button { height: 42px; width: 48px; } .t3-skill { bottom: calc(150px + var(--safe-b)); right: calc(84px + var(--safe-r)); } }
.t3spec #t3-role { background: rgba(77, 210, 255, 0.22); }
.t3roles { z-index: 40; background: rgba(5, 6, 10, 0.55); }
.t3r-card { background: rgba(18, 20, 28, 0.96); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 18px; padding: 14px; width: min(640px, 94vw); }
.t3r-card h3 { margin: 0 0 10px; font-size: 16px; text-align: center; }
.t3r-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.t3r-list button { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.t3r-list button span { font-size: 28px; }
.t3r-list button b { font-size: 14px; }
.t3r-list button small { font-size: 10.5px; color: var(--ink-2); line-height: 1.4; }
.t3r-list button.on { border-color: #4dd2ff; background: rgba(77, 210, 255, 0.16); }
.t3r-close { margin-top: 10px; width: 100%; padding: 9px; border-radius: 10px; background: rgba(255, 255, 255, 0.1); font-weight: 800; }
@media (orientation: portrait) { .t3r-list { grid-template-columns: 1fr 1fr; } }
.t3shuf { font-size: 11px; font-weight: 900; color: #e7b8ff; background: rgba(120, 40, 160, 0.5); border-radius: 8px; padding: 3px 8px; align-self: flex-start; animation: t3pulse 0.8s infinite alternate; }
@keyframes t3pulse { from { opacity: 0.7; } to { opacity: 1; } }
.t3me .role { color: #cfe9ff; }
/* 変身かくれんぼ：2段目のボタン（ライト・お札・音・棚の下） */
.hs-bar2 { bottom: calc(98px + var(--safe-b)); }
.hs-bar2 button { border-color: rgba(255, 230, 150, 0.6); }
@media (max-height: 430px) { .hs-bar2 { bottom: calc(84px + var(--safe-b)); } }
@media (orientation: portrait) { .hs-bar2 { bottom: calc(140px + var(--safe-b)); right: calc(92px + var(--safe-r)); } }
/* 怪物が近い：画面のふちが赤く脈打つ */
#vignette.near { opacity: 0.6; animation: nearBeat 0.9s ease-in-out infinite; }
@keyframes nearBeat { 0%, 100% { opacity: 0.25; } 30% { opacity: 0.75; } }
/* 変身かくれんぼの舞台は5つ：2段で並べる */
#hssel { flex-wrap: wrap; }
#hssel button { flex: 1 1 30%; }

/* ---------- タブレット（iPad など）：画面の部品が小さくなりすぎないよう拡大 ---------- */
@media (min-width: 740px) and (min-height: 740px) {
  #hud, #title .title-inner, .screen.modal > .card, .t3r-card { zoom: 1.3; }
}
@media (min-width: 1000px) and (min-height: 1000px) {
  #hud, #title .title-inner, .screen.modal > .card, .t3r-card { zoom: 1.45; }
}
/* 横向きのiPad：タイトルは左右の余白をとって真ん中寄せ */
@media (min-width: 740px) and (min-height: 740px) and (orientation: landscape) {
  #title .title-inner { max-width: 520px; padding-left: 5vw; }
}
/* 読み込めなかった時の案内 */
.loadfail { max-width: 340px; margin: 0 16px; text-align: center; background: rgba(18, 20, 28, 0.95); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 16px; padding: 18px; }
.loadfail b { font-size: 16px; }
.loadfail p { font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.loadfail button { margin-top: 4px; padding: 10px 22px; border-radius: 10px; background: #e53935; color: #fff; font-weight: 800; }
.loadfail small { display: block; margin-top: 8px; font-size: 10px; color: var(--muted); }
.install-btn { margin-top: 2px; width: 100%; padding: 8px; border-radius: 10px; font-size: 12px; font-weight: 800; color: #cfe9ff; background: rgba(59, 140, 255, 0.16); border: 1px dashed rgba(110, 170, 255, 0.5); }
.install-body ol { padding-left: 20px; line-height: 1.9; font-size: 14px; }
.install-body p { font-size: 13px; color: var(--ink-2); line-height: 1.7; }
/* 三つどもえ：実況テロップ（TV番組の字幕のように画面下寄りの帯） */
.t3cast { position: absolute; left: 50%; bottom: calc(118px + var(--safe-b)); transform: translate(-50%, 10px); z-index: 7; max-width: min(560px, 78vw);
  padding: 7px 16px; border-radius: 6px; font-size: 14px; font-weight: 900; letter-spacing: 0.02em; text-align: center; color: #fff;
  background: linear-gradient(90deg, rgba(10, 12, 18, 0.0), rgba(10, 12, 18, 0.88) 12%, rgba(10, 12, 18, 0.88) 88%, rgba(10, 12, 18, 0)); text-shadow: 0 2px 0 #000;
  opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; border-top: 2px solid #ffd23a; }
.t3cast.show { opacity: 1; transform: translate(-50%, 0); }
.t3cast.good { border-top-color: #5dff9a; } .t3cast.bad { border-top-color: #ff5a4a; }
body:not(.mode-tag3) .t3cast { display: none; }
@media (max-height: 430px) { .t3cast { bottom: calc(96px + var(--safe-b)); font-size: 13px; } }
@media (orientation: portrait) { .t3cast { bottom: auto; top: calc(150px + var(--safe-t)); max-width: 92vw; font-size: 12.5px; } }

/* ===================================================================
   ナンバーロック（4つ目のゲーム）
   =================================================================== */
.modetabs button[data-mode="numlock"].on { color: #fff; background: rgba(60, 220, 200, 0.18); border-color: rgba(90, 240, 215, 0.7); }
#btn-start.nl { background: linear-gradient(180deg, #2fd3bd, #138f88); box-shadow: 0 4px 0 #0b4f4b, 0 8px 20px rgba(40, 220, 200, 0.28); }
.nl { --nl-acc: #3ee6cf; --nl-pita: #3ee6cf; --nl-nia: #ffc861; --nl-card: rgba(255, 255, 255, 0.055); --nl-line: rgba(255, 255, 255, 0.1);
  z-index: 45; background: radial-gradient(120% 90% at 50% 0%, #121a22 0%, #07090d 70%); flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 10px;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) calc(10px + var(--safe-b)) calc(12px + var(--safe-l)); user-select: none; -webkit-user-select: none; font-variant-numeric: tabular-nums; }
.nl button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.nl-top { display: flex; align-items: center; gap: 8px; flex: none; white-space: nowrap; }
.nl-top > * { flex: none; }
.nl-back { width: 36px; height: 36px; border-radius: 10px; background: var(--nl-card) !important; font-size: 16px; }
.nl-title { font-weight: 900; font-size: 16px; letter-spacing: 0.04em; }
.nl-lv { font-size: 11px; font-weight: 800; color: var(--nl-acc); border: 1px solid rgba(62, 230, 207, 0.4); padding: 2px 8px; border-radius: 99px; }
.nl-turn { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 700; }
.nl-main { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; max-width: 980px; width: 100%; margin: 0 auto; }
.nl-boards { flex: 1; min-height: 120px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nl-board { min-height: 0; display: flex; flex-direction: column; background: var(--nl-card); border: 1px solid var(--nl-line); border-radius: 14px; overflow: hidden; }
.nl-board.me { border-color: rgba(62, 230, 207, 0.28); }
.nl-bh { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px; font-size: 11px; font-weight: 800; color: var(--ink-2); border-bottom: 1px solid var(--nl-line); }
.nl-code { font-size: 15px; letter-spacing: 0.18em; color: #fff; background: rgba(0, 0, 0, 0.35); padding: 2px 8px; border-radius: 6px; }
.nl-code.hide { color: var(--muted); }
.nl-board.cpu .nl-code::before { content: '🔒 '; letter-spacing: 0; font-size: 11px; }
.nl-info { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 8px; }
.nl-info:not(:empty) { padding: 6px 8px 0; }
.nl-info span { font-size: 11px; font-weight: 800; background: rgba(62, 230, 207, 0.12); color: var(--nl-acc); padding: 2px 7px; border-radius: 6px; }
.nl-info span.bad { background: rgba(255, 70, 70, 0.14); color: #ff8a8a; }
.nl-info span.dim { background: rgba(255, 255, 255, 0.05); color: var(--muted); }
.nl-info span.good { background: rgba(255, 200, 97, 0.14); color: var(--nl-nia); }
.nl-list { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.nl-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 14px 0; }
.nl-row { display: grid; grid-template-columns: 14px 1fr auto auto; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.03); }
.nl-row i { font-style: normal; font-size: 10px; color: var(--muted); }
.nl-row b { font-size: 18px; letter-spacing: 0.16em; }
.nl-row .pita, .nl-row .nia { font-weight: 900; font-size: 11px; white-space: nowrap; padding: 2px 5px; border-radius: 5px; }
.nl-row .pita { color: #04201d; background: var(--nl-pita); }
.nl-row .nia { color: #2a1d00; background: var(--nl-nia); }
.nl-row .z { color: var(--muted); background: rgba(255, 255, 255, 0.06); }
.nl-row .jam { grid-column: 3 / 5; color: #c79bff; font-weight: 900; font-size: 12px; }
.nl-row.hit { background: rgba(62, 230, 207, 0.2); }
.nl-row.new { animation: nlIn 0.45s ease-out; }
@keyframes nlIn { from { transform: translateX(-10px); opacity: 0; background: rgba(62, 230, 207, 0.35); } }
.nl-mark { font-size: 11px; font-weight: 800; color: #ffb4a0; text-align: center; padding: 3px 0; border-top: 1px dashed rgba(255, 160, 140, 0.4); margin-top: 2px; }
.nl-ctrl { flex: none; display: flex; flex-direction: column; gap: 8px; }
.nl-status { text-align: center; font-weight: 900; font-size: 15px; min-height: 38px; display: flex; flex-direction: column; justify-content: center; }
.nl-status small { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.nl-status.me { color: var(--nl-acc); }
.nl-status.cpu { color: #ff9a8a; }
.dots::after { content: '…'; animation: nlDots 1s steps(3) infinite; }
@keyframes nlDots { 0% { content: '.'; } 33% { content: '..'; } 66% { content: '...'; } }
.nl-cards { display: flex; gap: 5px; align-items: stretch; overflow-x: auto; scrollbar-width: none; }
.nl-cards button[data-card] { flex: 1 0 auto; min-width: 58px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 4px; border-radius: 10px; background: var(--nl-card) !important; border: 1px solid rgba(62, 230, 207, 0.35) !important; font-size: 10px; font-weight: 800; white-space: nowrap; }
.nl-cards button span { font-size: 17px; line-height: 1.1; }
.nl-cards button.off { opacity: 0.45; }
.nl-cards button.gone { opacity: 0.18; text-decoration: line-through; border-color: transparent !important; }
.nl-cpucards { align-self: center; font-size: 10px; color: var(--muted); white-space: nowrap; padding: 0 2px; }
.nl-q { width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--nl-card) !important; font-weight: 900; color: var(--muted) !important; }
.nl-memo { display: grid; grid-template-columns: auto repeat(10, 1fr); gap: 3px; align-items: center; }
.nl-memo span { font-size: 10px; color: var(--muted); font-weight: 800; padding-right: 3px; }
.nl-memo button { height: 26px; border-radius: 6px; font-size: 13px; font-weight: 800; background: rgba(255, 255, 255, 0.04) !important; color: var(--ink-2) !important; position: relative; }
.nl-memo button.m1 { color: #6b6f78 !important; text-decoration: line-through; background: rgba(255, 60, 60, 0.1) !important; }
.nl-memo button.m2 { color: #07090d !important; background: var(--nl-acc) !important; }
.nl-slots { display: flex; gap: 8px; justify-content: center; }
.nl-slots b { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; font-size: 28px; font-weight: 900; background: rgba(0, 0, 0, 0.4); border: 1.5px solid var(--nl-line); }
.nl-slots b.cur { border-color: var(--nl-acc); box-shadow: 0 0 0 3px rgba(62, 230, 207, 0.15); }
.nl-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.nl-pad button { height: 46px; border-radius: 11px; font-size: 20px; font-weight: 800; background: rgba(255, 255, 255, 0.08) !important; }
.nl-pad button:active { transform: scale(0.95); background: rgba(62, 230, 207, 0.25) !important; }
.nl-pad button.used { opacity: 0.3; }
.nl-pad .del { grid-column: span 2; font-size: 14px; }
.nl-pad .ok { grid-column: span 3; font-size: 16px; font-weight: 900; color: #04201d !important; background: linear-gradient(180deg, #4ef0d8, #1fb3a3) !important; }
.nl-pad .ok:disabled, .nl-mrow .ok:disabled { opacity: 0.35; }
.nl.setup .nl-boards { opacity: 0.35; }
.nl.setup .nl-cards, .nl.setup .nl-memo { display: none; }
.nl-pop { position: fixed; left: 50%; top: 34%; transform: translate(-50%, -50%) scale(0.9); z-index: 3; pointer-events: none; padding: 12px 22px; border-radius: 14px; font-weight: 900; font-size: 20px; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
  background: rgba(12, 16, 22, 0.94); border: 1px solid var(--nl-line); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity 0.15s, transform 0.2s cubic-bezier(.2, 1.6, .4, 1); }
.nl-pop.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.nl-pop.good { color: var(--nl-acc); border-color: rgba(62, 230, 207, 0.5); }
.nl-pop.bad { color: #ff9a8a; border-color: rgba(255, 120, 100, 0.5); }
.nl-modal { position: fixed; inset: 0; z-index: 4; background: rgba(0, 0, 0, 0.6); display: grid; place-items: center; padding: 16px; }
.nl-mcard { width: min(420px, 100%); max-height: 100%; overflow-y: auto; background: #10151c; border: 1px solid var(--nl-line); border-radius: 18px; padding: 18px; }
.nl-mcard h3 { margin: 0 0 8px; font-size: 17px; }
.nl-mcard p { margin: 0 0 12px; color: var(--ink-2); font-size: 13px; }
.nl-mcard ul { margin: 0 0 12px; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.nl-mcard .pita { color: var(--nl-pita); } .nl-mcard .nia { color: var(--nl-nia); }
.nl-mrow { display: flex; gap: 8px; margin-top: 6px; }
.nl-mrow button { flex: 1; height: 46px; border-radius: 12px; font-weight: 900; background: rgba(255, 255, 255, 0.08) !important; }
.nl-mrow .ok { color: #04201d !important; background: linear-gradient(180deg, #4ef0d8, #1fb3a3) !important; }
.nl-swapd { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.nl-swapd button { width: 64px; height: 64px; border-radius: 14px; font-size: 30px; font-weight: 900; background: rgba(255, 255, 255, 0.07) !important; border: 2px solid transparent !important; }
.nl-swapd button.on { border-color: var(--nl-acc) !important; color: var(--nl-acc) !important; }
.nl-mcard.end { text-align: center; }
.nl-etitle { font-size: 30px; font-weight: 900; margin: 6px 0 14px; }
.nl-etitle.win { color: var(--nl-acc); } .nl-etitle.lose { color: #ff8a7a; }
.nl-ecodes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.nl-ecodes div { background: rgba(255, 255, 255, 0.05); border-radius: 12px; padding: 10px; }
.nl-ecodes small { display: block; font-size: 11px; color: var(--muted); }
.nl-ecodes b { font-size: 28px; letter-spacing: 0.2em; }
.nl-esub { font-size: 13px; color: var(--ink-2); margin-bottom: 12px; line-height: 1.6; }
/* 横向き：左に記録、右に入力 */
@media (orientation: landscape) and (min-width: 600px) {
  .nl-main { flex-direction: row; }
  .nl-boards { min-height: 0; }
  .nl-ctrl { width: min(380px, 46%); justify-content: center; }
}
@media (orientation: landscape) and (max-height: 440px) {
  .nl { gap: 6px; }
  .nl-top { display: none; }
  .nl-status { min-height: 30px; font-size: 13px; }
  .nl-ctrl { gap: 5px; }
  .nl-slots b { width: 40px; height: 40px; font-size: 22px; }
  .nl-pad button { height: 38px; }
  .nl-memo button { height: 22px; }
  .nl-cards button[data-card] { padding: 3px; }
}
@media (orientation: landscape) and (max-height: 440px) {
  .nl-row { grid-template-columns: 1fr auto auto; gap: 4px; padding: 3px 5px; }
  .nl-row i { display: none; }
  .nl-row b { font-size: 15px; letter-spacing: 0.08em; }
  .nl-row .pita, .nl-row .nia { padding: 1px 3px; font-size: 10px; }
  .nl-row .jam { grid-column: 2 / 4; }
  .nl-bh { padding: 5px 8px; }
  .nl-ctrl { width: min(330px, 50%); }
  .nl-cards button[data-card] { min-width: 0; flex: 1 1 0; font-size: 9px; }
  .nl-cards button span { font-size: 14px; }
}
@media (min-width: 1000px) and (min-height: 700px) {
  .nl-title { font-size: 20px; }
  .nl-ctrl { width: min(460px, 44%); gap: 12px; }
  .nl-status { font-size: 19px; }
  .nl-row { padding: 8px 12px; }
  .nl-row b { font-size: 24px; }
  .nl-row .pita, .nl-row .nia { font-size: 14px; padding: 3px 8px; }
  .nl-bh, .nl-info span { font-size: 13px; }
  .nl-cards button[data-card] { font-size: 12px; padding: 8px 4px; }
  .nl-cards button span { font-size: 22px; }
  .nl-memo button { height: 34px; font-size: 16px; }
  .nl-slots b { width: 68px; height: 68px; font-size: 36px; }
  .nl-pad button { height: 62px; font-size: 26px; }
  .nl-pad .ok, .nl-pad .del { font-size: 19px; }
}
@media (max-width: 400px) { .nl-row b { font-size: 15px; letter-spacing: 0.1em; } .nl-row { gap: 4px; padding: 4px 5px; } .nl-row .pita, .nl-row .nia { padding: 2px 3px; font-size: 10px; } .nl-cards button[data-card] { min-width: 0; flex: 1 1 0; } }

/* ===== 怪物の一人称視点（試作） ===== */
.crosshair { display: none; position: fixed; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; pointer-events: none; z-index: 5; }
body.fps .crosshair { display: block; }
.crosshair::before, .crosshair::after { content: ''; position: absolute; background: rgba(255, 255, 255, 0.9); box-shadow: 0 0 3px rgba(0, 0, 0, 0.8); }
.crosshair::before { left: 16px; top: 4px; width: 2px; height: 26px; }
.crosshair::after { top: 16px; left: 4px; height: 2px; width: 26px; }
.crosshair i { position: absolute; inset: 9px; border: 2px solid rgba(255, 255, 255, 0.0); border-radius: 50%; transition: border-color 0.12s, inset 0.12s; }
.crosshair.on i { border-color: #ff5a3a; inset: 5px; }
.crosshair.on::before, .crosshair.on::after { background: #ff7a5a; }
.crosshair.cool { opacity: 0.45; }
.crosshair.hit i { animation: chHit 0.35s ease-out; } .crosshair.miss i { animation: chMiss 0.35s ease-out; }
@keyframes chHit { 0% { border-color: #ffd23a; inset: -6px; } }
@keyframes chMiss { 0% { border-color: #9aa0a8; inset: -2px; } }
body.fps #btn-sprint { opacity: 0.85; }
/* 一人称では、お知らせを照準の下にずらす（真ん中をあける） */
body.fps #toasts { top: auto; bottom: calc(150px + var(--safe-b)); }
@media (orientation: portrait) { body.fps #toasts { bottom: calc(220px + var(--safe-b)); } }

/* 一人称の怪物の技ボタン（撃つボタンの左） */
.fps-ab { display: none; position: absolute; right: calc(24px + var(--safe-r)); bottom: calc(132px + var(--safe-b)); gap: 8px; }
body.fps .fps-ab { display: flex; }
.fps-ab button { position: relative; width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(20, 22, 28, 0.6); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font: inherit; }
.fps-ab button span { font-size: 20px; line-height: 1; }
.fps-ab button small { font-size: 9px; font-weight: 800; margin-top: 2px; }
.fps-ab button em { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: 20px; font-weight: 900; color: #fff; border-radius: 50%; }
.fps-ab button.cool { opacity: 0.55; } .fps-ab button.cool em { background: rgba(0, 0, 0, 0.55); }
@media (orientation: portrait) { .fps-ab { right: calc(14px + var(--safe-r)); bottom: calc(250px + var(--safe-b)); flex-direction: column; } }
/* においの方向：画面のふちが光る */
.fps-hint { position: fixed; inset: 0; pointer-events: none; opacity: 0; z-index: 4; background: conic-gradient(from calc(var(--a, 0rad) - 0.35rad) at 50% 50%, rgba(255, 210, 60, 0.55) 0 0.7rad, transparent 0.7rad); -webkit-mask: radial-gradient(circle at 50% 50%, transparent 48%, #000 75%); mask: radial-gradient(circle at 50% 50%, transparent 48%, #000 75%); }
.fps-hint.show { animation: fpsHint 1.8s ease-out; }
@keyframes fpsHint { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
/* 隠れる側：見られている */
.watched { position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: 0; transition: opacity 0.2s; box-shadow: inset 0 0 90px 20px rgba(255, 40, 40, 0.55); display: flex; justify-content: center; align-items: flex-start; padding-top: calc(92px + var(--safe-t)); }
.watched.on { opacity: 1; animation: watchPulse 0.9s ease-in-out infinite; }
.watched b { background: rgba(160, 10, 20, 0.85); color: #fff; font-size: 15px; padding: 6px 14px; border-radius: 99px; letter-spacing: 0.05em; }
@keyframes watchPulse { 50% { box-shadow: inset 0 0 120px 34px rgba(255, 40, 40, 0.7); } }
