/* ============================================================
   Bushido Chat — 見た目
   和の配色(墨・和紙・藍・朱) / ライト & ダーク両対応
   ============================================================ */

:root {
  --bg:        #f6f4ef;   /* 和紙 */
  --bg-soft:   #efece4;
  --surface:   #ffffff;
  --surface-2: #faf8f4;
  --line:      #e4dfd4;
  --line-soft: #eeeae1;
  --text:      #1b1a18;   /* 墨 */
  --muted:     #7e766a;
  --faint:     #a9a294;
  --accent:    #14263c;   /* ロゴの紺 */
  --accent-2:  #26456a;
  --accent-on: #ffffff;
  --gold:      #a8865a;   /* ロゴの金 */
  --vermilion: #c0432e;   /* 朱(いいね) */
  --logo:      url(/logo-mark.png);
  --shadow:    0 1px 2px rgba(27,26,24,.04), 0 8px 24px -12px rgba(27,26,24,.16);
  --shadow-lg: 0 2px 6px rgba(27,26,24,.06), 0 24px 48px -20px rgba(27,26,24,.28);
  --radius:    18px;
  --radius-sm: 12px;
  --sans: "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Zen Old Mincho", "Yu Mincho", serif;
}

html[data-theme="dark"] {
  --bg:        #0e1013;
  --bg-soft:   #14171c;
  --surface:   #16191e;
  --surface-2: #1b1f25;
  --line:      #272c34;
  --line-soft: #21252b;
  --text:      #ecebe6;
  --muted:     #949aa3;
  --faint:     #6d747d;
  --accent:    #8fb2d4;
  --accent-2:  #abc8e4;
  --accent-on: #0e1013;
  --gold:      #c9a96e;
  --vermilion: #e2664e;
  --logo:      url(/logo-mark-light.png);
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 2px 8px rgba(0,0,0,.5), 0 24px 48px -20px rgba(0,0,0,.8);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg:        #0e1013;
    --bg-soft:   #14171c;
    --surface:   #16191e;
    --surface-2: #1b1f25;
    --line:      #272c34;
    --line-soft: #21252b;
    --text:      #ecebe6;
    --muted:     #949aa3;
    --faint:     #6d747d;
    --accent:    #8fb2d4;
    --accent-2:  #abc8e4;
    --accent-on: #0e1013;
    --gold:      #c9a96e;
    --vermilion: #e2664e;
    --logo:      url(/logo-mark-light.png);
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lg: 0 2px 8px rgba(0,0,0,.5), 0 24px 48px -20px rgba(0,0,0,.8);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  /* うっすらとした和紙の風合い */
  background-image:
    radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%);
  background-attachment: fixed;
  padding-bottom: calc(74px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; color: inherit; }
img { display: block; max-width: 100%; }

/* ---------------------------------------------- ヘッダー */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner {
  max-width: 620px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 9px; margin-right: auto; }
.brand-mark {
  width: 34px; height: 34px;
  flex: none;
  background: var(--logo) center/contain no-repeat;
}
.brand-text {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: .16em;
  font-weight: 700;
}
.brand-thin { font-weight: 400; color: var(--gold); margin-left: .5em; letter-spacing: .18em; }
@media (max-width: 380px) { .brand-thin { display: none; } }

.topbar-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  height: 34px;
  min-width: 34px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  cursor: pointer;
  font-size: 11.5px;
  letter-spacing: .09em;
  font-weight: 500;
  color: var(--muted);
  transition: .18s;
}
.icon-btn:hover { color: var(--text); border-color: var(--faint); }

/* ---------------------------------------------- 共通 */

.view { max-width: 620px; margin: 0 auto; padding: 0 16px 40px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-on);
  font-weight: 500;
  letter-spacing: .03em;
  cursor: pointer;
  transition: .18s;
  white-space: nowrap;
  flex: none;
}
.btn:hover { background: var(--accent-2); }
.btn:disabled { opacity: .42; cursor: default; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--faint); }
.btn-sm { height: 34px; padding: 0 15px; font-size: 13px; }
.btn-block { width: 100%; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 11.5px;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.input, .textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  transition: .18s;
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.textarea { resize: vertical; min-height: 90px; }
.hint { font-size: 12px; color: var(--faint); margin-top: 6px; line-height: 1.6; }
.error-msg {
  background: color-mix(in srgb, var(--vermilion) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--vermilion) 32%, transparent);
  color: var(--vermilion);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 14px;
}

