:root {
  --bg: #313338; --side: #2b2d31; --side-2: #1e1f22; --hover: #35373c; --active: #404249;
  --text: #dbdee1; --muted: #949ba4; --strong: #f2f3f5; --accent: #5865f2; --accent-2: #4752c4;
  --link: #00a8fc; --danger: #f23f42; --line: #3f4147; --input: #383a40;
  --side-w: 260px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }

.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* ---------- sidebar ---------- */
.sidebar { width: var(--side-w); flex: none; background: var(--side); display: flex; flex-direction: column; min-height: 0; }
.brand { height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 16px; font-weight: 700; color: var(--strong);
  border-bottom: 1px solid var(--side-2); flex: none; padding-top: env(safe-area-inset-top); box-sizing: content-box; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; }
/* Watchers の下にキャッチコピー（2026-11-20） */
.brand-names { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
/* Google ログイン: X の下に小さな文字のリンク */
.login-col { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.login-col.wide { width: 100%; }
.google-login { font-size: 10.5px; color: var(--muted); text-decoration: underline; }
.google-login:hover { color: var(--strong); }
.lw-google { display: block; margin-top: 10px; font-size: 12px; text-align: center; }
.brand-tag { font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rooms { flex: 1; overflow-y: auto; padding: 8px; }
.section { font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--muted); padding: 16px 8px 4px; }
.rooms ul { list-style: none; margin: 0; padding: 0; }
.rooms li a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; color: var(--muted); }
.rooms li a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.rooms li a.active { background: var(--active); color: var(--strong); }
.rooms .hash { width: 20px; text-align: center; font-size: 20px; line-height: 1; opacity: .7; }
.rooms .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 通知 badges (Discord-style red pill on the right) */
.rooms li a.unread { color: var(--strong); font-weight: 700; }
.rooms .badge { margin-left: auto; flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #f23f43;
  color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }
.menu { position: relative; }
.menu.has-unread::after { content: ""; position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; border-radius: 50%;
  background: #f23f43; box-shadow: 0 0 0 2px var(--bg); }
.me { background: var(--side-2); padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); flex: none; }
.me-row { display: flex; align-items: center; gap: 8px; }
.me-names { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.me-names strong { color: var(--strong); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-names span { color: var(--muted); font-size: 12px; }
.login { display: flex; align-items: center; justify-content: center; gap: 6px; background: var(--strong); color: #000;
  font-weight: 700; border-radius: 6px; padding: 10px; }
.login:hover { text-decoration: none; opacity: .9; }
.login .x { font-size: 16px; }

/* ---------- avatars ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover; background: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.avatar.sm { width: 32px; height: 32px; font-size: 14px; }
.avatar.xs { width: 20px; height: 20px; font-size: 11px; }

/* ---------- main ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.room-head { height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-bottom: 1px solid var(--side-2);
  box-shadow: 0 1px 0 rgba(0,0,0,.2); padding-top: env(safe-area-inset-top); box-sizing: content-box; }
.menu { display: none; background: none; border: 0; font-size: 20px; padding: 4px 8px; margin-left: -8px; color: var(--muted); }
.room-title { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.room-title > span:first-child { color: var(--muted); font-size: 20px; display: inline-flex; }
.room-title strong { color: var(--strong); }
.topic { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; padding-left: 8px; border-left: 1px solid var(--line); }
.online { color: #23a55a; font-size: 13px; flex: none; }

.timeline { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 0 8px; }
.older { display: block; margin: 0 auto 8px; background: var(--side); border: 0; border-radius: 4px; padding: 6px 12px; color: var(--muted); }
.messages { list-style: none; margin: 0; padding: 0; }
.welcome { color: var(--muted); text-align: center; padding: 32px 16px; }
.day { display: flex; align-items: center; margin: 16px 16px 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
.day::before, .day::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.day span { padding: 0 8px; }

.msg { position: relative; display: flex; gap: 16px; padding: 4px 48px 4px 16px; margin-top: 12px; }
.msg:hover { background: rgba(0,0,0,.08); }
.msg-main { min-width: 0; flex: 1; }
.author { color: var(--strong); font-weight: 600; }
.body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
/* hover toolbar: 😊＋ (react) / 🗑 (delete) */
.tools { position: absolute; right: 12px; top: -10px; display: flex; background: var(--side); border: 1px solid var(--line); border-radius: 6px;
  opacity: 0; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.3); z-index: 2; }
@media (hover: hover) { .msg:hover .tools { opacity: 1; pointer-events: auto; } }
.tools:focus-within { opacity: 1; pointer-events: auto; }
.tools .tool { background: none; border: 0; padding: 3px 7px; font-size: 13px; border-radius: 5px; }
.tools .tool:hover { background: var(--hover); }
/* Phones: hidden until the post is tapped (no permanent icons on top of the name / time). */
.tools.touch { top: -18px; right: 8px; }
.tools.touch .tool { padding: 7px 11px; font-size: 17px; }
.msg.tools-open { background: rgba(0,0,0,.12); }
.msg.tools-open .tools { opacity: 1; pointer-events: auto; }

/* reactions under a message */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.rchip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border-radius: 8px; border: 1px solid transparent;
  background: var(--side); color: var(--text); font-size: 13px; line-height: 1; }
.rchip:hover:not(:disabled) { border-color: var(--line); }
.rchip:disabled { cursor: default; }
.rchip .re { font-size: 15px; }
.rchip .rn { font-weight: 700; font-size: 12px; }
.rchip.mine { background: rgba(88,101,242,.22); border-color: var(--accent); color: var(--strong); }
@keyframes ifade { from { opacity: 0; } }

/* ---------- pinned (personal rooms) ---------- */
.pin { color: var(--muted); font-weight: 700; }

/* ---------- composer ---------- */
.composer { flex: none; display: flex; align-items: flex-end; gap: 8px; margin: 0 16px 16px; padding: 6px 6px 6px 14px;
  background: var(--input); border-radius: 8px; margin-bottom: calc(16px + env(safe-area-inset-bottom)); }
.composer textarea { flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; /* 16px stops iOS from zooming in */ line-height: 1.4; padding: 6px 0; max-height: 180px; }
.composer textarea::placeholder { color: var(--muted); }
/* "𝕏 でシェア": small chip above the composer for a few seconds after you post */
.share-chip { flex: none; align-self: flex-end; display: inline-flex; align-items: center; gap: 4px; margin: 0 16px 6px; padding: 4px 10px;
  border-radius: 999px; background: var(--side-2); border: 1px solid var(--line); color: var(--strong); font-size: 12px; font-weight: 700;
  animation: ifade .15s ease; }
.share-chip[hidden] { display: none; }
.share-chip:hover { text-decoration: none; background: var(--hover); }
.share-chip .x { font-size: 13px; }
.tools .tool-x { display: inline-flex; align-items: center; color: var(--strong); font-weight: 700; }
.tools .tool-x:hover { text-decoration: none; }
@media (max-width: 760px) { .share-chip { margin-right: 8px; } }
.composer button { flex: none; width: 36px; height: 36px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font-size: 16px; }
.composer button:hover { background: var(--accent-2); }
.composer button:disabled, .composer textarea:disabled { opacity: .5; cursor: not-allowed; }
.composer { padding-left: 6px; }
.composer button.attach { display: grid; place-items: center; background: transparent; color: var(--muted); }
/* Line icons (Lucide style, 24px grid): stroke follows the text color. */
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.composer button.attach:hover:not(:disabled) { background: var(--hover); color: var(--strong); }

/* ---------- 画像の添付: previews above the composer, images in posts, full-screen viewer ---------- */
.attachments { flex: none; display: flex; gap: 8px; margin: 0 16px 6px; overflow-x: auto; }
.att { position: relative; flex: none; width: 76px; height: 76px; border-radius: 8px; overflow: hidden; background: var(--side); }
.att img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att.loading img { opacity: .45; }
.att.failed { outline: 2px solid #f23f43; }
.att-state { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; }
.att-remove { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.65); color: #fff; font-size: 12px; line-height: 1; }
.msg-images { display: grid; gap: 4px; margin-top: 6px; grid-template-columns: repeat(2, 1fr); max-width: 420px; }
.msg-images.n1 { grid-template-columns: 1fr; max-width: 360px; }
.msg-image { padding: 0; border: 0; background: var(--side-2); border-radius: 8px; overflow: hidden; cursor: zoom-in; display: block; }
.msg-image img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.msg-images.n1 .msg-image img { aspect-ratio: auto; max-height: 360px; object-fit: contain; }
.viewer { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.92); display: grid; place-items: center; animation: ifade .12s ease; }
.viewer img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }
.viewer-close { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; width: 40px; height: 40px; border: 0;
  border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; font-size: 18px; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 8px;
  background: rgba(255,255,255,.12); color: #fff; font-size: 32px; }
.viewer-nav.prev { left: 8px; } .viewer-nav.next { right: 8px; }
.viewer-open { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  color: #ddd; font-size: 13px; background: rgba(0,0,0,.5); padding: 6px 12px; border-radius: 6px; }
@media (max-width: 760px) { .attachments { margin-left: 8px; margin-right: 8px; } }

.toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--side-2); color: var(--strong); padding: 8px 14px; border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.4);
  font-size: 14px; z-index: 30; max-width: calc(100vw - 32px); }

