:root {
  color-scheme: light;
  --bg: #f4f6e8;
  --text: #3d4630;
  --muted: #616d46;
  --primary: #8a9a4e;
  --primary-dark: #59672f;
  --primary-soft: #eef1d6;
  --line: #c3cd9a;
  --shadow: 0 4px 16px rgba(90, 110, 45, .08);
  --ease: cubic-bezier(.175, .885, .32, 1.275);
}
* { box-sizing: border-box; }
html {
  min-height: 100%;
  background: radial-gradient(ellipse at 15% 8%, rgba(253,247,216,.75), transparent 45%),
    radial-gradient(ellipse at 85% 15%, rgba(138,154,78,.22), transparent 50%),
    url('../assets/bg-person.webp') right bottom / auto 80vh no-repeat,
    linear-gradient(160deg, #f4f6e8, #e9eed4 45%, #dfe8bd);
  background-attachment: fixed;
  background-color: var(--bg);
}
body { margin: 0; color: var(--text); font: 13px/1.55 'Microsoft YaHei', 'Segoe UI', sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .65; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--primary-dark); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.layout { max-width: 1140px; margin: 0 auto; padding: 14px 14px 56px; }
.site-tabs { position: fixed; left: 0; top: 90px; z-index: 2; display: flex; flex-direction: column; gap: 18px; }
.site-tab {
  position: relative; isolation: isolate; display: flex; align-items: center; gap: 7px;
  height: 46px; padding: 0 19px 0 12px; font-size: 15px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
  filter: drop-shadow(0 2px 6px rgba(122,136,70,.12)); transition: transform .2s var(--ease);
}
.site-tab::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: rgba(255,255,255,.72); backdrop-filter: blur(10px);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%);
}
.site-tab:hover { transform: translateX(5px); }
.site-tab:hover::before { background: rgba(255,255,255,.92); }
.site-tab[aria-current] { color: #3c4a22; font-weight: 800; }
.site-tab[aria-current]::before { background: rgba(138,154,78,.42); }
.site-tab img { height: 52px; width: auto; display: block; flex-shrink: 0; object-fit: contain; }
.site-tab svg.icon { width: 18px; height: 18px; display: block; flex-shrink: 0; fill: currentColor; }
.site-tab .tab-emoji { font-size: 26px; line-height: 1; display: inline-block; flex-shrink: 0; }
@media (min-width: 769px) and (max-width: 1440px) {
  .site-tabs { transform: translateX(-56px); opacity: .88; transition: transform .25s var(--ease), opacity .2s; }
  .site-tabs:hover, .site-tabs:focus-within { transform: translateX(0); opacity: 1; }
}
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 24px 16px; margin-bottom: 16px; border-radius: 24px;
  border: 1px solid rgba(255,255,255,.35); color: #fff;
  background: linear-gradient(rgba(122,136,70,.9), rgba(104,118,58,.94)), url('../assets/xiaosonglu-bg.webp') center / cover;
  box-shadow: 0 8px 24px rgba(122,136,70,.22);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand img { width: 52px; height: 52px; flex: none; border-radius: 16px; object-fit: cover; background: rgba(255,255,255,.22); box-shadow: 0 6px 18px #0003, 0 0 0 2.5px #fdf7d866; }
h1 { font-size: 27px; line-height: 1.2; }
h2 { font-size: 17px; line-height: 1.4; }
.feature, .list-section { padding-inline: 4px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.list-section { margin-top: 16px; }
.card {
  min-width: 0; border: 1.5px solid rgba(138,154,78,.28); border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,.70), rgba(238,245,228,.56));
  backdrop-filter: blur(10px) saturate(1.25); box-shadow: inset 0 1px 0 #fffc, var(--shadow);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:hover, .card:focus-within { border-color: rgba(138,154,78,.55); box-shadow: inset 0 1px 0 #fffc, 0 10px 24px rgba(90,110,45,.14); }
.feature .card { background: linear-gradient(135deg, rgba(230,244,210,.88), rgba(240,248,224,.80)); border-color: rgba(138,154,78,.65); }
.copy { display: block; width: 100%; border: 0; background: none; text-align: left; padding: 9px 16px; border-radius: 12px; }
.copy:hover .quote { text-decoration: underline; text-underline-offset: 4px; }
.quote { display: block; font-size: 15px; font-weight: 650; overflow-wrap: anywhere; white-space: pre-wrap; }
.feature .quote { font-size: 17px; }
.meta, .card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 10px; color: var(--muted); font-size: 12px; }
.meta { padding: 10px 16px 0; }
.meta [data-field="id"] { font-variant-numeric: tabular-nums; font-weight: 700; }
.card-foot { justify-content: space-between; padding: 0 16px 9px; }
.copy-label, .action { display: inline-flex; align-items: center; gap: 5px; justify-content: center; border: 1px solid var(--line); border-radius: 999px; font-weight: 650; white-space: nowrap; }
.copy-label { min-height: 28px; padding: 2px 8px; color: var(--primary-dark); background: rgba(255,255,255,.54); }
.action { min-height: 34px; padding: 0 11px; background: var(--primary-soft); color: var(--primary-dark); }
.copy-label svg, .action svg { width: 15px; height: 15px; flex: none; }
.copy-label:hover, .action:hover, .tag:hover { border-color: var(--primary); background: #f8faef; }
.filters { padding: 11px 12px; margin-bottom: 9px; border: 1px solid #fffd; border-radius: 16px; background: rgba(255,255,255,.75); backdrop-filter: blur(16px) saturate(1.3); box-shadow: var(--shadow); }
.controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.controls label { min-width: 0; }
input, select { width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.65); }
input::placeholder { color: var(--muted); }
.header-actions { position: relative; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.pip-message:not(:empty) { position: absolute; right: 0; top: calc(100% + 8px); z-index: 3; width: max-content; max-width: 280px; padding: 7px 10px; border-radius: 10px; background: #fff; color: var(--text); box-shadow: var(--shadow); }
.tag-section { margin-top: 10px; }
.tag-heading { font-weight: 700; }
.tags { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.tag-placeholder { color: var(--muted); font-size: 12px; }
#selected-tags .tag:not(.tag-clear) { border-color: var(--primary); background: var(--primary-soft); }
html.memes-pip { min-height: 0; background: var(--bg); }
.memes-pip body { overflow: hidden; }
.pip-panel { display: flex; flex-direction: column; gap: 8px; padding: 10px; height: 100dvh; }
.pip-filters { max-height: 23%; overflow: auto; flex: 0 0 auto; }
.pip-panel .filters { margin: 0; padding: 6px; border-radius: 12px; }
.pip-panel .controls { gap: 5px; }
.pip-panel .controls :is(input, select) { min-height: 29px; padding: 2px 6px; }
.pip-panel .tag-section { margin-top: 4px; }
.pip-panel .tag-heading { font-size: 11px; }
.pip-panel .tags { gap: 3px; margin-top: 2px; }
.pip-panel .tag { min-height: 23px; padding: 1px 6px; font-size: 11px; }
.pip-panel .tag span { margin-left: 3px; }
.pip-summary { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.pip-summary .count { white-space: nowrap; }
.pip-scroll { overflow: auto; flex: 1; min-height: 0; }
.pip-panel .card { border-radius: 12px; }
.pip-panel .quote { font-size: 14px; }
.pip-panel :focus-visible { outline-offset: -2px; }
.tag { padding: 4px 10px; min-height: 29px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.7); font-size: 12px; }
.tag span { margin-left: 5px; color: var(--muted); }
.tag[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 700; }
#submission-dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #f8faee; color: var(--text); box-shadow: 0 16px 60px #27331244; }
#submission-dialog::backdrop { background: #27331266; }
#submission-form { display: grid; gap: 8px; }
#submission-form h2 { margin-bottom: 4px; }
#submission-form label { font-weight: 650; }
#submission-text { width: 100%; min-height: 100px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: inherit; font: inherit; resize: vertical; }
#submission-help { color: var(--muted); font-size: 12px; }
#submission-error { color: #8e3124; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.action.primary { color: #fff; background: var(--primary-dark); }
.action.primary:hover { background: #485526; }
.results { display: grid; gap: 9px; }
.count, .feedback, .empty { font-size: 12px; color: var(--muted); }
.count { padding: 3px 9px; background: rgba(255,255,255,.65); border: 1px solid #fffc; border-radius: 999px; }
.empty, .load-state { padding: 12px; background: #fffc; border-radius: 12px; }
.load-state { display: flex; align-items: center; gap: 10px; }
[data-field="danmaku"], .copy-status:not(:empty) { margin-inline-start: 8px; }
.feedback { min-height: 18px; margin: 4px 4px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (min-width: 769px) and (max-width: 1210px) { .layout { padding-left: max(26px, calc((1210px - 100vw) * .05 + 14px)); } }
@media (prefers-reduced-motion: reduce) { *, *::before { transition: none !important; } }
