/* ============ 设计变量 ============ */
:root {
  --bg: #F6F3EE;
  --surface: #FFFFFF;
  --ink: #221D17;
  --ink-2: #57503F;
  --muted: #9A9280;
  --line: #E8E1D4;
  --line-soft: #F0EBE2;
  --accent: #A9744F;
  --accent-soft: #F0E4D7;
  --shadow-sm: 0 1px 2px rgba(34, 29, 23, 0.05), 0 2px 10px rgba(34, 29, 23, 0.04);
  --shadow-md: 0 6px 24px rgba(34, 29, 23, 0.09);
  --shadow-lg: 0 16px 48px rgba(34, 29, 23, 0.16);
  --radius: 14px;
  --radius-lg: 20px;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --header-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  touch-action: pan-y;
  overscroll-behavior: none;
}

img { display: block; max-width: 100%; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
}

.hidden { display: none !important; }

/* ============ 通用按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--ink); color: #FBF8F2; }
.btn-primary:hover { background: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--ink-2);
  transition: all 0.2s ease;
  font-size: 17px;
}
.icon-btn:hover { background: rgba(34, 29, 23, 0.07); color: var(--ink); }

/* ============ 登录页 ============ */
.login-view {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  z-index: 50;
}
.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1100px 600px at 15% -10%, #EADCC8 0%, transparent 55%),
    radial-gradient(900px 500px at 110% 110%, #E3D3C0 0%, transparent 50%),
    var(--bg);
}
.login-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(34, 29, 23, 0.06) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.4;
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 46px 38px 36px;
  text-align: center;
  animation: rise 0.6s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-mark {
  font-size: 30px;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 18px;
}
.login-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.login-sub {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.18em;
}
.login-form { margin-top: 30px; }
.login-field input {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #FDFBF7;
  font-size: 16px;
  letter-spacing: 0.06em;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.login-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(169, 116, 79, 0.15);
}
.login-form .btn { margin-top: 14px; }
.login-error {
  min-height: 22px;
  margin-top: 12px;
  font-size: 13px;
  color: #B3543F;
}
.login-error.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.login-hint {
  margin-top: 26px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

/* ============ 主站布局 ============ */
.app-view { min-height: 100vh; display: flex; flex-direction: column; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(246, 243, 238, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  white-space: nowrap;
}
.brand-mark { color: var(--accent); font-size: 15px; }
.brand-name { overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.main-nav { display: flex; gap: 4px; }
.nav-item {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 15px;
  color: var(--ink-2);
  transition: all 0.2s ease;
}
.nav-item:hover { color: var(--ink); background: rgba(34, 29, 23, 0.05); }
.nav-item.active { color: #FBF8F2; background: var(--ink); }

.main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 40px 24px 80px; }
.site-footer {
  padding: 34px 24px 44px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.06em;
  border-top: 1px solid var(--line-soft);
}

/* ============ 首页 ============ */
#view-home {
  position: relative;
  min-height: calc(100vh - var(--header-h) - 40px);
  margin: 0 -24px;
  padding: 0 24px;
  background:
    linear-gradient(180deg, rgba(255, 248, 238, 0.78) 0%, rgba(255, 248, 238, 0.35) 42%, rgba(255, 248, 238, 0.06) 100%),
    url('/assets/ph/66-home.jpg') center center / cover no-repeat;
  border-radius: 0 0 28px 28px;
}
.hero { text-align: center; padding: 28px 0 14px; }
.hero-kicker {
  font-size: 10px;
  letter-spacing: 0.4em;
  color: var(--accent);
  text-transform: uppercase;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(32px, 6vw, 48px);
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-top: 12px;
  line-height: 1.2;
}
.hero-intro {
  max-width: 560px;
  margin: 10px auto 0;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.8;
}
.hero-cats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: stretch;
  gap: 22px;
  max-width: 1000px;
  margin: 32px auto 0;
}
.cat-card {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--line-soft);
}
.cat-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }
.cat-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #E7E0D2;
}
.cat-cover img {
  position: absolute;
  top: -2px;
  left: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  object-fit: cover;
  transition: transform 0.6s ease;
}
.cat-card:hover .cat-cover img { transform: scale(1.05); }
.cat-cover .cat-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 11px;
  letter-spacing: 0.14em;
}
.cat-body { padding: 22px 26px 26px; }
.cat-name {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
}
.cat-meta {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.cat-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--accent);
}


