* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
  background-color: #2c2c2c;
  color: #d7d7d7;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  background-color: #3c3c3c;
  padding: 15px;
  text-align: center;
  border-bottom: 1px solid #444;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.header img {
  width: 100%;
  height: 250px;
  max-width: 100%;
  display: block;
  margin: 0 auto;
  object-fit: cover;
}

.nav {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: center;
  gap: 30px;
  padding: 12px 0;
  background-color: #3c3c3c;
  border-bottom: 1px solid #444;
  z-index: 1000;
}

.nav a, .nav button {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #d7d7d7;
  font-weight: 600;
  font-size: 16px;
  padding: 8px 16px;
  border-radius: 20px;
  transition: background-color 0.2s, color 0.2s;
  border: none;
  background: none;
  cursor: pointer;
}

.nav a:hover, .nav button:hover {
  background-color: #00aaff;
  color: #fff;
}

.nav a i, .nav button i {
  font-size: 18px;
}

.notification-count {
  background-color: #ff4444;
  color: #fff;
  border-radius: 50%;
  padding: 2px 8px;
  font-size: 12px;
  position: relative;
  top: -10px;
  right: 10px;
}

.container {
  max-width: 800px;
  margin: 20px auto;
  padding: 0 10px; /* Reduced padding for smaller screens */
  flex: 1;
}

.thread-title-container {
  background: #3c3c3c; /* Match post-input-container */
  padding: 10px; /* Match post-input-container */
  border-radius: 12px; /* Match post-input-container */
  margin-bottom: 10px; /* Match post-input-container */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); /* Match post-input-container */
  width: 80%; /* Match post-input-container */
  margin: 5px auto; /* Match post-input-container */
  overflow: hidden; /* Match post-input-container */
}

.post-container {
  background: #3c3c3c;
  padding: 10px; /* Reduced padding */
  border-radius: 12px;
  margin-bottom: 10px; /* Reduced margin */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  width: 80%;
  margin: 5px auto; /* Further reduced margin */
  overflow: hidden; /* Prevent overflow */
}

.post-input-container {
  background: #3c3c3c;
  padding: 10px; /* Reduced padding */
  border-radius: 12px;
  margin-bottom: 10px; /* Reduced margin */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  width: 80%;
  margin: 5px auto; /* Further reduced margin */
}

.post-input {
  width: 100%;
  padding: 8px; /* Reduced padding */
  margin-bottom: 6px; /* Reduced margin */
  border: none;
  border-radius: 8px;
  background-color: #2c2c2c;
  color: #d7d7d7;
  resize: none;
  font-size: 14px;
  line-height: 1.5;
}

.post-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px #00aaff;
}

.file-input {
  display: none;
}

.file-button {
  background-color: #4a4a4a;
  color: #d7d7d7;
  border: 1px solid #555;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
  margin-right: 4px; /* Reduced margin */
}

.file-button:hover {
  background-color: #00aaff;
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 0 8px rgba(0, 170, 255, 0.3);
}

.file-button i, .file-button [data-feather] {
  width: 20px;
  height: 20px;
}

.file-buttons-container {
  display: flex;
  position: relative;
  margin-bottom: 6px; /* Reduced margin */
}

