:root {
  --primary:        #FF8C00;
  --primary-dark:   #CC7000;
  --primary-light:  #FFF3E0;
  --primary-xlight: #FFF8EE;
  --secondary:      #6D4C41;
  --accent:         #FFD54F;
  --danger:         #E53935;
  --success:        #43A047;
  --warning:        #FF9800;
  --text-primary:   #3E2723;
  --text-secondary: #6D4C41;
  --text-light:     #8D6E63;
  --text-placeholder:#BCAAA4;
  --bg-page:        #FFF8F0;
  --bg-card:        #FFFFFF;
  --bg-header:      linear-gradient(135deg, #FF8C00 0%, #FF6F00 100%);
  --bg-tabbar:      #FFFFFF;
  --border:         #FFE0B2;
  --border-light:   #FFF3E0;
  --shadow-card:    0 2px 12px rgba(255,140,0,0.10);
  --shadow-panel:   0 -4px 24px rgba(0,0,0,0.12);
  --shadow-modal:   0 8px 32px rgba(0,0,0,0.18);
  --radius-sm:      4px;
  --radius:         8px;
  --radius-lg:      12px;
  --radius-xl:      16px;
  --radius-full:    999px;
  --font-family:    "PingFang SC", "Helvetica Neue", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --header-height:  56px;
  --tabbar-height:  60px;
  --safe-bottom:    env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:active { opacity: 0.8; }

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; background: none; }
input, textarea { font-family: inherit; outline: none; border: none; }
ul, ol { list-style: none; }
.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-page);
  position: relative;
  overflow: hidden;
}
.app-header {
  height: var(--header-height);
  background: var(--bg-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(255,140,0,0.3);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.app-header .header-left,
.app-header .header-right { min-width: 40px; display: flex; align-items: center; }

.app-header .header-title {
  flex: 1;
  text-align: center;
  color: #FFFFFF;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header .header-btn {
  color: #FFFFFF;
  font-size: 20px;
  padding: 8px;
  border-radius: var(--radius);
  transition: background 0.2s;
}
.app-header .header-btn:active { background: rgba(255,255,255,0.2); }
.app-content {
  padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 8px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.app-tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--tabbar-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-tabbar);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  z-index: 200;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 0;
  color: var(--text-light);
  font-size: 10px;
  font-weight: 500;
  transition: color 0.2s, transform 0.2s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.tab-item i { font-size: 22px; transition: transform 0.2s; }
.tab-item.active { color: var(--primary); }
.tab-item.active i { transform: scale(1.1); }
.tab-item.post-tab {
  position: relative;
}
.tab-item.post-tab .tab-icon-wrap {
  width: 48px;
  height: 48px;
  background: var(--bg-header);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  margin-top: -20px;
  box-shadow: 0 4px 12px rgba(255,140,0,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.tab-item.post-tab:active .tab-icon-wrap {
  transform: scale(0.92);
  box-shadow: 0 2px 6px rgba(255,140,0,0.3);
}
.tab-item.post-tab span { display: none; }
.tab-badge {
  position: absolute;
  top: 2px;
  right: 50%;
  transform: translateX(12px);
  min-width: 16px;
  height: 16px;
  background: var(--danger);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 14px;
  margin: 8px 12px;
  transition: box-shadow 0.2s;
}
.card:active { box-shadow: 0 1px 4px rgba(255,140,0,0.08); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--bg-header);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255,140,0,0.3);
}
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { display: flex; width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
.input-field {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color 0.2s;
}
.input-field:focus { border-color: var(--primary); }
.input-field::placeholder { color: var(--text-placeholder); }
textarea.input-field { resize: vertical; min-height: 100px; line-height: 1.6; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.tag-primary { background: rgba(255,140,0,0.12); color: var(--primary); }
.tag-danger  { background: rgba(229,57,53,0.1); color: var(--danger); }
.tag-success { background: rgba(67,160,71,0.1); color: var(--success); }
.tag-grey    { background: rgba(141,110,99,0.1); color: var(--text-secondary); }
.tag-accent  { background: rgba(255,213,79,0.2); color: #C67C00; }
.level-badge-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 8px 2px 4px;
  border-radius: var(--radius-full);
  background: rgba(255, 140, 0, 0.08);
  border: 1px solid rgba(255, 140, 0, 0.12);
  color: var(--text-secondary);
  vertical-align: middle;
}
.level-badge-text {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.level-badge-special {
  background: linear-gradient(135deg, rgba(255, 183, 77, 0.22), rgba(255, 140, 0, 0.14));
  border-color: rgba(255, 140, 0, 0.28);
  box-shadow: 0 4px 12px rgba(255, 140, 0, 0.12);
}
.level-badge-special .level-badge-text {
  color: #C76B00;
}
.level-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
}
.level-icon-badge[src] {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: contain;
}
.level-icon-badge.fa {
  font-size: 18px;
  width: 20px;
  height: 20px;
}
.level-num-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  background: var(--level-bg, linear-gradient(135deg, #FF8C00, #FFD54F));
  color: var(--level-color, #fff);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
}
.user-line {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-light);
  flex-shrink: 0;
  border: 2px solid var(--border-light);
}
.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 64px; height: 64px; }
.avatar-xl { width: 80px; height: 80px; }

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.user-meta {
  font-size: 12px;
  color: var(--text-light);
}
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  transition: background 0.15s;
  cursor: pointer;
}
.list-item:active { background: var(--primary-xlight); }
.list-item + .list-item { border-top: 1px solid var(--border-light); }
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-light);
  gap: 12px;
}
.empty-state i { font-size: 64px; color: var(--border); }
.empty-state p { font-size: 14px; }
.toast {
  position: fixed;
  bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(62,39,35,0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  z-index: 9999;
  transition: transform 0.25s ease, opacity 0.25s;
  opacity: 0;
  white-space: nowrap;
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.toast-success { background: rgba(67,160,71,0.95); }
.toast.toast-error   { background: rgba(229,57,53,0.95); }
.toast.toast-warning { background: rgba(255,140,0,0.95); }
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: none;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s;
}
.modal-overlay.show { display: flex; opacity: 1; }
.modal-panel {
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.modal-overlay.show .modal-panel { transform: translateY(0); }
.app-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  z-index: 10020;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.app-confirm-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.app-confirm-dialog {
  width: min(92vw, 360px);
  background: #fff;
  border-radius: 22px;
  padding: 22px 18px 18px;
  box-shadow: 0 18px 46px rgba(15, 23, 42, .18);
  transform: translateY(18px) scale(.96);
  transition: transform .22s ease;
  text-align: center;
}
.app-confirm-overlay.show .app-confirm-dialog {
  transform: translateY(0) scale(1);
}
.app-confirm-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: rgba(255, 140, 0, .12);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.app-confirm-icon.danger {
  background: rgba(229, 57, 53, .12);
  color: #E53935;
}
.app-confirm-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}
.app-confirm-message {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: normal;
  word-break: break-word;
}
.app-confirm-actions {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.app-confirm-btn {
  border: none;
  border-radius: 14px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.app-confirm-cancel {
  background: #F4F4F5;
  color: #666;
}
.app-confirm-ok {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}
.app-confirm-ok.danger {
  background: linear-gradient(135deg, #EF5350, #E53935);
}
.loading-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-light);
  gap: 10px;
  font-size: 14px;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.load-more {
  text-align: center;
  padding: 14px;
  color: var(--text-light);
  font-size: 13px;
  cursor: pointer;
}
.load-more:active { color: var(--primary); }
.divider {
  height: 1px;
  background: var(--border-light);
  margin: 8px 0;
}
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--bg-header);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}
.img-grid { display: grid; gap: 4px; }
.img-grid-1 { grid-template-columns: 1fr; }
.img-grid-2 { grid-template-columns: repeat(2, 1fr); }
.img-grid-3 { grid-template-columns: repeat(3, 1fr); }
.img-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--primary-light);
}
.category-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 12px 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.category-scroll::-webkit-scrollbar { display: none; }
.category-chip {
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  border: 1.5px solid transparent;
  background: var(--bg-card);
  color: var(--text-secondary);
  box-shadow: var(--shadow-card);
}
.category-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.notice-bar {
  background: linear-gradient(90deg, rgba(255,140,0,0.08), rgba(255,140,0,0.03));
  border-left: 3px solid var(--primary);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 8px;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.notice-bar i { color: var(--primary); font-size: 16px; flex-shrink: 0; }
.notice-bar marquee { flex: 1; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.fade-in-up { animation: fadeInUp 0.3s ease forwards; }
.fade-in    { animation: fadeIn 0.25s ease forwards; }
.stagger-item { opacity: 0; animation: fadeInUp 0.3s ease forwards; }
.stagger-item:nth-child(1)  { animation-delay: 0.05s; }
.stagger-item:nth-child(2)  { animation-delay: 0.10s; }
.stagger-item:nth-child(3)  { animation-delay: 0.15s; }
.stagger-item:nth-child(4)  { animation-delay: 0.20s; }
.stagger-item:nth-child(5)  { animation-delay: 0.25s; }
.stagger-item:nth-child(n+6) { animation-delay: 0.30s; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
@media (min-width: 769px) {
  .app-container {
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    box-shadow: 0 0 40px rgba(0,0,0,0.08);
    min-height: 100vh;
  }
  .app-tabbar { border-radius: 0; }
}