body.on-home .site-footer { display: none; }
body.on-home .main { padding-bottom: 0; }

/* ============ 子分类卡片（平层/别墅） ============ */
.style-grid.subcat-mode {
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.subcat-card {
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-soft);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.subcat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.subcat-cover {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--line-soft);
}
.subcat-cover img { width: 100%; height: 100%; object-fit: cover; }
.subcat-body { padding: 18px 22px 22px; }
.subcat-name { font-family: var(--font-serif); font-size: 22px; font-weight: 600; }
.subcat-meta { margin-top: 5px; font-size: 13px; color: var(--muted); }

/* ============ 子页面头部 ============ */
.page-head { padding: 8px 0 30px; }
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  padding: 6px 0;
  transition: color 0.2s ease;
}
.back-btn:hover { color: var(--accent); }
.page-title {
  font-family: var(--font-serif);
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 600;
  margin-top: 14px;
  letter-spacing: 0.06em;
}
.page-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.08em;
}

/* ============ 风格卡片（紧凑小卡片） ============ */
.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}
.style-card {
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-soft);
  text-align: left;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.style-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.style-cover {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.style-card.has-gradient .style-cover { background: var(--sg); }
.style-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.style-card:hover .style-cover img { transform: scale(1.06); }
.style-mark { font-size: 24px; color: rgba(34, 29, 23, 0.32); line-height: 1; }
.style-body { padding: 10px 12px 12px; text-align: center; }
.style-name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.4;
}
.style-count { margin-top: 2px; font-size: 11px; color: var(--muted); letter-spacing: 0.05em; }

/* ============ 作品网格（两两并排） ============ */
.works-masonry {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 560px) {
  .works-masonry { gap: 10px; }
  .work-body { padding: 10px 10px 12px; }
  .work-title { font-size: 14px; }
  .work-desc { font-size: 12px; }
}

.work-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-soft);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: block;
  width: 100%;
  text-align: left;
}
.work-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.work-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #E7E0D2;
}
.work-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.work-card:hover .work-media img { transform: scale(1.04); }
.work-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink-2);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.work-body { padding: 14px 16px 16px; }
.work-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.5;
}
.work-desc {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.work-link-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--accent);
}
/* 网页作品封面 */
.work-media.url-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #E4DAC8, #CBB79B);
}
.url-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ============ 空状态 ============ */
.empty-state { text-align: center; padding: 70px 20px; }
.empty-icon { font-size: 34px; color: var(--accent); opacity: 0.7; }
.empty-title { margin-top: 16px; font-family: var(--font-serif); font-size: 18px; }
.empty-sub { margin-top: 6px; color: var(--muted); font-size: 14px; }

/* ============ 灯箱 ============ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 14, 12, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  overscroll-behavior: none;
}
.lb-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  position: relative;
}
.lb-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#lb-slide-next { display: none; }
#lb-img, #lb-img-next {
  max-width: calc(100% - 96px);
  max-height: calc(100% - 190px);
  object-fit: contain;
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.25s ease;
  transition: transform 0.06s linear;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#lb-img-next { animation: none; box-shadow: none; }
.lb-zoombar {
  position: absolute;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 2;
  background: rgba(20, 18, 15, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 6px;
}
.lb-zoombar button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #FBF8F2;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.lb-zoombar button:hover { background: rgba(255, 255, 255, 0.22); }
.lb-hint { font-size: 12px; color: rgba(255, 255, 255, 0.55); margin-top: 6px; }

/* 底部作品缩略图条 */
.lb-thumbs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 12px 18px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  touch-action: pan-x;
  background: linear-gradient(transparent, rgba(16, 14, 12, 0.92));
  z-index: 2;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.lb-thumbs::-webkit-scrollbar { display: none; }