.section-title {
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: .22em;
  color: var(--faint);
  text-transform: uppercase;
  margin: 26px 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 55%, transparent), var(--line));
}

.empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--faint);
}
.empty-mark { font-family: var(--serif); font-size: 40px; opacity: .3; margin-bottom: 10px; }

.spinner {
  width: 22px; height: 22px;
  margin: 40px auto;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------- アバター */

.avatar-wrap {
  position: relative;
  display: inline-block;
  flex: none;
  line-height: 0;
}
.avatar-flag {
  position: absolute;
  right: -2px;
  bottom: -1px;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 0 0 1.5px var(--surface), 0 1px 3px rgba(0,0,0,.35);
  background: var(--surface);
}
.post .avatar-flag, .dm-row .avatar-flag { box-shadow: 0 0 0 1.5px var(--bg), 0 1px 3px rgba(0,0,0,.3); }
.profile-hero .avatar-flag { right: 2px; bottom: 2px; border-radius: 3px; }

.avatar {
  border-radius: 50%;
  background: var(--bg-soft);
  object-fit: cover;
  flex: none;
  border: 1px solid var(--line-soft);
}
.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-radius: 50%;
  flex: none;
  border: 1px solid var(--line-soft);
  user-select: none;
}

/* ---------------------------------------------- 武道ごとの板 */

.board-bar {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 12px 0 2px;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  scroll-padding: 16px;
}
.board-bar::-webkit-scrollbar { display: none; }

.board-tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .03em;
  white-space: nowrap;
  transition: .18s;
}
.board-tab:hover { color: var(--text); border-color: var(--faint); }
.board-tab.on {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-on);
  font-weight: 500;
}
.board-tab-mark {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--gold);
  line-height: 1;
}
.board-tab.on .board-tab-mark { color: var(--accent-on); opacity: .85; }

/* 投稿カードに付く小さな板の名札 */
.board-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 1px 9px 1px 7px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
  background: color-mix(in srgb, var(--gold) 9%, transparent);
  color: var(--gold);
  font-size: 11px;
  letter-spacing: .04em;
  line-height: 1.7;
  white-space: nowrap;
  flex: none;
  transition: .18s;
}
.board-chip:hover { background: color-mix(in srgb, var(--gold) 20%, transparent); }
.board-chip span { font-size: 10.5px; }

