:root {
  --bg: #050607;
  --panel: rgba(14, 16, 18, 0.94);
  --ink: #e6e2da;
  --muted: #a39f97;
  --warm: #e0a45a;
  --red: #d8453b;
  --line: #3a3d40;
  --sa-t: env(safe-area-inset-top, 0px);
  --sa-r: env(safe-area-inset-right, 0px);
  --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
body { overflow: hidden; overscroll-behavior: none; }

#stage {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh; /* 古いブラウザの代替 */
  height: 100dvh;
  height: var(--app-h, 100dvh);
  overflow: hidden;
}
#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  background: #000;
}

/* ---- HUD ---- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud[hidden] { display: none; }
#touch-layer {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  touch-action: none; /* 視点スワイプでページがスクロールしないように（ゲーム領域だけ） */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#stick-base {
  position: absolute;
  left: 0;
  top: 0;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
}
#stick-base.active { opacity: 1; }
/* 外側の輪：ここまで倒すと走る。弧の長さでスタミナを見せる（満タン未満のときだけ） */
#stick-base::before,
#stick-base::after {
  content: "";
  position: absolute;
  inset: -19px;
  border-radius: 50%;
  pointer-events: none;
}
#stick-base::before { border: 1.5px dashed rgba(255, 255, 255, 0.22); }
#stick-base::after {
  background: conic-gradient(rgba(224, 164, 90, 0.8) calc(var(--st, 1) * 360deg), transparent 0);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
  mask: radial-gradient(closest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
  opacity: 0;
  transition: opacity 0.2s;
}
#stick-base.tired::after { opacity: 1; }
#stick-base.dash-intent::before { border-color: rgba(255, 255, 255, 0.45); }
#stick-base.run::before { border-style: solid; border-color: var(--warm); }
#stick-base.run #stick-knob { background: rgba(224, 164, 90, 0.65); }
#stick-knob {
  position: absolute;
  left: 32px;
  top: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}
body.mode-touch #hud::before {
  /* スティック位置の目安 */
  content: "";
  position: absolute;
  left: calc(var(--sa-l) + 40px);
  bottom: calc(var(--sa-b) + 32px);
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

.hud-btn {
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(10, 12, 14, 0.55);
  color: var(--ink);
  font: inherit;
  border-radius: 14px;
  min-width: 56px;
  min-height: 56px;
  padding: 6px 14px;
}
#btn-menu {
  position: absolute;
  top: calc(var(--sa-t) + 14px);
  left: calc(var(--sa-l) + 16px);
  font-size: 24px;
  min-width: 52px;
  min-height: 52px;
}
#hud-buttons {
  position: absolute;
  right: calc(var(--sa-r) + 22px);
  bottom: calc(var(--sa-b) + 22px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}
#btn-action { min-width: 112px; min-height: 60px; font-weight: 600; border-color: var(--warm); }
#btn-rec { min-width: 112px; min-height: 60px; }
#btn-rec.recording { background: rgba(216, 69, 59, 0.85); border-color: #ff8b82; }
#btn-rec:disabled { opacity: 0.6; }
body.mode-pc #hud-buttons { opacity: 0.85; }
body.mode-pc #hud::before { display: none; }

