/* ==========================================================================
   Robbit Shreddit UI 2.0 - 1:1 Modern Reddit (2024-2026) Design System
   Pure Local CSS (< 20KB, Zero External CDN Dependency)
   ========================================================================== */

:root {
  --canvas: #0B1416;
  --surface: #0E1A1D;
  --surface-hover: #131F23;
  --widget-bg: #04090A;
  --pill-bg: #1A282D;
  --pill-hover: #223237;
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text-main: #F2F4F5;
  --text-body: #B8C5C9;
  --text-muted: #82959B;
  --orangered: #FF4500;
  --orangered-hover: #D93900;
  --periwinkle: #7193FF;
  --online-green: #46D160;
  --reddit-blue: #629FFF;
}

[v-cloak] { display: none !important; }

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  background-color: var(--canvas);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 自定义滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #223237; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #33464D; }

/* ==========================================================================
   1. 顶部通栏导航 Header (56px Sticky)
   ========================================================================== */
.shreddit-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  background-color: var(--canvas);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.snoo-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--orangered);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255, 69, 0, 0.35);
}

.wordmark {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #fff;
}

.header-search {
  flex: 1;
  max-width: 560px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrap {
  width: 100%;
  height: 40px;
  background-color: var(--pill-bg);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s ease;
}

.search-input-wrap:hover {
  background-color: var(--pill-hover);
}

.search-input-wrap:focus-within {
  background-color: var(--surface);
  border-color: var(--border-strong);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.875rem;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 顶部胶囊按钮 */
.pill-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  color: var(--text-main);
  background: transparent;
}

.pill-btn:hover {
  background-color: var(--pill-bg);
}

.pill-btn-surface {
  background-color: var(--pill-bg);
}

.pill-btn-surface:hover {
  background-color: var(--pill-hover);
}

.pill-btn-orange {
  background-color: var(--orangered-hover);
  color: #fff;
}

.pill-btn-orange:hover {
  background-color: var(--orangered);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--pill-bg);
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
}

.avatar-wrap {
  position: relative;
  display: inline-flex;
}

.online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background-color: var(--online-green);
  border: 1.5px solid var(--canvas);
  border-radius: 50%;
}

/* ==========================================================================
   2. 主体三栏网格布局 (Left Drawer + Center Feed + Right Widget)
   ========================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: calc(100vh - 56px);
}

.main-workspace {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 24px 48px;
  display: grid;
  grid-template-columns: minmax(0, 740px) 316px;
  gap: 24px;
  justify-content: center;
}

@media (max-width: 1200px) {
  .main-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .right-rail {
    display: none;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .left-drawer {
    display: none;
  }
  .main-workspace {
    padding: 12px;
  }
}

/* ==========================================================================
   3. 左侧通高导航栏 (Left Navigation Rail)
   ========================================================================== */
.left-drawer {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  border-right: 1px solid var(--border-subtle);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  user-select: none;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-divider {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: 12px 0;
}

.nav-group-header {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-item {
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-body);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover {
  background-color: var(--surface-hover);
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--pill-bg);
  color: var(--text-main);
  font-weight: 600;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sub-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.nav-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.06);
  padding: 1px 7px;
  border-radius: 999px;
}

.drawer-footer {
  padding: 12px 8px 4px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.lang-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--surface-hover);
  border: 1px solid var(--border-subtle);
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 10px;
  color: var(--text-main);
}

.lang-box select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.lang-box select option {
  background: var(--surface);
  color: var(--text-main);
}

/* ==========================================================================
   4. 中间信息流头部 & 排序栏 (Subreddit Header & Sort Bar)
   ========================================================================== */
.sub-banner {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
}

.sub-banner-strip {
  height: 56px;
  background: linear-gradient(90deg, #FF4500 0%, #FF6B00 45%, #1A282D 100%);
}

.sub-banner-body {
  padding: 0 20px 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: -22px;
  flex-wrap: wrap;
  gap: 12px;
}

.sub-banner-identity {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.sub-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--orangered);
  border: 4px solid var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.sub-title-main {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.2;
}

.sub-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sort-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 10px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.sort-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sort-pill {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.12s;
}

.sort-pill:hover {
  background-color: var(--surface-hover);
  color: var(--text-main);
}

.sort-pill.active {
  background-color: var(--pill-bg);
  color: var(--text-main);
}

/* ==========================================================================
   5. 现代版 Reddit 帖子卡片 (Shreddit Post Card)
   ========================================================================== */
.post-divider {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 2px 0;
}

.shreddit-post {
  padding: 12px 16px;
  border-radius: 16px;
  transition: background-color 0.15s ease;
  cursor: pointer;
  margin: 4px 0;
}

.shreddit-post:hover {
  background-color: var(--surface-hover);
}

/* 第一行：顶部署名元信息流 (Credit Bar) */
.post-credit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.credit-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.avatar-xs {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1A282D;
  object-fit: cover;
}

.sub-name-bold {
  font-weight: 700;
  color: var(--text-main);
}

.sub-name-bold:hover {
  text-decoration: underline;
}

.user-handle {
  color: var(--text-body);
  font-weight: 500;
}

.dot-sep {
  color: var(--text-muted);
}

/* Reddit Flair 胶囊标签 */
.flair-bot {
  background: rgba(70, 209, 96, 0.14);
  color: #46D160;
  border: 1px solid rgba(70, 209, 96, 0.3);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.flair-persona {
  background: rgba(113, 147, 255, 0.15);
  color: #8CA8FF;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
}

.flair-topic {
  background: var(--pill-bg);
  color: var(--text-body);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
}

/* 第二行：帖子标题 */
.shreddit-post-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.38;
  margin-bottom: 8px;
}

/* 第三行：内嵌视频窗与正文摘要 */
.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 10px 0;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-subtle);
}

