/* ============================================================================
   効果音部 — 押すと全員の端末で同時に鳴る
   ----------------------------------------------------------------------------
   俺ぼち予想部と同じ意匠に揃える（2026-08-23 全面改装）。
   色・書体・角の落とし方は Laravel 側の public/css/app.css と同じ値を使う。

   ただし**筐体（480px の1本道）は作らない**。PC ではキーボードの配列をそのまま
   描くため、幅を絞ると1キーが小さくなりすぎる。1画面に収める作りを優先する。

   方針：
     - 面は #04050a。奥からシアン寄りの光を差す
     - 角は斜めに落とす（clip-path）。枠線は inset の box-shadow で描く
     - 光るのは「いま鳴っているもの」だけ
     - 自分が押した＝金、他の人が押した＝緑。誰の音か一目で分かる
     - スマホは1画面に収める（スクロールさせない＝指を置いた瞬間に鳴らせる）
   ============================================================================ */

/* 🔴 フォントは @import ではなく <link> で読む（index.html の <head>）。
   @import だとこの CSS を読み終えてから取りに行くので1往復ぶん遅れる。 */

:root {
  /* --- 面 --------------------------------------------------------------- */
  --bg: #04050a;
  --fg: #e9ecf5;          /* --bg に対して 16.4:1 */
  --muted: rgba(233, 236, 245, 0.68);
  --dim: rgba(233, 236, 245, 0.46);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --surface: #0d0e1a;
  --surface-2: #14162a;

  /* --- キー ------------------------------------------------------------- */
  --key-bg: rgba(255, 255, 255, 0.035);
  --key-se: rgba(34, 211, 238, 0.12);
  --key-se-line: rgba(34, 211, 238, 0.4);
  --key-se-fg: #a5f3fc;
  --key-bgm: rgba(139, 92, 246, 0.15);     /* BGM＝バイオレット。予想部の左の選択肢と揃える */
  --key-bgm-line: rgba(139, 92, 246, 0.45);
  --key-bgm-fg: #c4b5fd;
  --dead: rgba(255, 255, 255, 0.015);

  /* --- 鳴っている印 ------------------------------------------------------ */
  --hit: #ffd251;         /* 自分が押した */
  --hit-line: #f0b323;
  --hit-remote: #34d399;  /* 他の人が押した */
  --hit-remote-line: #10b981;

  /* --- 行動・機能キー ---------------------------------------------------- */
  --accent: #22d3ee;
  --accent-deep: #0ea5be;
  --danger: #fb7185;
  --fn-bg: rgba(255, 210, 81, 0.1);
  --fn-line: rgba(255, 210, 81, 0.34);
  --fn-fg: #ffdf8a;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.6);

  /* 角の切り方はサイズごとに1つずつ持たせる。
     var() を1本の定義で使い回すと、置換が :root で確定して子で変えられない。 */
  --cut-9: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
  --cut-8: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  --cut-6: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  --cut-5: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);

  --font-body: 'Zen Kaku Gothic New', -apple-system, BlinkMacSystemFont,
    'Hiragino Kaku Gothic ProN', 'Noto Sans JP', Meiryo, sans-serif;
  --font-num: 'Oxanium', ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }

/* 🔴 枠線はすべて inset の box-shadow で描く（斜めに落とした角に border は乗らない）。
   button・input などブラウザが既定の枠を持つ要素は、ここで必ず消しておく。 */
button, input, select, textarea { border: 0; }

/* hidden 属性は必ず効かせる。クラス側の display 指定に負けると閉じられなくなる */
[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  margin: 0;
  padding: 0 clamp(12px, 2vw, 32px) 48px;
  background: var(--bg);
  background-image:
    radial-gradient(1000px 700px at 50% -160px, #0b2b38 0%, rgba(10, 10, 26, 0) 62%),
    radial-gradient(700px 500px at 12% 60%, rgba(34, 211, 238, 0.12) 0%, rgba(0, 0, 0, 0) 70%),
    radial-gradient(700px 500px at 92% 20%, rgba(124, 58, 237, 0.14) 0%, rgba(0, 0, 0, 0) 70%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--fg);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
}

/* 動きを控えたい人には動かさない */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes livepulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.7); }
}

/* ============================================================================
   俺ぼち共通のヘッダー（ここから戻る）
   ============================================================================ */