#rec-indicator {
  position: absolute;
  top: calc(var(--sa-t) + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  border-radius: 999px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
#rec-indicator[hidden] { display: none; }
#rec-indicator.live { color: #fff; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #666; }
#rec-indicator.live .rec-dot { background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }
.level { width: 60px; height: 6px; background: rgba(255, 255, 255, 0.15); border-radius: 3px; overflow: hidden; }
#rec-level { display: block; height: 100%; width: 0; background: #7fd07f; }

/* 録音しっぱなしの表示（左上、メニューの右）。実際に音が届いているときだけ赤。タップでマイクを止める */
#cap-ind {
  position: absolute;
  top: calc(var(--sa-t) + 14px);
  left: calc(var(--sa-l) + 84px);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  pointer-events: auto;
}
#cap-ind[hidden], #cap-del[hidden] { display: none; }
#cap-ind.cap-live { color: #fff; }
#cap-ind.cap-live .rec-dot { background: var(--red); }
#cap-ind.cap-muted .rec-dot, #cap-ind.cap-os_muted .rec-dot, #cap-ind.cap-stalled .rec-dot { background: transparent; border: 2px solid #888; box-sizing: border-box; }
#cap-level { display: block; height: 100%; width: 0; background: #7fd07f; }
#cap-amber { color: #e0a84a; }
#cap-amber:empty { display: none; }
#cap-del {
  position: absolute;
  top: calc(var(--sa-t) + 66px);
  left: calc(var(--sa-l) + 84px);
  min-height: 44px;
  font-size: 13px;
}
.modes { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.btn.mode { min-height: 52px; }

/* PCのスタミナ：満タン未満のときだけ、画面下中央に細いバー */
#stamina {
  position: absolute;
  left: 50%;
  bottom: calc(var(--sa-b) + 18px);
  width: 80px;
  height: 4px;
  margin-left: -40px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
#stamina span { display: block; height: 100%; width: calc(var(--st, 1) * 100%); background: rgba(224, 164, 90, 0.8); }
body.mode-pc #stamina.tired { opacity: 1; }
/* 息切れ中だけ、画面の縁をわずかに暗くする（点滅なし） */
#vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.9) 100%);
  opacity: 0;
  transition: opacity 0.8s;
  pointer-events: none;
}
#vignette.on { opacity: 0.3; }

#hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--sa-b) + 110px);
  transform: translateX(-50%);
  max-width: min(78vw, 560px);
  background: rgba(0, 0, 0, 0.65);
  padding: 8px 16px;
  border-radius: 10px;
  text-align: center;
  font-size: 15px;
  opacity: 0;
  transition: opacity 0.4s;
}
#hint.show { opacity: 1; }
#hud-status {
  position: absolute;
  top: calc(var(--sa-t) + 20px);
  right: calc(var(--sa-r) + 20px);
  font-size: 12px;
  color: var(--muted);
}
#pc-help {
  position: absolute;
  left: calc(var(--sa-l) + 16px);
  bottom: calc(var(--sa-b) + 12px);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
}
body.mode-touch #pc-help { display: none; }
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; }

