/* EJIOM Composer PoC v0.1 — quiet UI
   white / near-white, hairline, restrained typography.
   Emojiが宝石のように浮かんで見える静かなUI（仕様26） */

:root {
  --bg: #fafaf8;
  --fg: #1c1c1a;
  --muted: #90908a;
  --faint: #b5b5b0;
  --hairline: #e6e6e1;
  --card: #ffffff;
  --chip: #f3f3ef;
  --chip-press: #e9e9e4;
  --ink: #1c1c1a;
  --danger: #b3423a;
  --radius: 14px;
  --emoji-font: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315;
    --fg: #ececea;
    --muted: #85858b;
    --faint: #5b5b60;
    --hairline: #29292d;
    --card: #1b1b1e;
    --chip: #232327;
    --chip-press: #2d2d32;
    --ink: #ececea;
    --danger: #d97a72;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  /* アプリUIはOSのテキスト選択対象にしない（長押しは専用メニューが担う）。
     選択が必要な入力欄と文書ページだけ下で解除する */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
input, textarea, .privacy-main {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

#app {
  height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#app.vv-locked { height: var(--vvh, 100dvh); }

/* ---------- header ---------- */
header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 16px 8px;
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--hairline);
  flex: none;
}
.brand {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--fg);
  text-decoration: none;
}
.header-sub { color: var(--muted); font-size: 12px; }
.header-spacer { flex: 1; }
.header-link {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  padding: 6px 8px;
  margin: -6px -8px;
}
.header-link:active { color: var(--fg); }

/* ---------- chat ---------- */
#chat {
  flex: 1 1 auto;
  min-height: 40px;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg {
  align-self: flex-end;
  max-width: 86%;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-family: var(--emoji-font);
  font-size: 24px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  animation: msg-in 240ms ease-out;
}
.msg-time {
  align-self: flex-end;
  font-size: 10px;
  color: var(--faint);
  margin: -4px 4px 0 0;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.chat-empty {
  color: var(--faint);
  font-size: 12px;
  text-align: center;
  margin: auto;
}

/* ---------- benchmark sentence card ---------- */
#benchCard {
  flex: none;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--hairline);
}
.bench-progress {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.bench-progress .spacer { flex: 1; }
.bench-sentence {
  font-size: 17px;
  line-height: 1.6;
  margin-top: 4px;
}
.bench-btn {
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  padding: 6px 8px;
  margin: -6px -8px;
  font-family: inherit;
  cursor: pointer;
}
.bench-btn:active { color: var(--fg); }
.bench-btn.on { color: var(--danger); font-weight: 600; }

/* ---------- composer ---------- */
#composerCard {
  flex: none;
  margin: 8px 12px 0;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
}
#composerTokens {
  min-height: 58px;
  max-height: 132px;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  row-gap: 4px;
  cursor: text;
  touch-action: pan-y;
}
.tok {
  font-family: var(--emoji-font);
  font-size: 30px;
  line-height: 40px;
  height: 40px;
  padding: 0 1px;
  border-radius: 8px;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}
.tok.drag-src { opacity: 0.25; }
.tok.tok-added { animation: tok-in 180ms ease-out; }
@keyframes tok-in {
  from { transform: scale(0.55); opacity: 0.3; }
  60% { transform: scale(1.12); }
  to { transform: scale(1); opacity: 1; }
}
.tok-sp { width: 14px; height: 40px; }
.tok-nl { flex-basis: 100%; height: 6px; }
.caret {
  width: 2px;
  height: 34px;
  background: var(--ink);
  border-radius: 1px;
  margin: 0 1px;
  animation: caret-blink 1.1s steps(1) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }
.composer-hint {
  color: var(--faint);
  font-size: 13px;
  align-self: center;
  pointer-events: none;
}
.drag-ghost {
  position: fixed;
  z-index: 50;
  font-family: var(--emoji-font);
  font-size: 34px;
  pointer-events: none;
  transform: translate(-50%, -60%) scale(1.15);
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.18));
}
#composerTokens.sending .tok { animation: tok-send 260ms ease-in forwards; }
@keyframes tok-send {
  to { transform: translateY(-14px); opacity: 0; }
}