/* 投稿フォームの「どこに投稿するか」 */
.board-select {
  flex: none;
  height: 32px;
  max-width: 42vw;
  padding: 0 26px 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 13px center, right 8px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.board-select:focus { outline: none; border-color: var(--accent); }

/* ---------------------------------------------- 投稿フォーム */

.composer {
  margin: 18px 0;
  padding: 16px;
  display: flex;
  gap: 12px;
}
.composer-main { flex: 1; min-width: 0; }
.composer textarea {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.8;
  resize: none;
  outline: none;
  min-height: 52px;
  padding: 4px 0;
}
.composer textarea::placeholder { color: var(--faint); }
.composer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.composer-count { margin-left: auto; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.composer-count.over { color: var(--vermilion); }

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: .18s;
  white-space: nowrap;
  flex: none;
}
.chip-btn:hover { color: var(--accent); border-color: var(--accent); }
.chip-btn svg { width: 16px; height: 16px; flex: none; }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.preview-item { position: relative; aspect-ratio: 1; }
.preview-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.preview-del {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 0;
  background: rgba(0,0,0,.62);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

/* ---------------------------------------------- 投稿カード */

.post {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .18s;
  animation: rise .3s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.post:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.post-main { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.post-name { font-weight: 700; letter-spacing: .01em; }
.post-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.post-handle, .post-time { color: var(--faint); font-size: 13px; }
.post-dot { color: var(--faint); font-size: 13px; }
.post-body {
  margin: 3px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.8;
}
.post-body .mention { color: var(--accent); }

.media-grid { display: grid; gap: 4px; margin-top: 11px; border-radius: 14px; overflow: hidden; }
.media-grid.n1 { grid-template-columns: 1fr; }
.media-grid.n2 { grid-template-columns: 1fr 1fr; }
.media-grid.n3, .media-grid.n4 { grid-template-columns: 1fr 1fr; }
.media-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  background: var(--bg-soft);
}
.media-grid.n1 img { max-height: 480px; object-fit: contain; background: var(--bg-soft); }
.media-grid.n2 img, .media-grid.n3 img, .media-grid.n4 img { aspect-ratio: 1; }

/* ---- 動画 ---- */
.media-grid.is-video { position: relative; background: #000; }
.media-grid.is-video video {
  width: 100%;
  max-height: 520px;
  display: block;
  background: #000;
}
.pin-flag {
  position: absolute;
  top: 8px; left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  background: rgba(0,0,0,.6);
  color: var(--gold);
  font-size: 10.5px;
  letter-spacing: .06em;
  backdrop-filter: blur(6px);
  pointer-events: none;
}
.pin-flag svg { width: 12px; height: 12px; }

.preview-item.is-video video {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 10px;
  background: #000;
}

.gallery a.gal-video { position: relative; background: #000; }
.gal-video video { width: 100%; height: 100%; object-fit: cover; }
.gal-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.9);
  pointer-events: none;
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
}
.gal-play svg { width: 24px; height: 24px; }
.gal-pin {
  position: absolute;
  top: 4px; right: 4px;
  color: var(--gold);
  pointer-events: none;
}
.gal-pin svg { width: 13px; height: 13px; }

.post-actions { display: flex; align-items: center; gap: 4px; margin-top: 9px; margin-left: -8px; }
.act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  color: var(--faint);
  font-size: 12.5px;
  cursor: pointer;
  transition: .16s;
  font-variant-numeric: tabular-nums;
}
.act:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.act.like:hover, .act.like.on { color: var(--vermilion); }
.act.like:hover { background: color-mix(in srgb, var(--vermilion) 10%, transparent); }
.act.like.on svg { fill: var(--vermilion); }
.act svg { width: 16px; height: 16px; }
.act.pop svg { animation: pop .34s ease; }
@keyframes pop { 40% { transform: scale(1.34); } 70% { transform: scale(.92); } }
.act-more { margin-left: auto; }

/* ---------------------------------------------- スレッド */

.thread-focus { padding: 20px 16px; border-bottom: 1px solid var(--line); }
.thread-focus .post-body { font-size: 17px; line-height: 1.85; margin-top: 10px; }
.thread-meta {
  display: flex; gap: 18px;
  padding-top: 13px; margin-top: 13px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px; color: var(--muted);
}
.thread-meta b { color: var(--text); font-weight: 700; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 13px;
  padding: 14px 0 4px;
}
.back-link:hover { color: var(--accent); }

/* ---------------------------------------------- プロフィール */

.profile-hero {
  padding: 26px 20px 20px;
  margin: 18px 0 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.profile-hero::before {
  content: "";
  position: absolute; inset: 0 0 auto;
  height: 78px;
  background: linear-gradient(115deg,
    color-mix(in srgb, var(--accent) 26%, transparent),
    color-mix(in srgb, var(--gold) 30%, transparent));
}
.profile-avatar-wrap { position: relative; display: inline-block; }
.profile-hero .avatar,
.profile-hero .avatar-fallback {
  width: 88px; height: 88px;
  font-size: 34px;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow);
  position: relative;
}
.profile-name { font-size: 20px; font-weight: 700; margin-top: 12px; letter-spacing: .01em; }
.profile-handle { color: var(--faint); font-size: 13.5px; }
.profile-bio { margin: 12px auto 0; max-width: 40ch; white-space: pre-wrap; color: var(--muted); }
.profile-counts { display: flex; justify-content: center; gap: 26px; margin-top: 16px; }
.profile-counts > * { font-size: 12px; color: var(--faint); letter-spacing: .08em; }
.profile-counts b { display: block; font-size: 17px; color: var(--text); font-weight: 700; letter-spacing: 0; }
.profile-counts a { transition: .18s; }
.profile-counts a:hover { color: var(--accent); }
.profile-counts a:hover b { color: var(--accent); }
.notif-icon.follow { color: var(--gold); }
.profile-cta { margin-top: 16px; display: flex; gap: 8px; justify-content: center; }

.tabs { display: flex; gap: 4px; margin: 18px 0 2px; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1;
  padding: 11px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .06em;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: .18s;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 14px;
}
.gallery a { display: block; aspect-ratio: 1; overflow: hidden; border-radius: 6px; }
.gallery img {
  width: 100%; height: 100%;
  object-fit: cover;
  background: var(--bg-soft);
  transition: transform .3s;
}
.gallery a:hover img { transform: scale(1.06); }

/* ---------------------------------------------- 認証画面 */

.auth-wrap { max-width: 400px; margin: 40px auto 0; }
.auth-head { text-align: center; margin-bottom: 26px; }
.auth-mark {
  display: block;
  width: 76px; height: 76px;
  margin: 0 auto 14px;
  background: var(--logo) center/contain no-repeat;
}
.auth-title { font-family: var(--serif); font-size: 21px; letter-spacing: .1em; font-weight: 600; }
.auth-sub { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.auth-card { padding: 24px 22px; }
.auth-alt { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--muted); }
.auth-alt a { color: var(--accent); font-weight: 500; }
.auth-alt a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------- 下タブ */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 45;
  display: flex;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line-soft);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-inner { max-width: 620px; margin: 0 auto; display: flex; width: 100%; }
.tabbar a, .tabbar button {
  flex: 1;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 0 8px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: .06em;
  cursor: pointer;
  transition: color .18s;
}
.tabbar a.on { color: var(--accent); }
.tabbar a:hover, .tabbar button:hover { color: var(--text); }
.tabbar svg { width: 21px; height: 21px; }
.tabbar .fab-slot svg { width: 25px; height: 25px; color: var(--accent); }

/* ---------------------------------------------- トースト / 拡大 */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  background: var(--text);
  color: var(--bg);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: rise .24s ease both;
  max-width: 88vw;
  text-align: center;
}

