/* ============ BASE & RESET ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-dark: #08060c;
  --bg-darker: #0c0a12;
  --bg-card: rgba(255,255,255,0.02);
  --red: #dc2626;
  --red-dark: #991b1b;
  --red-glow: rgba(220,38,38,0.3);
  --green: #10b981;
  --green-dark: #059669;
  --yellow: #eab308;
  --text: rgba(255,255,255,0.9);
  --text-muted: rgba(255,255,255,0.5);
  --text-dim: rgba(255,255,255,0.3);
  --border: rgba(255,255,255,0.08);
  --border-light: rgba(255,255,255,0.15);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  transition: background 0.5s ease;
}

body.typing-fast {
  background: linear-gradient(180deg, #0d0610 0%, #1a0a12 50%, #0a0608 100%);
}

/* ============ LAYOUT ============ */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ============ HEADER ============ */
.header {
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  font-weight: 400;
  color: #fff;
  text-shadow: 2px 2px 0 #3a0a0a, 0 0 20px var(--red-glow);
  letter-spacing: -1px;
  word-spacing: -3px;
  line-height: 1.6;
}

.title-ex {
  color: var(--red);
  text-shadow: 0 0 15px var(--red-glow), 0 0 30px rgba(220,38,38,0.2);
}

.live-count {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.9); }
}

/* ============ CATEGORIES ============ */
.categories {
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 8px 16px;
  overflow-x: auto;
}

.cat-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 4px;
}

.cat-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.cat-btn.active {
  color: #fff;
  background: var(--red);
  box-shadow: 0 0 10px var(--red-glow);
}

/* ============ COMPOSER ============ */
.composer {
  margin: 24px auto;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 680px;
  transition: all 0.3s ease;
}

.composer.active {
  background: linear-gradient(135deg, rgba(220,38,38,0.08) 0%, rgba(12,10,18,0.98) 30%);
  border-color: rgba(220,38,38,0.25);
  box-shadow: 0 0 30px rgba(220,38,38,0.1);
}

.composer-question {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.composer-question.hidden {
  opacity: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.burning {
  color: var(--red);
  text-shadow: 0 0 10px var(--red-glow);
}

.composer-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
}

.composer-user.visible {
  opacity: 1;
  height: auto;
}

.avatar-small {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: rgba(255,255,255,0.8);
}

.username { color: var(--text-muted); font-size: 13px; }
.typing-now { color: var(--text-dim); font-size: 12px; }

.composer-form textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  resize: none;
  min-height: 80px;
  outline: none;
}

.composer-form textarea::placeholder { color: var(--text-dim); }

