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

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-muted: #666;
  --border: #e0e0e0;
  --comment-bg: #f8f9fa;
}

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ── Header ── */
header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 20px;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 20px;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

/* ── Category Nav ── */
.cat-nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 4px 20px;
}

.cat-nav-inner,
.cat-more-row {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.cat-nav-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  overflow: hidden;
  max-height: 36px;
  transition: max-height 0.3s ease;
}

.cat-nav-inner.expanded {
  max-height: 300px;
}

.cat-more-row {
  display: flex;
  justify-content: center;
  padding: 2px 0 4px;
}

.cat-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all 0.2s;
}
.cat-btn:hover { color: var(--primary); border-color: var(--primary); }
.cat-btn.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

.cat-more-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all 0.2s;
}
.cat-more-btn:hover { color: var(--primary); border-color: var(--primary); }

/* ── Main Layout ── */
.main-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ── Shorts-style Article+Comment ── */
.shorts-container {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  height: calc(100vh - 120px);
  position: sticky;
  top: 112px;
}

.article-panel {
  background: var(--card-bg);
  border-radius: 12px;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.comment-panel {
  background: var(--card-bg);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}

/* ── Article List ── */
.article-list {
  margin-top: 20px;
}

.article-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: all 0.2s;
}
.article-card:hover, .article-card.active {
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(26,115,232,0.15);
}

.article-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.cat-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.source-name {
  font-size: 12px;
  color: var(--text-muted);
}

.pub-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.article-card h3 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 8px;
}

.article-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.comment-count {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Article Detail Panel ── */
.article-detail-header {
  margin-bottom: 20px;
}

.article-detail-header h2 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 12px;
}

.article-detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.original-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
}
.original-link:hover { background: var(--primary-dark); }

.article-summary {
  font-size: 15px;
  line-height: 1.8;
  margin: 20px 0;
  padding: 20px;
  background: var(--comment-bg);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}

/* ── Comments ── */
.comment-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
}

.comment-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.comment-item {
  padding: 12px;
  border-radius: 8px;
  background: var(--comment-bg);
  margin-bottom: 8px;
}

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

.comment-nick {
  font-weight: 600;
  font-size: 13px;
}

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

.comment-content {
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

.comment-form {
  padding: 12px;
  border-top: 1px solid var(--border);
  background: #fff;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 8px;
  font-family: inherit;
  resize: none;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.comment-submit-btn {
  width: 100%;
  padding: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.comment-submit-btn:hover { background: var(--primary-dark); }

/* ── Category Colors ── */
.cat-정치 { background: #fff0f0; color: #c0392b; }
.cat-경제 { background: #f0fff4; color: #27ae60; }
.cat-사회 { background: #f0f4ff; color: #2980b9; }
.cat-생활문화 { background: #fff8f0; color: #e67e22; }
.cat-세계 { background: #f5f0ff; color: #8e44ad; }
.cat-IT과학 { background: #f0fffe; color: #16a085; }
.cat-부동산 { background: #fffbf0; color: #d35400; }
.cat-헬스건강 { background: #f0fff8; color: #1abc9c; }
.cat-스포츠 { background: #f0f8ff; color: #2471a3; }
.cat-연예 { background: #fff0fb; color: #c0392b; }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* ── Loading ── */
.loading {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .shorts-container {
    grid-template-columns: 1fr;
    height: auto;
    position: static;
  }

  .comment-panel {
    height: 400px;
  }

  .main-wrap {
    padding: 12px;
  }
}

/* ── Footer ── */
.site-footer {
  background: #2c2c2c;
  color: #aaa;
  padding: 30px 20px;
  margin-top: 40px;
  font-size: 13px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin-bottom: 12px;
}
.footer-links a {
  color: #ccc;
  text-decoration: none;
}
.footer-links a:hover { color: #fff; }
.footer-info { margin-bottom: 8px; }
.footer-copy { color: #777; }
