/* ================================================================
   拾录 SHILU — styles
   ================================================================ */

:root {
  --sans: "Inter", "SF Pro SC", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI",
    "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, "Songti SC", "STSong", "SimSun", serif;

  --bg: #f4f1eb;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --ink: #1a1815;
  --ink-2: #57524a;
  --ink-3: #8e877b;
  --line: #e6e0d3;
  --line-2: #d5cdbd;
  --accent: #b4472a;
  --accent-hover: #9c3a20;
  --accent-soft: #f6e6df;
  --ok: #3f7a57;
  --warn: #ad7a25;
  --danger: #a3332b;

  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(26, 24, 21, 0.06);
  --shadow-md: 0 18px 34px -20px rgba(26, 24, 21, 0.45);
  --ease: cubic-bezier(0.2, 0.75, 0.25, 1);

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #131210;
  --surface: #1c1a17;
  --surface-2: #232019;
  --ink: #f1ece3;
  --ink-2: #b7afa2;
  --ink-3: #857e72;
  --line: #2b2822;
  --line-2: #3d3931;
  --accent: #e06a45;
  --accent-hover: #ef7c56;
  --accent-soft: #3a231b;
  --ok: #6fae8a;
  --warn: #d3a154;
  --danger: #e0796b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 18px 34px -20px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(80% 55% at 12% -10%, rgba(180, 71, 42, 0.05), transparent 70%),
    radial-gradient(60% 50% at 100% 0%, rgba(63, 122, 87, 0.04), transparent 70%);
  z-index: 0;
}

