/* ミミドラ！— 見た目はすべてクラスで持つ（インラインスタイルは使わない） */
:root {
  --bg: #0d0817;
  --ink: #f4ecd8;
  --accent: #f5c542;
  --red: #d43c3c;
  --line: #5d4a7a;
  --dark: #1a1024;
  --h: 100vh;
  --foot: 2.2rem;
}
@supports (height: 100dvh) {
  :root { --h: 100dvh; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'DotGothic16', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  touch-action: none;
}

body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.app {
  --w: min(100vw, calc((var(--h) - var(--foot)) * 0.6667));
  position: relative;
  width: var(--w);
  height: calc(var(--w) * 1.5);
  font-size: calc(var(--w) * 0.046);
  line-height: 1.4;
  overflow: hidden;
  background: #000;
  touch-action: none;
  box-shadow: 0 0 0 2px var(--line);
}

.stage {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: -moz-crisp-edges;
  image-rendering: pixelated;
  touch-action: none;
}

.foot {
  margin: 0;
  height: var(--foot);
  line-height: var(--foot);
  font-size: 0.8rem;
  color: #9b8fb8;
  text-align: center;
}

.is-hidden { display: none !important; }

/* ---- 吹き出し ---- */
.bubble {
  position: absolute;
  max-width: 76%;
  padding: 0.4em 0.65em;
  background: #f4ecd8;
  color: var(--dark);
  border: 0.14em solid var(--dark);
  border-radius: 0.35em;
  box-shadow: 0.16em 0.16em 0 var(--dark);
  font-size: 0.95em;
  pointer-events: none;
}
.bubble::after {
  content: '';
  position: absolute;
  bottom: -0.62em;
  width: 0;
  height: 0;
  border-left: 0.45em solid transparent;
  border-right: 0.45em solid transparent;
  border-top: 0.6em solid #f4ecd8;
}
.bubble--mal { left: 3%; top: 35%; }
.bubble--mal::after { left: 1.2em; }
/* マルの小声のヒント */
.bubble--whisper { font-size: 0.8em; opacity: 0.8; }
/* 操作説明（最初の 1 回だけ）。マルの吹き出しとは別の要素 */
.bubble--coach { left: 50%; top: 27%; transform: translateX(-50%); width: 84%; max-width: 84%; text-align: center; font-size: 0.85em; }
.bubble--coach::after { display: none; }
.bubble--guest { right: 3%; top: 35%; }
.bubble--guest::after { right: 1.2em; }

/* ---- メッセージ帯 ---- */
.msg {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 9%;
  padding: 0.35em 0.5em;
  text-align: center;
  font-size: 1.05em;
  background: rgba(13, 8, 23, 0.8);
  border: 0.1em solid var(--line);
  pointer-events: none;
}
.msg--ok { color: #8fe08f; border-color: #4caf50; }
.msg--ng { color: #ff9a9a; border-color: var(--red); }

/* ---- HUD（ラウンド表示と操作案内） ---- */
.hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1.2%;
  display: flex;
  justify-content: space-between;
  padding: 0 4%;
  font-size: 0.78em;
  color: #cbbfe6;
  pointer-events: none;
}

.hud__stage { text-align: right; }

/* ---- 会場の熱のラベル（メーター本体は canvas。位置はメーターの右） ---- */
.heat__label {
  position: absolute;
  left: 75.6%;
  top: 10.4%;
  font-size: 0.62em;
  color: #ffb35c;
  pointer-events: none;
}

/* ---- ロケバス・とぼとぼ帰るシーンの「タップでスキップ」 ---- */
.skiphint {
  position: absolute;
  right: 3%;
  bottom: 1.6%;
  margin: 0;
  font-size: 0.7em;
  color: #cbbfe6;
  opacity: 0.75;
  pointer-events: none;
}

/* ---- 撤収の文字 ---- */
.strike {
  position: absolute;
  left: 0;
  right: 0;
  top: 40%;
  margin: 0;
  text-align: center;
  font-size: 1.9em;
  letter-spacing: 0.12em;
  color: var(--ink);
  text-shadow: 0.08em 0.08em 0 var(--red);
  pointer-events: none;
  animation: cardIn 0.6s steps(6) both;
}

/* ---- 曲名カード ---- */
.titlecard {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  animation: cardIn 0.6s steps(6) both;
}
.titlecard__label { margin: 0 0 0.6em; font-size: 1.1em; color: var(--accent); letter-spacing: 0.2em; }
.titlecard__name { margin: 0; font-size: 2.1em; letter-spacing: 0.15em; text-shadow: 0.08em 0.08em 0 var(--red); }
@keyframes cardIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

/* ---- パネル（はじめる／けっか） ---- */
.panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6%;
  text-align: center;
  background: rgba(13, 8, 23, 0.9);
}
.panel__title {
  margin: 0 0 0.8em;
  font-size: 1.9em;
  line-height: 1.25;
  color: var(--accent);
  text-shadow: 0.08em 0.08em 0 var(--red);
}
.panel__title--sub { font-size: 1.5em; }
.panel__sub { margin: -0.4em 0 1.2em; font-size: 1em; color: var(--ink); letter-spacing: 0.08em; }
.panel__name { margin: 0 0 0.3em; font-size: 0.9em; color: var(--accent); letter-spacing: 0.15em; }
.panel__desc { margin: 0 0 1.4em; padding: 0; list-style: none; line-height: 1.8; font-size: 0.95em; }
.panel__error { margin: 0 0 1em; color: #ff9a9a; }
.panel__score { margin: 0.2em 0; font-size: 1.7em; color: var(--ink); }
.panel__crowd { margin: 0.2em 0 0.8em; font-size: 1.1em; color: #cbbfe6; }
.panel__comment { margin: 0 0 1.4em; font-size: 1em; line-height: 1.6; }
.panel__heat { margin: 0 0 0.6em; font-size: 1.1em; color: #ffb35c; }
.panel__mal { margin: -0.6em 0 1.4em; font-size: 0.95em; color: var(--accent); }
.panel__note { margin: 0 0 1.2em; font-size: 0.85em; line-height: 1.6; color: #cbbfe6; }
.panel__stage { margin: 0 0 0.2em; font-size: 0.9em; color: var(--accent); letter-spacing: 0.1em; }
.panel__btns--col { flex-direction: column; align-items: stretch; gap: 1em; min-width: 62%; }
.panel > .btn + .btn { margin-top: 0.9em; }

.btn {
  font-family: inherit;
  font-size: 1.15em;
  padding: 0.6em 1.2em;
  background: var(--accent);
  color: var(--dark);
  border: 0.13em solid var(--dark);
  box-shadow: 0.18em 0.18em 0 var(--red);
  cursor: pointer;
  touch-action: manipulation;
}
.btn--sub { background: var(--ink); box-shadow: 0.18em 0.18em 0 var(--line); }
.panel__btns { display: flex; flex-wrap: wrap; gap: 0.9em; justify-content: center; }

/* 画面下の「↑ 異常なし」ボタン。listen 中だけ押せる（それ以外は薄く） */
.btn--none {
  position: absolute;
  left: 50%;
  bottom: 1.6%;
  transform: translateX(-50%);
  font-size: 0.9em;
  padding: 0.35em 1em;
  background: var(--dark);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0.14em 0.14em 0 var(--red);
  white-space: nowrap;
}
.btn.btn--none:active { transform: translate(calc(-50% + 0.1em), 0.1em); }
.btn--none.is-idle { opacity: 0.45; }

/* 右側の音量ボタン（値に応じて 🔇 / 🔈 / 🔉 / 🔊）。パネルの上にも出す。右上のランプ・レール・あと何周（y 21 以下）・熱の文字（y 25–31）の下、スピーカー（y 58）の上に置く */
.btn--vol {
  position: absolute;
  right: 1.5%;
  top: 14.6%;
  z-index: 5;
  font-size: 0.8em;
  line-height: 1.2;
  padding: 0.25em 0.6em;
  background: var(--dark);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0.12em 0.12em 0 var(--red);
  white-space: nowrap;
}
.btn:active { transform: translate(0.1em, 0.1em); box-shadow: 0.08em 0.08em 0 var(--red); }

/* 一時停止ボタン。🔊 の左（同じ高さ）。右上のランプ・あと何周（y 21 以下）・熱の文字（y 25–31）の下。
   見た目の箱は小さいまま、タップの受け口だけ ::after で 44px 以上に広げる。広げた分が 🔊 に届かないよう、🔊 との隙間を広くとってある */
.btn--pause {
  position: absolute;
  right: 14.5%;
  top: 14.6%;
  z-index: 5;
  font-size: 0.8em;
  line-height: 1.2;
  padding: 0.25em 0.6em;
  background: var(--dark);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0.12em 0.12em 0 var(--red);
  white-space: nowrap;
}
.btn--pause::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
  transform: translate(-50%, -50%);
}
/* 一時停止パネル。音量パネル・🔊・⏸ より前に出す */
.panel--pause { z-index: 8; background: rgba(13, 8, 23, 0.86); }

/* 音量パネル（🔊 を押している間だけ開く）。🔊 ボタンの真下。ドット風の角ばった枠 */
.volpanel {
  position: absolute;
  right: 1.5%;
  top: 21.5%;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 0.5em;
  width: 62%;
  padding: 0.5em 0.7em;
  background: var(--dark);
  color: var(--accent);
  border: 0.13em solid var(--accent);
  box-shadow: 0.16em 0.16em 0 var(--red);
  touch-action: none;
}
.volpanel__value { min-width: 2.2em; text-align: right; font-size: 0.85em; }
.volpanel__range {
  flex: 1;
  min-width: 0;
  height: 1.6em;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  touch-action: none;
}
.volpanel__range:focus { outline: none; }
.volpanel__range::-webkit-slider-runnable-track { height: 0.5em; background: var(--line); border: 0.1em solid var(--ink); border-radius: 0; }
.volpanel__range::-webkit-slider-thumb { -webkit-appearance: none; width: 0.9em; height: 1.4em; margin-top: -0.55em; background: var(--accent); border: 0.13em solid var(--dark); border-radius: 0; box-shadow: 0.1em 0.1em 0 var(--red); }
.volpanel__range::-moz-range-track { height: 0.5em; background: var(--line); border: 0.1em solid var(--ink); border-radius: 0; }
.volpanel__range::-moz-range-thumb { width: 0.9em; height: 1.4em; background: var(--accent); border: 0.13em solid var(--dark); border-radius: 0; box-shadow: 0.1em 0.1em 0 var(--red); }
.volpanel__range:focus-visible::-webkit-slider-thumb { background: var(--ink); }
.volpanel__range:focus-visible::-moz-range-thumb { background: var(--ink); }
.blink { animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.55; } }

@media (prefers-reduced-motion: reduce) {
  .blink, .titlecard, .strike { animation: none; }
}
