/* 반반 — 디자인 시스템. 모바일 퍼스트, A=코랄 vs B=블루 투톤 스플릿 */
:root {
  --a: #ff5a4e;          /* 선택 A 코랄 */
  --a-deep: #d63a30;
  --b: #2f6bff;          /* 선택 B 블루 */
  --b-deep: #1e4ed8;
  --bg: #101014;         /* 다크 지면 */
  --panel: #1a1a21;
  --line: #2a2a33;
  --ink: #f4f2ee;
  --ink-dim: #9a97a3;
  --amber: #ffc24b;      /* 강조(랭킹·배지) */
  --tab-h: 60px;
  --radius: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  min-height: 100vh;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; cursor: pointer; background: none; color: inherit; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; width: 100%; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--b); border-color: transparent; }
img { max-width: 100%; display: block; }

/* ---------- 상단 헤더 ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(var(--bg) 80%, transparent);
}
.logo { font-size: 22px; font-weight: 900; letter-spacing: -0.5px; }
.logo .a-half { color: var(--a); }
.logo .b-half { color: var(--b); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--panel); position: relative; }
.icon-btn svg { width: 19px; height: 19px; stroke: var(--ink-dim); }
.badge-dot {
  position: absolute; top: 6px; right: 7px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--a); display: none;
}
.badge-dot.on { display: block; }

/* ---------- 하단 탭바 ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(16,16,20,0.96); border-top: 1px solid var(--line);
  display: flex; z-index: 40;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 10.5px; color: var(--ink-dim); font-weight: 600;
}
.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.tab.active { color: var(--ink); }
.tab.active svg { stroke: var(--amber); }

/* ---------- 오늘의 질문: 스플릿 투표 카드 ---------- */
.q-meta { display: flex; align-items: center; gap: 8px; padding: 4px 16px 10px; }
.chip {
  font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--panel); color: var(--ink-dim); border: 1px solid var(--line);
}
.chip.live { color: var(--bg); background: var(--amber); border: 0; }
.chip.live::before { content: "●"; font-size: 8px; margin-right: 4px; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

.split-card { margin: 0 16px 18px; border-radius: var(--radius); overflow: hidden; position: relative; }
.split-option {
  display: block; width: 100%; text-align: left; padding: 26px 20px;
  position: relative; overflow: hidden; transition: filter 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.split-option:active { filter: brightness(1.15); }
.split-option.opt-a { background: var(--a); }
.split-option.opt-b { background: var(--b); }
.split-option .tag {
  font-size: 13px; font-weight: 900; opacity: 0.75; letter-spacing: 1px;
}
.split-option .txt { font-size: 21px; font-weight: 800; line-height: 1.35; margin-top: 6px; word-break: keep-all; }
.vs-divider {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 46px; height: 46px; border-radius: 50%; background: var(--bg);
  display: grid; place-items: center; font-weight: 900; font-size: 15px; z-index: 5;
  border: 2px solid var(--line);
}
/* 투표 완료 → 결과 모드: 폭이 %에 비례 */
.split-card.voted .split-option { padding: 20px; }
.result-row { display: flex; height: 88px; }
.result-bar { display: flex; flex-direction: column; justify-content: center; padding: 0 14px; overflow: hidden; transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
.result-bar.opt-a { background: var(--a); }
.result-bar.opt-b { background: var(--b); }
.result-bar .pct { font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; }
.result-bar .lbl { font-size: 12px; font-weight: 700; opacity: 0.85; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.result-bar.mine::after { content: "내 선택"; font-size: 10px; font-weight: 800; background: rgba(0,0,0,0.3); border-radius: 999px; padding: 2px 8px; width: fit-content; margin-top: 4px; }
.total-line { text-align: center; font-size: 12.5px; color: var(--ink-dim); padding: 10px 0 2px; }

/* AI 코멘트 */
.ai-note {
  margin: 0 16px 18px; padding: 13px 15px; border-radius: 12px;
  background: var(--panel); border: 1px dashed var(--line);
  font-size: 14px; line-height: 1.5; color: var(--ink);
}
.ai-note b { color: var(--amber); font-size: 11.5px; display: block; margin-bottom: 4px; letter-spacing: 0.5px; }

/* ---------- 리스트/카드 공통 ---------- */
.section-title { font-size: 15px; font-weight: 800; padding: 14px 16px 10px; display: flex; justify-content: space-between; align-items: baseline; }
.section-title small { font-weight: 600; color: var(--ink-dim); font-size: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  margin: 0 16px 10px; padding: 15px;
}
.card .q-line { font-size: 14.5px; font-weight: 700; line-height: 1.45; word-break: keep-all; }
.card .q-line .va { color: var(--a); }
.card .q-line .vb { color: var(--b); }
.card .meta { display: flex; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--ink-dim); }
.mini-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin-top: 10px; }
.mini-bar .fa { background: var(--a); }
.mini-bar .fb { background: var(--b); }

/* ---------- 댓글 ---------- */
.comment { padding: 13px 16px; border-bottom: 1px solid var(--line); }
.comment .head { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-dim); }
.comment .side { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; }
.comment .side.sa { background: rgba(255,90,78,0.18); color: var(--a); }
.comment .side.sb { background: rgba(47,107,255,0.18); color: var(--b); }
.comment .body { font-size: 14.5px; line-height: 1.5; margin-top: 6px; word-break: break-word; }
.comment .like { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 12.5px; color: var(--ink-dim); font-weight: 700; }
.comment .like svg { width: 15px; height: 15px; stroke: currentColor; fill: none; }
.comment .like.on { color: var(--a); }
.comment .like.on svg { fill: var(--a); stroke: var(--a); }

/* ---------- 성향 바 ---------- */
.tend-row { margin: 0 16px 12px; }
.tend-row .lbls { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.tend-row .lbls .la { color: var(--a); } .tend-row .lbls .lb { color: var(--b); }
.tend-bar { display: flex; height: 22px; border-radius: 11px; overflow: hidden; font-size: 11px; font-weight: 800; }
.tend-bar > div { display: flex; align-items: center; padding: 0 8px; }
.tend-bar .ta { background: var(--a); justify-content: flex-start; }
.tend-bar .tb { background: var(--b); justify-content: flex-end; }

/* ---------- 버튼/폼 ---------- */
.btn {
  display: block; width: calc(100% - 32px); margin: 0 16px; padding: 15px;
  border-radius: 12px; text-align: center; font-weight: 800; font-size: 15px;
  background: var(--ink); color: var(--bg);
}
.btn.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.btn.share-a { background: var(--a); color: #fff; }
.btn.share-b { background: var(--b); color: #fff; }
.btn:disabled { opacity: 0.4; }
.form-block { padding: 6px 16px; display: flex; flex-direction: column; gap: 12px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-dim); margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--ink-dim); padding: 0 16px; line-height: 1.5; }

/* ---------- 공유 카드 (9:16 스토리 비율 의식) ---------- */
.share-stage { padding: 24px 16px; }
.share-card {
  border-radius: 20px; overflow: hidden; border: 1px solid var(--line);
  background: var(--panel);
}
.share-card .sc-head { padding: 22px 20px 6px; font-size: 13px; font-weight: 800; color: var(--ink-dim); letter-spacing: 2px; }
.share-card .sc-q { padding: 4px 20px 18px; font-size: 20px; font-weight: 800; line-height: 1.4; word-break: keep-all; }
.share-card .sc-q .va { color: var(--a); } .share-card .sc-q .vb { color: var(--b); }
.share-card .sc-choice { margin: 0 20px 16px; padding: 14px; border-radius: 12px; text-align: center; font-weight: 900; font-size: 17px; color: #fff; }
.share-card .sc-choice.ca { background: var(--a); } .share-card .sc-choice.cb { background: var(--b); }
.share-card .sc-foot { padding: 0 20px 22px; font-size: 13px; color: var(--ink-dim); text-align: center; }
.share-card .sc-foot b { color: var(--amber); }

/* ---------- 탭 스위처/빈 상태/토스트 ---------- */
.seg { display: flex; gap: 8px; padding: 4px 16px 12px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg .s { flex-shrink: 0; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--panel); color: var(--ink-dim); border: 1px solid var(--line); }
.seg .s.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.empty { text-align: center; color: var(--ink-dim); padding: 48px 20px; font-size: 14px; line-height: 1.6; }
.empty .big { font-size: 34px; margin-bottom: 10px; font-weight: 900; }
#toast {
  position: fixed; bottom: calc(var(--tab-h) + 18px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); font-size: 13.5px; font-weight: 700;
  padding: 11px 18px; border-radius: 999px; z-index: 60; opacity: 0; transition: opacity 0.25s;
  pointer-events: none; white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ---------- 히어로 (index 상단, 비로그인 첫 방문 강조) ---------- */
.hero {
  margin: 0 16px 16px; border-radius: var(--radius); overflow: hidden;
  background-color: #17171d; background-image: url("../assets/hero.jpg");
  background-size: cover; background-position: center;
  padding: 30px 20px; min-height: 150px; display: flex; flex-direction: column; justify-content: flex-end;
}
.hero h1 { font-size: 30px; font-weight: 900; letter-spacing: -1px; text-shadow: 0 1px 8px rgba(0,0,0,0.55); }
.hero p { font-size: 13.5px; margin-top: 4px; color: rgba(255,255,255,0.85); text-shadow: 0 1px 6px rgba(0,0,0,0.55); }

/* ---------- 랭킹 ---------- */
.rank-item { display: flex; gap: 12px; align-items: flex-start; }
.rank-no { font-size: 16px; font-weight: 900; color: var(--ink-dim); min-width: 22px; font-variant-numeric: tabular-nums; }
.rank-item.top .rank-no { color: var(--amber); }

/* 데스크톱에서도 폰 프레임 느낌 유지 */
@media (min-width: 561px) {
  body { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