::selection { background: var(--accent-soft); color: var(--ink); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 999px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

img { display: block; }

[hidden] { display: none !important; }

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------------------------------------------------------------- */
/* 侧栏                                                              */
/* ---------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px;
  margin-bottom: 30px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 35px;
  height: 35px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 6px -2px rgba(180, 71, 42, 0.6);
}

.brand-text { display: flex; flex-direction: column; gap: 3px; }
.brand-text b { font-size: 16px; font-weight: 650; letter-spacing: 0.14em; line-height: 1; }
.brand-text i {
  font-style: normal;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.32em;
  color: var(--ink-3);
  line-height: 1;
}

.side-label {
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--ink-3);
  padding: 0 10px;
  margin: 0 0 10px;
  font-weight: 500;
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.nav-item svg { width: 17px; height: 17px; flex: none; opacity: 0.75; }
.nav-item:hover { background: rgba(26, 24, 21, 0.045); color: var(--ink); }
[data-theme="dark"] .nav-item:hover { background: rgba(255, 255, 255, 0.05); }

.nav-item.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line);
  font-weight: 550;
}
.nav-item.active svg { opacity: 1; color: var(--accent); }

.nav-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.nav-item.active .nav-count { color: var(--ink-2); }

.side-stats {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 4px;
  text-align: center;
}
.side-stats > div + div { border-left: 1px solid var(--line); }
.side-stats b {
  display: block;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.side-stats span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
}

.side-foot {
  display: flex;
  gap: 4px;
  margin-top: 14px;
  padding: 0 4px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: 0.16s var(--ease);
}
.icon-btn:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------------------------------------------------------------- */
/* 主区                                                              */
/* ---------------------------------------------------------------- */

.main {
  min-width: 0;
  padding: 0 42px 90px;
  max-width: 1560px;
  width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 0 14px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.searchbox {
  flex: 1;
  max-width: 520px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.searchbox:focus-within {
  border-color: var(--line-2);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.searchbox-icon { display: grid; place-items: center; color: var(--ink-3); }
.searchbox-icon svg { width: 16px; height: 16px; }
.searchbox input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13.5px;
}
.searchbox input::placeholder { color: var(--ink-3); }
.searchbox input::-webkit-search-cancel-button { -webkit-appearance: none; }

kbd {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 5px;
  padding: 1px 5px;
  line-height: 1.5;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.sortbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.sortbox select {
  height: 34px;
  padding: 0 26px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e877b' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  appearance: none;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
}

.btn {
  height: 38px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.18s var(--ease);
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 2px 6px -3px rgba(180, 71, 42, 0.8);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: none; }
.btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-2);
}
.btn-ghost:hover { border-color: var(--line-2); color: var(--ink); background: var(--surface-2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.plus { font-size: 15px; line-height: 1; margin-top: -1px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 28px 0 18px;
}
.page-head h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: 0.015em;
}
.page-sub {
  margin: 7px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip {
  height: 30px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: 0.16s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.chip .n { font-size: 10.5px; opacity: 0.55; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- */
/* 卡片网格                                                          */
/* ---------------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 26px 18px;
}

.card {
  position: relative;
  cursor: pointer;
  min-width: 0;
  animation: rise 0.45s var(--ease) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.card-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgba(26, 24, 21, 0.05);
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease);
}
.card:hover .card-poster {
  transform: translateY(-4px);
  box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow-md);
}
.card-poster img,
.drawer-poster img,
.poster-preview img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease), opacity 0.3s;
}

.ph {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 90% at 15% 0%, color-mix(in srgb, var(--tone, #8e877b) 22%, transparent), transparent 65%),
    var(--surface-2);
}
.ph b {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 400;
  color: var(--tone, var(--ink-3));
  opacity: 0.5;
  transform: translateY(-2px);
}
.ph::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid color-mix(in srgb, var(--tone, #8e877b) 22%, transparent);
  border-radius: 6px;
  pointer-events: none;
}
.ph-icon { color: var(--tone, var(--ink-3)); opacity: 0.42; display: grid; place-items: center; }

.score {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 27px;
  height: 23px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.93);
  color: #1a1815;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}
.score.high { background: var(--accent); color: #fff; }

.fav-mark {
  position: absolute;
  top: 9px;
  left: 9px;
  width: 18px;
  height: 18px;
  color: #ffcf6b;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.card-title {
  margin: 11px 2px 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}
.card-meta {
  margin: 3px 2px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
}
.card-meta .meta-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; flex: none; }
.meta-done { color: var(--ok); }
.meta-doing { color: var(--warn); }
.meta-planned { color: var(--ink-3); }
.meta-dropped { color: var(--danger); }

/* ---------------------------------------------------------------- */
/* 空状态                                                            */
/* ---------------------------------------------------------------- */

.empty {
  padding: 64px 20px 80px;
  text-align: center;
  animation: rise 0.5s var(--ease) both;
}
.empty-art { width: 168px; margin: 0 auto 22px; color: var(--ink-3); opacity: 0.62; }
.empty h2 { margin: 0 0 8px; font-size: 18px; font-weight: 550; letter-spacing: 0.02em; }
.empty p { margin: 0 0 22px; font-size: 13px; color: var(--ink-3); }

.foot-note {
  margin-top: 64px;
  text-align: center;
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  opacity: 0.7;
}

/* ---------------------------------------------------------------- */
/* 遮罩层                                                            */
/* ---------------------------------------------------------------- */

.layer { position: fixed; inset: 0; z-index: 60; }
.layer[hidden] { display: none; }
.layer.center { display: grid; place-items: center; padding: 26px; }

.scrim {
  position: absolute;
  inset: 0;
  background: rgba(22, 17, 12, 0.44);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.layer.is-open .scrim { opacity: 1; }

/* ---------------------------------------------------------------- */
/* 详情抽屉                                                          */
/* ---------------------------------------------------------------- */

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(468px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-left: 1px solid var(--line);
  box-shadow: -30px 0 60px -40px rgba(0, 0, 0, 0.6);
  overflow-y: auto;
  transform: translateX(30px);
  opacity: 0;
  transition: transform 0.32s var(--ease), opacity 0.32s var(--ease);
}
.layer.is-open .drawer { transform: none; opacity: 1; }

.drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 10px;
}
.drawer-cat {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.drawer-cat .rule { width: 22px; height: 1px; background: var(--line-2); }

.drawer-hero {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  gap: 20px;
  padding: 8px 24px 0;
}
.drawer-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line), 0 12px 24px -16px rgba(0, 0, 0, 0.55);
}
.drawer-poster img { width: 100%; height: 100%; object-fit: cover; }
.drawer-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}
.drawer-sub {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.pill.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.pill.doing { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.pill.planned { color: var(--ink-3); }
.pill.dropped { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }

.rating-block {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 18px;
}
.rating-num {
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.rating-max { font-size: 12px; color: var(--ink-3); }
.rating-tier {
  margin-left: 4px;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--accent);
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
}
.rating-empty {
  margin-top: 18px;
  font-size: 12px;
  color: var(--ink-3);
  border: 1px dashed var(--line-2);
  border-radius: 9px;
  padding: 9px 12px;
  text-align: center;
}

.drawer-body { padding: 22px 24px 30px; }

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.meta-item dt {
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  margin: 0 0 4px;
}
.meta-item dd {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.meta-item dd.empty-val { color: var(--ink-3); opacity: 0.6; }

.section-label {
  font-size: 9.5px;
  letter-spacing: 0.2em;
  color: var(--ink-3);
  margin: 24px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.review-text {
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--ink-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
}

.drawer-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding: 16px 24px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.drawer-actions .btn { flex: 1; }
.btn-danger-ghost {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  color: var(--danger);
}
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); border-color: var(--danger); }

/* ---------------------------------------------------------------- */
/* 编辑弹窗                                                          */
/* ---------------------------------------------------------------- */

.modal {
  position: relative;
  width: min(1010px, 100%);
  max-height: min(92vh, 940px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transform: translateY(16px) scale(0.992);
  opacity: 0;
  transition: transform 0.32s var(--ease), opacity 0.28s var(--ease);
}
.layer.is-open .modal { transform: none; opacity: 1; }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  margin: 0 0 5px;
  font-size: 9px;
  letter-spacing: 0.26em;
  color: var(--ink-3);
}
.modal-head h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: 0.01em; }

.modal-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
  gap: 30px;
  padding: 22px 24px 26px;
  overflow-y: auto;
}

.editor-main { display: flex; flex-direction: column; gap: 15px; min-width: 0; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field .label,
.label {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.label em { font-style: normal; color: var(--accent); }
.label .rating-value {
  margin-left: auto;
  font-style: normal;
  color: var(--ink-2);
  font-size: 11px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

input[type="text"],
input[type="search"],
input[type="number"],
input[type="date"],
input:not([type]),
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  transition: border-color 0.16s, box-shadow 0.16s;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 0.75; }
input:hover, textarea:hover { border-color: var(--line-2); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 118px; line-height: 1.75; }
input[type="date"] { font-variant-numeric: tabular-nums; }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0.45; cursor: pointer; }
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); opacity: 0.5; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row.three { grid-template-columns: 1fr 1fr 1fr; }

.seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.seg button {
  flex: 1;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
  transition: 0.16s var(--ease);
  white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(26, 24, 21, 0.12);
  font-weight: 550;
}

.rating { display: flex; gap: 4px; }
.rating button {
  flex: 1;
  height: 31px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: 0.12s var(--ease);
}
.rating button:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--accent); }
.rating button.fill { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.rating button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  padding: 2px 0;
}
.check input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

.editor-side {
  display: flex;
  flex-direction: column;
  gap: 13px;
  border-left: 1px solid var(--line);
  padding-left: 28px;
  min-width: 0;
}

.poster-preview {
  position: relative;
  width: 100%;
  max-width: 186px;
  aspect-ratio: 2 / 3;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line), 0 10px 24px -18px rgba(0, 0, 0, 0.55);
}
.poster-preview img { width: 100%; height: 100%; object-fit: cover; }
.poster-preview .ph b { font-size: 38px; }

.poster-tabs { display: flex; border-bottom: 1px solid var(--line); gap: 2px; }
.poster-tabs button {
  flex: 1;
  padding: 7px 0 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  cursor: pointer;
  transition: 0.16s;
}
.poster-tabs button:hover { color: var(--ink); }
.poster-tabs button.active { color: var(--ink); border-color: var(--accent); }

.poster-pane { display: flex; flex-direction: column; gap: 9px; min-height: 0; }

.searchbar { display: flex; gap: 6px; }
.searchbar input { flex: 1; min-width: 0; }
.searchbar .btn { flex: none; }

.hint { margin: 0; font-size: 10.5px; color: var(--ink-3); line-height: 1.5; min-height: 16px; }
.hint.error { color: var(--danger); }

.poster-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 286px;
  overflow-y: auto;
  padding: 2px;
}
.poster-result {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  transition: 0.16s var(--ease);
}
.poster-result img { width: 100%; height: 100%; object-fit: cover; }
.poster-result:hover { box-shadow: 0 0 0 2px var(--line-2); transform: translateY(-1px); }
.poster-result.selected { box-shadow: 0 0 0 2px var(--accent); }
.poster-result.hide { display: none; }
.poster-result.selected::after {
  content: "✓";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}
