:root {
  color-scheme: dark;
  --bg: #14161a;
  --panel: #1e2127;
  --border: #2c303a;
  --text: #e8e8ea;
  --muted: #9a9ea8;
  --accent: #5b8def;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

header h1 {
  font-size: 18px;
  margin: 0;
}

header a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

.add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.add-form input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}

button {
  padding: 10px 16px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 16px;
}

.toolbar label {
  font-size: 13px;
  color: var(--muted);
}

.toolbar select {
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
}

.search-form {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}

.search-form input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
}

.search-form button {
  padding: 6px 14px;
  font-size: 13px;
}

.filter-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
}

.filter-banner a {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
}

.affiliate-banner {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.video-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.video-card-link {
  text-decoration: none;
  color: var(--text);
  display: block;
}

.video-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #000;
}

.video-card .meta {
  padding: 10px 12px;
}

.video-card .title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.3;
}

.video-card .author {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.video-card .stats {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.video-card .tags {
  padding: 0 12px 12px;
}

.video-stats + .tags {
  margin-bottom: 16px;
}

.tag-chip {
  display: inline-block;
  padding: 3px 9px;
  background: rgba(91, 141, 239, 0.15);
  border: 1px solid rgba(91, 141, 239, 0.4);
  border-radius: 999px;
  color: var(--accent);
  font-size: 11px;
  text-decoration: none;
  white-space: nowrap;
}

.tag-chip:hover {
  background: rgba(91, 141, 239, 0.3);
}

.empty {
  color: var(--muted);
  font-size: 14px;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.load-more-wrap button {
  background: var(--panel);
  border: 1px solid var(--border);
}

.error {
  color: #ff6b6b;
  font-size: 14px;
  margin-top: 8px;
}

/* watch page */
.player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

#player {
  width: 100%;
  height: 100%;
}

.danmaku-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.danmaku-item {
  position: absolute;
  white-space: pre;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  line-height: 1.15;
  font-weight: 700;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.9), 0 0 6px rgba(0, 0, 0, 0.9);
  will-change: transform;
}

.comment-form {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.comment-form textarea {
  flex: 1;
  min-width: 160px;
  padding: 10px 12px;
  background: #14161a;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 40px;
}

.comment-form input[type="color"] {
  width: 40px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
}

.comment-form label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.video-title {
  margin: 16px 0 4px;
  font-size: 18px;
}

.video-author {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 4px;
}

.video-stats {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 16px;
}
