:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "Noto Sans TC", system-ui, sans-serif;
  background: #0b0b0b;
  color: #eee;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #0b0b0b; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: fixed;
  inset: 0 0 auto;
  height: 52px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: rgba(20,20,20,.97);
  border-bottom: 1px solid #282828;
  backdrop-filter: blur(10px);
}
.brand { color: #fff; font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand:hover { color: #6cf; }
.search-form { flex: 1; max-width: 430px; }
.search-form input {
  width: 100%;
  border: 1px solid #383838;
  border-radius: 18px;
  padding: 7px 13px;
  color: #eee;
  background: #0f0f0f;
  outline: none;
}
.search-form input:focus { border-color: #6cf; }
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.top-button, .action-button, .dialog button, .comment-form button {
  border: 1px solid #444;
  border-radius: 18px;
  padding: 7px 13px;
  color: #eee;
  background: #242424;
}
.top-button:hover, .action-button:hover, .dialog button:hover, .comment-form button:hover {
  background: #333;
}

.app-shell { max-width: 1180px; margin: 0 auto; padding: 76px 18px 36px; }
.loading, .empty, .error-panel { padding: 48px 0; color: #aaa; text-align: center; }
.page-title { margin: 0 0 18px; font-size: clamp(22px, 4vw, 32px); }
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 22px 16px;
}
.work-card { min-width: 0; }
.work-link { display: block; color: inherit; text-decoration: none; }
.cover-wrap { aspect-ratio: 16/9; overflow: hidden; border-radius: 9px; background: #171717; }
.work-cover { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.work-link:hover .work-cover { transform: scale(1.025); }
.work-title { margin: 9px 0 4px; font-size: 16px; line-height: 1.4; }
.work-meta { margin: 0; color: #929292; font-size: 13px; }

.player-page { display: grid; grid-template-columns: minmax(0, 680px) minmax(240px, 1fr); gap: 26px; align-items: start; }
.player-column { min-width: 0; }
#player_dock { width: 100%; }
.work-heading { margin: 16px 0 7px; font-size: 24px; }
.work-description { color: #bbb; line-height: 1.7; white-space: pre-wrap; }
.player-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.action-button.active { border-color: #6cf; color: #6cf; background: #203243; }
.side-panel { border-left: 1px solid #242424; padding-left: 22px; }
.side-panel h3 { margin-top: 0; }

.comment-form { display: flex; gap: 8px; margin-bottom: 14px; }
.comment-form textarea {
  flex: 1;
  min-height: 46px;
  resize: vertical;
  border: 1px solid #3b3b3b;
  border-radius: 7px;
  padding: 9px;
  color: #eee;
  background: #101010;
}
.comment { padding: 11px 0; border-bottom: 1px solid #222; }
.comment-head { display: flex; gap: 8px; align-items: center; color: #888; font-size: 12px; }
.comment-name { color: #ddd; font-weight: 700; }
.comment-text { margin: 5px 0 0; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-delete { margin-left: auto; border: 0; color: #aaa; background: transparent; }

.dialog {
  width: min(430px, calc(100vw - 32px));
  border: 1px solid #444;
  border-radius: 12px;
  padding: 22px;
  color: #eee;
  background: #191919;
}
.dialog::backdrop { background: rgba(0,0,0,.72); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog h2 { margin: 0 0 16px; }
.dialog label { display: block; margin: 11px 0; color: #bbb; font-size: 13px; }
.dialog input { display: block; width: 100%; margin-top: 5px; border: 1px solid #444; border-radius: 6px; padding: 9px; color: #eee; background: #101010; }
.dialog-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 16px; }
.icon-button { border: 0 !important; font-size: 24px; background: transparent !important; }
.form-error { min-height: 20px; color: #f77; font-size: 13px; }

@media (max-width: 860px) {
  .player-page { display: block; }
  .side-panel { margin-top: 28px; padding-left: 0; border-left: 0; border-top: 1px solid #242424; padding-top: 20px; }
}
@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .brand { font-size: 14px; }
  #favorites_btn { display: none; }
  .top-button { padding-inline: 9px; }
  .app-shell { padding-inline: 12px; }
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; }
}
