:root {
  color-scheme: dark;
  --bg: #080a0e;
  --panel: #11151b;
  --line: #242c36;
  --muted: #929dab;
  --text: #e8edf3;
  --accent: #8dc8fa;
  --green: #59d194;
  --red: #ff777f;
  --radius: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea, select { color: inherit; font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid #83b6ed; outline-offset: 3px; }
a { color: #91c8ff; text-decoration: none; }
a:hover { text-decoration: underline; }
code { border: 1px solid var(--line); border-radius: 6px; background: #0b0e13; padding: 2px 6px; color: #ccd7e2; font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }

.app-shell { display: grid; grid-template-columns: 200px minmax(0, 710px) 260px; gap: 22px; justify-content: center; width: min(100%, 1290px); min-height: 100vh; margin: 0 auto; padding: 0 20px; }
.left-rail { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 18px 4px 16px 0; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #323c47; border-radius: 14px; color: #fff; background: #111820; font-size: 29px; font-weight: 760; line-height: 1; }
.main-nav { display: grid; gap: 7px; margin-top: 28px; }
.nav-button { display: flex; align-items: center; gap: 13px; min-height: 45px; width: 100%; padding: 0 12px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: #bec8d3; text-align: left; }
.nav-button:hover, .nav-button.active { border-color: var(--line); background: #11161d; color: #fff; }
.nav-button.active { font-weight: 650; }
.nav-icon { width: 20px; color: #a4b1bf; font-size: 21px; text-align: center; }
.count-badge { margin-left: auto; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 20px; background: #6d2730; color: #ffd8dc; font-size: 11px; text-align: center; }
.rail-footer { display: grid; gap: 4px; margin-top: auto; }
.signed-in { display: flex; align-items: center; gap: 9px; padding: 12px; color: var(--muted); font-size: 12px; }
.status-dot { display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.main-column { min-width: 0; border-right: 1px solid var(--line); border-left: 1px solid var(--line); }
.topbar { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 68px; padding: 10px 19px; border-bottom: 1px solid var(--line); background: #080a0eee; backdrop-filter: blur(16px); }
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.icon-button { display: grid; place-items: center; width: 37px; height: 37px; border: 1px solid var(--line); border-radius: 11px; background: #10151c; color: #bdc9d5; font-size: 21px; }
.icon-button:hover { border-color: #465363; color: white; }
.feed-filters { display: flex; align-items: center; gap: 7px; padding: 10px 17px; border-bottom: 1px solid var(--line); }
.filter-button, .text-button { min-height: 32px; padding: 0 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #aeb8c4; font-size: 12px; }
.filter-button { min-width: 35px; border-color: var(--line); font-size: 16px; }
.filter-button.active { color: #ff8190; border-color: #71313a; background: #31171c; }
#bookmarked-filter.active { color: #f0cd76; border-color: #68562c; background: #2b2415; }
.tag-filter-label { display: flex; align-items: center; gap: 7px; margin-left: auto; color: var(--muted); font-size: 11px; }
.tag-filter-label select { max-width: 180px; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: #10151c; }
.text-button { color: #aab4c0; }
.text-button:hover { background: #ffffff0c; color: white; }
.feed { min-height: 100px; }
.post-card { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); animation: appear .18s ease-out; }
@keyframes appear { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.post-main { min-width: 0; }
.post-heading { display: flex; align-items: baseline; gap: 9px; min-height: 25px; }
.author-link { border: 0; padding: 0; background: transparent; color: #edf2f7; font-size: 14px; font-weight: 680; }
.author-link:hover { color: white; text-decoration: underline; }
.post-time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.post-body { margin: 6px 0 10px; color: #dce2e9; font-size: 14px; line-height: 1.62; overflow-wrap: anywhere; white-space: pre-wrap; }
.post-body:empty { display: none; }

.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 11px; }
.media-grid.single { grid-template-columns: minmax(0, 1fr); }
.media-frame { position: relative; min-width: 0; border: 1px solid #29323d; border-radius: 12px; background: #05070a; }
.media-frame img { display: block; width: 100%; max-height: 500px; object-fit: cover; cursor: zoom-in; border-radius: inherit; }
.media-grid.single .media-frame img { max-height: 620px; object-fit: contain; }
.image-button { display: block; width: 100%; padding: 0; overflow: hidden; border: 0; border-radius: inherit; background: transparent; }
.media-number { position: absolute; z-index: 1; top: 8px; left: 8px; display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid #ffffff35; border-radius: 50%; background: #05070ad9; color: #fff; font-size: 10px; pointer-events: none; }
.video-frame { padding: 0; overflow: visible; }
.video-player { position: relative; min-width: 0; overflow: visible; border-radius: inherit; background: #000; }
.video-viewport { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 9; max-height: min(66vh, 520px); overflow: hidden; border-radius: 11px 11px 0 0; background: #000; }
.video-viewport video { display: block; width: 100%; height: 100%; max-height: min(66vh, 520px); object-fit: contain; background: #000; }
.player-controls { position: relative; z-index: 2; display: flex; align-items: center; gap: 7px; min-height: 43px; padding: 5px 8px; overflow: visible; border-top: 1px solid #252b33; border-radius: 0 0 11px 11px; background: #10151b; }
.player-button { display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: #e1e7ee; }
.player-button svg { display: block; }
.player-button:hover { background: #ffffff12; }
.player-time { flex: 0 0 auto; color: #bcc6d0; font: 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.seek-area { position: relative; flex: 1 1 auto; min-width: 40px; height: 26px; display: flex; align-items: center; }
.timeline-range, .volume-range { width: 100%; height: 20px; margin: 0; accent-color: #d6e4f2; cursor: pointer; }
.volume-range { width: 64px; accent-color: #d6e4f2; }
.timeline-preview { position: absolute; z-index: 5; bottom: 25px; display: grid; justify-items: center; width: 126px; padding: 4px; border: 1px solid #53606e; border-radius: 8px; background: #080a0e; box-shadow: 0 6px 22px #0009; transform: translateX(-50%); pointer-events: none; }
.timeline-preview img { display: block; width: 116px; height: 66px; object-fit: contain; background: #000; }
.timeline-preview span { padding-top: 2px; color: #e8edf3; font: 10px ui-monospace, monospace; }
.video-player:fullscreen { display: flex; flex-direction: column; width: 100vw; height: 100vh; padding: 14px; border: 0; border-radius: 0; background: #000; }
.video-player:fullscreen .video-viewport { flex: 1 1 auto; width: 100%; height: auto; max-height: none; aspect-ratio: auto; border-radius: 0; }
.video-player:fullscreen .video-viewport video { width: 100%; height: 100%; max-height: none; }
.video-player:fullscreen .player-controls { flex: 0 0 auto; width: min(100%, 980px); margin: 0 auto; }
.post-details { margin-top: 8px; }
.post-tags, .editor-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-chip { min-height: 24px; padding: 2px 8px; border: 1px solid #263c50; border-radius: 20px; background: #101a23; color: #94cafa; font-size: 10px; }
.tag-chip:hover { background: #182634; }
.post-actions { display: flex; align-items: center; gap: 5px; min-height: 31px; }
.action-icon { display: grid; place-items: center; width: 32px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #84909e; font-size: 16px; }
.action-icon:hover { background: #ffffff0c; color: #d9e2ea; }
.action-icon.selected { color: #ff7788; }
.action-icon[aria-label="取消收藏"] { color: #f0cd76; }
.edit-annotation { margin-left: 2px; }
.delete-link { margin-left: auto; color: #85909c; }
.delete-link:hover { background: #351a1d; color: #ffa6ac; }
.annotation-editor { display: grid; gap: 8px; margin: 7px 0 2px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: #0d1117; }
.annotation-editor textarea { width: 100%; min-height: 68px; padding: 8px; resize: vertical; border: 1px solid #303b47; border-radius: 8px; background: #080b10; color: var(--text); font-size: 12px; }
.tag-editor-row { display: flex; gap: 7px; }
.tag-editor-row input { flex: 1; min-width: 0; height: 34px; padding: 0 9px; border: 1px solid #303b47; border-radius: 8px; background: #080b10; font-size: 12px; }
.tag-editor-row .secondary-button { min-height: 34px; }
.editor-tags { min-height: 0; }
.removable { color: #b9c4ce; }
.editor-actions { display: flex; justify-content: flex-end; gap: 7px; }
.empty-state { padding: 45px 20px; color: var(--muted); text-align: center; }
.empty-state h2 { margin: 0; font-size: 15px; font-weight: 500; }
.feed-status { min-height: 22px; padding: 7px 14px; color: var(--muted); font-size: 11px; text-align: center; }
.secondary-button, .primary-button, .danger-button { min-height: 36px; padding: 0 13px; border: 1px solid #35404c; border-radius: 10px; background: #151b23; color: #e5ebf1; font-size: 11px; font-weight: 650; }
.secondary-button:hover { border-color: #596979; background: #1c2530; }
.primary-button { border-color: #dce5ee; background: #e2e9f0; color: #12171d; }
.primary-button:hover { background: white; }
.danger-button { border-color: #af3c47; background: #a4313c; color: white; }
.danger-button:hover { background: #c13a47; }
.full-button { width: 100%; margin-top: 4px; }
.load-more { display: block; margin: 12px auto 24px; }
.right-rail { padding-top: 18px; }
.side-card { margin-bottom: 14px; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: #10151b; }
.search-label { display: flex; align-items: center; gap: 8px; height: 39px; padding: 0 10px; border: 1px solid #29323d; border-radius: 10px; background: #090c10; color: #8090a0; font-size: 18px; }
.search-label input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.author-results { padding-top: 5px; }
.author-result { display: block; width: 100%; padding: 9px 7px; border: 0; border-radius: 8px; background: transparent; color: #d9e1e9; text-align: left; font-size: 12px; }
.author-result:hover { background: #ffffff08; }
.empty-authors { padding: 9px 7px; color: var(--muted); font-size: 11px; }
.card-heading { display: flex; align-items: center; gap: 8px; }
.card-heading h2 { margin: 0; font-size: 13px; }
.status-copy { margin: 9px 0 0; color: #d0d7df; font-size: 11px; }
.scan-time { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.preview-status { display: grid; gap: 7px; margin-top: 12px; color: var(--muted); font-size: 10px; }
.preview-status b { color: #d8e0e8; font-weight: 600; }
.preview-status .text-button { width: fit-content; padding-left: 0; }
.login-view { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: radial-gradient(ellipse at 50% 15%, #182432, transparent 56%), var(--bg); }
.login-card { width: min(100%, 370px); padding: 28px; border: 1px solid #2b3540; border-radius: 20px; background: #10151bed; box-shadow: 0 25px 80px #0008; }
.brand-mark-large { width: 49px; height: 49px; margin-bottom: 17px; }
.login-card h1 { margin: 0 0 10px; font-size: 23px; }
.login-card label, .password-form label { display: grid; gap: 6px; margin: 15px 0 0; color: #b4c0cc; font-size: 11px; font-weight: 600; }
.login-card input, .password-form input { width: 100%; height: 42px; padding: 0 11px; border: 1px solid #303b47; border-radius: 9px; background: #090c10; color: white; }
.form-error { min-height: 16px; margin: 6px 0; color: #ff959d; font-size: 11px; }
.login-card .full-button { margin-top: 6px; }
.mobile-search-close { display: none; }
.dialog-card { width: min(calc(100% - 30px), 440px); max-height: min(80vh, 680px); padding: 22px; border: 1px solid #35414c; border-radius: 17px; background: #11161d; color: var(--text); box-shadow: 0 24px 95px #000b; }
.dialog-card::backdrop { background: #0009; backdrop-filter: blur(4px); }
.dialog-card h2 { margin: 0 0 10px; font-size: 18px; }
.dialog-card > p { color: #aab5c1; font-size: 12px; line-height: 1.6; }
.dialog-id { padding: 5px 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.wide-dialog { width: min(calc(100% - 30px), 560px); }
.dialog-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-topline h2 { margin: 0; }
.deletion-list { display: grid; gap: 8px; max-height: 48vh; overflow: auto; margin-top: 14px; }
.deletion-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: #0b0e13; }
.deletion-entry code { width: fit-content; }
.deletion-entry p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.status-pending { color: #f1c977; }
.status-failed { color: #ff9098; }
.status-complete { color: var(--green); }
.deletion-entry button { min-height: 30px; }
.password-form .dialog-actions { margin-top: 11px; }
.lightbox { position: relative; width: min(96vw, 1200px); max-width: none; max-height: 94vh; padding: 14px; overflow: visible; border: 1px solid #4c5663; border-radius: 13px; background: #080a0e; }
.lightbox::backdrop { background: #000e; }
.lightbox img { display: block; max-width: 100%; max-height: calc(94vh - 28px); margin: auto; object-fit: contain; }
.lightbox-close { position: absolute; z-index: 1; top: -13px; right: -13px; display: grid; place-items: center; width: 35px; height: 35px; border: 1px solid #56616e; border-radius: 50%; background: #151b23; color: white; font-size: 21px; }
.toast { position: fixed; z-index: 8; right: 20px; bottom: 20px; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px; border: 1px solid #394552; border-radius: 11px; background: #151b23; color: #eaf1f7; font-size: 12px; box-shadow: 0 14px 40px #0008; opacity: 0; pointer-events: none; transform: translateY(9px); transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 140px minmax(0, 1fr); gap: 12px; padding: 0 12px; }
  .right-rail { display: none; }
  .right-rail.mobile-search-open { position: fixed; z-index: 7; inset: 0; display: block; width: 100%; max-height: 100vh; overflow: auto; padding: 15px 13px calc(75px + env(safe-area-inset-bottom)); background: var(--bg); }
  .right-rail.mobile-search-open .search-card { max-width: 520px; margin: 0 auto; }
  .mobile-search-close { display: block; margin: 0 0 9px auto; }
}
@media (max-width: 690px) {
  .app-shell { display: block; padding: 0 0 calc(62px + env(safe-area-inset-bottom)); }
  .left-rail { position: fixed; z-index: 4; inset: auto 0 0; display: block; width: 100%; height: auto; padding: 5px max(8px, env(safe-area-inset-left)) calc(5px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #0c1016f7; backdrop-filter: blur(20px); }
  .left-rail > .brand-mark, .rail-footer { display: none; }
  .main-nav { display: flex; justify-content: space-around; gap: 0; margin: 0; }
  .nav-button { display: grid; justify-items: center; gap: 1px; min-height: 48px; width: 25%; padding: 3px 1px; border-radius: 9px; font-size: 9px; }
  .nav-icon { font-size: 18px; }
  .count-badge { position: absolute; margin: -28px 0 0 24px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 9px; }
  .main-column { min-height: calc(100vh - 60px); border: 0; }
  .topbar { min-height: 61px; padding: 9px 14px; }
  .topbar h1 { font-size: 18px; }
  .feed-filters { padding: 8px 12px; }
  .tag-filter-label { gap: 5px; font-size: 10px; }
  .tag-filter-label select { max-width: 135px; }
  .post-card { padding: 14px 12px 10px; }
  .post-body { font-size: 13px; }
  .media-grid { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .media-frame { border-radius: 9px; }
  .video-viewport { max-height: min(58vh, 420px); }
  .video-viewport video { max-height: min(58vh, 420px); }
  .player-controls { flex-wrap: wrap; justify-content: space-between; gap: 2px; min-height: 0; padding: 4px 5px; }
  .player-controls .seek-area { order: 10; flex: 1 0 100%; }
  .player-button { width: 40px; height: 40px; }
  .player-time { font-size: 9px; }
  .volume-range { width: 40px; }
  .timeline-preview { width: 105px; }
  .timeline-preview img { width: 95px; height: 55px; }
  .load-more { margin-bottom: 86px; }
  .feed-status { padding-bottom: 75px; }
  .toast { right: 11px; bottom: calc(63px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  .volume-range { width: 34px; }
  .player-controls { gap: 1px; padding-left: 2px; padding-right: 2px; }
  .player-time { font-size: 8px; }
  .player-button { width: 38px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
