:root {
  /* 字體：沿用品牌站字體堆疊 */
  --rv-font-sans: 'Noto Sans TC', 'Hiragino Sans', 'Microsoft JhengHei', sans-serif;

  /* 中性色 */
  --rv-ink: #1f1f1f;
  --rv-ink-soft: #5a5551;
  --rv-ink-faint: #8a8480;
  --rv-bg: #f4f2ef;
  --rv-surface: #ffffff;
  --rv-line: #e6e1da;
  --rv-line-strong: #d3ccc2;

  /* 隱性品牌強調色 */
  --rv-accent: #b8483c;
  --rv-accent-tint: #f6e7e4;

  /* 通過 / 成功 */
  --rv-success: #2e7d32;
  --rv-success-dark: #1f5c24;
  --rv-success-tint: #e6f4e8;

  /* 退修 / 警示 */
  --rv-warn: #b8720c;
  --rv-warn-dark: #925a08;
  --rv-warn-tint: #fbf1dc;

  /* 錯誤 */
  --rv-danger: #c62828;
  --rv-danger-tint: #fdeaea;

  /* 平台識別色 */
  --rv-fb: #1877f2;
  --rv-fb-tint: #e7f0fe;
  --rv-ig: #c13584;
  --rv-ig-tint: #fbe4f0;
  --rv-threads: #101010;
  --rv-threads-tint: #ececec;

  /* 尺寸節奏 */
  --rv-radius: 14px;
  --rv-radius-sm: 8px;
  --rv-shadow-card: 0 2px 10px rgba(31, 31, 31, 0.07);
  --rv-shadow-lift: 0 10px 24px rgba(31, 31, 31, 0.14);
  --rv-ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* 間距刻度 */
  --rv-space-1: 4px;
  --rv-space-2: 8px;
  --rv-space-3: 12px;
  --rv-space-4: 16px;
  --rv-space-5: 24px;
  --rv-space-6: 32px;

  /* 字級 */
  --rv-fs-xs: 0.75rem;
  --rv-fs-sm: 0.875rem;
  --rv-fs-base: 1rem;
  --rv-fs-lg: 1.125rem;
  --rv-fs-xl: 1.375rem;

  /* 觸控尺寸 */
  --rv-touch-min: 44px;
  --rv-btn-height: 52px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--rv-bg);
  color: var(--rv-ink);
  font-family: var(--rv-font-sans);
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea, select {
  font-family: inherit;
}

#app { min-height: 100vh; }

/* ---------- 權杖閘門 ---------- */
.rv-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--rv-space-4);
}
.rv-gate__box {
  background: var(--rv-surface);
  border-radius: var(--rv-radius);
  box-shadow: var(--rv-shadow-card);
  padding: var(--rv-space-5);
  max-width: 360px;
  width: 100%;
}
.rv-gate__title { font-size: var(--rv-fs-lg); margin: 0 0 var(--rv-space-2); }
.rv-gate__desc { font-size: var(--rv-fs-sm); color: var(--rv-ink-soft); margin: 0 0 var(--rv-space-4); }
.rv-gate__input {
  width: 100%;
  height: var(--rv-touch-min);
  border: 1px solid var(--rv-line-strong);
  border-radius: var(--rv-radius-sm);
  padding: 0 var(--rv-space-3);
  margin-bottom: var(--rv-space-3);
  font-size: var(--rv-fs-base);
}
.rv-gate__error { color: var(--rv-danger); font-size: var(--rv-fs-sm); margin-top: var(--rv-space-3); }

/* ---------- Header ---------- */
.rv-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--rv-surface);
  border-bottom: 1px solid var(--rv-line);
  padding: var(--rv-space-3) var(--rv-space-4);
}
.rv-header.is-scrolled { box-shadow: var(--rv-shadow-card); }
.rv-header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rv-space-3);
}
.rv-header__title {
  font-size: var(--rv-fs-lg);
  font-weight: 700;
  margin: 0;
}
.rv-icon-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--rv-ink-soft);
}
.rv-icon-btn:active { background: var(--rv-bg); }
.rv-icon-btn.is-spinning { animation: rv-spin 0.6s linear; }
@keyframes rv-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.rv-header__count {
  margin-top: var(--rv-space-2);
  display: flex;
  align-items: center;
  gap: var(--rv-space-2);
  font-size: var(--rv-fs-sm);
  color: var(--rv-ink-soft);
}
.rv-count-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rv-danger);
  display: inline-block;
}
.rv-count-dot.is-zero { background: var(--rv-success); }