.poster-result .src {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 5px 4px;
  font-size: 8.5px;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.poster-result:hover .src { opacity: 1; }

.poster-skeleton {
  aspect-ratio: 2 / 3;
  border-radius: 7px;
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--line) 50%, var(--surface-2) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
}
@keyframes shimmer { to { background-position: -220% 0; } }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 132px;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: 0.16s var(--ease);
  padding: 14px;
}
.dropzone:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.dropzone small { font-size: 10px; color: var(--ink-3); }

.clear-poster {
  align-self: center;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 2px;
}
.clear-poster:hover { color: var(--danger); }

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.form-error { font-size: 12px; color: var(--danger); min-height: 18px; }
.modal-foot-actions { display: flex; gap: 9px; margin-left: auto; }

/* ---------------------------------------------------------------- */
/* 口令锁                                                            */
/* ---------------------------------------------------------------- */

.lock {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(60% 45% at 50% 0%, rgba(180, 71, 42, 0.07), transparent 70%),
    var(--bg);
}
.lock-card { width: min(360px, 100%); text-align: center; }
.lock-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: var(--accent);
  color: #fff;
  font-family: var(--serif);
  font-size: 29px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 12px 28px -14px rgba(180, 71, 42, 0.9);
}
.lock-card h1 {
  margin: 0 0 8px;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.16em;
}
.lock-sub { margin: 0 0 24px; font-size: 12.5px; color: var(--ink-3); }
.lock form { display: flex; gap: 8px; }
.lock input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  text-align: center;
  letter-spacing: 0.12em;
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.lock input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.lock .btn { height: 42px; padding: 0 20px; }
.lock-err { min-height: 18px; margin: 12px 0 0; font-size: 12px; color: var(--danger); }