#composerBar {
  display: flex;
  align-items: center;
  gap: 4px;
  border-top: 1px solid var(--hairline);
  padding: 6px 8px;
  padding-bottom: max(6px, 0px);
}
.cbtn {
  min-width: 44px;
  height: 40px;
  border: none;
  background: none;
  border-radius: 10px;
  font-size: 17px;
  color: var(--muted);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cbtn:active, .cbtn.pressed { background: var(--chip-press); color: var(--fg); }
.cbtn-space { flex: 1; max-width: 120px; }
.cbtn-space span {
  display: block;
  width: 40px;
  height: 5px;
  border: 1.5px solid currentColor;
  border-top: none;
  border-radius: 0 0 5px 5px;
}
#sendBtn {
  margin-left: auto;
  min-width: 72px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 160ms;
}
#sendBtn:disabled { opacity: 0.25; cursor: default; }
#sendBtn:not(:disabled):active { opacity: 0.75; }
.send-error {
  color: var(--danger);
  font-size: 11px;
  padding: 0 12px 6px;
}

/* ---------- candidates ---------- */
#candidates {
  flex: none;
  max-height: 38dvh;
  overflow-y: auto;
  padding: 6px 12px 4px;
  -webkit-overflow-scrolling: touch;
}
#candidates.tall { flex: 1 1 auto; max-height: none; min-height: 0; }
.cand-tools {
  display: flex;
  gap: 6px;
  padding: 2px 4px 6px;
  align-items: center;
}
.tool-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tool-btn:active, .tool-btn.pressed { background: var(--chip-press); }
.tool-btn.on { color: var(--fg); border-color: var(--muted); }

.crow { padding: 4px 4px 6px; }
.crow-label {
  font-size: 12px;
  color: var(--muted);
  padding: 0 2px 2px;
}
/* 文法補助行（？・〜たい 等）: 本文由来の行より一段控えめに */
.crow-assist { border-top: 1px solid var(--hairline); margin-top: 4px; padding-top: 8px; }
.crow-assist ~ .crow-assist { border-top: none; margin-top: 0; padding-top: 4px; }
.crow-assist .crow-label { color: var(--faint); }
.crow-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.chip {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--chip);
  font-family: var(--emoji-font);
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 140ms ease, background 140ms;
}
.chip:active, .chip.pressed { transform: scale(0.86); background: var(--chip-press); }
.chip-more {
  font-family: inherit;
  font-size: 18px;
  color: var(--muted);
  background: none;
  border: 1px dashed var(--hairline);
}
.crow-empty {
  color: var(--faint);
  font-size: 12px;
  padding: 6px 2px;
}
.miss-btn {
  border: none;
  background: none;
  color: var(--faint);
  font-size: 11px;
  font-family: inherit;
  padding: 8px 6px;
  cursor: pointer;
}
.miss-btn:active { color: var(--muted); }
.miss-btn.done { color: var(--muted); }
.cand-hint {
  color: var(--faint);
  font-size: 12px;
  text-align: center;
  padding: 10px 0 6px;
}

/* search row */
.search-row {
  display: flex;
  gap: 6px;
  padding: 2px 4px 6px;
}
.search-row input {
  flex: 1;
  height: 36px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--card);
  color: var(--fg);
  font-size: 15px;
  font-family: inherit;
  padding: 0 10px;
  outline: none;
}
.search-row input:focus { border-color: var(--muted); }

