/* ══════════════════════════════════════════
   개미공탐지수 — gongtam.com
   Dark theme · Mobile first · max-width 560px
   ══════════════════════════════════════════ */

:root {
  --bg: #0a0a0f;
  --bg2: #12121c;
  --card: #16162a;
  --card-border: #1e1e3a;
  --text: #e0e0ef;
  --dim: #6e6e8a;
  --green: #00E676;
  --green-dark: #00C853;
  --red: #FF1744;
  --orange: #FF6D00;
  --yellow: #FFD600;
  --blue: #448aff;
  --radius: 14px;
}

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

body {
  font-family: 'Noto Sans KR', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 560px;
  margin: 0 auto;
  padding: 0 14px env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.mono { font-family: 'JetBrains Mono', monospace; }

/* ── 헤더 ── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 8px;
}
.logo {
  font-size: 18px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--yellow), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.updated { font-size: 11px; color: var(--dim); }

/* ── 게이지 ── */
.gauge-section { text-align: center; padding: 4px 0 0; }
.gauge-container { position: relative; width: 280px; margin: 0 auto; }
.gauge-svg { width: 100%; height: auto; display: block; }
.gauge-center {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}
.gauge-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
  transition: color .5s;
}
.gauge-grade {
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
  transition: color .5s;
}
.score-pills {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  margin-top: 10px;
}
.pill { text-align: center; padding: 0 16px; }
.pill-label { font-size: 11px; color: var(--dim); display: block; }
.pill-value { font-size: 20px; font-weight: 800; display: block; }
.pill-divider { width: 1px; height: 28px; background: var(--card-border); }
.gauge-date { font-size: 11px; color: var(--dim); margin-top: 6px; }

/* ── 24시간 스파크라인 ── */
.spark-section {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 8px 0;
}
.spark-label { font-size: 11px; color: var(--dim); margin-bottom: 4px; }
.spark-svg { width: 100%; height: 60px; display: block; }
.spark-section { position: relative; overflow: hidden; }
.spark-range { display: flex; justify-content: space-between; font-size: 10px; color: var(--dim); margin-top: 2px; }

/* ── 시그널 배지 ── */
.signal-section { text-align: center; margin: 10px 0; }
.signal-badge {
  display: inline-block;
  padding: 8px 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  border: 2px solid var(--card-border);
  background: var(--bg2);
  transition: all .3s;
}