/* ---------------------------------------------------------------- */
/* Toast                                                             */
/* ---------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 100;
  transform: translate(-50%, 12px);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-radius: 10px;
  background: #1b1916;
  color: #f4f1ea;
  font-size: 12.5px;
  box-shadow: 0 16px 34px -16px rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: 0.28s var(--ease);
  max-width: min(90vw, 520px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button {
  border: 0;
  background: transparent;
  color: #ffb08e;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  font-weight: 550;
}
.toast button:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- */
/* 响应式                                                            */
/* ---------------------------------------------------------------- */

@media (max-width: 1180px) {
  .main { padding: 0 28px 80px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 22px 15px; }
  .editor { grid-template-columns: minmax(0, 1fr) 286px; gap: 22px; }
  .editor-side { padding-left: 22px; }
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(12px);
    overflow-x: auto;
  }
  .brand { margin: 0; padding: 0; flex: none; }
  .brand-text i { display: none; }
  .brand-mark { width: 30px; height: 30px; font-size: 16px; border-radius: 8px; }
  .nav { flex-direction: row; gap: 2px; }
  .nav-item { height: 32px; padding: 0 10px; font-size: 12.5px; white-space: nowrap; }
  .nav-item svg { display: none; }
  .nav-count { display: none; }
  .side-stats, .side-foot { display: none; }
  .main { padding: 0 20px 70px; }
  .topbar { padding: 14px 0 12px; }
  .page-head { margin: 18px 0 14px; }
  .editor { grid-template-columns: 1fr; }
  .editor-side {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 18px;
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    grid-template-areas: "preview tabs" "preview panes";
    align-items: start;
    gap: 12px 18px;
  }
  .poster-preview { grid-area: preview; max-width: 150px; margin: 0; }
  .poster-tabs { grid-area: tabs; }
  .poster-pane { grid-area: panes; }
  .clear-poster { grid-column: 2; justify-self: start; }
  .layer.center { padding: 12px; }
  .modal { max-height: 94vh; border-radius: 14px; }
}

@media (max-width: 720px) {
  .main { padding: 0 14px 60px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .searchbox { max-width: none; order: 2; width: 100%; }
  .topbar-actions { order: 1; width: 100%; justify-content: space-between; }
  .sortbox span { display: none; }
  .page-head h1 { font-size: 22px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 20px 12px; }
  .card-title { font-size: 12.5px; }
  .drawer { width: 100%; }
  .drawer-hero { grid-template-columns: 112px minmax(0, 1fr); gap: 14px; }
  .drawer-title { font-size: 18px; }
  .rating-num { font-size: 32px; }
  .editor { padding: 18px 16px 22px; gap: 18px; }
  .editor-side { grid-template-columns: 1fr; grid-template-areas: "preview" "tabs" "panes"; }
  .poster-preview { max-width: 140px; margin: 0 auto; }
  .field-row.three { grid-template-columns: 1fr 1fr; }
  .field-row-seg { grid-template-columns: 1fr; }
  .modal-head, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .meta-grid { gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
