:root {
  --bg: #111418;
  --panel: rgba(24, 28, 34, 0.92);
  --text: #eef1f4;
  --muted: #9aa4af;
  --accent: #d4a24c;
  --danger: #d9534f;
  --talk: #3a7bd5;
  --student: #2e9e5b;
  --demo: #b5651d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; }
button { font: inherit; color: var(--text); background: #2a3038; border: 0; border-radius: 10px;
  padding: 12px 14px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:active { filter: brightness(1.3); }
button.primary { background: var(--accent); color: #1a1a1a; font-weight: 700; width: 100%; padding: 16px; }
button.danger { background: var(--danger); }
.hint { color: var(--muted); font-size: 0.85rem; }
.error { color: #ff8a80; }

.screen { position: fixed; inset: 0; }
#lobby { max-width: 480px; margin: 0 auto; padding: 32px 16px; position: static; }
#lobby h1 { font-size: 1.5rem; }
#lobby label { display: block; margin: 16px 0 6px; }
#lobby input { width: 100%; font-size: 1.1rem; padding: 12px; border-radius: 10px; border: 1px solid #444; background: #1b2026; color: var(--text); }

#remoteVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
#localVideo { position: absolute; right: 12px; top: calc(env(safe-area-inset-top) + 52px); width: 26vw; max-width: 200px;
  border-radius: 10px; border: 2px solid rgba(255,255,255,0.3); background: #222; z-index: 2; }
.mirror { transform: scaleX(-1); }

#topBar { position: absolute; top: calc(env(safe-area-inset-top) + 10px); left: 12px; right: 12px; display: flex; gap: 8px; z-index: 3; }
.pill { background: var(--panel); padding: 6px 12px; border-radius: 999px; font-size: 0.9rem; }
.mode-talk { background: var(--talk); }
.mode-student { background: var(--student); }
.mode-demo { background: var(--demo); }

#shareBox { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); background: var(--panel);
  padding: 16px; border-radius: 12px; width: min(92vw, 420px); z-index: 4; }
#shareBox code { display: block; word-break: break-all; background: #000; padding: 8px; border-radius: 6px; margin-bottom: 10px; }
.row { display: flex; gap: 8px; }
.row button { flex: 1; }

#tapToPlay { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5;
  background: var(--accent); color: #111; font-weight: 700; padding: 20px 28px; }

#bottomBar { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 12px calc(env(safe-area-inset-bottom) + 10px);
  display: flex; flex-direction: column; gap: 8px; z-index: 3;
  background: linear-gradient(transparent, rgba(0,0,0,0.6)); }
#modeBar, #ctrlBar { display: flex; gap: 6px; }
#modeBar button, #ctrlBar button { flex: 1; padding: 12px 4px; font-size: 0.95rem; }
.mode-btn.active[data-mode="talk"] { background: var(--talk); }
.mode-btn.active[data-mode="student"] { background: var(--student); }
.mode-btn.active[data-mode="demo"] { background: var(--demo); }
/* 生徒側: 講師の切り替えを表示するだけ(押せない) */
#modeBar.readonly button { pointer-events: none; }
#modeBar.readonly button:not(.active) { opacity: 0.45; }
.ctrl.off { background: #5a2a2a; text-decoration: line-through; }

#settings { position: absolute; inset: auto 0 0 0; max-height: 80vh; overflow-y: auto; background: var(--panel);
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px); z-index: 6; border-radius: 16px 16px 0 0; }
#settings h2 { margin-top: 0; }
#settings label { display: block; margin: 10px 0; }
#settings input[type=range] { width: 100%; }
#settings .check { display: flex; gap: 8px; align-items: center; }
#settings pre { background: #000; padding: 10px; border-radius: 8px; font-size: 0.8rem; white-space: pre-wrap; }