/* ---- 画面 ---- */
#screens {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y; /* 説明や一覧は通常スクロールを残す */
  z-index: 10;
}
#screens[hidden] { display: none; }
.screen {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--sa-t) + 20px) calc(var(--sa-r) + 16px) calc(var(--sa-b) + 20px) calc(var(--sa-l) + 16px);
  background: radial-gradient(ellipse at 50% 30%, rgba(40, 30, 20, 0.55), rgba(0, 0, 0, 0.88));
}
.screen.overlay { background: rgba(0, 0, 0, 0.72); }
.panel {
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel.narrow { max-width: 420px; text-align: center; }
/* タイトル：TAPECORE（カセットのラベルのような字）と、録音中の赤い点。下に「先に行ってる。」 */
.logo { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 4px 0; }
h1.title {
  font-family: "Helvetica Neue", "Arial Black", Arial, "Hiragino Sans", sans-serif;
  font-weight: 800;
  font-size: clamp(30px, 7.5vw, 46px);
  letter-spacing: 0.3em;
  margin: 0 -0.3em 0 0; /* 字間の分、右にずれないように */
  text-align: center;
  display: flex;
  align-items: center;
  gap: 0.45em;
}
.logo-rec { width: 0.32em; height: 0.32em; border-radius: 50%; background: var(--red); flex: none; animation: pulse 1.6s infinite; }
.title-sub {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  font-size: 15px;
  letter-spacing: 0.2em;
  color: var(--muted);
}
h2 { margin: 0; font-size: 22px; }
h3 { margin: 8px 0 0; font-size: 16px; color: var(--muted); }
p { margin: 0; }
.lead { text-align: center; color: var(--muted); }
.small { font-size: 13px; color: var(--muted); }
.warn { color: #f0b36a; font-size: 14px; }
.pre { white-space: pre-wrap; }
.box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.warnbox { border-color: #7a5a2a; }
details.box summary { cursor: pointer; min-height: 32px; }
.notes { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.btn {
  font: inherit;
  color: var(--ink);
  background: #1d2124;
  border: 1px solid #4a4f53;
  border-radius: 12px;
  min-height: 48px;
  padding: 10px 16px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: #6b4a22; border-color: var(--warm); font-weight: 600; }
.btn.big { min-height: 56px; font-size: 18px; }
.btn.small { min-height: 44px; min-width: 48px; padding: 6px 12px; font-size: 14px; }
.btn.danger { border-color: #8a3a34; color: #ffb4ad; }

.text, .url {
  font: inherit;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #4a4f53;
  background: #0d0f10;
  color: var(--ink);
  font-size: 16px; /* iOSの自動ズーム防止 */
}
.url { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; -webkit-user-select: all; user-select: all; }
.urlbox { display: flex; flex-direction: column; gap: 6px; }

.meter { height: 10px; background: #222; border-radius: 5px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: #7fd07f; transition: width 0.05s; }

.cliplist { display: flex; flex-direction: column; gap: 8px; }
.clip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-bottom: 1px solid #25282b; padding-bottom: 8px; }
.clipinfo { flex: 1 1 140px; font-size: 14px; }
.clipinfo .badge { display: inline-block; margin-left: 6px; padding: 1px 6px; border: 1px solid #5a4a2a; border-radius: 8px; font-size: 11px; color: #d8c08a; }
.clipinfo .badge.quiet { border-color: #3a3d40; color: #8a8f94; }
.clip.listened .clipinfo { color: #c9cdd1; }
.zonehead { margin: 10px 0 0; font-size: 13px; font-weight: normal; color: #8a8f94; }
.chk { display: flex; align-items: center; gap: 6px; min-height: 44px; font-size: 14px; }
.chk input { width: 22px; height: 22px; }

.vol { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.vol input { flex: 1; min-height: 36px; }
/* 置いたとき：右の窓の自分のテープが、左の窓へ移る（次の人には、これが「前の人のテープ」になる） */
#deck.swap #win-right { transition: transform 1.2s ease-in-out; transform: translateX(-112%); }
#deck.swap #win-left { transition: opacity 0.3s; opacity: 0.25; }
@media (prefers-reduced-motion: reduce) {
  #deck.swap #win-right { transition: opacity 0.6s; transform: none; opacity: 0; }
}
.looks { flex-wrap: wrap; }
.looks span { flex: 1 0 100%; }
.looks .btn { flex: 1; }
.looks .btn.on { border-color: var(--warm); color: var(--warm); }

.rotate-icon { font-size: 44px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sa-b) + 24px);
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 50;
  max-width: 90vw;
  font-size: 14px;
}
progress { width: 100%; }
.noscript { padding: 20px; }

@media (orientation: landscape) and (max-height: 500px) {
  .panel { padding: 16px; gap: 8px; }
  h1.title { font-size: 30px; }
  #hint { bottom: calc(var(--sa-b) + 96px); }
}

/* ---- v3：ダブルデッキ（右下）。左＝前の人のテープ、右＝自分のテープ（ずっと録音） ---- */
#deck {
  position: absolute;
  right: calc(var(--sa-r) + 16px);
  bottom: calc(var(--sa-b) + 16px);
  width: 236px;
  padding: 8px 10px 10px;
  border-radius: 12px;
  background: linear-gradient(#2c2e31, #17181a);
  border: 1px solid #4a4d51;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
#deck[hidden] { display: none; }
.deck-wins { display: flex; gap: 8px; }
.win { flex: 1; background: #0b0c0d; border: 1px solid #3a3d40; border-radius: 6px; padding: 6px 6px 4px; }
.reels { display: flex; justify-content: space-around; align-items: center; height: 26px; background: #1b1d20; border-radius: 4px; }
.reel {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #9aa0a6;
  background: repeating-conic-gradient(#9aa0a6 0 20deg, transparent 20deg 60deg);
}
.win.spin .reel { animation: reel 1.4s linear infinite; }
.win.cue .reel { animation: reel 0.16s linear infinite; }
.win.rev .reel { animation-direction: reverse; }
@keyframes reel { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .win.spin .reel, .win.cue .reel { animation: none; } }
.win.empty .reels { opacity: 0.3; }
.win-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 11px; color: var(--muted); }
.cnt { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: #e8d39a; background: #151310; padding: 0 4px; border-radius: 3px; letter-spacing: 0.08em; }
.lamp { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #4a1c19; margin-right: 4px; }
.lamp.on { background: #ff3b30; box-shadow: 0 0 6px #ff3b30; }
.lamp.nomic { background: transparent; border: 1px solid #ff3b30; box-sizing: border-box; }
.deck-btns { display: flex; gap: 8px; margin-top: 8px; }
.dbtn {
  flex: 1;
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid #55595e;
  background: #26282b;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.dbtn.play { flex: 1.3; }
.dbtn.on { background: #3d3220; border-color: var(--warm); }
.dbtn:disabled { opacity: 0.4; }
#hud-buttons { bottom: calc(var(--sa-b) + 168px); }
body.mode-pc #deck { opacity: 0.92; }
@media (orientation: landscape) and (max-height: 500px) {
  #deck { width: 214px; padding: 6px 8px 8px; }
  .dbtn { min-height: 46px; }
  #hud-buttons { bottom: calc(var(--sa-b) + 150px); }
}

/* ---- v3：捕まった画面と巻き戻し ---- */
.death {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  font-size: clamp(30px, 7vw, 44px);
  letter-spacing: 0.25em;
  text-align: center;
  margin: 8px 0;
}
/* 捕まったあと、テープが止まるまでの言い残す時間 */
.lastbar { height: 6px; margin: 14px 0; border-radius: 3px; overflow: hidden; background: rgba(255, 255, 255, 0.1); }
.lastbar .fill { display: block; height: 100%; width: 100%; background: rgba(224, 164, 90, 0.75); }
.cleared { font-variant-numeric: tabular-nums; }
.tapes { display: flex; flex-direction: column; gap: 8px; }
.tape-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-bottom: 1px solid #25282b; padding-bottom: 8px; }
.tape-row .info { flex: 1 1 160px; font-size: 14px; }
.selfdeck { display: flex; gap: 10px; align-items: center; }
.selfdeck .cnt { font-size: 16px; }

/* v3：案内は画面の上に出す（右下のデッキと重ならないように） */
#hint { top: calc(var(--sa-t) + 74px); bottom: auto; }
@media (orientation: landscape) and (max-height: 500px) { #hint { top: calc(var(--sa-t) + 64px); bottom: auto; } }
#pc-help { max-width: calc(100% - 290px); }

/* 届いたテープ・渡した印・樹形図 */
.box.arrived { border-color: var(--warm); }
.box.arrived > p:first-child { color: var(--warm); font-weight: 700; }
.badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border: 1px solid var(--warm); border-radius: 999px; color: var(--warm); font-size: 12px; vertical-align: middle; }
.tree { overflow-x: auto; max-width: 100%; padding: 4px 0; }
.tree svg { display: block; margin: 6px auto; max-width: none; }
.tree .legend { color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.legend .li { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; box-sizing: border-box; border: 1.5px solid #111; }
.legend .dot.exited { background: #cfc08a; }
.legend .dot.snapped { background: #d8453b; }
.legend .dot.abandoned { background: #8a857c; }
.legend .dot.full { background: #7fa3b5; }
.legend .dot.revoked { background: none; border: 1.5px dashed #8a857c; }
.legend .dot.self { background: #cfc08a; box-shadow: 0 0 0 2px #101213, 0 0 0 4px #e0a45a; margin: 0 2px; }
.legend .dot.next { background: none; border: 1.5px dashed #e0a45a; }
.legend .dot.best { background: none; border: 1px dotted #f3d27a; width: 13px; height: 13px; }
input.url { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #0c0d0e; color: var(--ink); }
progress { width: 100%; height: 10px; }

.relay { color: var(--warm); }
#lbl-right { white-space: nowrap; letter-spacing: -0.04em; }

/* ---- 読む紙（お知らせ・メモ）：ゲームは止めない。× で閉じる ---- */
.note-card {
  position: fixed; left: 50%; top: calc(var(--sa-t, 0px) + 10px); transform: translateX(-50%); z-index: 30;
  width: min(460px, calc(100vw - 32px)); box-sizing: border-box; padding: 14px 40px 12px 16px;
  border-radius: 12px; border: 1px solid #c9c4b8; background: rgba(240, 238, 230, 0.96); color: #222;
  max-height: calc(100% - 140px); overflow-y: auto;
}
.note-card .note-title { margin: 0 0 6px; font-weight: 700; color: #a1251c; }
.note-card .note-line { margin: 2px 0; font-size: 14px; line-height: 1.5; }
.note-close {
  position: absolute; right: 6px; top: 6px; width: 36px; height: 36px; border-radius: 18px; border: 0;
  background: rgba(0, 0, 0, 0.08); color: #222; font-size: 20px; line-height: 36px; cursor: pointer;
}
@media (max-height: 420px) { .note-card .note-line { font-size: 12.5px; } }

/* ---- タイトルの案内（アプリの中のブラウザ・横向き） ---- */
.box.warnbox { border-color: #8a6a2a; }
.box.warnbox > p:first-child { color: var(--warm); font-weight: 700; }
.rotate-tip { display: flex; align-items: center; gap: 8px; justify-content: center; }
.rotate-anim { display: inline-block; animation: rotate-hint 2.4s ease-in-out infinite; }
@keyframes rotate-hint { 0%, 30% { transform: rotate(0deg); } 55%, 100% { transform: rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) { .rotate-anim { animation: none; } }

/* ---- 合言葉・名前 ---- */
.passphrase {
  margin: 4px 0; padding: 12px 10px; border-radius: 12px; border: 1px solid var(--warm); text-align: center;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; font-size: clamp(22px, 5vw, 32px); letter-spacing: 0.04em; color: var(--ink);
  user-select: all; -webkit-user-select: all;
}
input.pass-input, input.name-input {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #0c0d0e; color: var(--ink); font-size: 18px;
}
input.name-input { font-size: 16px; margin-top: 4px; }
.namebox { display: flex; flex-direction: column; gap: 2px; margin: 6px 0; text-align: left; }
.names { margin-top: 6px; text-align: left; }
.namelist { margin: 4px 0 0; padding-left: 18px; color: var(--muted); }
.namelist li.self { color: var(--warm); }

/* ---- ボタン盤（エレベーター）・シャッター（警備室）：ゲームは止めない ---- */
.roompanel {
  position: fixed; left: 50%; top: calc(var(--sa-t, 0px) + 10px); transform: translateX(-50%); z-index: 30;
  width: min(360px, calc(100vw - 32px)); box-sizing: border-box; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(10, 11, 12, 0.9); color: var(--ink); text-align: center;
  display: flex; flex-direction: column; gap: 8px;
}
.roompanel .lock-title { margin: 0; font-weight: 700; color: var(--warm); }
.roompanel .note-close { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
.panel-floor { display: inline-block; min-width: 3em; color: var(--ink); }
.elev-keys { display: grid; grid-template-columns: repeat(2, 64px); gap: 6px; justify-content: center; }
.elev-key { padding: 8px 0; font-size: 18px; border-radius: 999px; }
.btn.shutter { flex: 1; font-size: 14px; }
.btn.shutter.on { border-color: #d8453b; color: #ffb4ab; }
.roompanel progress { width: 100%; }
@media (max-height: 420px) {
  .roompanel { padding: 8px 10px; gap: 5px; }
  .elev-keys { grid-template-columns: repeat(5, 46px); }
  .elev-key { padding: 4px 0; font-size: 16px; }
}
#btn-sound { min-width: 112px; min-height: 52px; }
#btn-sound[hidden] { display: none; }

/* ---- ステージを選ぶ ---- */
.stage-pick { display: flex; flex-direction: column; gap: 6px; }
.btn.stage { display: grid; grid-template-columns: 1.6em 1fr; grid-template-rows: auto auto; text-align: left; gap: 0 8px; align-items: center; }
.btn.stage .stage-n { grid-row: span 2; font-weight: 700; color: var(--warm); text-align: center; }
.btn.stage .stage-t { font-weight: 700; }
.btn.stage.on { border-color: var(--warm); }
body.has-panel #hint { top: calc(var(--panel-b, 120px) + 8px); bottom: auto; }
.passphrase .pw { white-space: nowrap; display: inline-block; }

/* ---- 扉の番号の盤・切り貼りの同意 ---- */
.code-keys { display: grid; grid-template-columns: repeat(3, 64px); gap: 6px; justify-content: center; }
.code-keys .elev-key.small { font-size: 14px; }
.panel-code { display: inline-block; min-width: 4.5em; letter-spacing: 0.2em; color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-height: 420px) {
  .code-keys { grid-template-columns: repeat(6, 46px); }
}

/* ---- 歩き出す前の、今回のステージ・捕まった画面の一文・番号が足りないとき ---- */
.stage-list { margin: 0; padding: 0 0 0 1.1em; text-align: left; display: flex; flex-direction: column; gap: 4px; line-height: 1.5; }
.stage-list b { color: var(--warm); font-weight: 700; }
.death-tip { color: var(--ink); }
.panel-code.short { animation: code-short 0.5s; }
@keyframes code-short { 0%, 60% { color: var(--red); } }
@media (orientation: landscape) and (max-height: 500px) {
  .stage-list { gap: 2px; line-height: 1.35; }
  body.has-panel #hint { max-width: min(52vw, 420px); font-size: 13px; }
}
/* 一時停止中は、盤・お知らせ・錠を一時停止の画面の下に隠す */
body.paused .roompanel, body.paused .note-card { display: none; }

/* 画面の文字は選べないようにする（ボタンを長押ししたとき、文字の選択やコピーのメニューが出ないように）。入力欄だけは選べる */
html, body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.passphrase, .url { -webkit-user-select: none; user-select: none; }

/* デッキの上：左のテープの、いま鳴っている所の部屋の名前 */
.deck-chapter { font-size: 11px; color: #c9c3b8; min-height: 1.3em; margin: -2px 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.02em; }
@media (orientation: landscape) and (max-height: 500px) { .deck-chapter { font-size: 10px; margin-bottom: 2px; } }
/* 唱える扉の言葉の札・インターホンの答えの札（文字の札は、丸いボタンより横に長く） */
.code-keys .elev-key.wide { border-radius: 8px; font-size: 16px; padding: 8px 10px; grid-column: span 3; }

/* みんなの系譜（一覧の1行） */
.btn.lineage { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; width: 100%; }
.btn.lineage .stage-t { font-weight: 700; }
.tree .hit:focus { outline: none; }

/* ホーム画面に追加の案内 */
.install-steps li { margin: 6px 0; }
.share-ic { display: inline-block; border: 1px solid var(--muted); border-radius: 4px; padding: 0 5px; font-size: 0.9em; }

/* 準備の画面の行き先（名前の途中で折り返さない） */
.stage-route span { white-space: nowrap; }

/* 早送りでしか聞こえない部屋：テープを鳴らしているあいだ、▶▶ がゆっくり光る */
.dbtn.glow { animation: dbtn-glow 1.4s ease-in-out infinite; }
@keyframes dbtn-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 164, 90, 0); border-color: rgba(255, 255, 255, 0.12); }
  50% { box-shadow: 0 0 14px 2px rgba(224, 164, 90, 0.55); border-color: rgba(224, 164, 90, 0.9); }
}
@media (prefers-reduced-motion: reduce) { .dbtn.glow { animation: none; border-color: rgba(224, 164, 90, 0.9); } }