.lb-thumb {
  flex: 0 0 auto;
  width: 76px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  opacity: 0.72;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.1);
  padding: 0;
}
.lb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-thumb:hover { opacity: 1; }
.lb-thumb.active {
  border-color: #F0D9A8;
  opacity: 1;
  box-shadow: 0 0 0 2px rgba(240, 217, 168, 0.35), 0 0 16px 3px rgba(240, 217, 168, 0.6);
}
.lb-thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.9);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lb-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  box-shadow: none;
  color: #FFFFFF;
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  z-index: 3;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.lb-close:hover { opacity: 0.8; transform: scale(1.08); }
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #FBF8F2;
  font-size: 26px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.lb-nav:hover { background: rgba(255, 255, 255, 0.24); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-caption {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 20px 24px;
  text-align: center;
  z-index: 2;
  pointer-events: none;
}
.lb-title, .lb-desc, .lb-hint { display: none; }
.lb-title { font-family: var(--font-serif); font-size: 17px; font-weight: 600; }
.lb-count {
  display: inline-block;
  padding: 5px 16px;
  border-radius: 999px;
  background: rgba(20, 18, 15, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #FBF8F2;
  font-size: 13px;
  letter-spacing: 0.12em;
}
.lb-desc { max-width: 560px; margin: 8px auto 0; font-size: 13px; color: rgba(255, 255, 255, 0.8); line-height: 1.7; }

/* ============ 管理抽屉 ============ */
.drawer { position: fixed; inset: 0; z-index: 80; }
.drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(20, 17, 14, 0.4);
  animation: fadeIn 0.25s ease;
}
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(430px, 100vw);
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}
.drawer-head h3 { font-family: var(--font-serif); font-size: 19px; font-weight: 600; }
.drawer-tabs {
  display: flex;
  gap: 2px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  overflow-x: auto;
}
.tab {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink-2);
  white-space: nowrap;
  transition: all 0.2s ease;
}
.tab:hover { background: rgba(34, 29, 23, 0.05); }
.tab.active { background: var(--ink); color: #FBF8F2; }
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  -webkit-overflow-scrolling: touch;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.25s ease; }

/* 表单 */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(169, 116, 79, 0.13);
}
.form-group textarea { resize: vertical; min-height: 52px; }
.hint { margin-top: 8px; font-size: 12px; color: var(--muted); }
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--line-soft);
  border-radius: 12px;
  padding: 5px;
}
.seg-item {
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--ink-2);
  transition: all 0.2s ease;
  text-align: center;
}
.seg-item.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 500; }
.file-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.file-pick:hover { border-color: var(--accent); color: var(--accent); }
.file-pick input { display: none; }

.upload-previews {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.upload-previews:empty { display: none; }
.preview-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--line-soft);
}
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item .pv-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 29, 23, 0.5);
  color: #FBF8F2;
  font-size: 12px;
  letter-spacing: 0.05em;
}
.preview-item .pv-state.ok { background: rgba(56, 118, 74, 0.72); }

.divider { border: none; border-top: 1px solid var(--line-soft); margin: 24px 0; }
.section-title { font-size: 14px; font-weight: 600; margin-bottom: 14px; letter-spacing: 0.05em; }