.video-container iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.shreddit-post-body {
  font-size: 0.875rem;
  color: var(--text-body);
  line-height: 1.55;
  margin-bottom: 10px;
  white-space: pre-line;
  word-break: break-word;
}

/* 第四行：标志性底部胶囊互动栏 (Action Pills) */
.post-action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.action-pill {
  height: 32px;
  background-color: var(--pill-bg);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  user-select: none;
  transition: background-color 0.12s;
}

.action-pill:hover {
  background-color: var(--pill-hover);
}

.vote-btn-icon {
  height: 32px;
  width: 32px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s;
}

.vote-btn-icon.up:hover, .vote-btn-icon.up.active {
  color: var(--orangered);
  background-color: rgba(255, 69, 0, 0.16);
}

.vote-btn-icon.down:hover, .vote-btn-icon.down.active {
  color: var(--periwinkle);
  background-color: rgba(113, 147, 255, 0.16);
}

.vote-count-label {
  padding: 0 4px;
  min-width: 20px;
  text-align: center;
}

.action-pill-btn {
  border: none;
  padding: 0 12px;
  gap: 6px;
  cursor: pointer;
}

.source-link-pill {
  color: var(--reddit-blue);
  text-decoration: none;
  padding: 0 12px;
  gap: 5px;
}

.source-link-pill:hover {
  text-decoration: underline;
}

/* ==========================================================================
   6. 右侧 r/Robbit 社区信息卡 (Right Community Sidebar Widget)
   ========================================================================== */
.right-rail {
  position: relative;
}

.community-widget {
  position: sticky;
  top: 72px;
  background-color: var(--widget-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.widget-header-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.widget-sub-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.widget-desc {
  font-size: 0.82rem;
  color: var(--text-body);
  line-height: 1.5;
}

/* Reddit 经典三栏统计 */
.widget-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.stat-num {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.pulse-green {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--online-green);
  display: inline-block;
  box-shadow: 0 0 6px var(--online-green);
}

.widget-sec-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.rules-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rule-row {
  display: flex;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-body);
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.rule-num {
  font-weight: 700;
  color: var(--text-muted);
}

.moderators-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 290px;
  overflow-y: auto;
  padding-right: 4px;
}

.mod-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mod-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mod-handle {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   7. 沉浸式帖子详情页 & Reddit 折叠引导线评论树 (Post Detail & Thread Tree)
   ========================================================================== */
.detail-view-card {
  background-color: var(--canvas);
  padding: 4px 0 32px;
}

.detail-top-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.back-circle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background-color: var(--pill-bg);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s;
}

.back-circle-btn:hover {
  background-color: var(--pill-hover);
}

/* 评论输入框 (Add a comment box) */
.comment-composer {
  margin: 18px 0 24px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background-color: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s;
}

.comment-composer:focus-within {
  border-color: var(--text-muted);
}

.composer-textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 0.9rem;
  resize: vertical;
  min-height: 76px;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: rgba(255, 255, 255, 0.03);
  border-top: 1px solid var(--border-subtle);
}

/* Reddit 标志性左侧竖线评论树 */
.shreddit-comment {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.comment-gutter {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 28px;
  flex-shrink: 0;
}

.thread-guide-line {
  flex: 1;
  width: 2px;
  background-color: rgba(255, 255, 255, 0.12);
  margin-top: 6px;
  cursor: pointer;
  transition: background-color 0.15s, width 0.15s;
  border-radius: 999px;
}

.thread-guide-line:hover {
  background-color: var(--orangered);
  width: 3px;
}

.comment-main {
  flex: 1;
  min-width: 0;
  padding-bottom: 4px;
}

.comment-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.comment-author {
  font-weight: 700;
  color: var(--text-main);
}

.comment-body-text {
  font-size: 0.9rem;
  color: var(--text-body);
  line-height: 1.5;
  margin: 4px 0 6px;
  white-space: pre-line;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.comment-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.comment-action-btn:hover {
  background-color: var(--pill-bg);
  color: var(--text-main);
}

/* ==========================================================================
   8. 模态弹窗 & 轻提示 Toast
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-card {
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(0,0,0,0.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
}

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-body); margin-bottom: 6px; }
.form-control {
  width: 100%;
  background-color: var(--pill-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
}
.form-control:focus { border-color: var(--text-main); }

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}
.auth-divider span {
  padding: 0 12px;
}

.google-btn-wrap {
  display: flex;
  justify-content: center;
  margin: 4px 0 16px;
  min-height: 44px;
}

.toast-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--orangered);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 300;
}