/* ---------- scratch ---------- */
#scratchBar {
  flex: none;
  border-top: 1px solid var(--hairline);
  padding: 8px 12px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--bg);
}
#scratch {
  flex: 1;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--card);
  color: var(--fg);
  font-size: 16px; /* iOSのfocusズームを防ぐため16px以上 */
  font-family: inherit;
  line-height: 1.45;
  padding: 9px 12px;
  resize: none;
  outline: none;
  max-height: 92px;
  min-height: 40px;
  transition: opacity 300ms ease;
}
#scratch:focus { border-color: var(--muted); }
#scratch.fading { opacity: 0; }
#scratch::placeholder { color: var(--faint); }
.scratch-note {
  position: absolute;
  visibility: hidden;
}

/* ---------- long-press popover（picker sheet(70)より上に出す） ---------- */
#popover {
  position: fixed;
  z-index: 90;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0,0,0,0.14);
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 316px;
}
#popoverBackdrop {
  position: fixed;
  inset: 0;
  z-index: 85;
}

/* ---------- picker sheet ---------- */
#pickerSheet {
  position: fixed;
  z-index: 70;
  left: 0; right: 0; bottom: 0;
  margin: 0 auto;
  max-width: 640px;
  height: 62dvh;
  background: var(--bg);
  border-top: 1px solid var(--hairline);
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 240ms ease;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.12);
}
#pickerSheet.open { transform: none; }
.picker-head {
  display: flex;
  align-items: center;
  padding: 8px 14px 4px;
  gap: 8px;
}
.picker-title { font-size: 13px; color: var(--muted); flex: 1; }
.picker-close {
  border: none; background: none;
  font-size: 15px; color: var(--muted);
  padding: 8px 10px;
  font-family: inherit;
  cursor: pointer;
}
.picker-preview {
  flex: none;
  margin: 0 14px 8px;
  padding: 7px 10px;
  min-height: 42px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  font-family: var(--emoji-font);
  font-size: 22px;
  line-height: 1.3;
  white-space: pre;
  overflow-x: auto;
  display: flex;
  align-items: center;
}
.picker-preview.flash { animation: preview-flash 260ms ease-out; }
@keyframes preview-flash {
  from { background: var(--chip-press); }
}
.picker-preview-empty {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 12px;
  color: var(--faint);
}
.picker-tabs {
  display: flex;
  padding: 0 8px 6px;
  gap: 2px;
  overflow-x: auto;
  flex: none;
}
.ptab {
  min-width: 40px;
  height: 36px;
  border: none;
  background: none;
  border-radius: 10px;
  font-family: var(--emoji-font);
  font-size: 20px;
  cursor: pointer;
  opacity: 0.5;
}
.ptab.on { background: var(--chip); opacity: 1; }
.picker-grid {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 10px calc(10px + env(safe-area-inset-bottom));
  align-content: flex-start;
}
.picker-grid .chip { background: none; }
.picker-grid .chip:active { background: var(--chip-press); }
#pickerBackdrop {
  position: fixed; inset: 0; z-index: 65;
  background: rgba(0,0,0,0.18);
  opacity: 0;
  transition: opacity 240ms;
  pointer-events: none;
}
#pickerBackdrop.open { opacity: 1; pointer-events: auto; }