.composer-options {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: all 0.4s ease;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.composer-options.visible {
  max-height: 400px;
  opacity: 1;
}

.option-row { margin-bottom: 16px; }

.option-label {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.emotion-pills, .intention-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 8px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.pill:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

.pill.active {
  background: rgba(220,38,38,0.3);
  border-color: rgba(220,38,38,0.5);
  color: #fff;
}

.composer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.nickname-input {
  flex: 1;
  min-width: 150px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.nickname-input:focus {
  border-color: var(--border-light);
}

.nickname-input::placeholder { color: var(--text-dim); }

.composer-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.char-counter {
  color: var(--text-dim);
  font-size: 13px;
  transition: all 0.2s;
}

.char-counter.warning { color: var(--yellow); }
.char-counter.danger { color: var(--red); font-weight: bold; }

.submit-btn {
  padding: 12px 24px;
  background: var(--red);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px var(--red-glow);
}

.submit-btn:hover {
  background: #ef4444;
  transform: translateY(-2px);
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ============ SORT FILTERS ============ */
.sort-filters {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  max-width: 680px;
  margin: 0 auto;
}

.sort-btn {
  padding: 8px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.sort-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

.sort-btn.active {
  background: rgba(255,255,255,0.1);
  border-color: var(--border-light);
  color: #fff;
}

/* ============ FEED ============ */
.feed {
  max-width: 680px;
  margin: 0 auto;
  padding-bottom: 40px;
  transition: opacity 0.2s ease;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 15px;
}

/* ============ POST ============ */
.post {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  transition: all 0.2s;
}

.post:hover {
  border-color: var(--border-light);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.post.justified { border-left: 3px solid var(--green); }
.post.toofar { border-left: 3px solid var(--red); }
.post.contested { border-left: 3px solid var(--yellow); }

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  font-weight: 600;
}

.avatar-xs {
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #fff;
}

.post-user {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.post-time {
  color: var(--text-dim);
  font-size: 12px;
}

.emotion-tag {
  padding: 2px 8px;
  background: rgba(220,38,38,0.2);
  border-radius: 10px;
  color: rgba(255,255,255,0.7);
  font-size: 11px;
}

.post-venom-score {
  text-align: right;
}

.venom-num {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--red);
  transition: transform 0.2s ease;
}

.venom-label {
  font-size: 11px;
  color: var(--text-dim);
}

.post-content {
  padding: 0 16px 16px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  word-wrap: break-word;
}

/* ============ VERDICT SYSTEM ============ */
.verdict-system {
  padding: 16px;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid var(--border);
}

.section-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Venom */
.venom-section { margin-bottom: 20px; }

.venom-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  transition: transform 0.15s ease;
}

.venom-segment {
  width: 32px;
  height: 40px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
}

.venom-segment:hover {
  border-color: var(--border-light);
  background: rgba(255,255,255,0.1);
}

.venom-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, var(--red) 0%, rgba(220,38,38,0.5) 100%);
  opacity: 0;
  transition: all 0.2s;
}

.venom-segment.active .venom-fill {
  opacity: 1;
}

.venom-info {
  font-size: 13px;
  color: var(--text-muted);
}

.venom-avg {
  color: var(--text);
  font-weight: 600;
}

.venom-count { color: var(--text-dim); }

/* Verdict */
.verdict-section { margin-bottom: 20px; }

.verdict-bar {
  height: 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  margin-bottom: 8px;
}

.verdict-fill {
  height: 100%;
  transition: width 0.4s ease;
}

.verdict-fill.yes {
  background: linear-gradient(90deg, var(--green) 0%, #34d399 100%);
}

.verdict-fill.no {
  background: linear-gradient(90deg, #f87171 0%, var(--red) 100%);
}

.verdict-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin-bottom: 12px;
}

.yes-percent { color: var(--green); font-weight: 600; }
.no-percent { color: var(--red); font-weight: 600; }

.verdict-status {
  color: var(--text-muted);
  font-size: 11px;
}

.verdict-status.justified { color: var(--green); }
.verdict-status.toofar { color: var(--red); }
.verdict-status.contested { color: var(--yellow); }

.verdict-buttons {
  display: flex;
  gap: 10px;
}

.verdict-btn {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid var(--border);
}

.verdict-btn.yes {
  background: rgba(16,185,129,0.15);
  color: var(--green);
  border-color: rgba(16,185,129,0.3);
}

.verdict-btn.yes:hover {
  background: rgba(16,185,129,0.25);
}

.verdict-btn.no {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
}

.verdict-btn.no:hover {
  background: rgba(255,255,255,0.1);
}

.verdict-btn.voted {
  opacity: 0.5;
  cursor: default;
}

/* Echo */
.echo-section {}

.echo-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.echo-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.echo-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--border-light);
  color: var(--text);
}

.echo-btn.active {
  background: rgba(220,38,38,0.2);
  border-color: rgba(220,38,38,0.4);
  color: #fff;
}

.echo-emoji { font-size: 14px; }
.echo-text { font-size: 11px; }
.echo-count { color: var(--text-dim); font-size: 11px; }

/* ============ POST FOOTER ============ */
.post-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.show-comments-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s;
}

.show-comments-btn:hover { color: var(--text); }

/* ============ COMMENTS ============ */
.add-comment {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.comment-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.comment-nickname {
  flex: 1;
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.comment-nickname::placeholder { color: var(--text-dim); }

.comment-textarea {
  flex: 1;
  padding: 10px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  resize: none;
  min-height: 60px;
  outline: none;
}

.comment-textarea::placeholder { color: var(--text-dim); }

.comment-submit {
  padding: 10px 20px;
  background: rgba(220,38,38,0.3);
  border: 1px solid rgba(220,38,38,0.4);
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.comment-submit:hover { background: rgba(220,38,38,0.4); }

.comments-section {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.1);
}

.comment {
  margin-bottom: 16px;
}

.comment.nested {
  margin-left: 32px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.comment-user {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.comment-time {
  color: var(--text-dim);
  font-size: 11px;
}

.comment-text {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.reply-form {
  margin-top: 10px;
}

.reply-nickname {
  width: 100%;
  padding: 6px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  margin-bottom: 6px;
  outline: none;
}

.reply-row {
  display: flex;
  gap: 8px;
}

.reply-textarea {
  flex: 1;
  padding: 8px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  resize: none;
  min-height: 40px;
  outline: none;
}

.reply-btn {
  padding: 8px 16px;
  background: rgba(220,38,38,0.3);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.reply-btn:hover { background: rgba(220,38,38,0.4); }

.replies { margin-top: 12px; }

.no-comments {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 20px;
}

/* ============ FOOTER ============ */
.footer {
  text-align: center;
  padding: 40px 20px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--red); }

.footer-copy {
  color: var(--text-dim);
  font-size: 12px;
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 14px 24px;
  background: var(--green);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.error { background: var(--red); }

/* ============ LOADING ============ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.loading-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.loader {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============ MOBILE ============ */
@media (max-width: 640px) {
  .site-title { font-size: 12px; }
  .header-inner { padding: 12px; }
  .categories { padding: 6px 8px; }
  .cat-btn { padding: 6px 12px; font-size: 12px; }
  .composer { margin: 16px; padding: 16px; }
  .composer-question { font-size: 16px; }
  .post { margin: 0 8px 12px; }
  .verdict-buttons { flex-direction: column; }
  .echo-buttons { justify-content: center; }
  .toast { left: 20px; right: 20px; }
}