/* 管理作品列表 */
.manage-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 10px;
}
.manage-thumb {
  width: 68px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--line-soft);
  flex-shrink: 0;
}
.manage-info { flex: 1; min-width: 0; }
.manage-info .m-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-info .m-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.manage-del {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px;
  color: #B3543F;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.manage-del:hover { background: #B3543F; color: #fff; border-color: #B3543F; }

/* 风格管理 */
.style-mgr-group { margin-bottom: 24px; }
.style-mgr-group h4 { font-family: var(--font-serif); font-size: 16px; margin-bottom: 12px; }
.style-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.style-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
}
.style-chip button {
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  transition: color 0.2s ease;
}
.style-chip button:hover { color: #B3543F; }
.add-style-row { display: flex; gap: 8px; margin-top: 10px; }
.add-style-row input { flex: 1; }
.add-style-row button { flex-shrink: 0; }

/* 链接管理 */
.link-manager-intro {
  padding: 14px 16px;
  margin-bottom: 20px;
  border: 1px solid #E4D4C3;
  border-radius: 12px;
  background: var(--accent-soft);
}
.link-manager-intro strong { display: block; font-size: 15px; margin-bottom: 4px; }
.link-manager-intro p { font-size: 12px; color: var(--ink-2); line-height: 1.7; }
.link-create {
  display: flex;
  align-items: center;
  gap: 8px;
}
.link-create .link-prefix { flex-shrink: 0; }
.link-create input { min-width: 0; flex: 1; }
.link-create .btn { flex-shrink: 0; padding: 12px 16px; }
.link-prefix {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--ink);
  color: #FBF8F2;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.links-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--ink-2);
}
.links-head span:last-child { color: var(--muted); }
.links-list { display: flex; flex-direction: column; gap: 10px; }
.link-row {
  padding: 13px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
}
.link-row.main-link { border-color: #DCC8B2; }
.link-row-head,
.link-edit-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.link-row-head { justify-content: space-between; }
.link-row-head strong { font-size: 15px; }
.link-edit-line input {
  min-width: 0;
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FDFBF7;
  outline: none;
}
.link-edit-line input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(169, 116, 79, 0.13);
}
.link-badge {
  display: inline-flex;
  padding: 3px 8px;
  margin-right: 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}