.site-head {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 clamp(-32px, -2vw, -12px);
  padding: 10px clamp(12px, 2vw, 32px);
  background: linear-gradient(180deg, rgba(6, 7, 16, 0.94) 0%, rgba(6, 7, 16, 0.72) 100%);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

/* すりガラスが効かない環境では透けさせない */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-head { background: #06070f; }
}

.site-brand { display: flex; align-items: center; flex: 1; min-width: 0; text-decoration: none; }
.site-brand:hover { opacity: 0.85; }

/* ロゴだけでは戻れることに気づけないので、左に印を添える */
.site-brand__back {
  flex: none;
  margin-right: 8px;
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  color: var(--dim);
  transition: color .12s ease, transform .12s ease;
}
.site-brand:hover .site-brand__back { color: var(--accent); transform: translateX(-2px); }

/* ロゴは黒い筆文字に黄色の縁。読ませているのは実質「黄色の輪郭」なので、
   光も黄色で回して輪郭を立てる。 */
.site-brand__logo {
  display: block;
  height: 30px;
  width: auto;
  max-width: 46vw;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(255, 196, 0, 0.45));
}

.site-nav { display: flex; align-items: center; gap: 16px; flex: none; }
.site-nav a {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(233, 236, 245, 0.8);
  text-decoration: none;
  transition: color .12s ease;
}
.site-nav a:hover { color: #fff; }
.site-nav__me {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  border-radius: 50%;
  line-height: 1;
}
.site-nav__me:hover { box-shadow: inset 0 0 0 1px var(--accent); }

/* ============================================================================
   見出し
   ============================================================================ */

.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 0 0; }
.head-left { min-width: 0; }

.sec-label { display: flex; align-items: center; gap: 10px; margin: 0; }
.sec-label__text {
  font-family: var(--font-num);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.24em;
  color: rgba(165, 243, 252, 0.65);
}
.sec-label__line {
  flex: 1;
  min-width: 60px;
  height: 1px;
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.35), rgba(255, 255, 255, 0));
}

h1 {
  margin: 8px 0 0;
  font-size: clamp(26px, 4vw, 32px);
  font-weight: 900;
  letter-spacing: .01em;
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 0 22px rgba(34, 211, 238, 0.7), 0 0 54px rgba(14, 165, 190, 0.45);
}

/* ロゴ画像を入れるときは h1 の中に <img class="logo" ...> を置く */
h1 .logo {
  display: block;
  height: clamp(26px, 4vw, 32px);
  width: auto;
  max-width: 72vw;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(34, 211, 238, 0.5));
}

.tagline { margin: 7px 0 0; font-size: 13px; font-weight: 700; color: var(--key-se-fg); }

.status { margin: 12px 0 0; display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); display: inline-block; transition: background .2s, box-shadow .2s; }
.dot.on { background: var(--hit-remote); box-shadow: 0 0 10px var(--hit-remote); animation: livepulse 1.4s ease-in-out infinite; }
.dot.off { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.peers { font-family: var(--font-num); font-weight: 700; color: var(--accent); }

.head-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 18px; }