/* ---------- 篩選列 ---------- */
.rv-filterbar {
  position: sticky;
  top: 70px;
  z-index: 15;
  background: var(--rv-bg);
  padding: var(--rv-space-3) var(--rv-space-4);
  display: flex;
  gap: var(--rv-space-2);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rv-line);
}
.rv-segmented {
  display: flex;
  border: 1px solid var(--rv-line-strong);
  border-radius: var(--rv-radius-sm);
  overflow: hidden;
}
.rv-segmented__btn {
  border: none;
  background: var(--rv-surface);
  padding: 0 var(--rv-space-3);
  height: 40px;
  font-size: var(--rv-fs-sm);
  cursor: pointer;
  color: var(--rv-ink-soft);
}
.rv-segmented__btn.is-active {
  background: var(--rv-accent);
  color: #fff;
  font-weight: 700;
}
.rv-select {
  height: 40px;
  border: 1px solid var(--rv-line-strong);
  border-radius: var(--rv-radius-sm);
  background: var(--rv-surface);
  padding: 0 var(--rv-space-2);
  font-size: var(--rv-fs-sm);
  color: var(--rv-ink);
}

/* ---------- 列表 ---------- */
.rv-list {
  padding: var(--rv-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--rv-space-4);
  max-width: 100%;
}

@media (min-width: 600px) {
  #app { max-width: 680px; margin: 0 auto; }
  .rv-filterbar { flex-wrap: nowrap; }
  .rv-header__row { flex-wrap: nowrap; }
}

/* ---------- 空狀態 ---------- */
.rv-empty {
  text-align: center;
  padding: var(--rv-space-6) var(--rv-space-4);
  color: var(--rv-ink-soft);
}
.rv-empty__emoji { font-size: 2.5rem; margin-bottom: var(--rv-space-3); }
.rv-empty__title { font-size: var(--rv-fs-base); font-weight: 700; margin: 0 0 var(--rv-space-1); color: var(--rv-ink); }
.rv-empty__sub { font-size: var(--rv-fs-sm); margin: 0; }

/* ---------- Skeleton ---------- */
.rv-skeleton-card {
  background: var(--rv-surface);
  border-radius: var(--rv-radius);
  box-shadow: var(--rv-shadow-card);
  padding: var(--rv-space-4);
}
.rv-skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, #ece7e0 25%, #f5f2ec 37%, #ece7e0 63%);
  background-size: 400% 100%;
  animation: rv-pulse 1.4s ease infinite;
  margin-bottom: var(--rv-space-2);
}
.rv-skeleton-media {
  aspect-ratio: 1/1;
  border-radius: var(--rv-radius-sm);
  background: linear-gradient(90deg, #ece7e0 25%, #f5f2ec 37%, #ece7e0 63%);
  background-size: 400% 100%;
  animation: rv-pulse 1.4s ease infinite;
  margin-bottom: var(--rv-space-3);
}
@keyframes rv-pulse {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------- 卡片 ---------- */
.rv-card {
  background: var(--rv-surface);
  border-radius: var(--rv-radius);
  box-shadow: var(--rv-shadow-card);
  overflow: hidden;
  transition: background-color 0.6s var(--rv-ease);
}
.rv-card.is-flash-success { background-color: var(--rv-success-tint); }
.rv-card.is-flash-warn { background-color: var(--rv-warn-tint); }

.rv-card__head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rv-space-2);
  align-items: center;
  padding: var(--rv-space-3) var(--rv-space-4);
}
.rv-card__id { color: var(--rv-ink-faint); font-size: var(--rv-fs-sm); }
.rv-card__brand { font-size: var(--rv-fs-sm); font-weight: 700; }
.rv-badge {
  font-size: var(--rv-fs-xs);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.rv-badge--fb { background: var(--rv-fb-tint); color: var(--rv-fb); }
.rv-badge--ig { background: var(--rv-ig-tint); color: var(--rv-ig); }
.rv-badge--threads { background: var(--rv-threads-tint); color: var(--rv-threads); }
.rv-tag {
  font-size: var(--rv-fs-xs);
  color: var(--rv-ink-soft);
  background: var(--rv-bg);
  padding: 2px 8px;
  border-radius: 999px;
}
.rv-card__schedule {
  margin-left: auto;
  font-size: var(--rv-fs-sm);
  color: var(--rv-ink-soft);
}

.rv-card__media {
  aspect-ratio: 1/1;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--rv-bg);
}
.rv-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rv-card__body { padding: var(--rv-space-3) var(--rv-space-4); }
.rv-card__text {
  white-space: pre-wrap;
  line-height: 1.75;
  margin: 0;
  font-size: var(--rv-fs-base);
}

