* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: sans-serif;
  line-height: 1.4;
  color: #000;
  background: #f0f0f0;
  font-size: 13px;
  transition: background-color 0.3s, color 0.3s;
}

/* 4chan/Reddit-style dark mode */
body.dark-mode {
  background: #161616;
  color: #ddd;
}

body.dark-mode .container {
  background: #222;
  border-color: #444;
}

body.dark-mode header {
  background: #333;
  border-color: #444;
  color: #ddd;
}

body.dark-mode .video-section,
body.dark-mode .voting-section,
body.dark-mode .comments-section {
  background: #222;
  border-color: #444;
  color: #ddd;
}

body.dark-mode .btn-primary,
body.dark-mode .btn-secondary {
  background: #333;
  border-color: #555;
  color: #ddd;
}

body.dark-mode .btn-primary {
  background: #4a4a4a;
}

body.dark-mode .btn-primary:hover {
  background: #5a5a5a;
}

body.dark-mode .btn-secondary:hover {
  background: #444;
}

body.dark-mode .video-info p {
  background: #333;
  border-color: #555;
  color: #ddd;
}

body.dark-mode .tag {
  background: #333;
  border-color: #555;
  color: #ddd;
}

body.dark-mode #new-tag-input,
body.dark-mode #comment-input {
  background: #333;
  border-color: #555;
  color: #fff;
}

body.dark-mode .comment {
  background: #333;
  border-color: #555;
  color: #fff;
}

body.dark-mode .star:hover,
body.dark-mode .star.active {
  color: #ffd700;
  text-shadow: 0 0 5px #ffd700;
}

body.dark-mode .vote-btn.bad {
  background: #5a3a3a;
  color: #fff;
}

body.dark-mode .vote-btn.good {
  background: #3a5a3a;
  color: #fff;
}

body.dark-mode .vote-btn.nightmare {
  background: #3a3a5a;
  color: #fff;
}

body.dark-mode .vote-btn.bad:hover {
  background: #7a4a4a;
}

body.dark-mode .vote-btn.good:hover {
  background: #4a7a4a;
}

body.dark-mode .vote-btn.nightmare:hover {
  background: #4a4a7a;
}

body.dark-mode h1,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode .video-info h3,
body.dark-mode .voting-section h4,
body.dark-mode .comments-section h4,
body.dark-mode .anon-id {
  color: #fff;
}

body.dark-mode .video-meta {
  color: #aaa;
}

body.dark-mode .comment-time {
  color: #aaa;
}

body.dark-mode .average {
  color: #fff;
}

body.dark-mode .no-comments {
  color: #aaa;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px;
  transition: background-color 0.3s;
}

header {
  background: #e0e0e0;
  color: #000;
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #ccc;
  transition: background-color 0.3s, border-color 0.3s;
}

header h1 {
  font-size: 18px;
  font-weight: bold;
}

.header-stats {
  display: flex;
  gap: 15px;
  align-items: center;
}



.main-content {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 15px;
}

.video-section {
  background: #fff;
  border: 1px solid #ccc;
  padding: 10px;
  transition: background-color 0.3s, border-color 0.3s;
}

#video-container {
  margin-bottom: 10px;
}

#main-video {
  width: 100%;
  height: 400px;
  background: #000;
  border: 1px solid #ccc;
}

.video-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.btn-primary,
.btn-secondary {
  padding: 8px 15px;
  border: 1px solid #ccc;
  background: #f0f0f0;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  transition: background-color 0.3s;
}

.btn-primary {
  background: #e0e0e0;
  font-weight: bold;
}

.btn-primary:hover {
  background: #d0d0d0;
}

.btn-secondary:hover {
  background: #e8e8e8;
}

.video-info h3 {
  font-size: 16px;
  color: #000;
  margin-bottom: 10px;
}

.video-info p {
  margin-bottom: 10px;
  line-height: 1.5;
  border: 1px solid #ccc;
  padding: 10px;
  background: #f9f9f9;
  transition: background-color 0.3s, border-color 0.3s;
}

.video-meta {
  display: flex;
  gap: 20px;
  font-size: 11px;
  color: #666;
}

.voting-section {
  background: #fff;
  border: 1px solid #ccc;
  padding: 10px;
  height: fit-content;
  transition: background-color 0.3s, border-color 0.3s;
}

.voting-section h4 {
  color: #000;
  font-size: 14px;
  margin-bottom: 10px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 5px;
}

.quick-vote {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #ccc;
}

.vote-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.vote-btn {
  padding: 10px 15px;
  border: 1px solid #ccc;
  background: #f0f0f0;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  min-width: 80px;
  transition: background-color 0.3s;
  color: #000;
}

.vote-btn.bad {
  background: #ffcccc;
}

.vote-btn.good {
  background: #ccffcc;
}

.vote-btn.nightmare {
  background: #ccccff;
}

.vote-btn:hover {
  transform: scale(1.05);
}

.vote-btn.bad:hover {
  background: #ff9999;
}

.vote-btn.good:hover {
  background: #99ff99;
}

.vote-btn.nightmare:hover {
  background: #9999ff;
}

.detailed-ratings {
  margin-bottom: 20px;
}

.rating-rubric {
  margin-bottom: 15px;
}

.rating-rubric label {
  display: block;
  font-weight: bold;
  margin-bottom: 5px;
  font-size: 11px;
  color: #000;
}

body.dark-mode .rating-rubric label {
  color: #fff;
}

.star-rating {
  display: flex;
  align-items: center;
  gap: 2px;
}

.star {
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
  color: #ccc; /* Default unlit color */
}

body.dark-mode .star {
  color: #666; /* Dark mode unlit color */
}