/* 音量。BGM を鳴らせる人にだけ出す（下の出し入れの節を見ること） */
.mixer { display: none; flex-direction: column; gap: 6px; }
.vol { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.vol-name { width: 34px; text-align: right; font-weight: 700; color: var(--fg); }
.vol input[type="range"] { width: 128px; accent-color: var(--accent); }
.vol-val { width: 34px; text-align: right; font-family: var(--font-num); font-weight: 700; font-variant-numeric: tabular-nums; }

.tools { display: flex; flex-direction: column; gap: 6px; }
.tools button {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  background: var(--key-bg);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  clip-path: var(--cut-6);
  color: var(--fg);
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.tools button:hover:not(:disabled) { background: rgba(34, 211, 238, 0.12); color: var(--accent); }
.tools button:disabled { opacity: .4; cursor: default; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 14px;
  background: var(--key-bg);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  clip-path: var(--cut-6);
  transition: box-shadow .12s ease, color .12s ease;
}
.switch input { accent-color: var(--accent); }

.hint { margin: 12px 0 18px; font-size: 11.5px; line-height: 1.7; font-weight: 500; color: rgba(233, 236, 245, 0.5); }
.hint.edit { color: var(--accent); font-weight: 700; }

/* ------------------------------------------------------------------ 役割 */
/* できることが役割で変わる。ここは見た目の整理で、通す／通さないの判定はサーバー側。
   data-role が付く前（読み込み直後）は、権限の低い側に寄せて隠しておく。 */
.role-badge {
  padding: 3px 9px 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg);
  background: var(--key-bg);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  clip-path: var(--cut-5);
}

.tools, .switch.edit, .switch.gate, .pg.add, .pg.del, .watch { display: none; }

/* 🔴 BGM に関わるものは「鳴らせる人（DJ 以上）」にだけ出す。
   役割が付く前（読み込み直後）は出さない側に寄せてある。判定の正はサーバー側。 */
body[data-role="dj"] .mixer,
body[data-role="admin"] .mixer { display: flex; }
body[data-role="dj"] .bar .bar-stop,
body[data-role="admin"] .bar .bar-stop { display: block; }
body[data-role="admin"] .tools { display: flex; }
body[data-role="admin"] .switch.edit,
body[data-role="admin"] .switch.gate { display: inline-flex; }
body[data-role="admin"] .pg.add,
body[data-role="admin"] .pg.del { display: inline-block; }
body[data-role="admin"] .watch { display: block; }

.watch { margin: -10px 0 14px; font-family: var(--font-num); font-size: 11.5px; font-weight: 700; color: var(--muted); min-height: 1em; }

/* 受付を止めているあいだは、切り替えスイッチ自体を目立たせる */
.switch.gate:has(input:not(:checked)) {
  color: var(--danger);
  box-shadow: inset 0 0 0 1px var(--danger), 0 0 18px -6px rgba(251, 113, 133, 0.8);
}

/* ============================================================================
   キー
   ============================================================================ */

/* 自分には押せないキー */
.key.locked { opacity: .3; cursor: not-allowed; box-shadow: none; }
body:not(.editing) .key.locked:hover { box-shadow: inset 0 0 0 1px var(--line); }

.keyboard { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; }

.key {
  flex: 1 1 0;
  min-width: 0;
  min-height: 84px;
  padding: 8px 6px;
  background: var(--key-bg);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  clip-path: var(--cut-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: center;
  transition: transform .05s ease, background-color .12s ease, box-shadow .12s ease;
}
/* 🔴 clip-path は outline も切る。角を落としたキーは内側の影で輪郭を描く。
   そのままだと、キーボードで辿っているときにどこにいるか分からなくなる。 */
.key:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 4px var(--accent-deep); }
.key .cap { font-family: var(--font-num); font-size: 13px; font-weight: 800; line-height: 1.1; color: var(--dim); }
.key .label {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
.key .mark { font-family: var(--font-num); font-size: 10px; color: var(--dim); }

/* 音が入っているキーだけ色を持たせる。SE＝シアン */
.key.se.assigned {
  background: var(--key-se);
  box-shadow: inset 0 0 0 1px var(--key-se-line), 0 0 20px -8px rgba(34, 211, 238, 0.7);
}
.key.se.assigned .label { color: var(--key-se-fg); font-weight: 700; }
.key.bgm.assigned {
  background: var(--key-bgm);
  box-shadow: inset 0 0 0 1px var(--key-bgm-line), 0 0 20px -8px rgba(139, 92, 246, 0.7);
}
.key.bgm.assigned .label { color: var(--key-bgm-fg); font-weight: 700; }
.key.labeled:not(.assigned) .label { color: var(--dim); }
.key.dead { background: var(--dead); color: var(--dim); cursor: default; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04); }
.key.dead .cap { font-weight: 500; opacity: .45; }

/* space・矢印など、音ではなく機能を持つキー */
.key.fn { background: var(--fn-bg); box-shadow: inset 0 0 0 1px var(--fn-line); }
.key.fn .label { color: var(--fn-fg); font-weight: 700; }
body.editing .key.fn { cursor: pointer; }

/* 鳴った瞬間。自分が押したら金、他の人が押したら緑。押した感じを出すため少し沈める */
.key.hit {
  background: var(--hit) !important;
  box-shadow: inset 0 0 0 1px var(--hit-line), 0 0 26px -2px rgba(255, 210, 81, 0.9) !important;
  transform: translateY(2px) scale(.985);
}
.key.hit .cap, .key.hit .label, .key.hit .mark { color: #2b1d02 !important; }
.key.hit-remote {
  background: var(--hit-remote) !important;
  box-shadow: inset 0 0 0 1px var(--hit-remote-line), 0 0 26px -2px rgba(52, 211, 153, 0.85) !important;
}
.key.hit-remote .cap, .key.hit-remote .label, .key.hit-remote .mark { color: #052e21 !important; }

/* 鳴り続けているもの（BGM）は、枠の内側を光らせたままにする。
   BGM のキーは画面に出さないが、他の端末から鳴らされた分はここで印が付く。 */
.key.playing { box-shadow: inset 0 0 0 2px var(--accent), 0 0 22px -6px rgba(34, 211, 238, 0.8); }
.key.drop { box-shadow: inset 0 0 0 2px var(--accent) !important; background: rgba(34, 211, 238, 0.14) !important; }

body.editing .key:not(.dead) { cursor: cell; }
body.editing .key:not(.dead):hover { box-shadow: inset 0 0 0 1px var(--accent); }

/* ------------------------------------------------------------ 設定パネル */
/* 音を差し替えるところ。後ろを暗く落として、手前だけを見せる。 */
.panel { position: fixed; inset: 0; background: rgba(4, 5, 10, .72); align-items: center; justify-content: center; padding: 20px; z-index: 40; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.panel:not([hidden]) { display: flex; }
.panel-inner {
  background: linear-gradient(150deg, #0d1a24 0%, #0a0f1a 60%);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.3), 0 24px 60px rgba(0, 0, 0, .8);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  padding: 20px;
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-cap { font-family: var(--font-num); font-size: 20px; font-weight: 800; color: var(--accent); }
.close { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); }
.close:hover { color: var(--fg); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.field input[type="text"], .field input[type="number"], .field select {
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  clip-path: var(--cut-6);
}
.field input:focus, .field select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }

.fade-row { display: flex; gap: 12px; }
.fade-row label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.fade-row input { width: 84px; }

.sound-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sound-name { font-size: 13px; color: var(--fg); flex: 1 1 100%; word-break: break-all; }
.sound-row button, .panel-inner button:not(.close) {
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 12px;
  background: var(--key-bg);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  clip-path: var(--cut-6);
  color: var(--fg);
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.sound-row button:hover { background: rgba(34, 211, 238, 0.12); color: var(--accent); }
.sound-row button.danger { color: var(--danger); }
.sound-row button.danger:hover { background: rgba(251, 113, 133, 0.14); }
.sound-row button:disabled { opacity: .4; cursor: default; }

.panel-msg { margin: 0; font-size: 12px; min-height: 1em; color: var(--accent); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 10px 30px rgba(0, 0, 0, .8);
  clip-path: var(--cut-9);
  color: var(--fg);
  font-size: 13px;
  font-weight: 700;
  padding: 11px 18px;
  z-index: 50;
}

/* ------------------------------------------------------------- ページャ */
.pager { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; }
.pg {
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  width: 40px;
  height: 40px;
  background: var(--key-bg);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  clip-path: var(--cut-8);
  color: var(--muted);
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.pg:hover:not(:disabled) { background: rgba(34, 211, 238, 0.12); color: var(--accent); }
.pg:disabled { opacity: .3; cursor: default; }
.pg.add, .pg.del { font-size: 14px; }
.pg.add { margin-left: 6px; }
.pg.del:hover:not(:disabled) { background: rgba(251, 113, 133, 0.14); color: var(--danger); }

.dots { display: inline-flex; gap: 6px; align-items: center; }
.dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  cursor: pointer;
  transition: background .12s ease, box-shadow .12s ease;
}
.dots button.on { background: var(--accent); box-shadow: 0 0 12px rgba(34, 211, 238, .9); }

.page-name { font-family: var(--font-num); font-size: 13px; font-weight: 800; letter-spacing: .1em; color: rgba(233, 236, 245, .75); margin-left: 6px; }

/* ------------------------------------------------------- スマホ用の操作バー */
/* 画面が広いときは出さない（← → がキーボード上にあるため） */
.bar { display: none; }
.bar button {
  font: inherit;
  font-weight: 700;
  background: var(--key-bg);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  clip-path: var(--cut-8);
  color: var(--fg);
  cursor: pointer;
}
/* BGM を止めるボタン。鳴らせる人にだけ出す */
.bar .bar-stop {
  display: none;
  flex: 1 1 auto;
  font-size: 15px;
  padding: 13px 10px;
  background: var(--fn-bg);
  box-shadow: inset 0 0 0 1px var(--fn-line);
  color: var(--fn-fg);
}
.bar-stop.hit { background: var(--hit) !important; box-shadow: inset 0 0 0 1px var(--hit-line) !important; color: #2b1d02 !important; }
.bar-stop.hit-remote { background: var(--hit-remote) !important; box-shadow: inset 0 0 0 1px var(--hit-remote-line) !important; color: #052e21 !important; }

.bar .bar-page { flex: 0 0 auto; width: 48px; font-family: var(--font-num); font-size: 20px; line-height: 1; padding: 0; }
.bar button:disabled { opacity: .3; cursor: default; }
.bar .bar-name {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----------------------------------------------------------- スマホ・タブレット */
/* 鳴らすボタンだけを画面いっぱいに並べる。音量・均一化・キー設定は出さない（PC で操作する） */
@media (max-width: 900px) {
  html { height: 100%; }
  body {
    height: 100vh;                       /* dvh 未対応の古い端末向け */
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0 max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
    touch-action: manipulation;          /* ダブルタップの拡大を止める */
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
  }

  /* 鳴らすボタン以外は出さない。1画面に収めてスクロールさせないため。
     🔴 ただし .site-head（トップへ戻る）は必ず残す。ここを隠すと戻れなくなる。 */
  .head-right, .hint, .pager, .watch, .sec-label, .tagline,
  body[data-role="admin"] .watch { display: none; }

  /* ヘッダーは1画面レイアウトの一部として上に置く。sticky は解く。 */
  .site-head {
    position: static;
    flex: 0 0 auto;
    gap: 10px;
    margin: 0;
    padding: max(4px, env(safe-area-inset-top)) 2px 4px;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .site-brand__logo { height: 22px; }
  .site-nav { gap: 12px; }
  .site-nav a { font-size: 12px; }
  .site-nav__me { width: 26px; height: 26px; font-size: 12px; }

  .head { flex: 0 0 auto; min-width: 0; align-items: baseline; flex-wrap: nowrap; gap: 8px; padding: 0; }
  .head-left { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
  h1 { font-size: 15px; text-shadow: 0 0 14px rgba(34, 211, 238, 0.6); }
  h1 .logo { height: 15px; }
  .status { margin: 0; font-size: 11px; gap: 5px; }

  /* 高さは画面に合わせて分け合う。スクロールさせない＝指を置いた瞬間に鳴らせる */
  .keyboard { flex: 1 1 auto; min-width: 0; min-height: 0; gap: 6px; }
  .grid { display: grid; gap: 6px; grid-auto-rows: minmax(0, 1fr); min-width: 0; min-height: 0; }
  .grid-bgm { grid-template-columns: repeat(5, minmax(0, 1fr)); flex: 2 1 0; }
  .grid-se { grid-template-columns: repeat(5, minmax(0, 1fr)); flex: 6 1 0; }
  /* BGM の段が無いとき（DJ 未満）は SE が全部を使う */
  .keyboard > .grid-se:only-child { flex: 1 1 auto; }

  .key { min-height: 0; padding: 3px 2px; gap: 1px; clip-path: var(--cut-6); justify-content: center; }
  .key .cap { font-size: 10px; color: var(--dim); }
  .key .label { font-size: 11px; line-height: 1.2; -webkit-line-clamp: 3; color: var(--fg); font-weight: 700; }
  .key .mark { display: none; }

  .bar { display: flex; flex: 0 0 auto; align-items: stretch; gap: 6px; padding: 6px 0 max(6px, env(safe-area-inset-bottom)); }

  .toast { bottom: calc(74px + env(safe-area-inset-bottom)); }
}

/* 横向きは横に広いので 10 列。1行あたりの高さを稼ぐ */
@media (max-width: 900px) and (orientation: landscape) {
  .grid-bgm { grid-template-columns: repeat(10, minmax(0, 1fr)); flex: 1 1 0; }
  .grid-se { grid-template-columns: repeat(10, minmax(0, 1fr)); flex: 3 1 0; }
  h1 { font-size: 14px; }
  h1 .logo { height: 14px; }
  .site-brand__logo { height: 19px; }
  .key .label { font-size: 10px; -webkit-line-clamp: 2; }
}