.rv-card__actions {
  display: flex;
  gap: var(--rv-space-2);
  padding: var(--rv-space-3) var(--rv-space-4) var(--rv-space-4);
}
.rv-btn {
  flex: 1;
  height: var(--rv-btn-height);
  border: none;
  border-radius: var(--rv-radius-sm);
  font-size: var(--rv-fs-base);
  font-weight: 700;
  font-family: var(--rv-font-sans);
  cursor: pointer;
  transition: transform .15s var(--rv-ease), opacity .15s;
}
.rv-btn:active { transform: scale(0.97); }
.rv-btn--approve { background: var(--rv-success); color: #fff; }
.rv-btn--approve:hover { background: var(--rv-success-dark); }
.rv-btn--revise { background: var(--rv-warn); color: #fff; }
.rv-btn--revise:hover { background: var(--rv-warn-dark); }
.rv-btn--ghost { background: var(--rv-bg); color: var(--rv-ink-soft); }
.rv-btn--revise-submit { background: var(--rv-warn); color: #fff; }
.rv-btn[disabled], .rv-btn[aria-busy="true"] { opacity: .55; pointer-events: none; }

.rv-loading-bar {
  margin: var(--rv-space-3) var(--rv-space-4) var(--rv-space-4);
  height: var(--rv-btn-height);
  border-radius: var(--rv-radius-sm);
  background: var(--rv-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--rv-fs-base);
  color: var(--rv-ink-soft);
  font-weight: 700;
}

/* ---------- 串文接龍 ---------- */
.rv-thread {
  list-style: none;
  margin: 0;
  padding: var(--rv-space-2) var(--rv-space-4) 0;
}
.rv-thread-item {
  position: relative;
  display: flex;
  gap: var(--rv-space-3);
  padding-bottom: var(--rv-space-4);
}
.rv-thread-item::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--rv-line-strong);
}
.rv-thread-item:last-child::before { display: none; }
.rv-thread-seq {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--rv-threads-tint);
  color: var(--rv-threads);
  font-weight: 700;
  font-size: var(--rv-fs-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.rv-thread-content { flex: 1; min-width: 0; }
.rv-thread-media {
  aspect-ratio: 1/1;
  max-width: 220px;
  border-radius: var(--rv-radius-sm);
  overflow: hidden;
  margin-bottom: var(--rv-space-2);
  cursor: zoom-in;
  background: var(--rv-bg);
}
.rv-thread-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rv-thread-text { white-space: pre-wrap; line-height: 1.7; margin: 0; font-size: var(--rv-fs-base); }

/* ---------- 退修面板 ---------- */
.rv-revise-panel {
  padding: var(--rv-space-3) var(--rv-space-4) var(--rv-space-4);
  background: var(--rv-warn-tint);
}
.rv-revise-label { display: block; font-size: var(--rv-fs-sm); font-weight: 700; margin-bottom: var(--rv-space-2); }
.rv-revise-textarea {
  width: 100%;
  border: 1px solid var(--rv-line-strong);
  border-radius: var(--rv-radius-sm);
  padding: var(--rv-space-3);
  font-size: var(--rv-fs-base);
  resize: vertical;
  margin-bottom: var(--rv-space-3);
}
.rv-revise-actions { display: flex; gap: var(--rv-space-2); }

/* ---------- 摺疊摘要列 ---------- */
.rv-collapsed {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--rv-space-3) var(--rv-space-4);
  min-height: 48px;
  cursor: pointer;
  font-size: var(--rv-fs-sm);
}
.rv-collapsed--approved { background: var(--rv-success-tint); color: var(--rv-success-dark); }
.rv-collapsed--revised { background: var(--rv-warn-tint); color: var(--rv-warn-dark); }
.rv-collapsed__line1 { font-weight: 700; }
.rv-collapsed__line2 { font-size: var(--rv-fs-xs); opacity: .85; margin-top: 2px; }

.rv-expanded-readonly .rv-card__actions { display: none; }

/* ---------- 燈箱 ---------- */
.rv-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.rv-lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
}
.rv-lightbox__close {
  position: absolute;
  top: var(--rv-space-3);
  right: var(--rv-space-3);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
}

/* ---------- Toast ---------- */
.rv-toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  background: var(--rv-danger-tint);
  color: var(--rv-danger);
  border-radius: var(--rv-radius-sm);
  padding: var(--rv-space-3) var(--rv-space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rv-space-3);
  box-shadow: var(--rv-shadow-lift);
  z-index: 90;
  max-width: 680px;
  margin: 0 auto;
  font-size: var(--rv-fs-sm);
  transition: opacity .3s;
}
.rv-toast[hidden] { display: none; }
.rv-toast__retry {
  border: none;
  background: var(--rv-danger);
  color: #fff;
  font-weight: 700;
  border-radius: var(--rv-radius-sm);
  padding: var(--rv-space-2) var(--rv-space-3);
  height: 36px;
  cursor: pointer;
  flex-shrink: 0;
}
