*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}

:root{
  --brand1:#4F46E5;
  --brand2:#7C3AED;
}

body{
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'PingFang SC','Microsoft YaHei',sans-serif;
  background:#f2f4f8;
  color:#1a1a2e;
  max-width:600px;
  margin:0 auto;
  min-height:100vh;
  padding-bottom:70px;
  position:relative;
  padding-top:env(safe-area-inset-top,0);
  transition:background .3s ease;
  background-attachment:fixed;
}

.page{display:none;padding:12px;animation:fadeIn .25s ease}
.page.active{display:block}
@keyframes fadeIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}

.page-back{
  display:inline-flex;align-items:center;gap:4px;
  background:rgba(255,255,255,.95);border:none;color:var(--brand1);
  font-size:14px;font-weight:600;padding:8px 14px;
  border-radius:20px;cursor:pointer;
  box-shadow:0 1px 4px rgba(0,0,0,.05);margin-bottom:12px;
}
.page-back:active{transform:scale(.95)}

.home-blank{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:80vh;color:#bbb}
.home-blank-icon{font-size:64px;margin-bottom:12px}
.home-blank-text{font-size:16px}

.search-bar{display:flex;gap:8px;margin-bottom:16px}
.search-bar input{
  flex:1;padding:11px 16px;border:none;border-radius:24px;
  font-size:14px;background:rgba(255,255,255,.95);outline:none;
  box-shadow:0 2px 8px rgba(0,0,0,.08);
}
.search-bar input:focus{box-shadow:0 0 0 2px var(--brand1)}
.search-bar button{
  width:44px;height:44px;border:none;border-radius:50%;
  background:linear-gradient(135deg,var(--brand1),var(--brand2));
  color:#fff;font-size:16px;cursor:pointer;
  box-shadow:0 2px 8px rgba(79,70,229,.3);
}
.search-bar button:active{transform:scale(.94)}

#homeFlow{display:flex;flex-direction:column;gap:20px}
.cat-section{display:flex;flex-direction:column;gap:10px}
.cat-head{display:flex;align-items:center;gap:8px;padding:0 4px}
.cat-head-icon{font-size:18px}
.cat-head-name{
  font-size:15px;font-weight:700;color:#1a1a2e;flex:1;
  text-shadow:0 1px 3px rgba(255,255,255,.9);
}
.cat-head-more{
  font-size:11px;color:var(--brand1);font-weight:600;cursor:pointer;
  padding:3px 10px;border-radius:20px;background:rgba(255,255,255,.95);
  box-shadow:0 1px 4px rgba(0,0,0,.05);
}

/* ========== 卡片改小：3 列 ========== */
.cat-posts{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.cat-empty{
  grid-column:1/-1;text-align:center;color:#888;font-size:12px;
  padding:16px 0;background:rgba(255,255,255,.9);border-radius:10px;
}

.post-card{
  background:#fff;border-radius:12px;overflow:hidden;cursor:pointer;
  box-shadow:0 1px 6px rgba(0,0,0,.06);transition:.2s;
  display:flex;flex-direction:column;
}
.post-card:active{transform:scale(.97)}
.post-card .cover{
  width:100%;height:80px;
  background:linear-gradient(135deg,#e0e7ff,#c7d2fe);
  display:flex;align-items:center;justify-content:center;
  font-size:26px;color:var(--brand1);overflow:hidden;
}
.post-card .cover img{width:100%;height:100%;object-fit:cover;display:block}
.post-card .card-body{padding:8px;display:flex;flex-direction:column;gap:6px;flex:1}
.post-card .card-title{
  font-size:12px;font-weight:600;line-height:1.35;color:#1a1a2e;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
  min-height:32px;
}
.post-card .card-footer{
  display:flex;align-items:center;gap:4px;margin-top:auto;
  padding-top:6px;border-top:1px solid #f5f5f5;
}
.post-card .card-avatar{
  width:16px;height:16px;border-radius:50%;background:#f0f0f0;
  display:flex;align-items:center;justify-content:center;font-size:10px;flex-shrink:0;
}
.post-card .card-author{
  font-size:10px;color:var(--brand1);font-weight:600;flex:1;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.post-card .card-stats{display:flex;gap:4px;font-size:10px;color:#999}

#page-cat .post-list{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}

.tools-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.tool-item{
  background:rgba(255,255,255,.95);border-radius:16px;padding:18px 8px;text-align:center;
  cursor:pointer;box-shadow:0 1px 6px rgba(0,0,0,.06);transition:.2s;
  display:flex;flex-direction:column;align-items:center;gap:8px;
}
.tool-item:active{transform:scale(.94);background:#f8f9ff}
.tool-icon{
  width:44px;height:44px;border-radius:12px;
  background:linear-gradient(135deg,#e0e7ff,#c7d2fe);
  display:flex;align-items:center;justify-content:center;font-size:22px;
}
.tool-name{font-size:12px;color:#333;font-weight:500}

.detail-card{background:#fff;border-radius:16px;padding:20px;margin-bottom:12px;box-shadow:0 2px 12px rgba(0,0,0,.08)}
.category-tag{
  display:inline-block;background:#eef2ff;color:var(--brand1);font-size:11px;
  padding:2px 10px;border-radius:20px;font-weight:500;margin-bottom:8px;
}
.detail-header{display:flex;align-items:center;gap:12px;margin-bottom:16px}
.avatar-lg{
  width:48px;height:48px;border-radius:50%;
  background:linear-gradient(135deg,#e0e7ff,#c7d2fe);
  display:flex;align-items:center;justify-content:center;font-size:24px;
}
.author-info .name{font-size:15px;font-weight:600;color:var(--brand1)}
.author-info .time{font-size:12px;color:#999;margin-top:2px}
.detail-title{font-size:20px;font-weight:700;line-height:1.4;margin-bottom:12px}
.detail-content{font-size:15px;line-height:1.8;color:#333;margin-bottom:16px;word-break:break-word}
.detail-content img{max-width:100%;border-radius:12px;margin:10px 0;display:block}
.detail-stats{display:flex;gap:20px;padding-top:16px;border-top:1px solid #f0f0f0;font-size:13px;color:#999;align-items:center}
.like-btn{
  margin-left:auto;background:#eef2ff;color:var(--brand1);border:none;
  padding:6px 14px;border-radius:20px;font-size:13px;cursor:pointer;font-weight:600;
}

.reply-list{background:#fff;border-radius:16px;padding:16px;box-shadow:0 2px 12px rgba(0,0,0,.08)}
.reply-list h3{font-size:15px;margin-bottom:12px}
.reply-item{display:flex;gap:10px;padding:12px 0;border-bottom:1px solid #f5f5f5}
.reply-item:last-child{border-bottom:none}
.avatar-sm{
  width:32px;height:32px;border-radius:50%;background:#f0f0f0;
  display:flex;align-items:center;justify-content:center;font-size:15px;flex-shrink:0;
}
.reply-body{flex:1;min-width:0}
.reply-author{font-size:12px;font-weight:600;color:var(--brand1)}
.reply-time{font-size:11px;color:#999;margin-left:8px}
.reply-content{font-size:14px;line-height:1.6;margin-top:4px;word-break:break-word}

.reply-form{background:#fff;border-radius:16px;padding:16px;margin-top:12px;box-shadow:0 2px 12px rgba(0,0,0,.08)}
.reply-form textarea{
  width:100%;padding:12px;border:1.5px solid #e5e7eb;border-radius:12px;
  font-size:14px;font-family:inherit;min-height:80px;resize:vertical;
  background:#fafafa;outline:none;
}
.reply-form textarea:focus{border-color:var(--brand1);background:#fff}
.reply-actions{display:flex;justify-content:flex-end;margin-top:10px}
.btn-reply{
  padding:10px 24px;background:linear-gradient(135deg,var(--brand1),var(--brand2));
  color:#fff;border:none;border-radius:10px;font-size:14px;font-weight:600;cursor:pointer;
}

.form-card{background:#fff;border-radius:16px;padding:20px;box-shadow:0 2px 12px rgba(0,0,0,.08)}
.form-group{margin-bottom:16px}
.form-group label{display:block;font-size:13px;font-weight:600;color:#555;margin-bottom:6px}
.form-group input,.form-group textarea,.form-group select{
  width:100%;padding:12px 14px;border:1.5px solid #e5e7eb;border-radius:12px;
  font-size:15px;font-family:inherit;background:#fafafa;outline:none;
  -webkit-appearance:none;transition:.2s;
}
.form-group input:focus,.form-group textarea:focus,.form-group select:focus{
  border-color:var(--brand1);background:#fff;
}
.form-group textarea{min-height:120px;resize:vertical}
.btn-submit{
  width:100%;padding:14px;background:linear-gradient(135deg,var(--brand1),var(--brand2));
  color:#fff;border:none;border-radius:12px;font-size:16px;font-weight:600;cursor:pointer;
}

/* ========== 我的（抖音风格，跟随主题） ========== */
#page-me{padding:0;min-height:100vh;background:transparent}

.dy-hero{
  background:linear-gradient(180deg,
    rgba(0,0,0,.55) 0%,
    rgba(0,0,0,.35) 60%,
    rgba(0,0,0,0) 100%);
  color:#fff;
  padding:0 16px 22px;
  position:relative;
}
body:not([data-dark]) .dy-hero{
  background:linear-gradient(180deg,
    rgba(255,255,255,.9) 0%,
    rgba(255,255,255,.7) 60%,
    rgba(255,255,255,0) 100%);
  color:#1a1a2e;
}

.dy-topbar{display:flex;align-items:center;justify-content:space-between;padding:12px 0}
.dy-topbar-title{font-size:16px;font-weight:600}
.dy-icon-btn{
  width:36px;height:36px;border:none;background:transparent;
  color:inherit;font-size:18px;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  border-radius:50%;transition:.2s;
}
.dy-icon-btn:active{background:rgba(127,127,127,.15)}

.dy-profile{display:flex;flex-direction:column;align-items:center;padding:8px 0 0}
.dy-avatar{
  width:88px;height:88px;border-radius:50%;
  background:linear-gradient(135deg,var(--brand1),var(--brand2));
  display:flex;align-items:center;justify-content:center;
  font-size:44px;
  margin-bottom:12px;
  box-shadow:0 6px 20px rgba(0,0,0,.25);
  border:3px solid rgba(255,255,255,.9);
  color:#fff;
}
.dy-name{font-size:18px;font-weight:700;margin-bottom:4px;color:inherit}
.dy-id{font-size:12px;opacity:.65;margin-bottom:18px}

.dy-stats{display:flex;justify-content:center;gap:44px;margin-bottom:18px}
.dy-stat{text-align:center}
.dy-stat-num{font-size:18px;font-weight:700;color:inherit;margin-bottom:2px}
.dy-stat-label{font-size:12px;opacity:.65}

.dy-btns{display:flex;gap:10px}
.dy-btn-edit,.dy-btn-share{
  padding:9px 22px;border-radius:8px;font-size:14px;
  font-weight:600;cursor:pointer;transition:.2s;border:none;
}
.dy-btn-edit{
  background:linear-gradient(135deg,var(--brand1),var(--brand2));
  color:#fff;
}
.dy-btn-edit:active{transform:scale(.96);opacity:.9}
.dy-btn-share{
  background:rgba(127,127,127,.18);
  color:inherit;
  border:1px solid rgba(127,127,127,.25);
}
.dy-btn-share:active{transform:scale(.96)}

.dy-tabs{
  display:flex;
  border-bottom:1px solid rgba(127,127,127,.2);
  position:sticky;top:0;z-index:10;
  background:rgba(255,255,255,.7);
}
body[data-dark] .dy-tabs{background:rgba(0,0,0,.5);color:#fff}
body:not([data-dark]) .dy-tabs{color:#1a1a2e}
.dy-tab{
  flex:1;padding:14px 0;background:none;border:none;
  color:inherit;opacity:.55;font-size:14px;font-weight:600;cursor:pointer;
  position:relative;transition:.2s;
}
.dy-tab.active{opacity:1}
.dy-tab.active::after{
  content:'';position:absolute;bottom:0;left:50%;transform:translateX(-50%);
  width:28px;height:2px;background:var(--brand1);border-radius:2px;
}

.dy-grid{
  display:grid;grid-template-columns:repeat(3,1fr);
  gap:2px;padding:2px;
  background:rgba(0,0,0,.06);
}
.dy-grid-item{
  position:relative;aspect-ratio:1 / 1;overflow:hidden;
  cursor:pointer;background:rgba(255,255,255,.9);
}
.dy-grid-item img{width:100%;height:100%;object-fit:cover;display:block}
.dy-cover-fallback{
  width:100%;height:100%;display:flex;align-items:center;justify-content:center;
  font-size:36px;
  background:linear-gradient(135deg,#e0e7ff,#c7d2fe);
  color:var(--brand1);
}
.dy-grid-item.text-mode{
  background:rgba(255,255,255,.9);padding:10px;
  display:flex;align-items:center;justify-content:center;
}
.dy-text-content{
  font-size:12px;color:#333;line-height:1.4;overflow:hidden;
  display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;
  word-break:break-word;
}
.dy-grid-stats{
  position:absolute;bottom:4px;left:6px;font-size:11px;color:#fff;
  text-shadow:0 1px 3px rgba(0,0,0,.8);font-weight:600;
}
.dy-empty{
  grid-column:1/-1;text-align:center;color:#666;font-size:13px;padding:60px 0;
}

/* ========== 设置页 ========== */
.settings-section{
  background:rgba(255,255,255,.95);border-radius:16px;padding:18px;margin-bottom:14px;
  box-shadow:0 2px 12px rgba(0,0,0,.06);
}
.settings-title{font-size:15px;font-weight:700;margin-bottom:14px;color:#1a1a2e}
.settings-item{margin-bottom:14px}
.settings-item:last-child{margin-bottom:0}
.settings-label{font-size:13px;color:#666;font-weight:600;margin-bottom:8px}
.settings-input{
  width:100%;padding:12px 14px;border:1.5px solid #e5e7eb;
  border-radius:12px;font-size:14px;background:#fafafa;
  outline:none;font-family:inherit;transition:.2s;
}
.settings-input:focus{border-color:var(--brand1);background:#fff}
.settings-static{
  padding:12px 14px;background:#f5f5f5;border-radius:12px;
  font-size:14px;color:#888;
}
.settings-save{
  width:100%;padding:12px;margin-top:6px;
  background:linear-gradient(135deg,var(--brand1),var(--brand2));
  color:#fff;border:none;border-radius:12px;font-size:14px;
  font-weight:600;cursor:pointer;transition:.2s;
}
.settings-save:active{transform:scale(.98)}

.settings-menu{
  background:rgba(255,255,255,.95);border-radius:16px;overflow:hidden;
  box-shadow:0 2px 12px rgba(0,0,0,.06);
}
.settings-menu-item{
  display:flex;align-items:center;gap:14px;padding:16px;
  cursor:pointer;border-bottom:1px solid #f5f5f5;transition:.2s;
}
.settings-menu-item:last-child{border-bottom:none}
.settings-menu-item:active{background:#f8f9ff}

.smi-icon{
  width:40px;height:40px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;
  font-size:20px;color:#fff;flex-shrink:0;
}
.smi-body{flex:1;min-width:0}
.smi-title{font-size:15px;font-weight:600;color:#1a1a2e;margin-bottom:2px}
.smi-desc{font-size:12px;color:#999}
.smi-arrow{font-size:22px;color:#ccc;flex-shrink:0}

.avatar-picker{display:grid;grid-template-columns:repeat(8,1fr);gap:8px}
.avatar-option{
  width:100%;aspect-ratio:1;border:2px solid transparent;
  border-radius:50%;background:#f5f5f5;font-size:18px;
  cursor:pointer;transition:.2s;display:flex;
  align-items:center;justify-content:center;padding:0;
}
.avatar-option.active{
  border-color:var(--brand1);background:#eef2ff;transform:scale(1.1);
}

.theme-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.theme-option{
  cursor:pointer;text-align:center;padding:8px;border-radius:12px;
  border:2px solid transparent;transition:.2s;
}
.theme-option.active{border-color:var(--brand1);background:#f5f5ff}
.theme-color{
  width:100%;height:44px;border-radius:10px;margin-bottom:6px;
  box-shadow:0 2px 6px rgba(0,0,0,.1);
}
.theme-name{font-size:12px;color:#555;font-weight:600}

.bg-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.bg-option{
  cursor:pointer;text-align:center;padding:6px;border-radius:12px;
  border:2px solid transparent;transition:.2s;
}
.bg-option.active{border-color:var(--brand1);background:#f5f5ff}
.bg-color{
  width:100%;height:50px;border-radius:10px;margin-bottom:6px;
  box-shadow:0 2px 6px rgba(0,0,0,.08);
  border:1px solid rgba(0,0,0,.05);
}
.bg-name{font-size:12px;color:#555;font-weight:600}

.custom-row{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:12px;
}
.custom-label{
  font-size:13px;
  color:#666;
  font-weight:600;
  min-width:60px;
}
.custom-mode{display:flex;gap:8px}
.mode-btn{
  padding:6px 16px;
  border:1.5px solid #e5e7eb;
  background:#fff;
  border-radius:20px;
  font-size:13px;
  font-weight:600;
  color:#666;
  cursor:pointer;
  transition:.2s;
}
.mode-btn.active{
  background:linear-gradient(135deg,var(--brand1),var(--brand2));
  color:#fff;
  border-color:transparent;
}
.custom-row input[type="color"]{
  width:60px;
  height:36px;
  border:none;
  background:transparent;
  cursor:pointer;
  border-radius:8px;
  padding:0;
}
.custom-row input[type="range"]{flex:1}
#angleVal{
  font-size:12px;
  color:#666;
  font-weight:600;
  min-width:36px;
}
.custom-preview{
  height:70px;
  border-radius:12px;
  margin:10px 0;
  box-shadow:0 2px 8px rgba(0,0,0,.1);
  border:1px solid rgba(0,0,0,.05);
}

.empty{text-align:center;padding:60px 20px;color:#999}
.empty .icon{font-size:48px;display:block;margin-bottom:12px}
.empty p{font-size:14px}

/* ==================== 底部导航 ==================== */
.bottom-nav{
  position:fixed;
  bottom:0;
  left:50%;
  transform:translateX(-50%);
  width:100%;
  max-width:600px;
  background:#fff;
  display:flex;
  justify-content:space-around;
  padding:6px 0;
  padding-bottom:calc(6px + env(safe-area-inset-bottom,0px));
  box-shadow:0 -2px 12px rgba(0,0,0,.08);
  z-index:200;
  border-top:1px solid #f0f0f0;
}

.nav-item{
  display:flex;flex-direction:column;align-items:center;gap:2px;
  padding:6px 12px;border:none;background:none;cursor:pointer;
  color:#999;font-size:10px;border-radius:12px;min-width:56px;transition:.2s;
}
.nav-item .nav-icon{font-size:22px;line-height:1;transition:.2s}
.nav-item.active{color:var(--brand1)}
.nav-item.active .nav-icon{transform:scale(1.1)}

/* Toast */
.toast{
  position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);
  background:rgba(0,0,0,.82);color:#fff;padding:12px 22px;border-radius:12px;
  font-size:14px;z-index:999;opacity:0;transition:.3s;pointer-events:none;
  max-width:80%;text-align:center;
}
.toast.show{opacity:1}

/* 弹窗 */
.modal-mask{
  position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:1000;
  display:flex;align-items:center;justify-content:center;
  opacity:0;pointer-events:none;transition:.2s;
}
.modal-mask.show{opacity:1;pointer-events:auto}
.modal-box{
  background:#fff;border-radius:18px;padding:24px;width:88%;max-width:360px;
  transform:scale(.92);transition:.2s;
}
.modal-mask.show .modal-box{transform:scale(1)}
.modal-box h3{font-size:17px;margin-bottom:16px;text-align:center}
.modal-box input{
  width:100%;padding:12px 14px;margin-bottom:12px;
  border:1.5px solid #e5e7eb;border-radius:12px;font-size:15px;
  background:#fafafa;outline:none;
}
.modal-box input:focus{border-color:var(--brand1);background:#fff}
.modal-btns{display:flex;gap:10px}
.modal-btns button{
  flex:1;padding:12px;background:linear-gradient(135deg,var(--brand1),var(--brand2));
  color:#fff;border:none;border-radius:12px;font-size:15px;font-weight:600;cursor:pointer;
}
.modal-btns button.gray{background:#e5e7eb;color:#555}
.modal-tip{text-align:center;font-size:12px;color:#999;margin-top:12px}

#imagePreview img{max-width:100%;border-radius:10px}