:root {
  --primary: #fb923c;
  --primary-dark: #f97316;
  --primary-soft: #fff4ea;
  --bg: #fff9f4;
  --card: #ffffff;
  --ink: #33302c;
  --ink-2: #6b655e;
  --line: #f0e8df;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(80, 50, 20, 0.06);
  --shadow-lg: 0 12px 32px rgba(80, 50, 20, 0.16);
  --c-anim: #f43f5e;
  --c-video: #3b82f6;
  --c-book: #10b981;
  --c-audio: #8b5cf6;
  --c-game: #f59e0b;
  --c-toy: #ec4899;
  --c-craft: #14b8a6;
  --c-place: #22c55e;
  --c-app: #6366f1;
  --c-show: #e11d48;
  --c-food: #ea580c;
  --c-method: #64748b;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { width: min(1120px, 100% - 32px); margin: 0 auto; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 249, 244, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #fbbf24);
  color: #fff; font-weight: 800; font-size: 20px;
  display: grid; place-items: center;
  box-shadow: 0 3px 8px rgba(249, 115, 22, 0.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; }
.brand-text small { font-size: 12px; color: var(--ink-2); }
.topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn {
  border: none; cursor: pointer; font-size: 14px; font-weight: 600;
  padding: 9px 16px; border-radius: 999px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 3px 10px rgba(249, 115, 22, 0.35); }
.btn-primary:hover { box-shadow: 0 5px 14px rgba(249, 115, 22, 0.45); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-danger { background: #ef4444; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 42px 0 26px; }
.hero h1 { font-size: clamp(24px, 4.5vw, 36px); font-weight: 800; letter-spacing: 0.5px; }
.grad { background: linear-gradient(90deg, var(--primary), #f59e0b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 12px auto 22px; color: var(--ink-2); max-width: 560px; font-size: 15px; }
.search-box {
  max-width: 560px; margin: 0 auto; position: relative;
  background: var(--card); border: 2px solid var(--line); border-radius: 999px;
  padding: 4px 8px 4px 18px; display: flex; align-items: center;
  box-shadow: var(--shadow); transition: border-color 0.15s ease;
}
.search-box:focus-within { border-color: var(--primary); }
.search-icon { width: 20px; height: 20px; color: var(--ink-2); flex-shrink: 0; }
.search-box input {
  flex: 1; border: none; outline: none; background: transparent;
  padding: 12px 10px; font-size: 15px; color: var(--ink);
}

/* ---------- Stats ---------- */
.stats-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 18px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 14px; font-size: 13px; color: var(--ink-2);
}
.stat b { color: var(--primary-dark); font-size: 15px; }

/* ---------- Filters ---------- */
.filters {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 22px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.filter-block { display: flex; align-items: flex-start; gap: 10px; }
.filter-label { font-size: 12px; color: var(--ink-2); padding-top: 7px; flex-shrink: 0; width: 44px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 999px; padding: 5px 13px; font-size: 13px; cursor: pointer;
  transition: all 0.15s ease; white-space: nowrap; user-select: none;
}
.chip:hover { border-color: var(--primary); color: var(--primary-dark); }
.chip.active {
  background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600;
}
.chip .count { opacity: 0.7; font-size: 12px; margin-left: 2px; }

/* ---------- Grid ---------- */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); position: relative;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: pop 0.25s ease both;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-title { font-size: 17px; font-weight: 700; line-height: 1.35; }
.card-title a { color: inherit; text-decoration: none; }
.card-title a:hover { color: var(--primary-dark); }
.card-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: 12px; font-weight: 600; border-radius: 6px; padding: 2px 9px;
  background: var(--primary-soft); color: var(--primary-dark);
}
.badge.age { background: #eff6ff; color: #2563eb; }
.badge.status-to_watch { background: #fef9c3; color: #a16207; }
.badge.status-watched { background: #dcfce7; color: #15803d; }
.badge.status-favorite { background: #fce7f3; color: #be185d; }
.card-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.stars { color: #f59e0b; letter-spacing: 1px; }
.stars .off { color: #e5ddd3; }
.card-note { font-size: 14px; color: var(--ink); background: #fbf6f0; border-radius: 10px; padding: 8px 12px; }
.card-note:empty { display: none; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; color: var(--ink-2); background: #f4efe9; border-radius: 999px; padding: 2px 10px; }
.card-foot {
  margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; color: var(--ink-2);
}
.card-source { max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-actions { display: flex; gap: 6px; }
.card-actions button {
  border: none; background: #f4efe9; color: var(--ink-2); cursor: pointer;
  font-size: 12px; border-radius: 8px; padding: 4px 10px; transition: all 0.12s ease;
}
.card-actions button:hover { background: var(--primary); color: #fff; }
.card-actions button.del:hover { background: #ef4444; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 60px 0; }
.empty-emoji { font-size: 48px; margin-bottom: 10px; }
.empty h3 { font-size: 20px; margin-bottom: 6px; }
.empty p { color: var(--ink-2); }

/* ---------- Overlay / Modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(40, 30, 20, 0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: #fff; border-radius: 20px; width: min(560px, 100%);
  max-height: calc(100vh - 48px); overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: modalIn 0.22s ease both;
}
.modal-sm { width: min(380px, 100%); }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.modal-head h2 { font-size: 19px; }
.modal-close { border: none; background: #f4efe9; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.modal-close:hover { background: #e9e1d7; }

/* ---------- Form ---------- */
.form { padding: 8px 22px 22px; }
.form-row { margin-top: 14px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.form label em { color: var(--primary-dark); font-style: normal; }
.form label .tip { color: #b0a79d; font-weight: 400; }
.form input[type="text"], .form input[type="url"], .form input:not([type]), .form input[type="password"],
.form select, .form textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; color: var(--ink); background: #fff; outline: none;
  transition: border-color 0.15s ease; font-family: inherit;
}
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--primary); }
.form textarea { resize: vertical; }
.star-picker { display: flex; align-items: center; gap: 4px; }
.star { font-size: 30px; color: #e5ddd3; cursor: pointer; transition: transform 0.12s ease, color 0.12s ease; line-height: 1; }
.star:hover { transform: scale(1.2); }
.star.on { color: #f59e0b; }
.star-value { font-size: 13px; color: var(--ink-2); margin-left: 8px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.form-actions .btn { min-width: 88px; }

/* ---------- PIN ---------- */
.pin-tip { font-size: 13px; color: var(--ink-2); padding: 12px 22px 0; }
.pin-input {
  margin: 14px 22px 0; width: calc(100% - 44px); border: 1.5px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 18px; text-align: center; letter-spacing: 4px; outline: none;
}
.pin-input:focus { border-color: var(--primary); }
.pin-error { color: #ef4444; font-size: 13px; text-align: center; margin-top: 10px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #33302c; color: #fff; font-size: 14px; padding: 11px 22px;
  border-radius: 999px; box-shadow: var(--shadow-lg); z-index: 200;
  animation: toastIn 0.25s ease both;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 卡片：标题行 + 播放/地图按钮 ---------- */
.card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-play {
  flex-shrink: 0; border: none; cursor: pointer;
  background: linear-gradient(135deg, #fb7185, #f43f5e); color: #fff;
  border-radius: 999px; padding: 5px 14px; font-size: 12px; font-weight: 600;
  box-shadow: 0 2px 6px rgba(244, 63, 94, 0.35);
  transition: transform 0.15s ease;
}
.btn-play:hover { transform: scale(1.06); }
.btn-map, .btn-map-link {
  flex-shrink: 0; font-size: 12px; color: #059669; text-decoration: none;
  background: #ecfdf5; border: 1px solid #a7f3d0;
  border-radius: 999px; padding: 4px 12px; cursor: pointer;
  transition: background 0.15s ease;
}
.btn-map:hover, .btn-map-link:hover { background: #d1fae5; }
.card-place {
  margin-top: 8px; padding: 8px 10px;
  background: #f8fafc; border: 1px dashed #e2e8f0; border-radius: 10px;
  display: flex; flex-direction: column; gap: 3px;
  font-size: 12.5px; color: var(--ink-2);
}
.card-place span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 地图总览入口 ---------- */
.view-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 14px; padding: 10px 14px;
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px;
  font-size: 13px; color: #166534;
}
.view-hint b { color: #16a34a; }

/* ---------- 表单：地点分组 & 地图选点 ---------- */
.form-group {
  padding: 14px; background: #f8fafc;
  border: 1px solid #e2e8f0; border-radius: 12px;
}
.form-group-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; color: var(--ink); }
.form-group-title em { font-weight: 400; }
.geo-search-row { display: flex; gap: 8px; margin-top: 8px; }
.geo-search-row input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px; outline: none;
}
.geo-search-row input:focus { border-color: var(--primary); }
.geo-results {
  max-height: 180px; overflow-y: auto; margin-top: 8px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.geo-result {
  display: block; width: 100%; text-align: left; border: none;
  border-bottom: 1px solid #f1f5f9; padding: 8px 12px; background: #fff;
  cursor: pointer; font-size: 13px;
}
.geo-result:last-child { border-bottom: none; }
.geo-result:hover { background: #f0fdf4; }
.geo-result b { display: block; color: var(--ink); font-weight: 600; }
.geo-result span { color: var(--ink-2); font-size: 12px; }
.place-picker-map {
  width: 100%; height: 260px; margin-top: 8px;
  border-radius: 12px; border: 1px solid var(--line); overflow: hidden; background: #eef2f6;
}
.geo-status { margin-top: 6px; font-size: 12px; color: #059669; }
.geo-status:empty { display: none; }

/* ---------- 观影模式 ---------- */
.player-overlay {
  background: rgba(8, 8, 12, 0.95); z-index: 210;
  flex-direction: column; justify-content: flex-start;
  padding: 0;
}
.player-head {
  width: 100%; max-width: 980px; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.player-title {
  color: #fff; font-size: 15px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.player-overlay .modal-close { background: rgba(255, 255, 255, 0.12); color: #fff; flex-shrink: 0; }
.player-overlay .modal-close:hover { background: rgba(255, 255, 255, 0.22); }
.player-box {
  width: 100%; max-width: 980px; aspect-ratio: 16 / 9;
  background: #000; border-radius: 8px; overflow: hidden;
}
.player-box iframe { width: 100%; height: 100%; display: block; border: 0; }
.player-tip { color: #71717a; font-size: 12px; margin-top: 10px; text-align: center; padding-bottom: 20px; }

/* ---------- 地图弹窗 ---------- */
.modal-map { width: min(720px, 100%); }
.map-detail-box { width: 100%; height: 460px; border-radius: 12px; overflow: hidden; }
.modal-full {
  width: min(1120px, 100%); height: min(760px, calc(100vh - 48px));
  display: flex; flex-direction: column;
}
.modal-full .modal-head { flex-shrink: 0; padding-bottom: 10px; }
.modal-full .modal-head h2 { font-size: 17px; }
.map-view-box { flex: 1; width: 100%; min-height: 0; border-radius: 12px; overflow: hidden; }
.map-info { font-size: 12.5px; line-height: 1.7; max-width: 240px; }
.map-info b { font-size: 14px; display: block; margin-bottom: 4px; }
.map-info a { color: #2563eb; text-decoration: none; font-size: 12px; }

@media (max-width: 640px) {
  .modal-full { height: calc(100vh - 80px); }
  .map-detail-box { height: 380px; }
  .place-picker-map { height: 220px; }
}

.hidden { display: none !important; }

/* ---------- Footer ---------- */
.footer { margin-top: auto; padding: 28px 0 36px; text-align: center; font-size: 13px; color: var(--ink-2); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; }
  .topbar-actions { width: 100%; justify-content: flex-end; }
  .btn { padding: 8px 14px; font-size: 13px; }
  .grid { grid-template-columns: 1fr; }
  .hero { padding: 28px 0 20px; }
  .form-row-2 { grid-template-columns: 1fr; }
  .filter-block { flex-direction: column; gap: 6px; }
  .filter-label { padding-top: 0; }
  .chips { flex-wrap: wrap; }
  .chips-scroll { flex-wrap: nowrap; }
}
