:root {
  --bg: #0c0612;
  --card: #181022;
  --elevated: #21162e;
  --text: #f8f0ff;
  --muted: #a897b8;
  --accent: #f0abfc;
  --accent-2: #c084fc;
  --line: rgba(240, 171, 252, 0.18);
  --radius: 16px;
  --space: 16px;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

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

body {
  font-family: var(--font);
  background:
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(192, 132, 252, 0.22), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
}

body.modal-open { overflow: hidden; }

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.hero { text-align: center; margin-bottom: 20px; }
.hero-eyebrow {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--accent);
  margin-bottom: 8px;
}
.hero h1 { font-size: 1.55rem; font-weight: 700; margin-bottom: 6px; }
.hero-sub { color: var(--muted); font-size: 13px; }

.search-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 20px;
}

.search-combo {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.search-combo input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #120c1a;
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.search-combo input:focus {
  border-color: rgba(240, 171, 252, 0.55);
}

.btn-search {
  padding: 11px 18px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #d946ef, #7c3aed);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.suggest-list {
  list-style: none;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #120c1a;
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
}

.suggest-list[hidden] {
  display: none;
}

.suggest-list li {
  padding: 11px 14px;
  font-size: 14px;
  border-bottom: 1px solid rgba(240, 171, 252, 0.08);
  cursor: pointer;
}

.suggest-list li:last-child {
  border-bottom: none;
}

.suggest-list li:active,
.suggest-list li:hover {
  background: var(--elevated);
  color: var(--accent);
}

.empty-panel {
  text-align: center;
  padding: 28px 12px;
  color: var(--muted);
  background: rgba(24, 16, 34, 0.55);
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  margin-bottom: 16px;
}

.empty-text { font-size: 14px; }
.recommend-title { margin: 18px 0 10px; font-size: 13px; color: var(--text); }
.recommend-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--elevated);
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 4px 0 12px;
  color: var(--muted);
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feed-load-zone {
  padding: 8px 0 24px;
  text-align: center;
}

.feed-load-zone[hidden] {
  display: none;
}

.feed-load-tip {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.feed-load-tip.is-loading {
  color: var(--accent-2);
}

.feed-sentinel {
  height: 1px;
  width: 100%;
  pointer-events: none;
}

.feed-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.feed-title {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.feed-place {
  font-size: 13px;
  color: var(--accent-2);
  margin-bottom: 8px;
}

.feed-summary {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}

.feed-card .media-grid {
  margin: 0 0 12px;
}

.fields-table {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--elevated);
  border-radius: 12px;
}

.field-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.field-name {
  color: var(--muted);
  flex-shrink: 0;
}

.field-value {
  text-align: right;
  word-break: break-all;
}

.feed-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
  white-space: pre-wrap;
}

/* media layouts */
.media-grid { width: 100%; }
.media-cell {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #0a0610;
  min-height: 0;
  cursor: pointer;
}
.media-cell img,
.media-cell video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  vertical-align: top;
  pointer-events: none;
}
.media-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  pointer-events: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  touch-action: none;
}
.lightbox[hidden] { display: none; }
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
}
.lightbox-body {
  position: relative;
  z-index: 1;
  max-width: min(100%, 720px);
  max-height: 82vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-body img,
.lightbox-body video {
  max-width: 100%;
  max-height: 82vh;
  border-radius: 10px;
  background: #000;
}
.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }
.lightbox-count {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}

.back-top {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 25;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(24, 16, 34, 0.92);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
}

.back-top[hidden] {
  display: none;
}

.back-top:active {
  transform: scale(0.96);
}

body.modal-open .back-top {
  display: none !important;
}

.media-n1 .media-cell { aspect-ratio: 3 / 4; max-height: 70vh; }

.media-n2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.media-n2 .media-cell { aspect-ratio: 3 / 4; }

.media-n3,
.media-n4 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 6px;
  align-items: stretch;
}
.media-main {
  display: flex;
  min-height: 0;
}
.media-main .media-cell {
  flex: 1;
  width: 100%;
  min-height: 220px;
}
.media-side {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 220px;
}
.media-n3 .media-side .media-cell,
.media-n4 .media-side .media-cell {
  flex: 1;
  min-height: 0;
}

.media-row {
  display: grid;
  gap: 6px;
  margin-bottom: 6px;
}
.media-row:last-child { margin-bottom: 0; }
.media-row-2 { grid-template-columns: 1fr 1fr; }
.media-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.media-n5 .media-cell,
.media-n6 .media-cell { aspect-ratio: 1; }

.media-has-more .media-extra {
  margin-top: 6px;
}
.media-has-more .media-extra .media-cell {
  aspect-ratio: 1;
}

@media (min-width: 560px) {
  .page { max-width: 640px; padding-top: 28px; }
}