.link-url {
  margin-top: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--line-soft);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  word-break: break-all;
}
.link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.link-btn {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 12px;
  transition: all 0.2s ease;
}
.link-btn:hover { border-color: var(--accent); color: var(--accent); }
.link-btn.primary { background: var(--ink); border-color: var(--ink); color: #FBF8F2; }
.link-btn.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.link-btn.danger { color: #B3543F; }
.link-btn.danger:hover { background: #B3543F; border-color: #B3543F; color: #fff; }
.link-empty {
  padding: 22px 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

/* 新链接管理：独立入口设置 */
.link-row-header {
  display: flex;
  gap: 10px;
  align-items: center;
}
.link-preview {
  width: 72px;
  height: 54px;
  flex-shrink: 0;
  border-radius: 9px;
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, rgba(255,248,238,0.72), rgba(255,248,238,0.18)),
    url('/assets/ph/66-home.jpg') center center / cover no-repeat;
}
.link-info { flex: 1; min-width: 0; }
.link-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-meta { margin-top: 3px; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-url-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
  margin-top: 9px;
}
.link-url-input {
  width: 100%;
  min-width: 0;
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--line-soft);
  color: var(--ink-2);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  outline: none;
}
.link-url-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(169, 116, 79, 0.12); }
.link-editor-card { max-width: 520px; max-height: 90vh; overflow-y: auto; }
.link-bg-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  margin-bottom: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--line-soft) center center / cover no-repeat;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
}
.link-bg-preview.has-image { border-style: solid; }
.link-bg-preview.has-image span { display: none; }
.link-bg-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(34,29,23,0.02), rgba(34,29,23,0.20));
  pointer-events: none;
}
.link-bg-pick { margin-top: 0; }
.link-editor-card .modal-error { margin-top: 4px; }
.link-editor-result { text-align: center; padding-top: 8px; }
.link-result-mark {
  width: 50px;
  height: 50px;
  margin: 4px auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 25px;
  font-weight: 700;
}
.link-editor-result h4 { font-family: var(--font-serif); font-size: 19px; }
.link-editor-result p { margin: 7px 0 16px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.link-result-row { display: flex; gap: 7px; margin-bottom: 10px; }
.link-result-row input {
  width: 100%;
  min-width: 0;
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
}
.link-result-row .btn { flex-shrink: 0; padding: 10px 14px; }

/* 新链接：主页分类卡片背景 */
.link-card-cover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.link-card-cover-item {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #FDFBF7;
}
.link-card-cover-item strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}
.link-card-bg-preview { min-height: 108px; margin-bottom: 8px; }
.link-card-cover-item .file-pick { padding: 10px 8px; font-size: 12px; }
.link-card-cover-item .btn { padding: 9px 10px; font-size: 12px; }
@media (max-width: 430px) {
  .link-card-cover-grid { grid-template-columns: 1fr; }
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #FBF8F2;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 200;
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #A3432F; }

/* ============ 响应式 ============ */
@media (max-width: 720px) {
  .header-inner { padding: 0 14px; }
  .brand-name { max-width: 130px; font-size: 16px; }
  .nav-item { padding: 7px 11px; font-size: 14px; }
  .main { padding: 24px 14px 60px; }
  #view-home {
    min-height: calc(100vh - var(--header-h) - 24px);
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
    padding-right: 14px;
    border-radius: 0 0 20px 20px;
  }
  .hero { padding: 14px 0 8px; }
  .hero-cats { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
  .cat-card { border-radius: 14px; }
  .cat-cover { aspect-ratio: 4 / 3; }
  .cat-cover .cat-tag { top: 8px; left: 8px; padding: 4px 10px; font-size: 10px; letter-spacing: 0.08em; }
  .cat-body { padding: 12px 12px 14px; text-align: left; }

  .cat-name { font-size: 17px; }
  .cat-meta { font-size: 12px; margin-top: 3px; }
  .cat-link { display: none; }
  .hero-kicker { font-size: 9px; }
  .hero-title { font-size: clamp(28px, 7vw, 34px); margin-top: 8px; }
  .hero-intro { font-size: 12px; margin-top: 6px; line-height: 1.7; }
  .lb-stage { padding: 0; }
  #lb-img, #lb-img-next {
    max-width: 100%;
    max-height: calc(100% - 120px);
    object-fit: contain;
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
  }
  #lb-img-next { box-shadow: none; }
  .style-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .style-grid.subcat-mode { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .subcat-card { border-radius: 14px; }
  .subcat-cover { aspect-ratio: 4 / 3; }
  .subcat-body { padding: 12px 12px 14px; }
  .subcat-name { font-size: 16px; }
  .subcat-meta { font-size: 11px; }
  .style-cover { aspect-ratio: 4 / 3; }
  .style-body { padding: 8px 6px 10px; }
  .style-name { font-size: 13px; }
  .style-count { font-size: 10px; }
  .lb-zoombar { bottom: 96px; }
  .lb-thumbs { padding: 12px 10px 14px; gap: 6px; }
  .lb-thumb { width: 64px; height: 48px; }
  .lb-nav { width: 40px; height: 40px; font-size: 22px; }
  .lb-prev { left: 6px; }
  .lb-next { right: 6px; }
  .drawer-panel { width: 100vw; }
}

/* 首页分类卡片图片设置 */
.cover-set { display: flex; gap: 12px; align-items: flex-start; }
.cover-set-img {
  width: 128px;
  height: 84px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--line-soft);
  flex-shrink: 0;
}
.cover-set-actions { flex: 1; display: flex; flex-direction: column; gap: 8px; }

/* ============ 后台密码弹窗 ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(20, 17, 14, 0.45);
  animation: fadeIn 0.25s ease;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--bg);
  border-radius: 18px;
  padding: 30px 26px 26px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.3s ease;
}
.modal-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  text-align: center;
}
.modal-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}
.modal-card input[type="password"] {
  width: 100%;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.modal-card input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(169, 116, 79, 0.13);
}
.modal-error {
  min-height: 20px;
  margin-top: 10px;
  font-size: 13px;
  color: #B3543F;
  text-align: center;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.modal-actions .btn { flex: 1; }



/* 管理作品：编辑按钮 */
.manage-edit {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--accent);
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.manage-edit:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 编辑作品弹窗 */
.work-edit-card { max-width: 520px; max-height: 88vh; overflow-y: auto; }
.we-img {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 8px;
}
.we-img img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.we-img-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.we-act {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
}
.we-act:hover { border-color: var(--accent); color: var(--accent); }
.we-replace { background: var(--surface); }
.we-replace:hover { background: var(--accent-soft); }

/* 禁止访客保存图片 */
.work-media img,
.style-cover img,
.subcat-cover img,
.cat-cover img,
.lb-thumb img,
#lb-img,
#lb-img-next,
.manage-thumb {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}