.backdrop { display: none; }

/* ---------- phones: sidebar becomes a drawer ---------- */
@media (max-width: 760px) {
  .menu { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px); z-index: 20; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 4px 0 24px rgba(0,0,0,.4); }
  .app.drawer .sidebar { transform: none; }
  .app.drawer .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 10; }
  .room-head { padding-left: 12px; padding-right: 12px; }
  .topic { display: none; }
  .msg { gap: 10px; padding-left: 12px; padding-right: 36px; }
  .avatar { width: 36px; height: 36px; }
  .composer { margin-left: 8px; margin-right: 8px; margin-bottom: calc(8px + env(safe-area-inset-bottom)); }
}

/* ---------- system messages (入室) ---------- */
a.brand:hover { text-decoration: none; }
.tag { font-size: 11px; font-weight: 700; color: #f0b232; background: rgba(240,178,50,.12); border-radius: 4px; padding: 1px 6px; }

/* ---------- welcome overlay (guests at the lounge top) ----------
   The live #挨拶 stays visible underneath: light veil + slight blur, card on top. */
.welcome-page { position: fixed; inset: 0; z-index: 40; overflow-y: auto; display: flex; align-items: center; justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  background: radial-gradient(520px 420px at 50% 50%, rgba(30,31,34,.72), rgba(30,31,34,.45)); }
.welcome-card { width: 100%; max-width: 440px; text-align: center; background: rgba(43,45,49,.94); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px 24px 20px; box-shadow: 0 24px 64px rgba(0,0,0,.55), 0 0 0 1px rgba(88,101,242,.15); }
.hero-mark { display: block; width: 60px; height: 60px; margin: 0 auto; border-radius: 18px; }
.welcome-card h1 { margin: 8px 0 2px; font-size: 24px; color: var(--strong); }
.lead { margin: 0; font-size: 16px; font-weight: 700; color: var(--strong); }
.sub { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.steps { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; text-align: left; }
.steps li { display: flex; gap: 12px; align-items: center; }
.steps li div { display: flex; flex-direction: column; line-height: 1.35; }
.steps b { color: var(--strong); font-size: 14px; }
.steps li span:not(.step-no) { color: var(--muted); font-size: 12.5px; }
.step-no { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; }
.cta { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 22px; }
.cta-login { display: flex; width: 100%; justify-content: center; align-items: center; gap: 8px; background: var(--strong); color: #000;
  font-weight: 800; font-size: 16px; border-radius: 999px; padding: 13px 24px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.cta-login:hover { text-decoration: none; filter: brightness(.95); }
.cta-login .x { font-size: 18px; }
.cta-peek { color: var(--muted); font-size: 13px; padding: 4px; }
.tip { margin: 14px 0 0; color: var(--muted); font-size: 12px; }
@media (max-width: 760px) {
  /* Phones: a bottom sheet, so the chat stays readable above it. */
  .welcome-page { align-items: flex-end; padding: 0; background: linear-gradient(180deg, rgba(30,31,34,.15) 0%, rgba(30,31,34,.7) 100%); }
  .welcome-card { max-width: none; border-radius: 18px 18px 0 0; border-bottom: 0; padding: 22px 20px calc(16px + env(safe-area-inset-bottom)); background: rgba(43,45,49,.97); }
  .hero-mark { display: none; }
  .welcome-card h1 { margin-top: 0; font-size: 21px; }
}


/* 管理人: blue ring on the avatar */
.avatar.admin { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #1d9bf0; }
.avatar.admin.xs { box-shadow: 0 0 0 1.5px var(--side), 0 0 0 3px #1d9bf0; }

/* 📌 pinned bar under the room header */
.pinbar { flex: none; border-bottom: 1px solid var(--side-2); background: linear-gradient(90deg, rgba(240,178,50,.12), rgba(240,178,50,.04)); }
.pinbar-head { width: 100%; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 9px 16px; text-align: left; color: var(--text); font-size: 13.5px; }
.pinbar-icon { flex: none; }
.pinbar-line { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinbar-line b { color: var(--strong); }
.pinbar-more { flex: none; font-size: 12px; color: var(--muted); }
.pinbar-toggle { flex: none; font-size: 12px; font-weight: 700; color: #f0b232; }
.pinbar-body { max-height: 50vh; overflow-y: auto; padding: 0 16px 12px; display: grid; gap: 10px; }
.pinbar-item { background: var(--side); border: 1px solid var(--line); border-left: 3px solid #f0b232; border-radius: 10px; padding: 10px 12px; }
.pinbar-meta { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 4px; }
.pinbar-meta b { color: var(--strong); }
.pinbar-meta time { color: var(--muted); font-size: 12px; }
.pinbar-jump { margin-top: 6px; background: none; border: 0; padding: 0; color: var(--link); font-size: 13px; font-weight: 600; }
.tag.pin { color: #f0b232; }
.msg.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { background: rgba(240,178,50,.18); } 100% { background: transparent; } }

/* コイン (bottom-left, next to your name) */
.coins { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 800; color: #f0b232;
  background: rgba(240,178,50,.1); border-radius: 999px; padding: 3px 9px 3px 5px; }
.coin { width: 16px; height: 16px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff3b0 0 12%, #f7c948 30%, #d99a1e 75%); box-shadow: inset 0 0 0 1.5px #b9790f; }

/* sidebar イベント card */

/* sidebar footer: [avatar + name -> 設定] [coins] [🏠] [⚙] */
.me-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 2px 4px 2px 0;
  border-radius: 6px; text-align: left; }
.me-open:hover { background: var(--hover); }
.me-gear { flex: none; display: grid; place-items: center; width: 32px; height: 32px; background: none; border: 0; border-radius: 6px; color: var(--muted); }
.me-gear:hover { background: var(--hover); color: var(--strong); }
.me-gear .icon { width: 19px; height: 19px; }
/* 設定 */
.set-card { gap: 6px; }
.set-card h4 { margin: 10px 0 2px; font-size: 11px; letter-spacing: .04em; color: var(--muted); }
.set-who { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.set-item { display: flex; align-items: center; gap: 12px; width: 100%; background: var(--side-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; color: var(--strong); text-align: left; }
.set-item:hover { background: var(--hover); }
.set-item .icon { width: 19px; height: 19px; flex: none; color: var(--muted); }
.set-item .icon:last-child { width: 16px; height: 16px; }
.set-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; font-weight: 600; }
.set-label small { font-weight: 400; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; line-height: 1.4; }
.set-item.danger, .set-item.danger .icon { color: #ff8a8c; }
.set-card .name-actions { margin-top: 10px; }
.name-modal { position: fixed; inset: 0; z-index: 65; background: rgba(10,11,13,.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.name-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; background: var(--side); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.name-card b { color: var(--strong); font-size: 16px; }
.name-input { background: var(--dark); border: 1px solid var(--line); border-radius: 8px; color: var(--strong); font-size: 16px; padding: 10px 12px; outline: none; }
.name-input:focus { border-color: var(--accent); }
.name-card small { color: var(--muted); font-size: 12px; }
.name-error { margin: 0; color: var(--danger); font-size: 13px; min-height: 0; }
.name-error:empty { display: none; }
.name-actions { display: flex; justify-content: flex-end; gap: 8px; }
.name-cancel { background: none; border: 0; color: var(--muted); padding: 8px 12px; }
.name-save { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 18px; font-weight: 800; }

/* edited posts */
.edited { color: var(--muted); font-size: 11px; }
.edit-card { max-width: 520px; }
.edit-input { resize: vertical; min-height: 120px; font: inherit; font-size: 15px; line-height: 1.5; }
/* phones: the drawer stays above the dim layer */
.app.drawer .sidebar { z-index: 20; }

/* 管理人 debug panel */
.dbg-card { max-width: 480px; max-height: calc(100dvh - 32px); overflow-y: auto; overflow-x: hidden; }
.dbg-card h4 { margin: 8px 0 0; font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.dbg { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dbg td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dbg td:last-child { text-align: right; color: var(--muted); overflow-wrap: anywhere; }
.dbg td.on { color: #23a55a; font-weight: 700; }
.dbg-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dbg-btn { background: var(--hover); border: 1px solid var(--line); color: var(--strong); border-radius: 8px; padding: 8px; font-size: 13px; }
.dbg-btn:hover { background: var(--active); }
.dbg-btn.danger { grid-column: 1 / -1; background: rgba(242,63,66,.15); border-color: rgba(242,63,66,.5); color: #ff8a8c; font-weight: 700; }
.dbg-links { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; }

.dbg-targets { display: flex; flex-wrap: wrap; gap: 6px; }
.dbg-target { background: var(--hover); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.dbg-target.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.dbg-who { font-size: 12px; color: var(--muted); }

/* コンペ: 𝕏 でエントリー */
.post-chip { background: #1d9bf0; color: #fff; font-weight: 800; border-radius: 999px; padding: 3px 12px; font-size: 13px; box-shadow: 0 0 0 3px rgba(29,155,240,.35); }
.entry-note { margin: 0; color: var(--text); font-size: 14px; }


/* 今の気持ち (入室): 3 buttons on the guest top page and in the first-login sheet; shown under the join message */
.mood-ask { margin: 14px 0 8px; font-size: 14px; color: var(--strong); font-weight: 700; }
.mood-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 4px; }
.mood-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px; border-radius: 14px;
  background: var(--side); border: 1px solid var(--line); color: var(--strong); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.mood-btn:hover, .mood-btn:focus-visible { border-color: var(--accent); background: rgba(88,101,242,.18); }
.mood-btn:disabled { opacity: .5; cursor: default; }
.mood-emoji { font-size: 28px; line-height: 1; }
.mood-card { max-width: 420px; text-align: center; }
.welcome-login-sub { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--muted); }
.welcome-legal, .set-legal { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); text-align: center; }
.welcome-legal a, .set-legal a { color: var(--muted); text-decoration: underline; }
.tag.supporter { color: #7dd3fc; background: rgba(125,211,252,.12); }

/* 株価タイル (ticker.js): small tiles side by side, fixed between the room header and the timeline.
   Too many to fit: they scroll sideways (a swipe on a phone, the thin bar or shift+wheel on a PC). */
:root { --tk-up: #23a55a; --tk-down: #f23f42; }
.ticker { flex: none; display: flex; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--side-2);
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; scrollbar-width: thin; overscroll-behavior-x: contain; }
.ticker[hidden] { display: none; }
.tk-slot { flex: none; scroll-snap-align: start; }
.tk-tile { width: 216px; height: 168px; display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px;
  background: var(--side); border: 1px solid var(--line); overflow: hidden; }
.tk-tile.up { background: linear-gradient(180deg, rgba(35,165,90,.16), var(--side) 55%); }
.tk-tile.down { background: linear-gradient(180deg, rgba(242,63,66,.16), var(--side) 55%); }
.tk-head { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.tk-name { font-size: 14px; font-weight: 800; color: var(--strong); }
.tk-tag { font-size: 10px; font-weight: 700; color: var(--muted); }
.tk-live { margin-left: auto; font-size: 10px; font-weight: 800; color: var(--tk-up); letter-spacing: .03em; }
.tk-pct { font-size: 26px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tk-tile.up .tk-pct, .tk-tile.up .tk-chg { color: var(--tk-up); }
.tk-tile.down .tk-pct, .tk-tile.down .tk-chg { color: var(--tk-down); }
.tk-chart { flex: 1; min-height: 0; width: 100%; position: relative; overflow: hidden; margin: 2px 0; }
.tk-chart svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* 前日終値: a clear dotted line across the chart, with a small label at the right end */
.tk-base { stroke: #b5bac1; stroke-width: 1; stroke-dasharray: 2 3; }
.tk-base-label { position: absolute; right: 0; transform: translateY(-100%); padding: 0 2px 1px; font-size: 9px; font-weight: 700; line-height: 1;
  color: #b5bac1; background: rgba(43,45,49,.75); border-radius: 3px; pointer-events: none; }
.tk-base-label.below { transform: translateY(2px); }
.tk-foot { display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; font-variant-numeric: tabular-nums; }
.tk-price { font-size: 18px; font-weight: 800; color: var(--strong); }
.tk-chg { font-size: 14px; font-weight: 800; }
/* Phone: a bit smaller, so about two and a half tiles show and the cut-off one says "swipe" */
@media (max-width: 760px) {
  .ticker { padding: 8px 10px; gap: 6px; scroll-padding-left: 10px; scrollbar-width: none; }
  .ticker::-webkit-scrollbar { display: none; }
  .tk-tile { width: 150px; height: 132px; padding: 6px 8px; }
  .tk-name { font-size: 13px; }
  .tk-pct { font-size: 20px; }
  .tk-price { font-size: 14px; }
  .tk-chg { font-size: 11px; }
}


/* ---------- 実況ストリーム (the post layout): time / small avatar (no name) / text / 5 reactions ----------
   The reactions float at the right of the first line, so a long post wraps around and under them. */
.msg { position: relative; display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 3px 16px; }
.msg:hover { background: rgba(0,0,0,.08); }
.st-time { width: 38px; flex: none; padding-top: 4px; font-size: 11px; line-height: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.who { position: relative; flex: none; display: inline-flex; margin-top: 1px; }
.avatar.st { width: 24px; height: 24px; font-size: 11px; }
.avatar.admin.st { box-shadow: 0 0 0 1.5px var(--bg), 0 0 0 3px #1d9bf0; }
.who .vip { position: absolute; right: -5px; bottom: -5px; font-size: 10px; line-height: 1; }
.msg-main { flex: 1; min-width: 0; padding-top: 1px; }
.msg-main .body { color: var(--strong); }
.msg.mine .msg-main .body { color: #6ee7b7; }
.msg-main.sys { color: var(--muted); font-size: 14px; line-height: 24px; }
.msg-main.sys b { color: var(--strong); }
.pin-mark { margin-right: 4px; }
.edited { margin-left: 4px; }
/* reactions: the 5 are always there; faint until someone uses it */
.msg-main > .reactions { float: right; margin: -1px 0 0 8px; gap: 0; flex-wrap: nowrap; }
.msg-images { clear: right; }
.rchip { height: 26px; padding: 0 5px; gap: 2px; border-radius: 13px; background: none; transition: opacity .15s, filter .15s; }
.rchip:not(.on) { opacity: .28; filter: grayscale(.7); }
.rchip:not(.on):hover:not(:disabled) { opacity: .7; filter: none; border-color: transparent; }
.rchip.on { background: none; }
.rchip.mine { background: rgba(88,101,242,.3); border-color: transparent; }
.rchip:active:not(:disabled) { transform: scale(.9); }
.pinbar-item .reactions { margin-top: 4px; }
@media (max-width: 760px) { .msg { padding: 4px 10px; } }

/* 株クラ実況LIVE: the red dot in the guest card title */
.live-dot { color: #f23f42; font-size: .7em; vertical-align: middle; animation: live-blink 1.6s ease-in-out infinite; }
@keyframes live-blink { 50% { opacity: .35; } }

/* ゲスト (no X login) in the sidebar footer: small X login button on the right */
.anon-row { gap: 8px; }
.login.small { flex: none; padding: 6px 10px; font-size: 12px; width: auto; }

/* "👍 リアクションされました": a small balloon at the top when someone reacts to your post */
.reacted { position: fixed; top: calc(60px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 60;
  padding: 6px 14px; border-radius: 999px; background: var(--strong); color: #111; font-size: 13px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(0,0,0,.35); pointer-events: none; white-space: nowrap; }
.reacted.pop { animation: reacted-pop .25s ease-out; }
@keyframes reacted-pop { from { opacity: 0; transform: translate(-50%, -8px) scale(.95); } }

/* 2026-11-17: 今の気持ち and the login wall are full modals: the page behind is hidden completely (opaque),
   and the card sits in the middle on phones too (no bottom sheet). */
.welcome-page, .name-modal.mood-modal, .login-wall {
  background: radial-gradient(600px 480px at 50% 40%, #2b2d31, var(--side-2) 70%); }
.login-wall { position: fixed; inset: 0; z-index: 80; overflow-y: auto; display: flex; align-items: center; justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
.lw-card .lead { margin-top: 10px; font-size: 18px; }
.lw-card .lw-go { margin-top: 18px; }
body.walled { overflow: hidden; }
.mood-btn > span:last-child { line-height: 1.25; word-break: keep-all; }
@media (max-width: 760px) {
  .welcome-page { align-items: center; padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
    background: radial-gradient(420px 420px at 50% 40%, #2b2d31, var(--side-2) 70%); }
  .welcome-card { border-radius: 16px; border-bottom: 1px solid var(--line); padding: 22px 18px 16px; }
  .welcome-page .hero-mark, .login-wall .hero-mark { display: block; width: 52px; height: 52px; margin-bottom: 6px; }
  .mood-btn { font-size: 13px; padding: 12px 4px; }
}

/* ---------- 吹き出し (案C, 2026-11-17; demo /lounge/demo/row.html?only=C). Overrides the 実況ストリーム rules above. ----------
   Others: avatar + grey bubble on the left. Yours: green bubble on the right, no avatar. The time sits at the end of the bubble.
   Reactions someone used: small chips on the bubble's bottom corner. Tap the bubble: the 5 reactions (+ ✏️) open under it. */
.msg { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 4px 16px 6px; }
.msg:hover { background: none; }
.msg.has-rx { padding-bottom: 18px; }
.msg.mine { flex-direction: row-reverse; }
.msg .col { min-width: 0; max-width: min(80%, 640px); display: flex; flex-direction: column; align-items: flex-start; }
.msg.mine .col { align-items: flex-end; }
.who { margin-top: 0; }
.avatar.st { width: 32px; height: 32px; font-size: 13px; }
.bub { position: relative; max-width: 100%; padding: 7px 12px; border-radius: 4px 16px 16px 16px; background: #3a3c43; color: var(--strong);
  overflow-wrap: anywhere; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: filter .12s; }
.msg.mine .bub { background: #1f4d3d; border-radius: 16px 4px 16px 16px; }
.bub .body { display: inline; color: var(--strong); }
.msg.mine .bub .body { color: #6ee7b7; }
.bub.sys { background: transparent; border: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.bub.sys b { color: var(--strong); font-weight: 600; }
.bub .msg-images { margin: 6px 0 2px; max-width: 100%; }
.bt { margin-left: 6px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.msg.mine .bt { color: rgba(167,243,208,.6); }
.msg.tools-open .bub { filter: brightness(1.15); }
.corner { position: absolute; right: -6px; bottom: -15px; display: flex; gap: 2px; }
.msg.mine .corner { right: auto; left: -6px; }
.corner .rchip { height: 22px; padding: 0 6px; gap: 2px; border-radius: 11px; border: 0; background: #2b2d31; box-shadow: 0 0 0 2px var(--bg); opacity: 1; filter: none; }
.corner .rchip.mine { background: #3c4270; }
.corner .rchip .re { font-size: 13px; }
.corner .rchip .rn { font-size: 11.5px; color: var(--strong); }
.picker { display: none; gap: 2px; margin-top: 6px; padding: 3px 4px; border-radius: 14px; background: var(--side-2); border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.msg.has-rx .picker { margin-top: 20px; }
.msg.tools-open .picker { display: flex; animation: pick-in .14s ease-out; }
@keyframes pick-in { from { opacity: 0; transform: translateY(-4px); } }
.pick { background: none; border: 0; font-size: 20px; line-height: 1; padding: 6px 7px; border-radius: 10px; cursor: pointer; }
.pick:hover { background: var(--hover); }
.pick.mine { background: rgba(88,101,242,.35); }
.pick.edit { font-size: 17px; border-left: 1px solid var(--line); border-radius: 0 10px 10px 0; margin-left: 2px; }
@media (max-width: 760px) { .msg { padding-left: 10px; padding-right: 10px; } .msg .col { max-width: 84%; } }

/* ---------- ユーザーの切り替え (管理人 → サンプルユーザー) ---------- */
.switch-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin: 0 0 8px; padding: 6px 10px;
  border: 1px solid #b7791f; border-radius: 8px; background: rgba(250,176,5,.14); color: #fcd34d; font-size: 12.5px; cursor: pointer; text-align: left; }
.switch-bar span { flex: none; font-weight: 600; text-decoration: underline; }
.switch-note { margin: 2px 0 8px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.switch-user { display: flex; align-items: center; gap: 10px; width: 100%; margin-bottom: 6px; padding: 8px 12px; background: var(--side-2);
  border: 1px solid var(--line); border-radius: 10px; color: var(--strong); cursor: pointer; text-align: left; font: inherit; }
.switch-user:hover { background: var(--hover); }
.switch-user.on { border-color: #5865f2; }
.switch-user .set-label { flex: 1; min-width: 0; }
.switch-now { flex: none; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #5865f2; color: #fff; }
/* 2026-11-17: your own posts sit on the left with your avatar like everyone else's (only the bubble stays green). */
.msg.mine { flex-direction: row; }
.msg.mine .col { align-items: flex-start; }
.msg.mine .bub { border-radius: 4px 16px 16px 16px; }
.msg.mine .corner { left: auto; right: -6px; }

/* ---------- 通知 (サイドバー) + the tab that peeks out on phones ---------- */
.notice-head { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.notice-head .badge { margin-left: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #f23f43; color: #fff; font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center; letter-spacing: 0; }
.notice-read { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 11.5px; cursor: pointer; padding: 0; }
.notice-read:hover { color: var(--strong); text-decoration: underline; }
.notice-list { list-style: none; margin: 0; padding: 0; }
.notice { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px; background: none;
  color: var(--muted); text-align: left; font: inherit; cursor: pointer; }
.notice:hover { background: var(--hover); }
.notice.new { background: rgba(242,63,67,.12); color: var(--text); }
.notice.new strong { color: var(--strong); }
.notice-emoji { flex: none; font-size: 18px; line-height: 1; }
.notice-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.notice-text strong { font-size: 13px; font-weight: 600; }
.notice-text small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice time { flex: none; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.notice-empty { margin: 4px 8px; font-size: 12px; color: var(--muted); }
.msg.flash .bub { animation: notice-flash 1.6s ease-out; }
@keyframes notice-flash { 0%, 40% { box-shadow: 0 0 0 3px #f23f43; } 100% { box-shadow: 0 0 0 3px transparent; } }
.notice-peek { display: none; }
@media (max-width: 760px) {
  .notice-peek:not([hidden]) { display: flex; align-items: center; gap: 5px; position: fixed; left: 0; top: 46%; z-index: 15;
    padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-left: 0; border-radius: 0 16px 16px 0; background: var(--side);
    color: var(--strong); font-size: 12.5px; box-shadow: 4px 4px 14px rgba(0,0,0,.4); cursor: pointer; animation: peek-in .3s ease-out; }
  .notice-peek .bell { font-size: 15px; }
  .notice-peek b { min-width: 20px; padding: 1px 6px; border-radius: 9px; background: #f23f43; color: #fff; font-size: 11.5px; text-align: center; }
  .app.drawer ~ .notice-peek, .app.drawer .notice-peek { display: none; }
}
@keyframes peek-in { from { transform: translateX(-100%); } }
/* ---------- イベントのバナー (sidebar, /events/ryukogo-2026/) ---------- */
.event-banner { position: relative; display: flex; flex-direction: column; gap: 3px; margin: 16px 4px 8px; padding: 12px 12px 11px; border-radius: 12px;
  background: linear-gradient(135deg, #3b2a06 0%, #6b4a0a 55%, #b7791f 100%); border: 1px solid rgba(252,211,77,.35);
  color: #fff7e0; overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,.25); transition: transform .12s, filter .12s; }
.event-banner::after { content: ""; position: absolute; right: -24px; top: -24px; width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(252,211,77,.35), transparent 70%); }
.event-banner:hover { text-decoration: none; filter: brightness(1.08); transform: translateY(-1px); }
.eb-tag { align-self: flex-start; font-size: 10px; font-weight: 800; letter-spacing: .12em; padding: 1px 7px; border-radius: 999px;
  background: #fcd34d; color: #3b2a06; }
.eb-title { font-size: 14.5px; font-weight: 800; color: #fff; }
.eb-sub { font-size: 11.5px; line-height: 1.5; color: rgba(255,247,224,.82); }
.eb-go { align-self: flex-end; margin-top: 2px; font-size: 12px; font-weight: 700; color: #fcd34d; }
