:root {
  --bg: #f4f7fc;
  --card: #fff;
  --line: #e3eaf5;
  --text: #1a2b4a;
  --muted: #7a8ba8;
  --accent: #3478f6;
  --accent-soft: rgba(52,120,246,.1);
  --danger: #e5484d;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px; min-height: 100%;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }

.page { min-height: 100vh; padding-bottom: calc(24px + var(--safe-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + var(--safe-top)) 12px 10px;
  background: rgba(255,255,255,.94); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .back {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; color: var(--text);
}
.topbar h1 { margin: 0; flex: 1; font-size: 17px; font-weight: 600; text-align: center; }
.topbar .side { width: 36px; }
.main { padding: 12px 14px; }

.empty {
  padding: 56px 20px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.6;
}
.empty .btn {
  display: inline-block; margin-top: 14px; height: 36px; line-height: 36px;
  padding: 0 18px; border-radius: 18px; background: var(--accent); color: #fff; text-decoration: none; font-size: 13px;
}

.works-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
}
.work-item {
  position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: #e8eef8;
  display: block; text-decoration: none; color: inherit;
}
.work-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.work-meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 6px 6px;
  background: linear-gradient(transparent, rgba(20,40,80,.55));
  color: #fff; font-size: 11px;
}
.work-title {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500;
}

.fav-list { display: flex; flex-direction: column; gap: 10px; }
.fav-card {
  display: flex; gap: 12px; padding: 12px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line);
}
.fav-cover {
  width: 84px; height: 84px; border-radius: 8px; object-fit: cover; background: #e8eef8; flex-shrink: 0;
}
.fav-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fav-title { font-size: 15px; font-weight: 600; margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fav-sub { font-size: 12px; color: var(--muted); margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fav-author { font-size: 12px; color: var(--muted); }
.fav-unstar {
  height: 28px; padding: 0 10px; border-radius: 14px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px;
}

.settings-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 12px;
}
.settings-card h2 {
  margin: 0 0 12px; font-size: 14px; color: var(--muted); font-weight: 600;
}
.avatar-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.avatar-row img {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: #e8eef8; border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(40,80,160,.08);
}
.avatar-actions { display: flex; flex-direction: column; gap: 6px; }
.btn-soft {
  height: 32px; padding: 0 12px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 500; text-align: left;
}
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: rgba(52,120,246,.55); box-shadow: 0 0 0 3px rgba(52,120,246,.1);
}
.field textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-save {
  width: 100%; height: 44px; border-radius: 22px; background: var(--accent);
  color: #fff; font-size: 15px; font-weight: 600; margin-top: 8px;
}
.btn-save:disabled { opacity: .45; }
.toast {
  position: fixed; left: 50%; bottom: calc(80px + var(--safe-bottom));
  transform: translateX(-50%); z-index: 80; max-width: 80%;
  padding: 10px 16px; border-radius: 8px; background: rgba(26,43,74,.9); color: #fff; font-size: 13px;
}
.loading-tip { padding: 40px; text-align: center; color: var(--muted); font-size: 13px; }
