/* emit.fans — Twitter-style 3-column layout, full-width cards on mobile. */
:root {
  --ink: #0f1419;
  --ink-2: #273340;
  --muted: #536471;
  --faint: #8b98a5;
  --line: #eff3f4;
  --line-2: #e1e8ed;
  --bg: #ffffff;
  --surface: #ffffff;
  --bar: rgba(255, 255, 255, 0.85);
  --on-ink: #ffffff;
  --tint: #fff7fa;
  --tint-line: var(--tint-line);
  --accent-ink: var(--accent-ink);
  --warn-ink: var(--warn-ink);
  --danger-soft: var(--danger-soft);
  --danger-line: var(--danger-line);
  --soft: #f7f9f9;
  --hover: rgba(15, 20, 25, 0.04);
  --accent: #ff2e74;
  --accent-2: #ff8a5b;
  --accent-soft: #ffe8f0;
  --accent-hover: #e8245f;
  --ok: #00a36c;
  --ok-soft: #e3f8ef;
  --warn: #f59f00;
  --warn-soft: #fff4db;
  --danger: #f4212e;
  --radius: 16px;
  --main-w: 600px;
  --rail-w: 275px;
  --side-w: 350px;
  --shadow: 0 0 15px rgba(101, 119, 134, 0.2), 0 0 3px 1px rgba(101, 119, 134, 0.15);
  --font-latin: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font: var(--font-latin), 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', Meiryo, sans-serif;
}
html[data-lang='ja'] { --font: var(--font-latin), 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', Meiryo, sans-serif; }
html[data-lang='en'] { --font: var(--font-latin), 'Noto Sans JP', sans-serif; }
html[data-lang='zh'] { --font: var(--font-latin), 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif; }
html[data-lang='ko'] { --font: var(--font-latin), 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif; }
html[data-lang='th'] { --font: var(--font-latin), 'Noto Sans Thai', 'Leelawadee UI', Tahoma, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
html[data-lang='th'] body { line-height: 1.65; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
img.icon { display: inline-block; flex-shrink: 0; vertical-align: middle; user-select: none; -webkit-user-drag: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.pad { padding: 12px 16px; }
.lead { color: var(--muted); font-size: 14px; }

/* ---------- App frame ---------- */
.app { display: flex; justify-content: center; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; width: var(--rail-w); flex-shrink: 0;
  display: flex; flex-direction: column; padding: 4px 12px 16px; overflow-y: auto;
}
.rail-logo { display: flex; align-items: center; gap: 10px; padding: 12px; margin-bottom: 4px; border-radius: 999px; width: max-content; }
.rail-logo:hover { background: var(--hover); }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-item {
  display: flex; align-items: center; gap: 18px; padding: 12px 16px 12px 12px; border-radius: 999px;
  font-size: 16px; width: max-content; max-width: 100%; transition: background .15s;
}
.rail-item:hover { background: var(--hover); }
.rail-item.is-active { font-weight: 700; }
.rail-item.is-active img.icon { filter: drop-shadow(0 0 0 var(--ink)); }
.rail-item.is-active::after { content: ''; width: 6px; height: 6px; border-radius: 3px; background: var(--accent); margin-left: -8px; }
.rail-post { margin: 16px 0 0; width: 90%; }
.rail-account { margin-top: auto; padding-top: 16px; }
.rail-auth { display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
.rail-me { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: 999px; text-align: left; }
.rail-me:hover { background: var(--hover); }
.rail-me-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.rail-me-text b, .rail-me-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-me-text span { color: var(--muted); font-size: 13.5px; }

.main {
  width: var(--main-w); max-width: 100%; flex-shrink: 0; min-height: 100vh;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.main-body { flex: 1; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  min-height: 53px; padding: 4px 12px 4px 16px;
  background: var(--bar); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-logo { display: none; }
.topbar-back { margin-left: -6px; }
.topbar-body { flex: 1; min-width: 0; }
.topbar-end { display: flex; align-items: center; gap: 8px; }
.head-title { display: flex; flex-direction: column; line-height: 1.2; }
.head-title h1 { font-size: 17px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-title span { font-size: 13px; color: var(--muted); }

.side { width: var(--side-w); flex-shrink: 0; padding: 8px 0 24px 28px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: none; }
.side::-webkit-scrollbar { display: none; }
.side-search {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px;
  background: var(--soft); border: 1px solid var(--soft); border-radius: 999px; margin-top: 2px;
}
.side-search:focus-within { background: var(--surface); border-color: var(--accent); }
.side-search input { flex: 1; border: 0; background: transparent; outline: none; min-width: 0; }
.side-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.side-card h2 { font-size: 17px; font-weight: 800; padding: 12px 16px; }
.side-trend { list-style: none; margin: 0; padding: 0; }
.side-trend a { display: flex; gap: 12px; padding: 10px 16px; }
.side-trend a:hover { background: var(--hover); }
.side-trend-rank { font-weight: 800; color: var(--accent); width: 16px; text-align: center; }
.side-trend-body { display: flex; flex-direction: column; min-width: 0; }
.side-trend-meta { font-size: 13px; color: var(--muted); }
.side-trend-text { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.side-more { display: block; padding: 14px 16px; color: var(--accent); }
.side-more:hover { background: var(--hover); }
.side-foot { display: flex; flex-direction: column; gap: 12px; padding: 0 4px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.foot-links a:hover { text-decoration: underline; }
.mobile-footer { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
  border: 1px solid transparent; transition: background .15s, opacity .15s; white-space: nowrap; user-select: none;
}
.btn:disabled, .btn.is-loading { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-dark { background: var(--ink); color: var(--on-ink); }
.btn-dark:hover:not(:disabled) { background: var(--ink-2); }
.btn-outline { border-color: var(--line-2); background: var(--surface); color: var(--ink); }
.btn-outline:hover:not(:disabled) { background: var(--hover); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-lg { min-height: 52px; font-size: 14px; padding: 0 24px; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; }
.icon-btn:hover { background: var(--hover); }
.icon-btn-sm { width: 34px; height: 34px; }
.link-btn { color: var(--accent); font-weight: 600; font-size: 13.5px; padding: 4px 8px; }

/* ---------- Tabs / chips ---------- */
.tabs { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 53px; z-index: 20; background: var(--bar); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.tabs a { flex: 1; position: relative; display: flex; justify-content: center; color: var(--muted); font-weight: 500; transition: background .15s; }
.tabs a:hover { background: var(--hover); }
.tabs a span { position: relative; padding: 9px 0; font-size: 13.5px; }
.tabs a.is-active { color: var(--ink); font-weight: 700; }
.tabs a.is-active::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 0; background: var(--accent); }
.tab-strip { display: flex; padding: 0 8px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tab-strip::-webkit-scrollbar { display: none; }
.tab-strip a { flex-shrink: 0; position: relative; display: flex; padding: 0 10px; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.tab-strip a span { position: relative; padding: 8px 0; }
.tab-strip a:hover { color: var(--ink); }
.tab-strip a.is-active { color: var(--ink); font-weight: 700; }
.tab-strip a.is-active::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 2px; background: var(--accent); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip-ghost { background: var(--soft); color: var(--muted); }
.chip-lg { padding: 7px 14px; font-size: 13.5px; background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); }
.chip-lg:hover { background: var(--hover); }
.chip-lg.is-active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 6px; background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn-ink); }

/* ---------- Cards ---------- */
.card { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); transition: background .15s; }
.feed .card:hover { background: var(--hover); }
.card-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.avatar { border-radius: 50%; background: var(--soft); flex-shrink: 0; object-fit: cover; }
.card-head { display: flex; align-items: center; gap: 4px; min-width: 0; line-height: 20px; }
.card-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.card-name:hover { text-decoration: underline; }
.card-handle { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.card-sep { width: 6px; flex-shrink: 0; }
.card-time { color: var(--muted); white-space: nowrap; }
.card-time:hover { text-decoration: underline; }
.card-more { margin-left: auto; margin-right: -8px; }
.card-text { display: block; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.card-text.is-large { font-size: 14px; line-height: 1.6; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.card-detail-meta { display: flex; gap: 16px; color: var(--muted); font-size: 13.5px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.card-actions { display: flex; justify-content: space-between; max-width: 425px; margin-left: -8px; }
.post.is-detail .card-actions { max-width: none; padding-top: 2px; }
.act { display: inline-flex; align-items: center; gap: 2px; min-height: 34px; padding: 0 8px 0 6px; border-radius: 999px; color: var(--muted); font-size: 13px; }
.act:hover:not(.act-static) { background: var(--accent-soft); color: var(--accent); }
.act span { min-width: 1ch; }
.act-like .icon-on { display: none; }
.act-like.is-on { color: var(--accent); }
.act-like.is-on .icon:not(.icon-on) { display: none; }
.act-like.is-on .icon-on { display: inline-block; animation: pop .3s ease; }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.blind-note { display: flex; align-items: center; gap: 6px; padding: 12px 14px; border-radius: 12px; background: var(--soft); color: var(--muted); font-size: 13.5px; }
.post.is-detail { grid-template-columns: auto 1fr; padding-top: 16px; }
.post.is-detail:hover { background: none; }

/* ---------- Media ---------- */
.media { position: relative; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--soft); margin-top: 4px; }
.media-photo:not(.is-detail) { aspect-ratio: 1 / var(--ratio, .75); max-height: 560px; }
.media-photo:not(.is-detail) img { width: 100%; height: 100%; object-fit: cover; }
.media-photo.is-detail img { width: 100%; height: auto; max-height: 80vh; object-fit: contain; background: #000; }
.media-photo img.is-full { animation: fade .25s ease; }
@keyframes fade { from { opacity: .6; } to { opacity: 1; } }
.media-video { aspect-ratio: 1 / var(--ratio, .5625); max-height: 600px; background: #000; }
.media-tap { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.media-tap img, .media-blank { width: 100%; height: 100%; object-fit: cover; display: block; background: linear-gradient(135deg, #2a2f36, #0f1419); }
.media-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; background: rgba(255, 46, 116, .92); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 24px rgba(0,0,0,.25); transition: transform .15s; }
.media-play img { margin-left: 4px; }
.media-tap:hover .media-play { transform: translate(-50%, -50%) scale(1.06); }
.media-badge { position: absolute; left: 10px; bottom: 10px; padding: 2px 8px; border-radius: 6px; background: rgba(0,0,0,.7); color: #fff; font-size: 12px; font-weight: 600; }
.media-video video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.media-voice { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--tint); border-color: var(--tint-line); }
.voice-play { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 4px 14px rgba(255,46,116,.35); }
.voice-play img { margin-left: 3px; }
.media-voice.is-playing .voice-play img { margin-left: 0; }
.voice-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 40px; min-width: 0; cursor: pointer; }
.voice-wave span { flex: 1; min-width: 2px; border-radius: 2px; background: #ffb3cd; transition: background .1s; }
.voice-wave span.is-played { background: var(--accent); }
.voice-time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); font-weight: 600; min-width: 40px; text-align: right; }

/* ---------- Ads ---------- */
.ad { position: relative; }
.ad img { width: 100%; height: auto; border-radius: var(--radius); }
.ad-label { position: absolute; top: 8px; right: 8px; z-index: 1; padding: 1px 7px; border-radius: 6px; background: rgba(0,0,0,.45); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.ad-feed { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ad-feed .ad-label { top: 20px; right: 24px; }

/* ---------- Lists & misc ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 56px 32px; }
.empty h3 { font-size: 19px; font-weight: 800; }
.empty p { color: var(--muted); max-width: 360px; }
.empty .btn { margin-top: 12px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 16px; }
.pager-num { color: var(--muted); font-weight: 600; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.list-head h2 { font-size: 14px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-head { font-size: 14px; font-weight: 800; padding: 16px 16px 8px; display: flex; gap: 8px; align-items: baseline; }
.sub-head span { color: var(--muted); font-weight: 500; font-size: 14px; }
.sub-head.danger { color: var(--danger); }
.notice { margin: 12px 16px; padding: 12px 14px; border-radius: 12px; background: var(--soft); color: var(--muted); font-size: 13.5px; }
.notice a { color: var(--accent); font-weight: 600; }
.user-list { border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.user-row { display: flex; gap: 12px; padding: 10px 16px; align-items: center; }
.user-row:hover { background: var(--hover); }
.user-row > span { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.user-row span span { color: var(--muted); font-size: 13.5px; }
.user-row em { font-style: normal; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-box { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 18px; border-radius: 999px; background: var(--soft); border: 1px solid var(--soft); }
.search-box:focus-within { background: var(--surface); border-color: var(--accent); }
.search-box input { flex: 1; border: 0; outline: none; background: transparent; font-size: 14px; min-width: 0; }

.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 16px; }
.cat-tile { position: relative; border-radius: 14px; overflow: hidden; transition: transform .15s; }
.cat-tile:hover { transform: translateY(-2px); }
.cat-tile img { width: 100%; height: auto; }
.cat-tile span { position: absolute; left: 14px; bottom: 10px; color: #fff; font-weight: 800; font-size: 14px; text-shadow: 0 1px 6px rgba(0,0,0,.25); }

.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-item { position: relative; }
.rank-no { position: absolute; z-index: 1; left: 6px; top: 8px; min-width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--ink); color: var(--on-ink); font-size: 12px; font-weight: 800; padding: 0 6px; }
.rank-item.is-top .rank-no { background: none; left: 2px; top: 2px; padding: 0; }
.rank-item .card { padding-left: 28px; }

/* ---------- Profile ---------- */
.profile { border-bottom: 1px solid var(--line); }
.profile-cover img { width: 100%; height: 200px; object-fit: cover; }
.profile-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 0 16px; }
.profile-avatar { margin-top: -56px; }
.profile-avatar .avatar { border: 4px solid var(--bg); width: 120px; height: 120px; }
.profile-actions { padding-top: 12px; }
.profile-info { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.profile-info h2 { font-size: 19px; font-weight: 800; line-height: 1.2; }
.profile-bio { white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 13.5px; }
.profile-meta span { display: inline-flex; align-items: center; gap: 4px; }
.profile-stats { display: flex; gap: 18px; color: var(--muted); font-size: 13.5px; }
.profile-stats b { color: var(--ink); }

.box { margin: 12px 16px; border: 1px solid var(--line-2); border-radius: var(--radius); }
.pad-box { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.box-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; }
.req-box { padding: 16px; background: var(--tint); border-color: var(--tint-line); display: flex; flex-direction: column; gap: 8px; }
.req-box form { display: flex; flex-direction: column; gap: 8px; }
.req-box textarea, .composer textarea, .box textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; resize: none; outline: none; background: var(--surface); font-size: 14px; line-height: 1.5;
}
.req-box textarea:focus, .composer textarea:focus, .box textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.promo { flex-direction: row; align-items: center; justify-content: space-between; background: var(--accent-soft); border-color: var(--tint-line); }
.promo p { font-size: 13.5px; }

.composer { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.composer-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.composer-bar { display: flex; align-items: center; gap: 10px; }
.composer-note { flex: 1; font-size: 12.5px; color: var(--muted); min-width: 0; }
.counter { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.counter.is-over { color: var(--danger); }
.cooldown { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn-ink); font-size: 13px; font-weight: 600; }
.cooldown::before { content: ''; width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%; border: 2px solid #f5c26b; border-top-color: var(--warn-ink); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint-row { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.attach-btn { cursor: pointer; margin-left: -8px; }
.attach-btn:hover { background: var(--accent-soft); }
.attach-preview { position: relative; border-radius: 12px; overflow: hidden; max-width: 320px; background: var(--soft); }
.attach-preview img, .attach-preview video { width: 100%; max-height: 260px; object-fit: cover; display: block; }
.attach-remove { position: absolute; top: 8px; right: 8px; background: rgba(15,20,25,.75); }
.attach-remove:hover { background: rgba(15,20,25,.9); }

.req .req-bubble { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 4px 16px 16px 16px; background: var(--soft); }
.req .req-bubble .media { margin-top: 4px; }
.req-answer { display: flex; gap: 10px; padding: 10px 0 2px; }
.req-answer > div { display: flex; flex-direction: column; padding: 10px 14px; border-radius: 16px 4px 16px 16px; background: var(--accent-soft); flex: 1; min-width: 0; }
.req-answer-name { font-weight: 700; font-size: 13px; color: var(--accent); }
.req-answer p { white-space: pre-wrap; overflow-wrap: anywhere; }
.comments .card { grid-template-columns: auto 1fr; }
.comment .card-name { max-width: 50%; }

.share-panel { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.share-row .btn { flex: 1; min-width: 120px; }
.share-row.is-big { flex-direction: column; }
.share-row.is-big .btn { min-height: 50px; font-size: 14px; }
.share-x { background: #000; color: #fff; }
.share-x:hover { background: #272c30; }
.share-line { background: #06c755; color: #fff; }
.share-line:hover { background: #05b34c; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; position: relative; }
.label { font-weight: 700; font-size: 13.5px; }
.hint { font-size: 12.5px; color: var(--muted); }
.field-error { color: var(--danger); font-size: 13px; font-weight: 600; }
.field input:not([type='checkbox']):not([type='file']), .field textarea, .copy-field input {
  width: 100%; min-height: 50px; border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; font-size: 14px; outline: none; background: var(--surface); transition: border .15s, box-shadow .15s;
}
.field textarea { resize: none; line-height: 1.55; }
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input:disabled { background: var(--soft); color: var(--muted); }
.field .counter { position: absolute; right: 12px; bottom: 8px; }
.input-prefix { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); transition: border .15s, box-shadow .15s; }
.input-prefix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-prefix span { padding-left: 14px; color: var(--muted); font-weight: 600; }
.field .input-prefix input { border: 0 !important; box-shadow: none !important; padding-left: 4px; }
.input-pass { position: relative; }
.input-pass input { padding-right: 70px !important; }
.input-pass .link-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.stack { display: flex; flex-direction: column; gap: 18px; margin-top: 20px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; line-height: 1.5; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-box { width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px; border: 2px solid var(--line-2); display: flex; align-items: center; justify-content: center; transition: all .15s; margin-top: 0; }
.check-box img { opacity: 0; transition: opacity .15s; }
.check input:checked + .check-box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .check-box img { opacity: 1; }
.check input:focus-visible + .check-box { box-shadow: 0 0 0 3px var(--accent-soft); }
.check a { color: var(--accent); font-weight: 600; text-decoration: underline; }
.warn-box { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13.5px; font-weight: 600; }

/* Custom select (no native <select>) */
.select { position: relative; }
.select-btn {
  width: 100%; min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); text-align: left; font-size: 14px; transition: border .15s, box-shadow .15s;
}
.select.is-open .select-btn, .select-btn:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.select.is-open .select-btn img:last-child { transform: rotate(180deg); }
.select-btn img { transition: transform .15s; }
.select-inline { width: auto; min-height: 36px; border-radius: 999px; font-size: 13.5px; font-weight: 600; padding: 0 12px; gap: 6px; }
.select-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); max-height: 320px; overflow-y: auto; display: none;
}
.select.is-open .select-list { display: block; animation: drop .14s ease-out; }
.select-list li { display: flex; align-items: center; gap: 10px; padding: 12px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.select-list li:hover, .select-list li:focus { background: var(--soft); outline: none; }
.select-list li span { flex: 1; }
.select-check { opacity: 0; }
.select-list li[aria-selected='true'] { font-weight: 700; }
.select-list li[aria-selected='true'] .select-check { opacity: 1; }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Dropdown menus */
.dd { position: relative; }
.dd-menu {
  position: absolute; z-index: 70; top: calc(100% + 4px); left: 0; min-width: 220px; padding: 6px;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); display: none;
}
.dd.is-open .dd-menu { display: block; animation: drop .14s ease-out; }
.dd-right { left: auto; right: 0; }
.dd-up { top: auto; bottom: calc(100% + 6px); }
.dd-menu a, .dd-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: 10px; font-size: 14px; font-weight: 600; text-align: left; }
.dd-menu a:hover, .dd-menu button:hover { background: var(--soft); }
.dd-menu .is-current { color: var(--accent); justify-content: space-between; }
.dd-menu a[role='menuitemradio'] { justify-content: space-between; }
.dd-menu .is-danger { color: var(--accent); }
.dd-menu form { margin: 0; }
.lang-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13px; font-weight: 600; }
.lang-btn:hover { background: var(--hover); }
.lang-wide { align-self: flex-start; }

/* Toggle switch */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); cursor: pointer; font-weight: 500; }
.toggle { width: 46px; height: 28px; border-radius: 14px; background: var(--line-2); position: relative; flex-shrink: 0; transition: background .2s; }
.toggle span { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.toggle-row input:checked + .toggle { background: var(--accent); }
.toggle-row input:checked + .toggle span { transform: translateX(18px); }
.toggle-row input:focus-visible + .toggle { box-shadow: 0 0 0 3px var(--accent-soft); }
.settings { display: flex; flex-direction: column; }
.settings form { display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.settings form:last-child { border-bottom: 0; }
.settings .sub-head { padding-left: 0; }
.settings > form > .btn, .settings form > .btn { align-self: flex-start; }

/* Auth */
.auth { max-width: 440px; margin: 0 auto; padding: 32px 20px 48px; display: flex; flex-direction: column; gap: 10px; }
.auth-logo { margin-bottom: 8px; }
.auth h2 { font-size: 24px; font-weight: 800; line-height: 1.25; }
.auth-form { display: flex; flex-direction: column; gap: 18px; margin-top: 16px; }
.auth-switch { color: var(--muted); margin-top: 12px; }
.auth-switch a { color: var(--accent); font-weight: 700; }

/* Upload */
.upload-hub { display: flex; flex-direction: column; gap: 12px; padding: 4px 16px 24px; }
.hub-tile { display: flex; align-items: center; gap: 16px; padding: 18px; border: 1px solid var(--line-2); border-radius: 18px; transition: background .15s, transform .15s; }
.hub-tile:hover { background: var(--soft); transform: translateY(-1px); }
.hub-icon { width: 60px; height: 60px; border-radius: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hub-photo .hub-icon { background: linear-gradient(135deg, #7b61ff, #3ec6ff); }
.hub-video .hub-icon { background: linear-gradient(135deg, #ff2e74, #ff8a5b); }
.hub-voice .hub-icon { background: linear-gradient(135deg, #00b894, #55efc4); }
.hub-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.hub-text b { font-size: 15px; }
.hub-text span { color: var(--muted); font-size: 13.5px; }
.hub-text em { font-style: normal; font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.upload-form { display: flex; flex-direction: column; gap: 18px; padding-bottom: 32px; }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 20px; text-align: center;
  border: 2px dashed var(--tint-line); border-radius: 18px; background: var(--tint); cursor: pointer; transition: background .15s, border-color .15s;
}
.drop:hover, .drop.is-over { background: var(--accent-soft); border-color: var(--accent); }
.drop-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--surface); display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(255,46,116,.15); margin-bottom: 6px; }
.drop b { font-size: 14px; }
.drop-limit { font-size: 13px; color: var(--muted); }
.preview { border: 1px solid var(--line-2); border-radius: 18px; overflow: hidden; }
.preview-media { background: #0f1419; display: flex; justify-content: center; }
.preview-media img, .preview-media video { max-width: 100%; max-height: 60vh; display: block; }
.preview-media audio { width: 100%; margin: 20px; }
.preview-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; }
.preview-info { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.preview .field-error { padding: 0 14px 12px; }
.progress { position: relative; height: 36px; border-radius: 10px; background: var(--soft); overflow: hidden; }
.progress span { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }
.progress em { position: relative; z-index: 1; display: flex; height: 100%; align-items: center; justify-content: center; font-style: normal; font-weight: 700; font-size: 13px; }
.complete { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 32px 20px 24px; border-bottom: 1px solid var(--line); }
.complete h2 { font-size: 20px; font-weight: 800; }
.complete p { color: var(--muted); }
.complete .share-row { width: 100%; max-width: 380px; margin-top: 8px; }
.copy-field { display: flex; gap: 8px; width: 100%; max-width: 380px; }
.copy-field input { flex: 1; min-height: 40px; font-size: 13.5px; color: var(--muted); }
.complete-actions { display: flex; gap: 10px; }
.complete-actions .btn { flex: 1; }

/* Legal docs */
.doc { padding-bottom: 40px; }
.doc h1 { font-size: 22px; font-weight: 800; line-height: 1.3; margin-top: 8px; }
.doc-updated { color: var(--muted); font-size: 13px; margin-top: 6px; }
.doc-intro { margin-top: 16px; color: var(--ink-2); }
.doc section { margin-top: 28px; }
.doc section h2 { font-size: 15px; font-weight: 800; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.doc ul:not(.select-list) { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.doc ul:not(.select-list) li::marker { color: var(--accent); }
.doc-links { margin-top: 36px; border-top: 1px solid var(--line); }
.doc-links a { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.level-table { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.level { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 14px; border: 1px solid var(--line-2); }
.level-tag { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 3px 10px; border-radius: 999px; color: #fff; font-weight: 700; font-size: 13px; }
.level-ok { background: var(--ok-soft); border-color: #bfe9d6; }
.level-ok .level-tag { background: var(--ok); }
.level-limit { background: var(--warn-soft); border-color: #ffe0a3; }
.level-limit .level-tag { background: var(--warn); }
.level-ng { background: var(--danger-soft); border-color: var(--danger-line); }
.level-ng .level-tag { background: var(--danger); }
.partner-hero img { width: 100%; height: 200px; object-fit: cover; }
.point-list { list-style: none; padding: 0 !important; margin-top: 16px !important; }
.point-list li { display: flex; align-items: center; gap: 10px; font-weight: 600; }

/* Admin */
.admin-list { display: flex; flex-direction: column; }
.admin-row { display: flex; gap: 12px; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.admin-row-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.admin-row-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.admin-preview { font-weight: 600; overflow-wrap: anywhere; }
.admin-preview:hover { text-decoration: underline; }
.admin-reasons { font-size: 13px; color: var(--accent); }
.admin-row-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

/* ---------- Modal (custom, replaces alert/confirm) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200; background: rgba(15, 20, 25, .45); display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadein .15s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 420px; max-height: calc(100vh - 40px); overflow-y: auto; background: var(--surface); border-radius: 22px;
  padding: 26px 24px 20px; display: flex; flex-direction: column; gap: 14px; animation: pop-in .18s ease-out;
}
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.modal-icon { align-self: center; width: 60px; height: 60px; border-radius: 50%; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
.modal-title { font-size: 17px; font-weight: 800; text-align: center; line-height: 1.35; }
.modal-body { color: var(--ink-2); font-size: 14px; text-align: center; white-space: pre-wrap; }
.modal-body.is-left { text-align: left; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.modal-actions .btn { min-height: 48px; }
.modal-cred { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: var(--soft); border: 1px dashed var(--line-2); }
.modal-cred div { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-cred span { color: var(--muted); font-size: 13px; font-weight: 600; }
.modal-cred code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; text-align: right; }
.reason-list { display: flex; flex-direction: column; gap: 6px; }
.reason { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; font-weight: 600; font-size: 14px; text-align: left; transition: all .12s; }
.reason:hover { background: var(--soft); }
.reason.is-selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.reason-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.reason.is-selected .reason-dot { border-color: var(--accent); }
.reason.is-selected .reason-dot::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.sent { display: flex; flex-direction: column; gap: 12px; }

/* Toast */
#toast-root { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--accent); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 13.5px; box-shadow: 0 6px 20px rgba(0,0,0,.18); animation: toast-in .2s ease-out; text-align: center; }
.toast.is-dark { background: var(--ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 1279px) {
  :root { --rail-w: 88px; }
  .rail { align-items: center; padding: 4px 8px 16px; }
  .rail-word, .rail-item span, .rail-post span, .rail-me-text, .rail-me > img.icon { display: none; }
  .rail-item { padding: 12px; }
  .rail-item.is-active::after { position: absolute; margin: 0; transform: translate(18px, -14px); }
  .rail-post { width: 52px; height: 52px; padding: 0; min-height: 0; }
  .rail-me { padding: 6px; justify-content: center; }
  .rail-auth { display: none; }
  .rail-account .dd-menu { left: 0; }
}
@media (max-width: 1079px) {
  .side { display: none; }
  .mobile-footer { display: block; padding: 24px 16px 32px; border-top: 1px solid var(--line); }
}
@media (max-width: 699px) {
  body { font-size: 14px; }
  .rail { display: none; }
  .main { width: 100%; border: 0; padding-bottom: env(safe-area-inset-bottom); }
  .topbar { padding: 4px 8px 4px 12px; min-height: 50px; }
  .topbar-logo { display: flex; }
  .tabs { top: 50px; }
  .head-title h1 { font-size: 14px; }
  .head-title span { font-size: 12px; }
  .lang-btn span { display: none; }
  .lang-btn { width: 36px; padding: 0; justify-content: center; }
  .lang-btn img:last-child { display: none; }

  /* Full-width cards: media runs edge to edge without side gutters. */
  .card.post { display: block; position: relative; padding: 12px 0 4px; }
  .card.post .card-avatar { position: absolute; left: 12px; top: 12px; }
  .card.post .card-avatar .avatar { width: 40px; height: 40px; }
  .card.post .card-main { gap: 8px; }
  .card.post .card-head { padding: 0 12px 0 60px; min-height: 40px; flex-wrap: wrap; row-gap: 0; }
  .card.post .card-head .card-name { max-width: 100%; }
  .card.post .card-more { position: absolute; right: 12px; top: 10px; margin: 0; }
  .card.post .card-text, .card.post .card-tags, .card.post .blind-note, .card.post .card-detail-meta { margin: 0 12px; }
  .card.post .media { border-radius: 0; border-left: 0; border-right: 0; margin: 2px 0 0; }
  .card.post .media-voice { margin: 2px 12px 0; border-radius: var(--radius); border: 1px solid var(--tint-line); }
  .card.post .media-photo:not(.is-detail) { max-height: 75vh; }
  .card.post .card-actions { margin: 0 4px; max-width: none; }
  .rank-item .card.post { padding-left: 0; }
  .rank-no { top: 52px; left: 12px; }
  .rank-item.is-top .rank-no { top: 48px; left: 18px; }
  .ad-feed { padding: 8px 0; }
  .ad-feed img { border-radius: 0; }
  .ad-feed .ad-label { top: 16px; right: 10px; }
  .box { margin: 12px 0; border-radius: 0; border-left: 0; border-right: 0; }
  .cat-grid { padding: 12px; gap: 10px; }
  .profile-cover img { height: 140px; }
  .profile-avatar { margin-top: -44px; }
  .profile-avatar .avatar { width: 92px; height: 92px; }

  /* Modals become bottom sheets on phones. */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 22px 22px 0 0; padding: 12px 20px calc(20px + env(safe-area-inset-bottom)); animation: sheet .22s ease-out; max-height: 90vh; }
  .modal::before { content: ''; align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin-bottom: 8px; }
  @keyframes sheet { from { transform: translateY(100%); } to { transform: none; } }
  #toast-root { bottom: calc(16px + env(safe-area-inset-bottom)); }
  .share-row .btn { min-width: 0; }
  .promo { flex-direction: column; align-items: stretch; text-align: left; }
}
@media (hover: none) {
  .feed .card:hover, .tabs a:hover { background: none; }
}

/* ---------- Compact horizontal rows (home, search, category, rank, profile, related) ---------- */
.rows > .ad-feed { border-bottom: 1px solid var(--line); }
.tile { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.tile:hover { background: var(--hover); }
.tile-media { position: relative; flex-shrink: 0; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; background: var(--soft); }
.tile-link { position: absolute; inset: 0; display: block; }
.tile-link img { width: 100%; height: 100%; object-fit: cover; }
.tile-video .tile-media { background: #1c2733; }
.tile-voice .tile-media { background: linear-gradient(150deg, #ff2e74, #ff8a5b); }
.tile-text .tile-media { background: var(--accent-soft); }
.tile-glyph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.tile-center, .tile-dur { pointer-events: none; position: absolute; }
.tile-center { top: 50%; left: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px; border-radius: 50%; background: rgba(15,20,25,.5); display: flex; align-items: center; justify-content: center; }
.tile-center img { margin-left: 2px; }
.tile-play { position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; background: rgba(15,20,25,.3); border: 2px solid #fff; box-shadow: none; }
.tile-dur { right: 4px; bottom: 4px; padding: 1px 6px; border-radius: 8px; background: rgba(15,20,25,.65); color: #fff; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 0; text-align: center; }
.tile-rank { flex-shrink: 0; width: 26px; text-align: center; font-size: 14px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.tile-rank.is-medal img { margin: 0 auto; }
.tile-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tile-cap { font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--ink); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; word-break: break-word; }
.tile-meta { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--muted); }
.tile-meta .avatar { flex-shrink: 0; }
.tile-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-stats { gap: 12px; flex-wrap: nowrap; overflow: hidden; }
.tile-stats > span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tile-time { margin-left: auto; }
.related { border-top: 1px solid var(--line); }
.related .sub-head a:hover { text-decoration: underline; }

@media (max-width: 699px) {
  .tile { gap: 10px; padding: 7px 12px; }
  .tile-media { width: 76px; height: 76px; border-radius: 8px; }
  .tile-cap { font-size: 13.5px; }
  .tile-meta { font-size: 12px; }
  .tile-stats { gap: 9px; }
  .tile-rank { width: 20px; font-size: 13px; }
  .tile-rank.is-medal img { width: 22px; height: 22px; }
}
@media (max-width: 380px) {
  .tile-stats > span:nth-child(1) { display: none; }
}
@media (hover: none) { .tile:hover { background: none; } }

/* ---------- Header search button + search sheet ---------- */
.topbar-search { display: none; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.search-sheet { display: flex; flex-direction: column; gap: 18px; }
.search-sheet-sec { display: flex; flex-direction: column; gap: 10px; }
.search-sheet-head { display: flex; align-items: center; justify-content: space-between; min-height: 28px; }
.search-sheet-head h3 { font-size: 14px; font-weight: 800; }
.modal.modal-search { max-width: 560px; gap: 16px; }
.modal.modal-search .modal-title { text-align: left; font-size: 15px; }
@media (max-width: 1079px) {
  .topbar-search { display: inline-flex; }
}
@media (max-width: 699px) {
  .topbar-search { width: 36px; height: 36px; }
  /* On phones the search sheet drops from the top so the keyboard never covers it. */
  .modal-backdrop.is-modal-search { align-items: flex-start; }
  .modal.modal-search { border-radius: 0 0 22px 22px; padding: calc(14px + env(safe-area-inset-top)) 16px 20px; animation: sheet-down .22s ease-out; max-height: 85vh; overflow-y: auto; }
  .modal.modal-search::before { display: none; }
  @keyframes sheet-down { from { transform: translateY(-100%); } to { transform: none; } }
}

/* ---------- Header menu button + slide-in menu (phones) ---------- */
.topbar-menu { display: none; margin-left: -6px; }
.topbar-random:hover, .topbar-search:hover, .topbar-menu:hover { background: var(--hover); }
.drawer { position: fixed; inset: 0; z-index: 150; background: rgba(15,20,25,0); transition: background .2s ease; }
.drawer.is-open { background: rgba(15,20,25,.4); }
.drawer-panel {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(300px, 84vw); overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 12px; padding: calc(8px + env(safe-area-inset-top)) 12px calc(20px + env(safe-area-inset-bottom));
  background: var(--bg); box-shadow: 0 0 24px rgba(15,20,25,.18);
  transform: translateX(-100%); transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.drawer.is-open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head .rail-logo { padding: 6px; }
.drawer-me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; }
.drawer-me:hover { background: var(--hover); }
.drawer-me > span { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.drawer-me b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-me span span { color: var(--muted); font-size: 13px; }
.drawer-auth { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.drawer-post { min-height: 46px; }
.drawer-nav { display: flex; flex-direction: column; }
.drawer-item { display: flex; align-items: center; gap: 16px; width: 100%; padding: 12px; border-radius: 12px; font-size: 14px; font-weight: 500; text-align: left; }
.drawer-item:hover { background: var(--hover); }
.drawer-item.is-active { font-weight: 800; }
.drawer-langs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.drawer-langs a.is-current { color: var(--accent); font-weight: 700; }
.drawer-foot { padding: 4px 12px 0; border-top: 1px solid var(--line); }
@media (max-width: 699px) {
  .topbar-menu { display: inline-flex; width: 38px; height: 38px; }
  .topbar-random { width: 36px; height: 36px; }
  .topbar-end { gap: 2px; }
  .topbar-logo img { width: 28px; height: 28px; }
}
@media (max-width: 1279px) { .topbar-menu { display: inline-flex; } }
@media (min-width: 1280px) { .drawer { display: none !important; } }

/* ---------- Client-side navigation: loading bar only, no page transition ---------- */
.nav-progress { position: fixed; z-index: 300; top: 0; left: 0; height: 3px; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: 0; pointer-events: none; }
.nav-progress.is-loading { opacity: 1; animation: nav-load 8s cubic-bezier(.1,.7,.2,1) forwards; }
.nav-progress.is-done { opacity: 0; width: 100%; transition: width .15s ease, opacity .3s ease .15s; }
@keyframes nav-load { from { width: 0; } to { width: 90%; } }
@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-panel { transition: none; }
}

/* ---------- First-visit welcome (language + sign-in) ---------- */
.welcome { display: flex; flex-direction: column; gap: 18px; }
.welcome-sec { display: flex; flex-direction: column; gap: 10px; }
.welcome-sec h3 { font-size: 13.5px; font-weight: 800; color: var(--muted); }
.welcome-langs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.welcome-lang { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); font-weight: 600; text-align: left; }
.welcome-lang:hover { background: var(--hover); }
.welcome-lang.is-current { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.welcome-auth { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.welcome-auth .btn { min-height: 46px; }
.modal.modal-welcome .modal-title { font-size: 18px; }
.modal.modal-welcome .modal-body { color: var(--muted); }
.btn-ghost { background: transparent; color: var(--muted); border: 0; }
.btn-ghost:hover { background: var(--hover); color: var(--ink); }

/* ---------- Requests: to everyone / to someone ---------- */
.want-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; }
.want-label { font-size: 13px; font-weight: 700; color: var(--muted); margin-right: 4px; }
.want-opt span { display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.want-opt span:hover { background: var(--hover); }
.want-opt input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.want-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.to-field { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; padding: 0 12px; height: 42px; border: 1px solid var(--line-2); border-radius: 12px; }
.to-field:focus-within { border-color: var(--accent); }
.to-field span { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.to-field input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 14px; }
.field-inline { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.field-inline .label { margin: 0; white-space: nowrap; }
.field-inline .select { flex: 1; }
.req-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.req-cta { margin-top: 10px; }
.req-cta .btn { display: inline-flex; gap: 4px; }
.for-request { display: flex; align-items: flex-start; gap: 10px; margin: 12px 16px 4px; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--ink); }
.upload-form .for-request { margin: 0 0 14px; }
.for-request > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.for-request b { font-size: 13px; color: var(--accent); }
.for-request span span { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }

/* ---------- List rows: inline voice player, lightbox ---------- */
button.tile-link { padding: 0; border: 0; cursor: zoom-in; background: none; }
.tile.is-stack { align-items: flex-start; }
.tile-stack { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.tile-stack .media-voice { margin: 0; border-radius: 12px; border: 1px solid var(--tint-line); padding: 8px 12px; gap: 10px; }
.tile-stack .media-voice .voice-play { width: 38px; height: 38px; }
.tile-stack .media-voice .voice-wave { height: 30px; }
.lightbox { position: fixed; inset: 0; z-index: 250; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; animation: fadein .15s ease; }
.lightbox-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 56px 12px 72px; }
.lightbox-stage img, .lightbox-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; background: #000; }
.lightbox-close { position: absolute; z-index: 1; top: calc(8px + env(safe-area-inset-top)); right: 8px; background: rgba(255,255,255,.12); }
.lightbox-close:hover { background: rgba(255,255,255,.22); }
.lightbox-open { position: absolute; z-index: 1; bottom: calc(16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.3); }
.lightbox-open:hover { background: rgba(255,255,255,.24); }

.req-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.req-foot .act { margin-left: -8px; }
.req-respond { display: inline-flex; gap: 4px; }
.strip-row { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); padding-right: 8px; }
.strip-row .tab-strip { flex: 1; min-width: 0; border-bottom: 0; }
.strip-row .select-inline { height: 32px; font-size: 13px; }

/* ---------- Adult policy bits ---------- */
.chip-origin { background: var(--ink); color: var(--on-ink); margin-right: 6px; vertical-align: 1px; font-size: 11px; padding: 1px 6px; }
.declare { font-size: 13px; color: var(--ink-2); align-items: flex-start; }
.declare.is-invalid .check-box { border-color: var(--danger); }
.modal-backdrop.is-modal-age { background: rgba(0, 0, 0, .92); }

/* iOS zooms into inputs under 16px */
@media (max-width: 767px) {
  input:not([type='checkbox']):not([type='radio']), textarea { font-size: 16px !important; }
}

/* ---------- Ranking windows (mobile first: one full-width row, big touch targets) ---------- */
.rank-window { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.rank-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: stretch; }
.rank-form input[type='number'] { width: 100%; min-width: 0; height: 44px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 12px; outline: none; background: var(--surface); font-size: 16px; }
.rank-form input[type='number']:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rank-form .select { min-width: 0; }
.rank-form .select-btn { min-height: 44px; height: 100%; }
.rank-form .btn { min-height: 44px; padding: 0 18px; }
.rank-note { padding: 8px 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }

/* ---------- Select picker modal ---------- */
.modal.modal-picker .modal-title { text-align: left; font-size: 15px; }
.picker-list { display: flex; flex-direction: column; gap: 2px; margin: 0 -6px; max-height: 60vh; overflow-y: auto; }
.picker-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; padding: 0 12px; border-radius: 12px; font-size: 15px; font-weight: 600; text-align: left; }
.picker-item:hover, .picker-item:focus-visible { background: var(--soft); outline: none; }
.picker-item.is-current { color: var(--accent); }

/* ---------- AI translation notice ---------- */
.ai-note { display: flex; align-items: flex-start; gap: 6px; padding: 8px 10px; border-radius: 10px; background: var(--warn-soft); color: var(--warn-ink); font-size: 12.5px; font-weight: 600; line-height: 1.45; }
.ai-note img.icon { margin-top: 1px; }
.drawer .ai-note { margin: 4px 16px 8px; }
.picker-body { display: flex; flex-direction: column; gap: 10px; }
.foot-ai { flex-basis: 100%; color: var(--warn-ink); }
.welcome-lang-dd .select-btn { width: 100%; min-height: 46px; gap: 8px; }
.welcome-lang-dd .select-label { flex: 1; text-align: left; font-weight: 600; }
.drawer .foot-ai { display: none; }

/* ---------- Dark theme: follows the system unless the visitor picked one (html[data-theme]) ---------- */
:root[data-theme='dark'] {
  color-scheme: dark;
  --ink: #e7e9ea;
  --ink-2: #c9ced3;
  --muted: #8b98a5;
  --faint: #66727e;
  --line: #2a2e33;
  --line-2: #3a4047;
  --bg: #0e1013;
  --surface: #171a1e;
  --soft: #1e2227;
  --hover: rgba(255, 255, 255, 0.05);
  --bar: rgba(14, 16, 19, 0.88);
  --on-ink: #0e1013;
  --accent-soft: rgba(255, 46, 116, 0.16);
  --tint: rgba(255, 46, 116, 0.07);
  --tint-line: rgba(255, 46, 116, 0.32);
  --accent-ink: #ff8fb3;
  --ok-soft: rgba(0, 163, 108, 0.18);
  --warn-soft: rgba(245, 159, 0, 0.14);
  --warn-ink: #f5c26b;
  --danger-soft: rgba(244, 33, 46, 0.12);
  --danger-line: rgba(244, 33, 46, 0.4);
  --shadow: 0 0 0 1px #2a2e33, 0 10px 30px rgba(0, 0, 0, 0.55);
}
:root[data-theme='dark'] img.icon:not([src*='-muted']):not([src*='-accent']):not([src*='-white']), :root[data-theme='dark'] img[src*='logo-word'] { filter: invert(1) hue-rotate(180deg); }
:root[data-theme='dark'] img.icon[src*='-muted'] { filter: brightness(1.55); }
:root[data-theme='dark'] .media-voice .voice-wave span:not(.is-played) { background: rgba(255, 46, 116, 0.35); }
@media (prefers-color-scheme: dark) {
:root:not([data-theme='light']) {
  color-scheme: dark;
  --ink: #e7e9ea;
  --ink-2: #c9ced3;
  --muted: #8b98a5;
  --faint: #66727e;
  --line: #2a2e33;
  --line-2: #3a4047;
  --bg: #0e1013;
  --surface: #171a1e;
  --soft: #1e2227;
  --hover: rgba(255, 255, 255, 0.05);
  --bar: rgba(14, 16, 19, 0.88);
  --on-ink: #0e1013;
  --accent-soft: rgba(255, 46, 116, 0.16);
  --tint: rgba(255, 46, 116, 0.07);
  --tint-line: rgba(255, 46, 116, 0.32);
  --accent-ink: #ff8fb3;
  --ok-soft: rgba(0, 163, 108, 0.18);
  --warn-soft: rgba(245, 159, 0, 0.14);
  --warn-ink: #f5c26b;
  --danger-soft: rgba(244, 33, 46, 0.12);
  --danger-line: rgba(244, 33, 46, 0.4);
  --shadow: 0 0 0 1px #2a2e33, 0 10px 30px rgba(0, 0, 0, 0.55);
}
:root:not([data-theme='light']) img.icon:not([src*='-muted']):not([src*='-accent']):not([src*='-white']), :root:not([data-theme='light']) img[src*='logo-word'] { filter: invert(1) hue-rotate(180deg); }
:root:not([data-theme='light']) img.icon[src*='-muted'] { filter: brightness(1.55); }
:root:not([data-theme='light']) .media-voice .voice-wave span:not(.is-played) { background: rgba(255, 46, 116, 0.35); }
}

/* Requests: only the sort picker remains on the strip row */
.strip-row.strip-end { justify-content: flex-end; }

/* ---------- Dock: bar pinned to the bottom of the main column (comment box on a post) ---------- */
/* Sticky as the last child of .main: it stays on screen while scrolling and takes the column's width on desktop. */
.dock {
  position: sticky; bottom: 0; z-index: 30; margin-top: auto;
  background: var(--bar); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.composer-dock { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; border-bottom: 0; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer-row .avatar { flex-shrink: 0; margin-bottom: 2px; }
.composer-dock textarea { flex: 1; min-width: 0; min-height: 38px; max-height: 140px; padding: 8px 14px; border-radius: 20px; overflow-y: auto; }
.composer-dock .btn { flex-shrink: 0; height: 38px; }
.composer-meta { display: flex; align-items: center; gap: 8px; padding-left: 40px; font-size: 11.5px; }
.composer-meta .composer-note, .composer-meta .counter { font-size: 11.5px; }
.composer-meta .composer-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-dock .cooldown { padding: 6px 10px; font-size: 12px; }
/* Toasts sit above the dock instead of covering it. */
body:has(.dock) #toast-root { bottom: calc(110px + env(safe-area-inset-bottom)); }

/* Voice-language filter at the end of a strip row: just a globe for "all", globe + language when filtering */
.vl-pick { flex-shrink: 0; }
.strip-row .vl-pick .select-btn { height: 30px; padding: 0 8px; gap: 4px; }
.vl-pick.is-all .select-label, .vl-pick.is-all .select-btn > :last-child { display: none; }
.vl-pick:not(.is-all) .select-btn { border-color: var(--accent); color: var(--accent-ink); }