/* ---------- rating overlay (bench) ---------- */
#ratingOverlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0,0,0,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.rating-card {
  background: var(--bg);
  border-radius: 18px;
  padding: 20px 22px 14px;
  width: 100%;
  max-width: 340px;
  animation: msg-in 200ms ease-out;
}
.rating-q { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.rating-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.rating-row .chip { width: 52px; height: 52px; font-size: 30px; }
.rating-row .chip.sel { background: var(--ink); }
.rating-skip {
  display: block;
  margin: 0 auto;
  border: none;
  background: none;
  color: var(--faint);
  font-size: 12px;
  padding: 8px 12px;
  font-family: inherit;
  cursor: pointer;
}

/* ---------- report ---------- */
#report {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-variant-numeric: tabular-nums;
}
.report-block {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.report-block h2 {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.stat-line {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 14px;
}
.stat-line b { font-weight: 600; }
table.cat-table { width: 100%; border-collapse: collapse; font-size: 12px; }
table.cat-table th, table.cat-table td {
  text-align: right;
  padding: 4px 6px;
  border-top: 1px solid var(--hairline);
  white-space: nowrap;
}
table.cat-table th { color: var(--muted); font-weight: 500; border-top: none; }
table.cat-table td:first-child, table.cat-table th:first-child { text-align: left; }
.report-actions { display: flex; gap: 8px; padding-bottom: 24px; }

/* ---------- home ---------- */
#app.home { justify-content: center; }
.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 18px;
}
.home-brand {
  font-size: 40px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.home-tagline { font-size: 17px; line-height: 1.7; }
.home-tagline-en, .home-desc-en { color: var(--muted); }
.home-how {
  font-family: var(--emoji-font);
  font-size: 17px;
  color: var(--muted);
  padding: 6px 0;
  white-space: nowrap;
}
.home-desc { font-size: 13px; color: var(--fg); line-height: 1.8; max-width: 420px; }
.home-start {
  margin-top: 8px;
  border: none;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 14px 28px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}
.home-start-en { font-size: 11px; font-weight: 400; opacity: 0.7; }
.home-start:active { opacity: 0.8; }
.home-start:disabled { opacity: 0.4; }
a.home-start { text-decoration: none; }
.home-start-second {
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--hairline);
}
.home-start-second .home-start-en { color: var(--muted); opacity: 1; }
.home-waiting {
  font-size: 11px;
  color: #3a9d5d;
  font-weight: 600;
}
.stats-line {
  text-align: center;
  color: #3a9d5d;
  padding: 0 0 4px;
}
.home-alt {
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}
.home-alt:active { background: var(--chip-press); }
.home-alt:disabled { opacity: 0.4; }
a.home-alt { text-decoration: none; }

/* ---------- match ---------- */
#setupView, #waitView {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#setupView[hidden], #waitView[hidden] { display: none; }
.wait-card { align-items: center; text-align: center; }
.wait-emoji {
  font-family: var(--emoji-font);
  font-size: 56px;
  animation: wait-breathe 1.8s ease-in-out infinite;
}
@keyframes wait-breathe {
  50% { transform: scale(1.08); opacity: 0.85; }
}
.wait-note { font-size: 12px; color: var(--muted); line-height: 1.7; }
.home-footer {
  padding: 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 11px;
  color: var(--faint);
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.home-footer a { color: var(--muted); }

/* ---------- privacy ---------- */
.privacy-main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 20px;
  max-width: 560px;
  margin: 0 auto;
}
.privacy-main .home-brand { font-size: 24px; margin-bottom: 20px; }
.privacy-block { margin-bottom: 24px; }
.privacy-block h2 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}
.privacy-block ul { padding-left: 20px; }
.privacy-block li { font-size: 13px; line-height: 1.8; margin-bottom: 8px; }
.privacy-contact { font-size: 12px; color: var(--muted); }

/* ---------- room: join ---------- */
#joinView, #goneView {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#joinView[hidden], #goneView[hidden], #waitingBar[hidden] { display: none; }
.join-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.join-title { font-size: 16px; font-weight: 600; text-align: center; line-height: 1.6; }
.join-title-en { font-size: 12px; font-weight: 400; color: var(--muted); }
.join-label { font-size: 11px; color: var(--muted); margin-top: 6px; }
.join-langs { display: flex; gap: 8px; }
.join-lang {
  flex: 1;
  height: 44px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}
