/* ===== 변수 ===== */
:root {
  --bg-primary: #0f1419;
  --bg-secondary: #1a2332;
  --bg-card: #1e2a3a;
  --bg-hover: #253344;
  --text-primary: #e7ecf1;
  --text-secondary: #8b9cad;
  --text-muted: #5c6f82;
  --accent: #00c896;
  --accent-dim: #00a87a;
  --danger: #f23645;
  --danger-dim: #c92d3a;
  --border: #2d3d52;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Noto Sans KR', -apple-system, sans-serif;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

/* ===== 리셋 & 기본 ===== */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; }

/* ===== 헤더 ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 20, 25, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.25rem;
}
.logo-icon { font-size: 1.5rem; }
.logo-text { color: var(--accent); }
.nav {
  display: flex;
  gap: 8px;
}
.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-link.active { color: var(--accent); background: rgba(0, 200, 150, 0.12); }
.header-actions { display: flex; gap: 10px; }

/* 버튼 */
.btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.2s, transform 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
}
.btn-primary:hover { background: var(--accent-dim); }
.btn-sm { padding: 8px 14px; font-size: 0.875rem; }

/* ===== 티커 바 ===== */
.ticker-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.ticker-wrap { padding: 10px 0; }
.ticker-list {
  display: flex;
  gap: 32px;
  animation: ticker 60s linear infinite;
  white-space: nowrap;
}
.ticker-list span {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.ticker-list .up { color: var(--accent); }
.ticker-list .down { color: var(--danger); }
@keyframes ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ===== 메인 ===== */
.main { max-width: 1200px; margin: 0 auto; padding: 32px 24px 48px; }

/* 히어로 */
.hero {
  margin-bottom: 48px;
  padding: 40px 0;
}
.hero-title {
  margin: 0 0 8px;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.hero-desc {
  margin: 0 0 8px;
  color: var(--text-secondary);
  font-size: 1rem;
}
.api-status {
  margin: 0 0 20px;
  font-size: 0.875rem;
  min-height: 1.25em;
}
.api-status.loading { color: var(--accent); }
.api-status.error { color: var(--danger); }
.market-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.market-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.market-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.market-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.market-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.market-change {
  font-size: 0.9rem;
  font-weight: 600;
}
.market-change.up { color: var(--accent); }
.market-change.down { color: var(--danger); }

/* 섹션 공통 */
.section {
  margin-bottom: 40px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.section-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}
.section-more {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
}
.section-more:hover { text-decoration: underline; }

/* 인기 종목 그리드 */
.stocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.stock-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.2s, background 0.2s;
}
.stock-card:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}
.stock-info { min-width: 0; }
.stock-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 2px;
}
.stock-code { font-size: 0.8rem; color: var(--text-muted); }
.stock-price {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.stock-price.up { color: var(--accent); }
.stock-price.down { color: var(--danger); }

/* 2열 레이아웃 */
.two-col {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
}
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

/* 커뮤니티 */
.community-section { min-width: 0; }
.post-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}
.post-form textarea {
  width: 100%;
  padding: 10px 0;
  margin-bottom: 10px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
}
.post-form textarea::placeholder { color: var(--text-muted); }
.post-form textarea:focus { outline: none; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  transition: background 0.2s;
}
.post-item:hover { background: var(--bg-hover); }
.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.post-author { color: var(--accent); font-weight: 500; }
.post-content { margin: 0; font-size: 0.95rem; line-height: 1.5; }
.post-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.post-tag {
  background: rgba(0, 200, 150, 0.15);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
}

/* 뉴스 */
.news-section { min-width: 0; }
.news-list { list-style: none; margin: 0; padding: 0; }
.news-item {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
  border-radius: var(--radius-sm);
  padding-left: 8px;
  margin-left: -8px;
}
.news-item:hover { background: var(--bg-hover); }
.news-item:last-child { border-bottom: none; }
.news-title {
  font-weight: 500;
  font-size: 0.95rem;
  margin-bottom: 4px;
  line-height: 1.4;
}
.news-meta { font-size: 0.8rem; color: var(--text-muted); }

/* 푸터 */
.footer {
  margin-top: 48px;
  padding: 32px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}
.footer-brand .logo-text { color: var(--accent); font-weight: 700; }
.footer-brand p { margin: 8px 0 16px; color: var(--text-secondary); font-size: 0.9rem; }
.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}
.footer-links a { color: var(--text-muted); font-size: 0.9rem; }
.footer-links a:hover { color: var(--text-primary); }
.footer-disclaimer {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== CTA 섹션 (랜딩/전환) ===== */
.cta-section { margin-bottom: 48px; }
.cta-box {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
}
.cta-title { margin: 0 0 12px; font-size: 1.5rem; font-weight: 700; }
.cta-desc {
  margin: 0 0 24px;
  color: var(--text-secondary);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.cta-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 24px; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.cta-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.cta-features li::before { content: '✓ '; color: var(--accent); }

/* ===== 서브페이지 공통 (약관, 개인정보, 고객센터, 로그인/가입) ===== */
.page-main {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px 48px;
}
.page-title { margin: 0 0 8px; font-size: 1.5rem; font-weight: 700; }
.page-lead { color: var(--text-secondary); margin-bottom: 32px; font-size: 0.95rem; }
.legal-body, .content-body {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  line-height: 1.7;
  font-size: 0.95rem;
  color: var(--text-secondary);
}
.legal-body h2 { font-size: 1.1rem; color: var(--text-primary); margin: 24px 0 10px; }
.legal-body h2:first-child { margin-top: 0; }
.legal-body p { margin: 0 0 12px; }
.legal-body ul { margin: 0 0 12px; padding-left: 1.2em; }

/* 폼 (로그인/회원가입) */
.form-card {
  max-width: 400px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.form-card h1 { margin: 0 0 24px; font-size: 1.35rem; text-align: center; }
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}
.form-group input::placeholder { color: var(--text-muted); }
.form-actions { margin-top: 24px; }
.form-actions .btn { width: 100%; justify-content: center; }
.form-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.form-footer a { color: var(--accent); }
.form-footer a:hover { text-decoration: underline; }
.form-checkbox { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.form-checkbox input { width: auto; margin-top: 4px; }
.form-checkbox label { margin: 0; font-size: 0.9rem; }
.form-checkbox a { color: var(--accent); }

/* 고객센터 */
.faq-list { list-style: none; margin: 0; padding: 0; }
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.faq-item:last-child { border-bottom: none; }
.faq-q { font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.faq-a { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.6; }
.contact-info { margin-top: 24px; padding: 20px; background: var(--bg-card); border-radius: var(--radius); }
.contact-info p { margin: 0 0 8px; color: var(--text-secondary); }

/* 반응형 */
@media (max-width: 768px) {
  .nav { display: none; }
  .hero-title { font-size: 1.4rem; }
  .market-cards { grid-template-columns: 1fr; }
  .cta-box { padding: 24px 20px; }
  .legal-body, .content-body { padding: 20px; }
}