/* ── 스탯 카드 (3열) ── */
.stats-row { display: flex; gap: 8px; margin: 10px 0; }
.stat-card {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
}
.stat-label { font-size: 11px; color: #9a9ab0; display: block; letter-spacing: -0.3px; }
.stat-value { font-size: 20px; font-weight: 900; display: block; margin: 4px 0; color: #fff; }
.stat-sub { font-size: 12px; font-weight: 700; }

/* ── 카드 ── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 10px 0;
}
.section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}
.badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--dim);
  background: var(--bg2);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── 광고 슬롯 ── */
.ad-slot {
  min-height: 90px;
  margin: 12px 0;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── 투표 ── */
.vote-buttons { display: flex; gap: 10px; }
.vote-btn {
  flex: 1;
  padding: 14px;
  border: 2px solid var(--card-border);
  border-radius: 12px;
  background: var(--bg2);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}
.vote-btn:active { transform: scale(0.97); }
.vote-up:hover { border-color: var(--green); }
.vote-down:hover { border-color: var(--red); }
.vote-bar-wrap {
  height: 8px;
  background: var(--red);
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0 6px;
}
.vote-bar-up {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width .6s ease;
}
.vote-labels { display: flex; justify-content: space-between; }
.vote-pct { font-size: 14px; font-weight: 700; }

/* ── SVG 차트 ── */
.chart-header { display: flex; justify-content: space-between; align-items: center; }
.chart-tabs { display: flex; gap: 4px; }
.chart-tab {
  background: none;
  border: 1px solid var(--card-border);
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .2s;
}
.chart-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.svg-chart-wrap { position: relative; margin-top: 12px; }
.trend-svg { width: 100%; height: 200px; display: block; }
.chart-tooltip {
  display: none;
  position: absolute;
  background: #222240;
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* ── 백테스트 카드 ── */
.bt-sub { font-size: 11px; color: var(--dim); margin-bottom: 10px; }
.bt-cards { display: flex; gap: 8px; }
.bt-card {
  flex: 1;
  background: var(--bg2);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  border: 1px solid transparent;
  transition: border-color .2s;
}
.bt-card:hover { border-color: var(--card-border); }
.bt-name { font-size: 11px; color: var(--dim); font-weight: 600; }
.bt-return { font-size: 22px; font-weight: 800; margin: 4px 0; }
.bt-win { font-size: 12px; color: var(--dim); }
.bt-trades { font-size: 10px; color: var(--dim); margin-top: 2px; }

/* ── 종가 맞추기 ── */
.predict-desc { font-size: 12px; color: var(--dim); margin-bottom: 10px; }
.predict-input-row { display: flex; gap: 8px; }
.predict-input {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  outline: none;
}
.predict-input:focus { border-color: var(--blue); }
.predict-btn {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.predict-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.predict-rank { margin-top: 12px; }
.rank-item { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--card-border); font-size: 12px; }
.rank-pos { font-weight: 700; width: 24px; }
.rank-diff { color: var(--dim); }

/* ── 달력 히트맵 ── */
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-btn {
  background: var(--bg2);
  border: 1px solid var(--card-border);
  color: var(--text);
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-month { font-size: 13px; font-weight: 700; }
.cal-legend { display: flex; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.cal-leg-item { font-size: 10px; color: var(--dim); display: flex; align-items: center; gap: 3px; }
.cal-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 3px; }
.cal-weekdays span { font-size: 9px; color: var(--dim); text-align: center; font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: transform .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
}
.cal-cell:hover { transform: scale(1.3); z-index: 5; }
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell.empty:hover { transform: none; }
.cal-tooltip {
  display: none;
  position: fixed;
  background: #222240;
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* ── 방법론 ── */
.method-desc { font-size: 13px; color: var(--dim); margin-bottom: 12px; }
.method-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.method-stat { text-align: center; padding: 8px 0; }
.method-num { font-size: 18px; font-weight: 800; }
.method-label { font-size: 10px; color: var(--dim); margin-top: 2px; }
.method-details { margin-top: 12px; }
.method-details summary { font-size: 12px; color: var(--blue); cursor: pointer; font-weight: 600; }
.method-details ul { margin: 8px 0 0 16px; font-size: 12px; color: var(--dim); }
.method-details li { margin-bottom: 4px; }
.method-details strong { color: var(--text); }

/* ── CNN 비교 ── */
.cnn-compare { display: flex; align-items: center; }
.cnn-col { flex: 1; text-align: center; }
.cnn-label { font-size: 12px; color: #9a9ab0; letter-spacing: -0.3px; }
.cnn-score { font-size: 38px; font-weight: 900; margin: 6px 0; color: #fff; }
.cnn-grade { font-size: 14px; font-weight: 700; }
.cnn-vs-badge {
  background: var(--bg2);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  color: var(--dim);
}
.cnn-note { font-size: 11px; color: var(--dim); text-align: center; margin-top: 10px; }

/* ── 일별 기록 테이블 ── */
.table-scroll { overflow-x: auto; }
.day-table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
.day-table th { text-align: left; color: var(--dim); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--card-border); }
.day-table td { padding: 6px 8px; border-bottom: 1px solid rgba(30,30,58,0.5); }

/* ── 푸터 ── */
.footer { text-align: center; padding: 24px 0 16px; }
.footer-disc { font-size: 10px; color: var(--dim); max-width: 320px; margin: 0 auto 8px; }
.footer-links { font-size: 11px; margin-bottom: 8px; }
.footer-links a { color: var(--dim); text-decoration: none; }
.footer-links a:hover { color: var(--blue); }
.footer-copy { font-size: 10px; color: #444; }

/* ── 유틸 ── */
.up { color: var(--green) !important; }
.down { color: var(--red) !important; }
.dim { color: var(--dim); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 채팅 (하단 고정) ── */
.chat-wrap {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  z-index: 1000;
  background: #10101f;
  border-top: 1px solid var(--card-border);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.6);
  transition: height .3s ease;
  overflow: hidden;
}
.chat-wrap.collapsed { height: 40px; }
.chat-wrap.expanded { height: 320px; }
.chat-header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  gap: 8px;
}
.chat-title { font-size: 13px; font-weight: 700; flex: 1; }
.chat-online { font-size: 11px; color: var(--green); font-weight: 600; }
.chat-arrow {
  font-size: 10px;
  color: var(--dim);
  transition: transform .3s;
}
.chat-wrap.collapsed .chat-arrow { transform: rotate(0deg); }
.chat-wrap.expanded .chat-arrow { transform: rotate(180deg); }
.chat-body {
  display: flex;
  flex-direction: column;
  height: calc(100% - 40px);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 8px;
  font-family: 'Noto Sans KR', -apple-system, sans-serif;
  font-size: 13px;
  scroll-behavior: smooth;
}
.chat-msg {
  padding: 4px 0;
  line-height: 1.6;
  word-break: break-word;
}
.chat-msg-nick {
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  margin-right: 6px;
  letter-spacing: -0.3px;
}
.chat-msg-text { color: var(--text); font-size: 13px; }
.chat-msg-time { font-size: 10px; color: #555; margin-left: 6px; }
.chat-msg-admin .chat-msg-nick { color: #FF1744 !important; }
.chat-msg-admin .chat-msg-text { color: #FF1744; }
.chat-banned {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--dim);
  font-weight: 700;
}
.chat-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--card-border);
  background: #0c0c18;
}
.chat-nick {
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-input {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: 'Noto Sans KR', sans-serif;
}
.chat-input:focus { border-color: var(--blue); }
.chat-input:disabled { opacity: 0.3; }
.chat-send {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.chat-send:disabled { opacity: 0.3; cursor: not-allowed; }
.chat-admin-action {
  display: inline-block;
  background: #FF1744;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 4px;
  border: none;
}
/* 본문에 채팅 높이만큼 패딩 */
#app { padding-bottom: 48px; }

/* ── 반응형 ── */
@media (max-width: 380px) {
  .stats-row { flex-direction: column; }
  .bt-cards { flex-direction: column; }
  .method-stats { grid-template-columns: repeat(2, 1fr); }
}