.join-lang.on { border-color: var(--ink); font-weight: 600; }
.join-avatars { display: flex; flex-wrap: wrap; gap: 5px; }
.join-avatars .chip.sel { outline: 2px solid var(--ink); }
.join-go {
  margin-top: 10px;
  height: 46px;
  border: none;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.join-go:disabled { opacity: 0.3; }

/* ---------- room: chat ---------- */
.header-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
#waitingBar {
  flex: none;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--hairline);
  text-align: center;
}
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.msg-row.mine { justify-content: flex-end; }
.msg-row.peer { justify-content: flex-start; }
.msg-row .msg { align-self: initial; max-width: 100%; }
.msg-row.peer .msg { background: var(--chip); }
.msg-avatar {
  font-family: var(--emoji-font);
  font-size: 18px;
  flex: none;
  margin-bottom: 16px;
}
.msg-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 86%;
}
.msg-col.mine { align-items: flex-end; }
.msg-col.peer { align-items: flex-start; }
.msg-col .msg-time { align-self: inherit; margin: 0 4px; }
.msg-deleted { opacity: 0.4; font-size: 15px; }
/* OSのテキスト選択メニューの代わりに長押しメニューを使う */
#chat, #chat * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ---------- action menu ---------- */
#menuBackdrop {
  position: fixed;
  inset: 0;
  z-index: 85;
}
.action-menu {
  position: fixed;
  z-index: 90;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.14);
  padding: 4px;
  display: flex;
  gap: 2px;
}
.action-menu button {
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--fg);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.action-menu button:active { background: var(--chip-press); }
.action-menu button.danger { color: var(--danger); }

/* ---------- world room (0001) ---------- */
#river {
  flex: 1 1 auto;
  min-height: 40px;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.river-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 4px 8px 4px 6px;
  border-radius: 10px;
  border-left: 2px solid transparent;
}
.river-row.own {
  background: var(--chip);
  border-left-color: var(--ink);
}
/* 発言者の旗は「席バッジ」として本文のEmoji列から切り離して見せる */
.river-flag {
  font-family: var(--emoji-font);
  font-size: 15px;
  line-height: 1;
  flex: none;
  padding: 5px 7px;
  margin-top: 3px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 8px;
}
.river-body {
  font-family: var(--emoji-font);
  font-size: 22px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
}
.river-meta {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-top: 6px;
}
.river-you {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 1px 6px;
}
.river-time {
  font-size: 10px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.river-date {
  text-align: center;
  font-size: 11px;
  color: var(--faint);
  padding: 10px 0 4px;
}
#jumpBtn {
  position: fixed;
  right: 16px;
  bottom: 180px;
  z-index: 40;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  border: 1px solid var(--hairline);
  background: var(--card);
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
#spectatorBar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline);
}
#spectatorBar[hidden] { display: none; }
#spectatorInfo { flex: 1; font-size: 12px; color: var(--muted); }
.spectator-sit {
  border: none;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
}
#slowNote {
  flex: none;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0 0;
  font-variant-numeric: tabular-nums;
}
#slowNote[hidden] { display: none; }
.sit-info { font-size: 12px; color: var(--muted); padding: 0 16px 6px; min-height: 18px; }
.sit-langs { padding: 0 14px 8px; }
.sit-go { margin: 8px 14px calc(10px + env(safe-area-inset-bottom)); }
.flag-occupied { opacity: 0.35; }
.chip.sel { outline: 2px solid var(--ink); }
.seats-sheet { height: auto; max-height: 62dvh; }
.seats-grid { flex: none; max-height: 40dvh; }
.seat-chip { cursor: default; }

/* ---------- ui chrome: lang toggle / net note / empty states ---------- */
.lang-toggle {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: 14px;
  z-index: 30;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--card);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
}
.net-note {
  flex: none;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  background: var(--chip);
  padding: 4px 0;
}
.net-note[hidden] { display: none; }
.river-empty {
  margin: auto;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.8;
  padding: 24px;
}
.river-empty .big { font-family: var(--emoji-font); font-size: 40px; display: block; margin-bottom: 8px; }
.sit-suggest {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 8px;
  font-size: 12px;
  color: var(--muted);
}
#jumpBtn { min-width: 40px; width: auto; padding: 0 12px; font-size: 13px; }

/* ---------- misc ---------- */
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 2px solid var(--muted);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
