/* ========================================
   전역 설정
======================================== */
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Noto+Sans+KR:wght@400;500;700&display=swap');

:root {
  --bg: #080c14;
  --surface: #0d1422;
  --surface2: #111827;
  --border: #1e2d45;
  --border-bright: #2a3f5f;
  --red: #e8323c;
  --red-dim: rgba(232, 50, 60, 0.12);
  --red-glow: rgba(232, 50, 60, 0.3);
  --text: #e2e8f0;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --mono: 'Space Mono', monospace;
  --sans: 'Noto Sans KR', sans-serif;

  /* 섹션 색상 */
  --news-color: #3b82f6;
  --discussion-color: #8b5cf6;
  --analysis-color: #10b981;
  --free-color: #f59e0b;
  --hot-color: #e8323c;
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  padding-bottom: 70px;
  overflow-x: hidden;
}

/* 배경 그리드 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(232,50,60,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,50,60,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ========================================
   헤더
======================================== */
.header {
  position: sticky;
  top: 0;
  background: rgba(8,12,20,0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  max-width: 680px;
  margin: 0 auto;
  height: 56px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.logo-mark {
  width: 30px;
  height: 30px;
  background: var(--red);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: white;
  box-shadow: 0 0 12px var(--red-glow);
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.logo-sub {
  display: block;
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 400;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-icon {
  width: 34px;
  height: 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  border-color: var(--red);
  color: var(--red);
}

.btn-write {
  height: 34px;
  padding: 0 14px;
  background: var(--red);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--mono);
  cursor: pointer;
  letter-spacing: 0.5px;
  box-shadow: 0 0 16px var(--red-glow);
  transition: all 0.2s;
}

.btn-write:hover {
  box-shadow: 0 0 24px var(--red-glow);
  transform: translateY(-1px);
}

/* ========================================
   섹션 탭
======================================== */
.section-tabs {
  display: flex;
  overflow-x: auto;
  background: rgba(8,12,20,0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  padding: 0 8px;
  height: 44px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: sticky;
  top: 56px;
  z-index: 90;
}

.section-tabs::-webkit-scrollbar { display: none; }

.tab {
  flex-shrink: 0;
  padding: 0 16px;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  cursor: pointer;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  position: relative;
  transition: color 0.2s;
}

.tab:hover { color: var(--text-dim); }

.tab.active { color: var(--red); }

.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 8px; right: 8px;
  height: 2px;
  background: var(--red);
  box-shadow: 0 0 8px var(--red-glow);
}

/* ========================================
   실시간 배너
======================================== */
.realtime-banner {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--red);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.banner-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 2px;
  white-space: nowrap;
}

.banner-title {
  font-size: 13px;
  color: var(--text-dim);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================
   필터 바
======================================== */
.filter-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg);
  position: relative;
  z-index: 1;
}

.filter-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}

.filter-btn.active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-bright);
}

/* ========================================
   피드
======================================== */
.feed {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 0 8px;
  position: relative;
  z-index: 1;
}

/* ========================================
   게시글 카드
======================================== */
.post-card {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.post-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: transparent;
  transition: background 0.2s;
}

.post-card:hover {
  background: var(--surface2);
}

.post-card:hover::before {
  background: var(--red);
  box-shadow: 2px 0 8px var(--red-glow);
}

.post-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.post-section-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid;
}

.post-section-badge.news { color: var(--news-color); border-color: rgba(59,130,246,0.3); background: rgba(59,130,246,0.08); }
.post-section-badge.discussion { color: var(--discussion-color); border-color: rgba(139,92,246,0.3); background: rgba(139,92,246,0.08); }
.post-section-badge.analysis { color: var(--analysis-color); border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.08); }
.post-section-badge.free { color: var(--free-color); border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.08); }
.post-section-badge.hot { color: var(--hot-color); border-color: rgba(232,50,60,0.3); background: rgba(232,50,60,0.08); }

.post-author {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

.post-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.post-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 6px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-preview {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.meta-item.hot { color: var(--red); }

/* ========================================
   하단 네비게이션
======================================== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: rgba(8,12,20,0.95);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
  display: flex;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s;
  border: none;
  background: transparent;
}

.nav-btn.active { color: var(--red); }
.nav-btn:hover { color: var(--text-dim); }

.nav-label {
  font-size: 9px;
  font-family: var(--mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ========================================
   모달
======================================== */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 200;
  overflow-y: auto;
}

.modal.active {
  display: block;
  animation: modalSlideUp 0.25s ease-out;
}

@keyframes modalSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-content {
  max-width: 680px;
  margin: 0 auto;
  min-height: 100vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(8,12,20,0.95);
  backdrop-filter: blur(12px);
  z-index: 10;
  height: 56px;
}

.modal-header h2 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.btn-close:hover { color: var(--text); }

.btn-submit {
  background: var(--red);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--mono);
  cursor: pointer;
  letter-spacing: 0.5px;
  box-shadow: 0 0 12px var(--red-glow);
  transition: all 0.2s;
}

.btn-submit:hover {
  box-shadow: 0 0 20px var(--red-glow);
}

.btn-submit:disabled {
  background: var(--surface2);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

.modal-body { padding: 16px; }

/* ========================================
   글쓰기 폼
======================================== */
.section-select {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-family: var(--mono);
  margin-bottom: 16px;
  cursor: pointer;
  outline: none;
}

.post-title-input {
  width: 100%;
  background: transparent;
  color: var(--text);
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  outline: none;
  font-family: var(--sans);
}

.post-title-input::placeholder { color: var(--text-muted); }

.post-content {
  width: 100%;
  min-height: 300px;
  background: transparent;
  color: var(--text);
  border: none;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  font-family: var(--sans);
}

.post-content::placeholder { color: var(--text-muted); }

/* ========================================
   게시글 상세
======================================== */
.post-detail { padding-bottom: 80px; }

.detail-header {
  padding: 18px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.detail-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 12px;
}

.detail-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
}

.detail-content {
  padding: 18px 16px;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.detail-meta-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 16px;
  color: var(--text-muted);
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
}

.detail-meta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.detail-meta-btn:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.detail-meta-btn.active {
  color: var(--red);
  border-color: var(--red-dim);
  background: var(--red-dim);
}

.detail-meta-icon { font-size: 13px; }
.detail-meta-count { font-weight: 700; }

/* ========================================
   댓글
======================================== */
.comments-section { padding: 16px; }

.comments-header {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.comment {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.comment-author {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
}

.comment-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.comment-content {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
}

/* ========================================
   로딩 & 빈 상태
======================================== */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 2px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-text {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.empty-subtext {
  font-size: 13px;
  color: var(--text-muted);
}

/* ========================================
   반응형
======================================== */
@media (min-width: 768px) {
  .header-content,
  .feed,
  .modal-content {
    max-width: 680px;
  }

  .post-card {
    border-radius: 10px;
    margin: 10px 12px 0;
    border: 1px solid var(--border);
  }

  .post-card::before { border-radius: 10px 0 0 10px; }

  .feed { padding-top: 8px; }
}

/* ========================================
   설치 버튼
======================================== */
.install-fab {
  position: fixed;
  right: 16px;
  bottom: 72px;
  z-index: 9999;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-bright);
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: all 0.2s;
}

.install-fab:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ========================================
   유틸리티
======================================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
