/* ============ 工作室官网 全站样式 ============ */
:root {
  --primary: #2563eb;
  --primary2: #7c3aed;
  --grad: linear-gradient(135deg, #2563eb, #7c3aed);
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* 顶部 */
.topbar { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .inner { display: flex; align-items: center; justify-content: space-between; height: 58px; position: relative; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.brand .dot { width: 30px; height: 30px; border-radius: 8px; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.nav { display: flex; gap: 4px; align-items: center; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.nav a { padding: 7px 14px; border-radius: 10px; font-size: 14px; color: var(--muted); transition: .15s; }
.nav a:hover, .nav a.on { color: var(--primary); background: #eff6ff; }
.burger { display: none; border: 0; background: none; font-size: 20px; color: var(--muted); cursor: pointer; padding: 6px; }
.mnav { display: none; flex-direction: column; padding: 8px 16px 14px; border-top: 1px solid var(--line); background: #fff; }
.mnav a { padding: 10px 6px; border-bottom: 1px dashed var(--line); color: var(--muted); font-size: 14px; }

/* Hero */
.hero { background: linear-gradient(135deg, #1e3a8a 0%, #312e81 50%, #4c1d95 100%); color: #fff; padding: 72px 0; text-align: center; }
.hero h1 { font-size: 34px; font-weight: 800; letter-spacing: 1px; }
.hero p { margin-top: 12px; opacity: .85; max-width: 640px; margin-left: auto; margin-right: auto; font-size: 15px; }

/* 轮播 */
.carousel { position: relative; overflow: hidden; border-radius: 18px; background: #0f172a; }
.slides { display: flex; transition: transform .5s ease; }
.slide { min-width: 100%; position: relative; }
.slide img { width: 100%; height: 340px; object-fit: cover; opacity: .92; }
.slide .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 34px 24px 18px; background: linear-gradient(transparent, rgba(0,0,0,.65)); color: #fff; font-weight: 700; font-size: 18px; }
.car-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255,255,255,.85); color: #334155; font-size: 15px; cursor: pointer; }
.car-btn.prev { left: 12px; } .car-btn.next { right: 12px; }
.dots { position: absolute; bottom: 12px; right: 16px; display: flex; gap: 6px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.5); cursor: pointer; }
.dots i.on { background: #fff; }

/* 区块 */
section.sec { padding: 46px 0 10px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.sec-head h2 { font-size: 22px; font-weight: 800; }
.sec-head .more { font-size: 13px; color: var(--muted); }
.sec-head .more:hover { color: var(--primary); }

/* 卡片 */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(3, 1fr); }
.card { background: #fff; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); transition: .2s; display: flex; flex-direction: column; }
.card:hover { box-shadow: 0 12px 30px rgba(30, 41, 59, .12); transform: translateY(-3px); }
.card .thumb { position: relative; height: 168px; background: #e2e8f0; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 34px; background: linear-gradient(135deg, #e0e7ff, #ede9fe); }
.card .body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.card h3 { font-size: 16px; font-weight: 700; }
.card .sum { font-size: 13px; color: var(--muted); margin-top: 6px; flex: 1; }
.prog { margin-top: 12px; }
.prog .bar { height: 7px; border-radius: 6px; background: #e2e8f0; overflow: hidden; }
.prog .bar i { display: block; height: 100%; background: var(--grad); border-radius: 6px; }
.prog .lab { font-size: 12px; color: var(--muted); margin-top: 5px; display: flex; justify-content: space-between; }
.card .acts { margin-top: 14px; display: flex; gap: 8px; }
.badge { position: absolute; top: 10px; left: 10px; background: rgba(37,99,235,.92); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.badge.gray { background: rgba(100,116,139,.9); }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 10px; font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; transition: .15s; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--grad); border: 0; color: #fff; }
.btn.primary:hover { opacity: .9; color: #fff; }
.btn.danger { color: #dc2626; } .btn.danger:hover { border-color: #dc2626; background: #fef2f2; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* 详情页 */
.detail-head { display: flex; gap: 20px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px; align-items: center; flex-wrap: wrap; }
.detail-head img { width: 190px; height: 120px; object-fit: cover; border-radius: 12px; }
.detail-head .ph-big { width: 190px; height: 120px; border-radius: 12px; background: linear-gradient(135deg,#e0e7ff,#ede9fe); display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 40px; }
.article { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 26px; margin-top: 18px; }
.article h1 { font-size: 22px; margin-bottom: 8px; }
.upd { border-left: 3px solid #dbeafe; padding: 2px 0 2px 16px; margin: 14px 0; }
.upd .v { font-weight: 700; color: var(--primary); font-size: 14px; }
.upd .d { font-size: 12px; color: #94a3b8; margin-left: 8px; }
.upd .c { font-size: 13px; color: var(--muted); margin-top: 4px; white-space: pre-wrap; }

/* 富文本 */
.rich { font-size: 14.5px; color: #374151; line-height: 1.9; word-break: break-word; }
.rich h1, .rich h2 { font-size: 19px; margin: 18px 0 10px; color: #0f172a; }
.rich h3 { font-size: 16px; margin: 16px 0 8px; color: #0f172a; }
.rich p { margin: 10px 0; } .rich ul, .rich ol { padding-left: 22px; margin: 10px 0; }
.rich blockquote { border-left: 4px solid #c7d2fe; background: #f8fafc; padding: 10px 14px; margin: 12px 0; color: #475569; border-radius: 0 8px 8px 0; }
.rich img { border-radius: 10px; margin: 12px 0; }
.rich code { background: #f1f5f9; padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.rich pre { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 10px; overflow-x: auto; margin: 12px 0; }
.rich pre code { background: none; color: inherit; padding: 0; }
.rich a { color: var(--primary); }
.rich table { border-collapse: collapse; margin: 12px 0; }
.rich th, .rich td { border: 1px solid var(--line); padding: 6px 12px; font-size: 13px; }

/* 悬浮侧边栏 */
.side-float { position: fixed; right: 16px; bottom: 32px; z-index: 50; display: flex; flex-direction: column; gap: 10px; }
.side-float a, .side-float button { width: 42px; height: 42px; border-radius: 12px; background: #fff; border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0,0,0,.08); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 15px; cursor: pointer; transition: .15s; }
.side-float a:hover, .side-float button:hover { color: var(--primary); }
.wx-pop { position: absolute; right: 52px; bottom: 0; display: none; width: 164px; box-sizing: border-box; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.14); }
.wx-item:hover .wx-pop, .wx-item.open .wx-pop { display: block; }
/* img 固定高 + width:100%：全局 img 的 max-width:100% 与 absolute 容器 shrink-to-fit
   组合会循环依赖、把图压成竖条（弹窗塌缩）；固定容器宽后不再塌缩，任何比例的二维码图都完整居中显示 */
.wx-pop img { display: block; width: 100%; height: 144px; object-fit: contain; background: #f8fafc; border-radius: 8px; }
.wx-pop p { font-size: 11px; color: #94a3b8; text-align: center; margin: 6px 0 0; white-space: nowrap; }

/* 页脚 */
footer { margin-top: 60px; border-top: 1px solid var(--line); background: #fff; }
footer .inner { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }
footer .links { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
footer a:hover { color: var(--primary); }

/* ============ 后台 ============ */
.admin { display: flex; min-height: 100vh; background: var(--bg); }
.aside { width: 210px; background: #fff; border-right: 1px solid var(--line); padding: 18px 12px; flex-shrink: 0; }
.aside .ttl { font-weight: 800; padding: 4px 10px 14px; font-size: 16px; }
.aside a { display: block; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-size: 14px; margin-bottom: 2px; }
.aside a:hover, .aside a.on { background: #eff6ff; color: var(--primary); font-weight: 600; }
.main { flex: 1; padding: 22px; min-width: 0; }
.main .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.main .head h2 { font-size: 19px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.tbl img { width: 52px; height: 36px; object-fit: cover; border-radius: 6px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.field input[type=text], .field input[type=password], .field input[type=number], .field input[type=url], .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 10px; font-size: 14px; font-family: inherit; background: #fff;
}
.field textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.stat b { font-size: 26px; display: block; }
.stat span { font-size: 12.5px; color: var(--muted); }

/* 富文本编辑器（后台） */
.editor-bar { display: flex; flex-wrap: wrap; gap: 4px; border: 1px solid #cbd5e1; border-bottom: 0; border-radius: 10px 10px 0 0; padding: 7px; background: #f8fafc; }
.editor-bar button { border: 1px solid transparent; background: none; padding: 5px 9px; border-radius: 7px; font-size: 12.5px; cursor: pointer; color: #334155; font-weight: 600; }
.editor-bar button:hover { background: #e2e8f0; }
.editor-area { min-height: 260px; border: 1px solid #cbd5e1; border-radius: 0 0 10px 10px; padding: 14px; background: #fff; outline: none; font-size: 14px; line-height: 1.8; overflow-y: auto; }
.editor-area:focus { border-color: var(--primary); }

/* 提示 */
.toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 99; padding: 10px 20px; border-radius: 12px; color: #fff; font-size: 13.5px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.toast.ok { background: #16a34a; } .toast.err { background: #dc2626; }
.empty { text-align: center; color: #94a3b8; padding: 40px 0; font-size: 13.5px; }
.login-box { max-width: 380px; margin: 90px auto; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 30px; }

/* 响应式 */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .nav { display: none; } .burger { display: block; }
  .mnav.open { display: flex; }
  .grid { grid-template-columns: 1fr; }
  .hero { padding: 52px 0; } .hero h1 { font-size: 26px; }
  .slide img { height: 200px; }
  .admin { flex-direction: column; }
  .aside { width: 100%; display: flex; overflow-x: auto; padding: 10px; gap: 4px; }
  .aside .ttl { display: none; }
  .aside a { white-space: nowrap; }
  .main { padding: 14px; }
  .row2 { grid-template-columns: 1fr; }
  .detail-head img, .detail-head .ph-big { width: 100%; height: 160px; }
}