.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8,8,10,.93);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade .2s ease both;
}
@keyframes fade { from { opacity: 0; } }
.lightbox img { max-width: 100%; max-height: 92vh; object-fit: contain; border-radius: 6px; }
.lightbox-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 16px;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

/* ---------------------------------------------- お知らせ */

.bell-btn { position: relative; padding: 0 8px; }
.bell-btn.on { color: var(--accent); border-color: var(--accent); }
.bell-dot {
  position: absolute;
  top: 5px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--vermilion);
  border: 1.5px solid var(--bg);
}

.notif-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .18s;
}
.notif-row:last-child { border-bottom: 0; }
.notif-row:hover { background: var(--surface-2); }
.notif-row.unread { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.notif-icon { display: inline-flex; flex: none; color: var(--accent); }
.notif-icon svg { width: 17px; height: 17px; }
.notif-icon.like { color: var(--vermilion); }
.notif-icon.like svg { fill: var(--vermilion); }
.notif-main { flex: 1; min-width: 0; display: block; }
.notif-text { display: block; font-size: 13.5px; line-height: 1.6; }
.notif-excerpt {
  display: block;
  font-size: 12.5px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-time { font-size: 11px; color: var(--faint); flex: none; }

/* ---------------------------------------------- DM 一覧 */

.dm-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .18s;
}
.dm-row:last-child { border-bottom: 0; }
.dm-row:hover { background: var(--surface-2); }
.dm-row-main { flex: 1; min-width: 0; }
.dm-row-head { display: flex; align-items: baseline; gap: 8px; }
.dm-row-name { font-weight: 700; }
.dm-row-time { margin-left: auto; font-size: 11.5px; color: var(--faint); flex: none; }
.dm-row-last {
  color: var(--muted);
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dm-row.unread .dm-row-last { color: var(--text); font-weight: 500; }
.dm-you { color: var(--faint); }
.dm-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--vermilion);
  flex: none;
}

/* ---------------------------------------------- DM チャット */

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
}
.chat-head:hover { background: var(--surface-2); }
.chat-head-name { font-weight: 700; line-height: 1.4; }
.chat-head-handle { color: var(--faint); font-size: 12.5px; line-height: 1.4; }

.chat-log { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 12px; }

.bubble-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 78%;
  animation: rise .26s ease both;
}
.bubble-row.mine { align-self: flex-end; align-items: flex-end; }

.bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px 18px 18px 5px;
  padding: 9px 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.bubble-row.mine .bubble {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-on);
  border-radius: 18px 18px 5px 18px;
}
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.bubble-row.mine .bubble-text .mention { color: var(--accent-on); text-decoration: underline; }
.bubble-img {
  width: 100%;
  max-width: 260px;
  border-radius: 10px;
  margin-top: 6px;
  cursor: zoom-in;
}
.bubble:has(.bubble-img:first-child) { padding: 6px; }
.bubble-img:first-child { margin-top: 0; }
.bubble-time { font-size: 10.5px; color: var(--faint); margin: 3px 6px 0; }

.chat-note {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 10px;
}

.chat-bar {
  position: sticky;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-lg);
}
.chat-bar textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.6;
  resize: none;
  outline: none;
  padding: 7px 2px;
  max-height: 120px;
}
.chat-bar textarea::placeholder { color: var(--faint); }
.chat-bar .chip-btn { height: 34px; padding: 0 10px; }

/* ---------------------------------------------- ショップ表示・規約 */

.shop-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  margin-left: 2px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent);
  color: var(--gold);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .08em;
  line-height: 1.7;
  vertical-align: middle;
  flex: none;
}
.profile-name .shop-badge { font-size: 11px; margin-left: 8px; }

.agree {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 4px 0 18px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
  cursor: pointer;
}
.agree input { margin-top: 4px; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.agree a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.doc { padding: 22px 20px 26px; margin-top: 8px; }
.doc h2 {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: .08em;
  margin: 0 0 6px;
}
.doc h3 {
  font-size: 14px;
  margin: 26px 0 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-soft);
  letter-spacing: .04em;
}
.doc p { font-size: 13.5px; color: var(--muted); margin: 0 0 10px; }
.doc ul { margin: 0 0 10px; padding-left: 1.2em; }
.doc li { font-size: 13.5px; color: var(--muted); margin-bottom: 5px; }
.doc b { color: var(--text); }

/* ---------------------------------------------- 管理画面 */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat b {
  display: block;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.stat span { font-size: 10.5px; color: var(--faint); letter-spacing: .06em; }
.stat.warn b { color: var(--vermilion); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row label { display: block; }
select.input { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 16px center, right 11px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.demo { padding: 6px 18px 18px; }
.demo-block { margin-top: 16px; }
.demo-title {
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--faint);
  margin-bottom: 8px;
}
.demo-row { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; font-size: 12.5px; }
.demo-label { width: 34%; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-bar { flex: 1; height: 7px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.demo-bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 999px;
}
.demo-row b { width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

.mod-item { padding: 14px 16px; margin-bottom: 10px; }
.mod-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mod-flag {
  display: inline-flex;
  align-items: center;
  padding: 1px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--vermilion) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--vermilion) 40%, transparent);
  color: var(--vermilion);
  font-size: 11px;
  letter-spacing: .05em;
}
.mod-flag.auto {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent);
}
.mod-head .board-chip { margin-left: auto; }
.mod-author { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.mod-author a { font-weight: 700; }
.mod-banned {
  font-size: 10.5px;
  color: var(--vermilion);
  border: 1px solid color-mix(in srgb, var(--vermilion) 40%, transparent);
  border-radius: 999px;
  padding: 0 8px;
}
.mod-body { margin-top: 8px; }
.mod-reason {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--muted);
  border-left: 2px solid var(--gold);
}
.mod-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.mod-actions .mod-ban { margin-left: auto; }
.btn-danger {
  background: var(--vermilion);
  color: #fff;
  border-color: transparent;
}
.btn-danger:hover { background: color-mix(in srgb, var(--vermilion) 82%, #000); }

/* ---------------------------------------------- 下タブの未読の印 */

.tab-icon { position: relative; display: inline-flex; }
.tab-badge {
  position: absolute;
  top: -1px; right: -3px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--vermilion);
  border: 1.5px solid var(--bg);
}

/* ---------------------------------------------- 広い画面 */

@media (min-width: 720px) {
  body { padding-bottom: 40px; }
  .tabbar { display: none; }
  .view { padding-top: 4px; }
  .chat-bar { bottom: 14px; }
  .toast { bottom: 24px; }
}
