:root {
  color-scheme: light;
  --bg: #f4f7f1;
  --panel: #fffdf7;
  --ink: #182522;
  --muted: #667470;
  --line: #dce4d6;
  --accent: #0b7a66;
  --accent-2: #b9475b;
  --shadow: 0 18px 48px rgba(24, 37, 34, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(11, 122, 102, 0.05) 1px, transparent 1px) 0 0 / 36px 36px,
    linear-gradient(180deg, rgba(185, 71, 91, 0.04), transparent 45vh),
    var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select,
input {
  -webkit-tap-highlight-color: transparent;
}

.mobile-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 12px;
  background: rgba(244, 247, 241, 0.92);
  border-bottom: 1px solid rgba(220, 228, 214, 0.85);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  color: white;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
  line-height: 1.1;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.account-link {
  flex: 0 0 auto;
  padding: 8px 12px;
  color: var(--accent);
  border: 1px solid rgba(11, 122, 102, 0.35);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.8);
  font-weight: 700;
  text-decoration: none;
}

main {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 12px 12px 40px;
}

.search-panel {
  position: sticky;
  top: 59px;
  z-index: 15;
  padding: 12px;
  background: rgba(255, 253, 247, 0.94);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(24, 37, 34, 0.08);
  backdrop-filter: blur(16px);
  transition: transform 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
  will-change: transform, opacity;
}

.search-panel.is-hidden {
  transform: translateY(calc(-100% - 12px));
  opacity: 0;
  pointer-events: none;
  box-shadow: none;
}

label {
  display: block;
  min-width: 0;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
  outline: none;
}

input {
  padding: 0 12px;
}

select {
  padding: 0 34px 0 10px;
}

input:focus,
select:focus {
  border-color: rgba(11, 122, 102, 0.65);
  box-shadow: 0 0 0 3px rgba(11, 122, 102, 0.12);
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 10px;
  margin-top: 10px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 2px 10px;
  color: var(--accent);
  font-size: 14px;
}

.status-row span {
  color: var(--muted);
}

.mobile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
}

.masonry-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 10px;
}

.mobile-card {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(220, 228, 214, 0.9);
  border-radius: 10px;
  background: #fffefb;
  box-shadow: 0 8px 24px rgba(24, 37, 34, 0.08);
}

.mobile-card button {
  display: block;
  width: 100%;
  padding: 0;
  color: inherit;
  border: 0;
  background: transparent;
  text-align: left;
}

.thumb {
  display: block;
  min-height: 0;
  background: #edf3eb;
}

.thumb img,
.thumb video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb.is-ppt {
  aspect-ratio: 16 / 9;
}

.thumb.is-ppt img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 7px;
  color: white;
  background: rgba(11, 122, 102, 0.92);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.card-copy {
  display: none;
}

.card-copy p {
  display: -webkit-box;
  min-height: 38px;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-copy small {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.load-more {
  display: block;
  width: 100%;
  min-height: 46px;
  margin: 18px 0 4px;
  color: var(--accent);
  border: 1px solid rgba(11, 122, 102, 0.35);
  border-radius: 10px;
  background: rgba(255, 253, 247, 0.94);
  font-weight: 800;
}

.load-more:disabled {
  opacity: 0.62;
}

.sentinel {
  height: 1px;
}

.back-top {
  position: fixed;
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  z-index: 18;
  display: none;
  width: 42px;
  height: 42px;
  color: white;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--shadow);
  font-size: 20px;
  font-weight: 900;
}

.back-top.is-visible {
  display: block;
}

.detail-dialog {
  width: 100%;
  max-width: 720px;
  height: 94dvh;
  max-height: 94dvh;
  margin: auto auto 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 18px 18px 0 0;
  background: transparent;
}

.detail-dialog::backdrop {
  background: rgba(24, 37, 34, 0.48);
}

.sheet {
  height: 100%;
  overflow: auto;
  background: var(--panel);
  will-change: transform, opacity;
}

.sheet.is-closing {
  transform: translateY(100%);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.sheet-head button {
  width: 38px;
  height: 38px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-size: 26px;
  line-height: 1;
}

.detail-media {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  max-height: 62dvh;
  overflow: hidden;
  background: #101614;
}

.detail-media img,
.detail-media video {
  display: block;
  width: 100%;
  max-height: 62dvh;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.detail-media img {
  cursor: zoom-in;
}

.ppt-viewer {
  width: 100%;
  background: #101614;
}

.ppt-viewer img {
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

.ppt-controls {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: white;
  background: rgba(16, 22, 20, 0.82);
  text-align: center;
}

.ppt-controls button {
  height: 36px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 24px;
}

.ppt-controls button:disabled {
  opacity: 0.35;
}

.detail-body {
  padding: 14px;
  border-top: 1px solid var(--line);
}

.detail-ad-box {
  position: relative;
  display: none;
  align-items: center;
  justify-items: center;
  min-height: 84px;
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid rgba(220, 228, 214, 0.72);
  border-radius: 10px;
  background: rgba(255, 253, 247, 0.45);
}

.detail-ad-skeleton {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.detail-ad-skeleton::before {
  content: "";
  display: block;
  width: 100%; 
  height: 84px;
  background:
    linear-gradient(90deg, transparent, rgba(11, 122, 102, 0.08), transparent),
    linear-gradient(rgba(11, 122, 102, 0.06), rgba(11, 122, 102, 0.06));
  background-size: 160px 100%, 100% 100%;
  background-position: -160px 0, 0 0;
  animation: ad-skeleton 1.8s ease-in-out infinite;
}

.mobile-detail-ad-unit {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 84px;
}

.detail-ad-box:has(iframe) .detail-ad-skeleton {
  opacity: 0;
}

@keyframes ad-skeleton {
  to {
    background-position: calc(100% + 160px) 0, 0 0;
  }
}

.prompt-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffefb;
  box-shadow: 0 8px 22px rgba(24, 37, 34, 0.06);
}

.prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.prompt-head button {
  padding: 8px 12px;
  color: white;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  font-weight: 800;
}

#detailPrompt {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 0;
}

.detail-meta div {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
}

.detail-meta dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.detail-meta dd {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  display: block;
  grid-column: 1 / -1;
  padding: 56px 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.72);
  text-align: center;
}

.empty-state strong {
  display: block;
  font-size: 22px;
}

.empty-state p {
  margin: 8px 0 0;
  color: var(--muted);
}

.zoom-dialog {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(16, 22, 20, 0.96);
}

.zoom-dialog::backdrop {
  background: rgba(16, 22, 20, 0.86);
}

.zoom-dialog button {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 12px;
  z-index: 3;
  width: 42px;
  height: 42px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 28px;
  line-height: 1;
}

.zoom-dialog img {
  display: block;
  width: 100%;
  min-height: 100%;
  object-fit: contain;
}

@media (max-width: 360px) {
  .mobile-grid {
    gap: 8px;
  }

  .masonry-column {
    gap: 8px;
  }
}

@media (min-width: 620px) {
  .mobile-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .search-panel {
    top: 70px;
  }
}
