* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", sans-serif;
}

body {
  background: #1a1a1a;
  color: #d7dadc;
}

.header {
  height: 48px;
  background: #1a1a1b;
  border-bottom: 1px solid #343536;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-weight: bold;
  color: #ff4500;
  font-size: 20px;
}

.header-buttons {
  display: flex;
  gap: 8px;
}

.header-btn {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.header-btn.login {
  background: transparent;
  color: #d7dadc;
  border: 1px solid #d7dadc;
}

.header-btn.signup {
  background: #ff4500;
  color: white;
}

.container {
  max-width: 1248px;
  margin: 20px auto;
  display: grid;
  grid-template-columns: 240px 1fr 312px;
  gap: 24px;
  padding: 0 16px;
}

.sidebar-left {
  background: #1a1a1b;
  border: 1px solid #343536;
  border-radius: 4px;
  padding: 8px;
}

.nav-block {
  margin-bottom: 16px;
}

.nav-block h4 {
  font-size: 10px;
  font-weight: 700;
  color: #818384;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding: 0 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 8px;
  border-radius: 4px;
  color: #d7dadc;
  font-size: 14px;
  font-weight: 500;
}

.nav-link:hover {
  background: #272729;
}

.nav-link.active {
  background: #272729;
  font-weight: 600;
}

.btn {
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.btn.full {
  width: 100%;
}

.btn.primary {
  background: #ff4500;
  color: white;
}

.btn.primary:hover {
  background: #ff5414;
}

.btn.secondary {
  background: transparent;
  border: 1px solid #d7dadc;
  color: #d7dadc;
}

.post-card {
  background: #1a1a1b;
  border: 1px solid #343536;
  border-radius: 4px;
  margin-bottom: 8px;
  padding: 8px;
  display: flex;
  gap: 8px;
}

/* VOTE SECTION IN POST-ACTIONS */
.post-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.post-actions .vote-section {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: auto;
  margin-right: 10px;
}

.post-actions .vote-btn {
  background: none;
  border: none;
  color: #818384;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.post-actions .vote-count {
  font-size: 12px;
  font-weight: 700;
  color: #d7dadc;
  margin: 0 8px;
}

.content-section {
  flex: 1;
}

.post-meta {
  font-size: 12px;
  color: #818384;
  margin-bottom: 4px;
}

.post-title {
  font-size: 18px;
  font-weight: 500;
  color: #d7dadc;
  margin-bottom: 8px;
}

.post-body {
  font-size: 14px;
  color: #d7dadc;
  line-height: 1.5;
  margin-bottom: 8px;
}

.action-btn {
  background: none;
  border: none;
  color: #818384;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 4px;
}

.action-btn:hover {
  background: #272729;
}

.sidebar-right .widget {
  background: #1a1a1b;
  border: 1px solid #343536;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 16px;
}

.widget h4 {
  font-size: 14px;
  font-weight: 700;
  color: #d7dadc;
  margin-bottom: 12px;
}

.widget p {
  font-size: 14px;
  color: #818384;
  margin-bottom: 12px;
}

.trending-item {
  font-size: 14px;
  color: #d7dadc;
  padding: 4px 0;
}

.comment-box {
  background: #1a1a1b;
  border: 1px solid #343536;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 16px;
}

.comment-input {
  width: 100%;
  background: #272729;
  border: 1px solid #343536;
  border-radius: 4px;
  padding: 8px;
  color: #d7dadc;
  resize: vertical;
  min-height: 80px;
  margin-bottom: 8px;
}

.comment {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #343536;
}

.comment .vote-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 32px;
}

.comment .vote-btn {
  background: none;
  border: none;
  color: #818384;
  font-size: 16px;
  cursor: pointer;
}

.comment .vote-count {
  font-size: 12px;
  font-weight: 700;
  color: #d7dadc;
}

.comment-content {
  flex: 1;
}

.comment-meta {
  font-size: 12px;
  color: #818384;
  margin-bottom: 4px;
}

.comment-author {
  font-weight: 700;
  color: #d7dadc;
}

.comment-text {
  font-size: 14px;
  color: #d7dadc;
  line-height: 1.4;
}

.footer {
  background: #1a1a1b;
  border-top: 1px solid #343536;
  padding: 24px;
  text-align: center;
  margin-top: 32px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
}

.footer-link {
  color: #818384;
  font-size: 12px;
  cursor: pointer;
}

/* Rules Widget */
.rules-widget {
  font-size: 14px;
}

.rule-item {
  border-bottom: 1px solid #343536;
  padding: 8px 0;
  cursor: pointer;
}

.rule-item:last-child {
  border-bottom: none;
}

.rule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.rule-toggle {
  color: #818384;
  font-size: 16px;
}

.rule-content {
  display: none;
  font-size: 13px;
  color: #818384;
  margin-top: 6px;
  line-height: 1.4;
}

/* Comments and Replies */
.reply-btn {
  background: none;
  border: none;
  color: #818384;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 10px;
  margin-top: 4px;
  border-radius: 4px;
}

.reply-btn:hover {
  background: #272729;
}

.reply-form {
  margin-top: 8px;
  padding-left: 16px;
}

.reply-input {
  width: 100%;
  background: #272729;
  border: 1px solid #343536;
  border-radius: 4px;
  padding: 8px;
  color: #d7dadc;
  resize: vertical;
  min-height: 60px;
  margin-bottom: 8px;
  font-size: 14px;
}

.replies {
  margin-left: 32px;
  margin-top: 8px;
  border-left: 2px solid #343536;
  padding-left: 12px;
}

.comment.reply {
  border: none;
  padding: 8px 0;
  margin: 0;
}

.btn.small {
  padding: 6px 12px;
  font-size: 12px;
}

.post-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.post-card-link:hover .post-card {
  border-color: #575757;
}

.post-excerpt {
  font-size: 14px;
  color: #d7dadc;
  line-height: 1.4;
  margin-bottom: 8px;
  max-height: 42px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Alert Box Styles */
.alert-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.alert-box {
  background: #1a1a1b;
  border: 1px solid #343536;
  border-radius: 8px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
  position: relative;
}

.alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.alert-title {
  font-size: 18px;
  font-weight: 600;
  color: #d7dadc;
}

.alert-close {
  background: none;
  border: none;
  color: #818384;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.alert-close:hover {
  color: #d7dadc;
}

.alert-message {
  color: #818384;
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.4;
}

.code-input {
  width: 100%;
  padding: 12px;
  border-radius: 4px;
  border: 1px solid #343536;
  background: #272729;
  color: #d7dadc;
  font-size: 14px;
  margin-bottom: 16px;
}

.code-input:focus {
  outline: none;
  border-color: #ff4500;
}

.how-to-link {
  color: #ff4500;
  font-size: 14px;
  text-decoration: none;
  display: block;
  text-align: center;
  margin-top: 12px;
  cursor: pointer;
}

.how-to-link:hover {
  text-decoration: underline;
}

.reply-post-btn {
  background: none;
  border: none;
  color: #818384;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 4px;
}

.reply-post-btn:hover {
  background: #272729;
}

.stats-widget {
  background: #1a1a1b;
  border: 1px solid #343536;
  border-radius: 4px;
  padding: 16px;
  margin-top: 8px;
}

.stats-widget h4 {
  font-size: 14px;
  font-weight: 700;
  color: #d7dadc;
  margin-bottom: 12px;
  border-bottom: 1px solid #343536;
  padding-bottom: 8px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #2a2a2a;
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-label {
  font-size: 13px;
  color: #818384;
  font-weight: 500;
}

.stat-value {
  font-size: 13px;
  color: #d7dadc;
  font-weight: 600;
}

/* Online Now special styling */
.stat-item:nth-child(2) .stat-value {
  color: #46d160;
}

.stat-item:nth-child(1) .stat-value::after {
  content: " ↗";
  color: #46d160;
  font-size: 12px;
}

.search-widget {
  background: #1a1a1b;
  border: 1px solid #343536;
  border-radius: 4px;
  padding: 16px;
  margin-top: 8px;
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-input {
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #343536;
  background: #272729;
  color: #d7dadc;
  font-size: 14px;
}

.search-input:focus {
  outline: none;
  border-color: #ff4500;
}

.search-input::placeholder {
  color: #818384;
}

/* MOBILE RESPONSIVE */
@media (max-width: 1200px) {
  .container {
    grid-template-columns: 200px 1fr 280px;
    gap: 20px;
  }
}

@media (max-width: 992px) {
  .container {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 15px;
  }

  .sidebar-left,
  .sidebar-right {
    display: block;
    order: 2;
  }

  .feed {
    order: 1;
  }

  .header {
    padding: 0 15px;
    height: 50px;
  }

  .logo {
    font-size: 18px;
  }

  .header-btn {
    padding: 6px 12px;
    font-size: 13px;
  }

  .post-card {
    padding: 15px;
    margin-bottom: 12px;
  }

  .post-title {
    font-size: 16px;
  }

  .post-excerpt {
    font-size: 14px;
    max-height: 60px;
    -webkit-line-clamp: 3;
  }

  .post-body {
    font-size: 14px;
    line-height: 1.5;
  }

  .sidebar-left,
  .sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  .nav-block {
    background: #1a1a1b;
    border: 1px solid #343536;
    border-radius: 8px;
    padding: 15px;
  }

  .widget {
    margin-bottom: 0;
  }

  .search-widget {
    order: 1;
  }

  .stats-widget {
    order: 2;
  }

  .nav-block:nth-child(2) {
    order: 3;
  }

  .nav-block:nth-child(3) {
    order: 4;
  }

  .sidebar-right .widget:nth-child(1) {
    order: 1;
  }

  .sidebar-right .rules-widget {
    order: 2;
  }

  .feed-title {
    font-size: 20px;
    margin-bottom: 15px;
  }

  .btn {
    padding: 10px 14px;
    font-size: 14px;
  }

  /* POST ACTIONS MOBILE */
  .post-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .post-actions .vote-section {
    margin-right: 15px;
  }

  .post-actions .vote-btn {
    font-size: 18px;
  }

  .action-btn {
    font-size: 12px;
    padding: 8px 12px;
  }

  .comment {
    padding: 12px;
    flex-direction: column;
  }

  .comment .vote-section {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    margin-bottom: 8px;
  }

  .comment .vote-btn {
    margin: 0 10px;
  }

  .replies {
    margin-left: 15px;
    padding-left: 10px;
    border-left: 2px solid #343536;
  }

  .comment.reply {
    padding: 8px 0;
  }

  .comment-box {
    padding: 12px;
  }

  .comment-input {
    min-height: 70px;
    font-size: 14px;
  }

  .alert-box {
    margin: 20px;
    width: calc(100% - 40px);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 10px;
    gap: 15px;
  }

  .header {
    padding: 0 10px;
  }

  .header-buttons {
    gap: 6px;
  }

  .header-btn {
    padding: 5px 10px;
    font-size: 12px;
  }

  .post-card {
    padding: 12px;
    flex-direction: column;
  }

  /* POST ACTIONS SMALL MOBILE */
  .post-actions {
    gap: 6px;
  }

  .post-actions .vote-section {
    margin-right: 10px;
  }

  .post-actions .vote-btn {
    font-size: 16px;
    padding: 3px;
  }

  .post-actions .vote-count {
    font-size: 11px;
    margin: 0 6px;
  }

  .action-btn {
    font-size: 11px;
    padding: 6px 8px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-box {
    padding: 8px;
  }

  .stat-number {
    font-size: 14px;
  }

  .stat-name {
    font-size: 10px;
  }

  .rule-item {
    padding: 10px 0;
  }

  .rule-header {
    font-size: 13px;
  }

  .comment {
    padding: 10px;
  }

  .comment-meta {
    font-size: 12px;
  }

  .comment-text {
    font-size: 14px;
    line-height: 1.4;
  }

  .replies {
    margin-left: 10px;
    padding-left: 8px;
  }

  .footer {
    padding: 20px 10px;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: 12px;
  }

  .footer-link {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 8px;
  }

  .header {
    height: 45px;
  }

  .logo {
    font-size: 16px;
  }

  .header-btn {
    padding: 4px 8px;
    font-size: 11px;
  }

  .post-card {
    padding: 10px;
    margin-bottom: 10px;
  }

  .post-title {
    font-size: 15px;
  }

  .post-meta {
    font-size: 12px;
  }

  .post-excerpt {
    font-size: 13px;
  }

  .post-body {
    font-size: 13px;
    line-height: 1.4;
  }

  /* POST ACTIONS VERY SMALL */
  .post-actions {
    gap: 4px;
  }

  .post-actions .vote-section {
    margin-right: 8px;
  }

  .post-actions .vote-btn {
    font-size: 14px;
  }

  .post-actions .vote-count {
    font-size: 10px;
    margin: 0 4px;
  }

  .action-btn {
    font-size: 10px;
    padding: 4px 6px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .nav-block {
    padding: 12px;
  }

  .widget {
    padding: 15px;
  }

  .comment-box {
    padding: 10px;
  }

  .comment-input {
    min-height: 60px;
    font-size: 14px;
  }

  .comment {
    padding: 8px;
  }

  .comment-text {
    font-size: 13px;
  }

  .replies {
    margin-left: 8px;
    padding-left: 6px;
  }

  .alert-box {
    padding: 20px;
    margin: 15px;
  }

  .alert-title {
    font-size: 16px;
  }

  .code-input {
    padding: 10px;
  }
}

/* Touch-friendly buttons */
@media (max-width: 768px) {
  .btn, 
  .header-btn, 
  .action-btn, 
  .vote-btn,
  .nav-link,
  .reply-btn {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .vote-btn {
    min-height: auto;
    min-width: 44px;
  }

  .action-btn,
  .reply-btn {
    min-height: 36px;
  }
}

/* Improve readability on mobile */
@media (max-width: 768px) {
  body {
    font-size: 14px;
    line-height: 1.4;
  }

  .post-body,
  .comment-text {
    font-size: 15px;
    line-height: 1.5;
  }
}

/* Form elements mobile */
@media (max-width: 768px) {
  .search-input,
  .comment-input,
  .code-input,
  .reply-input {
    font-size: 16px;
    padding: 12px;
  }
  
  .search-input:focus,
  .comment-input:focus,
  .code-input:focus,
  .reply-input:focus {
    font-size: 16px;
  }
}

/* Ensure proper text sizing */
@media (max-width: 768px) {
  h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
  }
  
  .post-title {
    line-height: 1.3;
    margin-bottom: 8px;
  }
  
  .widget h4 {
    font-size: 15px;
  }
}