:root {
  color-scheme: light;
  --sidebar: #171b22;
  --sidebar-hover: #222832;
  --sidebar-active: #2b333e;
  --sidebar-text: #f1f3f5;
  --sidebar-muted: #8993a0;
  --canvas: #eef0f2;
  --surface: #ffffff;
  --surface-subtle: #f7f8f9;
  --border: #d8dde3;
  --border-strong: #bec6cf;
  --text: #1e242b;
  --muted: #6c7682;
  --accent: #b83a32;
  --accent-hover: #9f302a;
  --danger-bg: #fff4f3;
  --danger-border: #e4b8b4;
  --success: #29855d;
  --radius: 5px;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 2px solid #4f7ea8; outline-offset: 2px; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: 248px;
  flex-direction: column;
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid #0d1015;
}

.brand {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  border-bottom: 1px solid #2a3039;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  overflow: hidden;
  place-items: center;
  background: #fff;
}
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }

.brand-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; }
.brand-copy strong { font-size: 16px; letter-spacing: .08em; }
.brand-copy span { color: var(--sidebar-muted); font-size: 9px; letter-spacing: .16em; }

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.icon-button svg { width: 19px; height: 19px; }
.sidebar-close { display: none; border-color: #3a424d; background: transparent; color: #c3c9d0; }

.module-nav { padding: 21px 12px 10px; }
.sidebar-label {
  margin: 0 8px 8px;
  color: var(--sidebar-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
}

.module-button {
  display: flex;
  width: 100%;
  height: 42px;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #b7bec7;
  cursor: pointer;
  text-align: left;
}

.module-button svg { width: 19px; height: 19px; }
.module-button:hover { background: var(--sidebar-hover); color: #fff; }
.module-button.active { background: var(--sidebar-active); color: #fff; font-weight: 700; }
.module-button.active::before { content: ""; width: 3px; height: 20px; margin-left: -12px; background: #d25249; }

.sidebar-rule { height: 1px; margin: 8px 20px 20px; background: #2a3039; }
.sidebar-panel { display: none; min-height: 0; flex: 1; overflow: hidden; }
.sidebar-panel.active { display: flex; flex-direction: column; }
.sidebar-heading { display: flex; align-items: baseline; justify-content: space-between; padding: 0 20px; }
.sidebar-heading .sidebar-label { margin-left: 0; }
.sidebar-heading > span { color: #687380; font-size: 11px; }

.category-list {
  min-height: 0;
  padding: 0 12px 18px;
  overflow-y: auto;
  scrollbar-color: #46505c transparent;
  scrollbar-width: thin;
}

.category-button {
  display: flex;
  width: 100%;
  min-height: 37px;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #aeb6c0;
  cursor: pointer;
  text-align: left;
}

.category-button::before { content: ""; width: 5px; height: 5px; margin-right: 10px; border: 1px solid #626d79; }
.category-button > span:first-of-type { flex: 1; }
.category-button small { color: #606b78; font-size: 9px; letter-spacing: .06em; }
.category-button:hover { background: var(--sidebar-hover); color: #fff; }
.category-button.active { background: #242b34; color: #fff; font-weight: 700; }
.category-button.active::before { border-color: #d25249; background: #d25249; }
.category-button.is-warm small::after { content: " · READY"; color: #63aa85; }

.sidebar-footer {
  display: flex;
  min-height: 49px;
  align-items: center;
  gap: 9px;
  padding: 0 20px;
  border-top: 1px solid #2a3039;
  color: var(--sidebar-muted);
  font-size: 11px;
}

.connection-dot { width: 7px; height: 7px; border-radius: 50%; background: #7a838e; }
.connection-dot.ready { background: #48a477; }
.connection-dot.error { background: #ca574e; }

.workspace { min-height: 100vh; margin-left: 248px; }
.workspace-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.96);
}

.header-title-group { display: flex; min-width: 0; align-items: center; gap: 12px; }
.breadcrumb { margin: 0 0 3px; color: var(--muted); font-size: 11px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 19px; line-height: 1.25; }
h2 { margin-bottom: 0; font-size: 20px; line-height: 1.3; }
.menu-button { display: none; }
.header-actions { display: flex; gap: 8px; }
.header-actions[hidden] { display: none; }

.button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.button svg { width: 17px; height: 17px; }
.button:hover:not(:disabled) { border-color: #929da8; background: #f6f7f8; }
.button:disabled { cursor: wait; opacity: .5; }
.primary-button { min-width: 116px; border-color: var(--accent); background: var(--accent); color: #fff; }
.primary-button:hover:not(:disabled) { border-color: var(--accent-hover); background: var(--accent-hover); }

.content-view { display: none; width: min(1160px, calc(100% - 56px)); margin: 0 auto; padding: 30px 0 48px; }
.content-view.active { display: block; }
.content-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-kicker { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.compact-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.compact-status > span { width: 7px; height: 7px; border-radius: 50%; background: #9098a1; }
.compact-status > span.ready { background: var(--success); }
.compact-status > span.error { background: #b83a32; }

.video-stage { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border: 1px solid #11151a; background: #0b0d10; }
.video-stage video { display: block; width: 100%; height: 100%; object-fit: contain; }
.media-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; background: #0b0d10; color: #dfe3e7; }
.media-loading[hidden] { display: none; }
.media-loading strong { font-size: 13px; }
.spinner { width: 27px; height: 27px; border: 2px solid #464d56; border-top-color: #e5e8eb; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.media-tag { position: absolute; top: 13px; left: 13px; padding: 6px 9px; border: 1px solid rgba(255,255,255,.25); background: rgba(8,10,13,.82); color: #fff; font-size: 11px; }
.video-corner-status { position: absolute; right: 13px; bottom: 13px; display: flex; align-items: center; gap: 8px; padding: 6px 9px; border: 1px solid rgba(255,255,255,.2); background: rgba(8,10,13,.82); color: #d8dde2; font-size: 10px; font-variant-numeric: tabular-nums; }
.video-corner-status strong { padding-right: 8px; border-right: 1px solid #555d66; color: #fff; font-size: 10px; }

.player-toolbar { display: flex; min-height: 61px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border: 1px solid var(--border); border-top: 0; background: var(--surface); }
.player-actions { display: flex; align-items: center; gap: 7px; }
.compact-button { min-width: 0; padding: 7px 10px; color: #4d5762; font-size: 12px; }
.compact-button.active { border-color: #747f8b; background: #e9ecef; color: #1f252c; }
.rate-control { display: inline-flex; min-height: 36px; align-items: center; gap: 6px; padding: 0 7px 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: #626c77; font-size: 11px; }
.rate-control select { height: 26px; padding: 0 4px; border: 0; background: transparent; color: var(--text); font-weight: 700; cursor: pointer; outline: 0; }
.check-control { display: inline-flex; align-items: center; gap: 8px; color: #4f5964; font-size: 12px; cursor: pointer; }
.check-control input { width: 15px; height: 15px; accent-color: var(--accent); }
.video-stage.cover video { object-fit: cover; }

.info-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 14px; border: 1px solid var(--border); background: var(--surface); }
.info-strip > div { min-width: 0; padding: 13px 15px; border-right: 1px solid var(--border); }
.info-strip > div:last-child { border-right: 0; }
.info-strip span, .info-strip strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-strip span { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.info-strip strong { font-size: 12px; }

.notice { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 11px 13px; border: 1px solid; font-size: 12px; }
.notice[hidden] { display: none; }
.error-notice { border-color: var(--danger-border); background: var(--danger-bg); color: #87312b; }
.text-button { padding: 0; border: 0; border-bottom: 1px solid currentColor; background: transparent; color: inherit; font-weight: 700; cursor: pointer; }
.result-count { padding: 5px 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 11px; }

.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.gallery-item { position: relative; overflow: hidden; aspect-ratio: 3 / 4; border: 1px solid var(--border); background: #e2e5e8; cursor: zoom-in; }
.gallery-item img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity .18s ease; }
.gallery-item:hover { border-color: #88939e; }
.gallery-item:hover img { opacity: .9; }
.gallery-item::after { content: attr(data-index); position: absolute; right: 7px; bottom: 7px; min-width: 23px; padding: 3px 5px; background: rgba(18,21,25,.76); color: #fff; font-size: 9px; text-align: center; }
.gallery-item.skeleton { cursor: default; background: #e2e5e8; }
.gallery-item.skeleton::after { display: none; }
.gallery-item.skeleton::before { content: ""; position: absolute; top: 0; bottom: 0; width: 35%; background: #edf0f2; animation: skeleton 1.15s ease-in-out infinite; }
@keyframes skeleton { from { left: -40%; } to { left: 105%; } }
.gallery-item.image-failed { display: none; }
.load-more-row { display: flex; justify-content: center; padding-top: 24px; }

.viewer { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: 72px minmax(0, 1fr) 72px; grid-template-rows: 54px minmax(0, 1fr); align-items: center; background: rgba(10,12,15,.96); }
.viewer[hidden] { display: none; }
.viewer-topbar { grid-column: 1 / -1; display: flex; height: 54px; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid #333941; color: #c7cdd3; font-size: 12px; }
.viewer-topbar > div { display: flex; gap: 6px; }
.viewer-tool { display: inline-flex; height: 32px; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid #424952; border-radius: 3px; background: #191d23; color: #e1e5e9; cursor: pointer; }
.viewer-tool:hover { background: #252b32; }
.viewer-tool svg { width: 16px; height: 16px; }
.viewer img { display: block; grid-column: 2; grid-row: 2; max-width: 100%; max-height: calc(100vh - 78px); margin: auto; object-fit: contain; }
.viewer-nav { display: grid; width: 42px; height: 52px; place-items: center; justify-self: center; border: 1px solid #414851; border-radius: 3px; background: #191d23; color: #e3e6e9; cursor: pointer; }
.viewer-nav:hover { background: #293039; }
.viewer-nav svg { width: 23px; height: 23px; }
.viewer-prev { grid-column: 1; grid-row: 2; }
.viewer-next { grid-column: 3; grid-row: 2; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 150; max-width: min(360px, calc(100vw - 40px)); padding: 10px 14px; border: 1px solid #424a54; border-radius: 3px; background: #20252c; color: #fff; font-size: 12px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .16s, transform .16s; }
.toast.show { opacity: 1; transform: translateY(0); }
.sidebar-backdrop { display: none; }

@media (max-width: 980px) {
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .sidebar { width: min(290px, 86vw); transform: translateX(-102%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close, .menu-button { display: inline-grid; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.45); }
  .sidebar-backdrop.open { display: block; }
  .workspace { margin-left: 0; }
  .workspace-header { min-height: 64px; padding: 9px 16px; }
  .breadcrumb { display: none; }
  h1 { font-size: 17px; }
  .content-view { width: calc(100% - 28px); padding-top: 22px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .info-strip { grid-template-columns: repeat(2, 1fr); }
  .info-strip > div:nth-child(2) { border-right: 0; }
  .info-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .player-toolbar { align-items: flex-start; flex-direction: column; }
  .player-actions { width: 100%; flex-wrap: wrap; }
  .check-control { align-self: flex-end; }
  .viewer { grid-template-columns: 48px minmax(0, 1fr) 48px; }
  .viewer-nav { width: 36px; height: 46px; }
}

@media (max-width: 480px) {
  .header-actions .button { width: 36px; padding: 0; font-size: 0; }
  .header-actions .button svg { width: 18px; height: 18px; }
  .content-heading { align-items: center; }
  h2 { font-size: 18px; }
  .video-stage { margin-right: -14px; margin-left: -14px; border-right: 0; border-left: 0; }
  .player-toolbar { margin-right: -14px; margin-left: -14px; }
  .check-control { font-size: 11px; }
  .compact-button span, .rate-control > span { display: none; }
  .rate-control { padding-left: 5px; }
  .viewer-tool span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