.star:hover,
.star.hover,
.star.active {
  color: #ffd700;
  text-shadow: 0 0 5px #ffd700;
}

.star.inactive {
  color: #ccc;
}

body.dark-mode .star.inactive {
  color: #666;
}

.average {
  margin-left: 10px;
  font-weight: bold;
  color: #000;
  font-size: 11px;
}

.tagging-section {
  margin-bottom: 20px;
}

.tag-list {
  margin-bottom: 10px;
  min-height: 30px;
}

.tag {
  display: inline-block;
  background: #e0e0e0;
  border: 1px solid #ccc;
  padding: 2px 6px;
  margin: 2px;
  font-size: 10px;
  transition: background-color 0.3s, border-color 0.3s;
  color: #000;
}

.add-tag {
  display: flex;
  gap: 5px;
}

#new-tag-input {
  flex: 1;
  padding: 5px;
  border: 1px solid #ccc;
  font-family: inherit;
  font-size: 11px;
  transition: background-color 0.3s, border-color 0.3s;
  color: #000;
  background: #fff;
}

#add-tag-btn {
  padding: 5px 10px;
  border: 1px solid #ccc;
  background: #f0f0f0;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  transition: background-color 0.3s;
  color: #000;
}

#add-tag-btn:hover {
  background: #e8e8e8;
}

.leaderboard-section {
  background: #fff;
  border: 1px solid #ccc;
  padding: 10px;
  margin-top: 10px;
  transition: background-color 0.3s, border-color 0.3s;
  width: 100%;
}

.leaderboard-controls {
  margin-bottom: 15px;
  display: flex;
  justify-content: flex-end;
}

#sort-by {
  padding: 5px;
  border: 1px solid #ccc;
  background: #fff;
  font-family: inherit;
  font-size: 12px;
  color: #000;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid #ccc;
}

.leaderboard-table th {
  background-color: #f0f0f0;
  font-weight: bold;
  color: #000;
}

body.dark-mode .leaderboard-table th {
  background-color: #333;
  color: #fff;
}

.leaderboard-table tr:nth-child(even) {
  background-color: #f9f9f9;
}

body.dark-mode .leaderboard-table tr:nth-child(even) {
  background-color: #333;
}

.leaderboard-table tr:hover {
  background-color: #e9e9e9;
}

body.dark-mode .leaderboard-table tr:hover {
  background-color: #444;
}

.video-link {
  color: #0066cc;
  text-decoration: none;
  font-weight: bold;
}

.video-link:hover {
  text-decoration: underline;
}

body.dark-mode .video-link {
  color: #66ccff;
}

.prompt-cell {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.no-data {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 20px;
}

body.dark-mode .no-data {
  color: #aaa;
}

/* Dark mode fixes for leaderboard */
body.dark-mode .leaderboard-section {
  background: #222;
  border-color: #444;
  color: #ddd;
}

body.dark-mode #sort-by {
  background: #333;
  border-color: #555;
  color: #fff;
}

body.dark-mode .leaderboard-table {
  color: #ddd;
}

body.dark-mode .leaderboard-table td {
  border-color: #444;
  color: #ddd;
}

body.dark-mode .leaderboard-table th {
  border-color: #444;
}

body.dark-mode .btn-secondary {
  background: #333;
  border-color: #555;
  color: #ddd;
}

body.dark-mode .btn-secondary:hover {
  background: #444;
}

.comments-section {
  grid-column: 1 / -1;
  background: #fff;
  border: 1px solid #ccc;
  padding: 10px;
  margin-top: 10px;
  transition: background-color 0.3s, border-color 0.3s;
}

.comments-section h4 {
  color: #000;
  font-size: 14px;
  margin-bottom: 15px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 5px;
}

.add-comment {
  margin-bottom: 20px;
}

#comment-input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  font-family: inherit;
  font-size: 12px;
  resize: vertical;
  margin-bottom: 10px;
  transition: background-color 0.3s, border-color 0.3s;
  color: #000;
  background: #fff;
}

#submit-comment-btn {
  padding: 8px 15px;
  border: 1px solid #ccc;
  background: #e0e0e0;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  transition: background-color 0.3s;
  color: #000;
}

#submit-comment-btn:hover {
  background: #d0d0d0;
}

.comments-list {
  border-top: 1px solid #ccc;
  padding-top: 15px;
}

.comment {
  border: 1px solid #ccc;
  margin-bottom: 10px;
  padding: 10px;
  background: #f9f9f9;
  transition: background-color 0.3s, border-color 0.3s;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 11px;
}

.anon-id {
  font-weight: bold;
  color: #000;
}

body.dark-mode .anon-id {
  color: #fff;
}

.comment-time {
  color: #666;
}

body.dark-mode .comment-time {
  color: #aaa;
}

.comment-content {
  line-height: 1.4;
  word-wrap: break-word;
  color: #000;
}

body.dark-mode .comment-content {
  color: #fff;
}

.no-comments {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 20px;
}

body.dark-mode .no-comments {
  color: #aaa;
}

/* Dark mode toggle button */
.dark-mode-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: #e0e0e0;
  color: #000;
  border: 1px solid #ccc;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
}

.dark-mode-toggle:hover {
  background: #d0d0d0;
}

body.dark-mode .dark-mode-toggle {
  background: #444;
  color: #ddd;
  border-color: #555;
}

body.dark-mode .dark-mode-toggle:hover {
  background: #555;
}

@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .comments-section {
    grid-column: 1;
  }
}

@media (max-width: 768px) {
  .header-stats {
    flex-direction: column;
    gap: 5px;
  }

  .video-controls {
    flex-direction: column;
  }

  .vote-buttons {
    flex-direction: column;
  }

  .add-tag {
    flex-direction: column;
  }
}