:root {
  --bg: #ffffff;
  --text: #14171a;
  --sub: #6b7380;
  --faint: #a3a9b3;
  --line: #eceef1;
  --accent: #3346c9;
  --scale: 1;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

button { font: inherit; }

/* ---------- 操作バー（2つだけ） ---------- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.langs, .sizes { display: flex; gap: 4px; }
.bar button {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f7f9;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.langs button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; font-weight: 700; }
.langs select {
  height: 36px;
  max-width: 46vw;
  padding: 0 8px;
  border: 1px solid var(--text);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
}
.sizes button { width: 42px; padding: 0; font-weight: 700; }

/* ---------- 字幕 ---------- */
.captions {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  font-size: calc(20px * var(--scale));
  line-height: 1.55;
}
.cap { padding: 10px 0; border-bottom: 1px solid var(--line); }
.cap .src { color: var(--sub); font-size: .82em; }
.cap .src + .tgt { margin-top: 4px; }
.cap .wait { color: var(--faint); }
.live { padding: 10px 0; color: var(--faint); }
.idle { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 48px 0 24px; }
.idle[hidden], .message[hidden] { display: none; }
.idle-logo { width: min(240px, 68vw); height: auto; }
.idle-chara { display: none; }
.screen-mark { display: none; }
.message { margin: 0; color: var(--sub); font-size: 16px; text-align: center; line-height: 1.7; }
.message span { font-size: 14px; }

.conn {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: #fff6e0;
  color: #7a5200;
  font-size: 13px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  white-space: nowrap;
}

.tolatest {
  position: fixed;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  padding: 10px 16px;
  border: none;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
}

/* ---------- 会場スクリーン（?mode=screen） ---------- */
body.screen {
  --bg: #000;
  --text: #fff;
  --sub: #b8bec7;
  --faint: #7d848e;
  cursor: none;
}
body.screen .bar, body.screen .tolatest { display: none; }
body.screen .captions {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding: 3vh 5vw 6vh;
  font-size: calc(5.2vh * var(--scale));
  font-weight: 600;
  line-height: 1.4;
}
body.screen .cap { border: none; padding: 1.2vh 0; }
body.screen .cap .src { font-weight: 400; }
body.screen .message { font-size: 3vh; }
body.screen .idle { justify-content: center; flex: 1; gap: 3vh; padding: 0; }
body.screen .idle-logo { display: none; }
body.screen .idle-chara { display: block; height: 24vh; width: auto; }
body.screen .screen-mark { display: block; position: fixed; top: 3vh; right: 3vw; height: 9vh; width: auto; }
body.screen.idle-on .screen-mark { display: none; }
body.screen .conn { background: rgba(255,255,255,.12); color: #ddd; box-shadow: none; }