.post-button {
  background-color: #00aaff;
  color: #fff;
  border: none;
  width: 40px; /* Slightly reduced */
  height: 40px; /* Slightly reduced */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.post-button:hover {
  background-color: #0088cc;
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(0, 170, 255, 0.5);
}

.post-button i, .post-button [data-feather] {
  width: 20px; /* Reduced */
  height: 20px; /* Reduced */
}

.char-count {
  color: #aaa;
  font-size: 12px;
  font-weight: 500;
  text-align: right;
}

.preview-container {
  margin-top: 6px; /* Reduced margin */
  display: flex;
  flex-wrap: wrap;
  gap: 4px; /* Reduced gap */
}

.preview-item {
  position: relative;
  max-width: 100px; /* Reduced for smaller screens */
}

.preview-item img {
  max-width: 100%;
  max-height: 80px; /* Reduced */
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #444;
}

.preview-item audio,
.preview-item video {
  max-width: 100%;
  max-height: 80px; /* Reduced */
  border-radius: 8px;
}

.remove-preview {
  position: absolute;
  top: -6px; /* Reduced */
  right: -6px; /* Reduced */
  background-color: #ff5555;
  color: #fff;
  border: none;
  width: 18px; /* Reduced */
  height: 18px; /* Reduced */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px; /* Reduced */
  line-height: 1;
}

.remove-preview:hover {
  background-color: #cc0000;
}

.post-item {
  padding: 8px 0; /* Reduced padding */
  border-bottom: 1px solid #444;
  display: flex;
  flex-wrap: wrap; /* Force wrapping */
  gap: 8px; /* Reduced gap */
  transition: background-color 0.2s;
  width: 100%;
  overflow: hidden; /* Prevent overflow */
}

.post-item:hover {
  background-color: #353535;
}

.post-item:last-child {
  border-bottom: none;
}

.post-item .avatar, .post-item-overlay .avatar, .comment-item .avatar {
  min-width: 32px;
  min-height: 32px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #444;
  margin-right: 4px; /* Reduced margin */
  display: block; /* Ensure visibility */
  visibility: visible; /* Explicitly set to visible */
}

.post-content {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.post-content p {
  margin-bottom: 4px; /* Reduced margin */
  font-size: 14px;
  word-break: break-word;
}

.post-content strong {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.post-media {
  margin-top: 6px; /* Reduced margin */
  max-width: 100%;
  overflow: hidden;
}

.post-media img {
  max-width: 100%;
  max-height: 200px; /* Reduced for smaller screens */
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #444;
  display: block;
}

.post-media audio {
  width: 100%;
  max-width: 250px; /* Reduced */
}

.post-media video {
  width: 100%;
  max-width: 280px; /* Reduced */
  border-radius: 8px;
  border: 1px solid #444;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px; /* Reduced gap */
  font-size: 12px;
  color: #aaa;
  font-weight: 500;
  margin-top: 4px; /* Reduced margin */
  width: 100%;
  overflow: hidden;
}

.vote-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 3px; /* Further reduced gap */
  align-items: center;
  width: auto;
}

.vote-button, .like-button, .comment-button, .share-button {
  background-color: transparent;
  color: #00aaff;
  border: 1px solid #00aaff;
  padding: 2px; /* Reduced padding */
  border-radius: 50%;
  width: 28px; /* Reduced */
  height: 28px; /* Reduced */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s, transform 0.2s;
}

.vote-button:hover, .like-button:hover, .comment-button:hover, .share-button:hover {
  background-color: #00aaff;
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 0 6px rgba(0, 170, 255, 0.3); /* Reduced shadow */
}

.vote-button i, .vote-button [data-feather], .like-button i, .comment-button i, .share-button i, .share-button [data-feather] {
  width: 14px; /* Reduced */
  height: 14px; /* Reduced */
}

.vote-score, .like-count, .comment-count {
  color: #aaa;
  font-size: 12px;
  font-weight: 500;
}

.error-message {
  color: #ff5555;
  font-size: 12px;
  margin-bottom: 8px;
}

.flex-2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hidden {
  display: none;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  overflow-y: auto;
  padding: 20px;
}

.overlay-content {
  background: #3c3c3c;
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

.overlay-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #ff5555;
  color: #fff;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}

.overlay-close:hover {
  background: #cc0000;
}

.post-item-overlay {
  padding: 12px;
  border-bottom: 1px solid #444;
  background: #353535;
  border-radius: 8px 8px 0 0;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.comments-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 0 12px;
}

.comment-item {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #444;
  align-items: flex-start;
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-content {
  flex: 1;
}

.comment-content p {
  font-size: 12px;
  margin-bottom: 2px; /* Reduced margin */
}

.comment-content strong {
  color: #fff;
  font-weight: 600;
}

.comment-content .comment-time {
  color: #aaa;
  font-size: 10px;
  font-weight: 500;
}

.comment-input-container {
  padding: 10px; /* Reduced padding */
  border-top: 1px solid #444;
}

.comment-input {
  width: 100%;
  padding: 6px; /* Reduced padding */
  margin-bottom: 6px; /* Reduced margin */
  border: none;
  border-radius: 8px;
  background-color: #2c2c2c;
  color: #d7d7d7;
  resize: none;
  font-size: 12px; /* Reduced font size */
}

.comment-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px #00aaff;
}

@media (max-width: 600px) {
  .header img {
    height: 80px; /* Further reduced */
  }
  .nav {
    flex-direction: column;
    gap: 6px; /* Reduced gap */
    padding: 8px 0; /* Reduced padding */
  }
  .nav a, .nav button {
    font-size: 12px; /* Reduced font size */
    padding: 4px 10px; /* Reduced padding */
  }
  .nav a i, .nav button i {
    font-size: 14px; /* Reduced */
  }
  .container {
    padding: 0 5px; /* Further reduced padding */
  }
  .thread-title-container, .post-container, .post-input-container {
    width: 100%; /* Match for consistency */
    margin: 3px auto; /* Further reduced margin */
    padding: 6px; /* Reduced padding for consistency */
  }
  .thread-title-container h2, .post-input-container h2 {
    font-size: 12px; /* Match for consistency */
  }
  .post-input {
    font-size: 12px;
    padding: 6px; /* Reduced */
  }
  .file-button, .post-button, .vote-button, .like-button, .comment-button, .share-button {
    width: 24px; /* Further reduced */
    height: 24px; /* Further reduced */
  }
  .file-button i, .file-button [data-feather], .post-button i, .post-button [data-feather], 
  .vote-button i, .vote-button [data-feather], .like-button i, .comment-button i, .share-button i, .share-button [data-feather] {
    width: 12px; /* Further reduced */
    height: 12px; /* Further reduced */
  }
  .preview-item {
    max-width: 60px; /* Further reduced */
  }
  .preview-item img, .preview-item audio, .preview-item video {
    max-height: 50px; /* Further reduced */
  }
  .post-item .avatar {
    width: 28px; /* Reduced */
    height: 28px; /* Reduced */
    min-width: 28px;
    min-height: 28px;
    display: block; /* Ensure visibility */
    visibility: visible; /* Force visibility */
  }
  .post-content p, .post-content strong {
    font-size: 10px; /* Reduced */
    word-break: break-word;
    margin-bottom: 2px; /* Further reduced */
  }
  .post-media img {
    max-height: 150px; /* Further reduced */
  }
  .post-media audio, .post-media video {
    max-width: 180px; /* Further reduced */
  }
  .post-meta, .vote-score, .like-count, .comment-count {
    font-size: 9px; /* Reduced */
    flex-wrap: wrap;
    margin-top: 2px; /* Further reduced */
  }
  .vote-buttons {
    gap: 2px; /* Further reduced */
    flex-wrap: wrap;
  }
  .overlay-content {
    max-width: 90%; /* Adjusted */
  }
  .post-item-overlay .avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
  }
  .comment-item .avatar {
    width: 24px; /* Reduced */
    height: 24px; /* Reduced */
    min-width: 24px;
    min-height: 24px;
  }
  .post-item-overlay {
    padding: 8px; /* Reduced */
  }
  .comments-list {
    padding: 0 8px; /* Reduced */
    max-height: 250px; /* Further reduced */
  }
  .comment-content p {
    font-size: 10px; /* Reduced */
    word-break: break-word;
  }
  .comment-content .comment-time {
    font-size: 8px; /* Reduced */
  }
}

@media (max-width: 900px) and (min-width: 601px) {
  .nav {
    gap: 20px;
  }
  .nav a, .nav button {
    font-size: 15px;
  }
  .container {
    max-width: 90%;
  }
  .post-content p, .post-content strong {
    font-size: 13px;
  }
  .post-media img {
    max-height: 250px;
  }
  .post-media audio, .post-media video {
    max-width: 350px;
  }
  .overlay-content {
    max-width: 80%;
  }
}

.bg-dark-base { background-color: #2c2c2c; }
.bg-dark-accent { background-color: #3c3c3c; }
.border-dark-divider { border-color: #444; }
.text-light-gray { color: #d7d7d7; }
.text-blue-accent { color: #00aaff; }
.hover\:text-blue-dark:hover { color: #0088cc; }
.text-gray-muted { color: #aaa; }