/* 셸 + 컴포넌트. 색·수치는 tokens.css 변수만 사용한다. */

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg-outer);
  color: var(--text);
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--acid); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── 앱 컬럼 ─────────────────────────────── */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  border-inline: 1px solid #101609;
}
.view { padding: 14px var(--pad) calc(92px + env(safe-area-inset-bottom)); outline: none; }

/* ── 상단바 ─────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px var(--pad);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.brand svg { width: 22px; height: 22px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.chip {
  border: 1px solid var(--line-bright); border-radius: 999px;
  padding: 6px 11px; font-size: 12px; color: var(--muted);
}
.chip.connected { color: var(--acid); border-color: var(--acid-dim); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.iconbtn {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px; color: var(--muted);
}
.iconbtn svg { width: 18px; height: 18px; }

/* ── 하단 탭바 ───────────────────────────── */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(480px, 100%); z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 9px 6px calc(9px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 94%, black);
  border-top: 1px solid var(--line);
}
.tabbar a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 3px 0; font-size: 10px; color: var(--faint); border-radius: 10px;
  transition: color .15s;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.active { color: var(--acid); }
.tabbar a.active::before {
  content: ""; position: absolute; top: -10px;
  width: 26px; height: 2px; border-radius: 2px;
  background: var(--acid); box-shadow: 0 0 10px var(--acid);
}

/* ── 공통 구획 ───────────────────────────── */
section { margin-bottom: 18px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.sec-head h2 { font-size: 15px; font-weight: 700; }
.sec-head a { font-size: 12px; color: var(--muted); }
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0 16px; }
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--acid);
}
.top-gap { margin-top: 14px; }
.top-gap-s { margin-top: 8px; }
.hide { display: none; }

/* ── 카드 ────────────────────────────────── */
.card {
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 82%, black));
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px;
}
.card-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.hero { position: relative; overflow: hidden; padding: 24px 18px; }
.hero h1 { font-size: 24px; font-weight: 800; line-height: 1.28; letter-spacing: -0.02em; margin-top: 8px; }
.hero p { color: var(--muted); font-size: 13px; margin-top: 8px; position: relative; }
.hero::after {
  content: ""; position: absolute; left: -30%; right: -30%; bottom: -75%; height: 170px;
  background: radial-gradient(closest-side, rgba(198, 245, 63, 0.16), transparent);
  pointer-events: none;
}
.spark-bg {
  position: absolute; right: -8px; bottom: -4px; width: 62%; height: 60px; opacity: 0.5;
}
.spark-bg polyline { fill: none; stroke: var(--acid); stroke-width: 2; stroke-linecap: round; }

/* ── 시세·통계 ───────────────────────────── */
.statrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 10px 12px; min-width: 0;
}
.stat b { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.stat span { font-size: 14px; font-weight: 700; }
.up { color: var(--green); }
.down { color: var(--red); }
.acid { color: var(--acid); }

.price-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.price { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.delta { font-size: 13px; font-weight: 700; }
.tag {
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 999px; border: 1px solid;
}
.tag.warn { color: #FFB35C; border-color: #5A4322; background: #291D0E; }

.spark { width: 100%; height: 34px; margin-top: 12px; }
.spark polyline { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.chart { width: 100%; height: 120px; margin-top: 8px; }
.chart .line { fill: none; stroke: var(--acid); stroke-width: 2; }
.chart .fill { fill: rgba(198, 245, 63, 0.12); }

/* ── 메뉴 그리드 ─────────────────────────── */
.grid-menu { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.grid-menu a {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 13px 2px; font-size: 11px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.grid-menu .ic, .row .ic, .promo-head .ic {
  display: grid; place-items: center; flex: none;
  background: var(--surface-2); color: var(--acid); border-radius: 12px;
}
.grid-menu .ic { width: 38px; height: 38px; }
.grid-menu .ic svg, .row .ic svg { width: 20px; height: 20px; }

/* ── 리스트 행 ───────────────────────────── */
.rows { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color .15s;
}
a.row:active, a.row:hover { border-color: var(--line-bright); }
.row .ic { width: 38px; height: 38px; }
.row .tx { flex: 1; min-width: 0; }
.row .tx b { display: block; font-size: 14px; font-weight: 700; }
.row .tx small {
  display: block; margin-top: 2px; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row .chev { color: var(--faint); }
.row .chev svg { width: 16px; height: 16px; }
.row .val { text-align: right; flex: none; }
.row .val b { display: block; font-size: 14px; }
.row .val small { display: block; font-size: 11px; font-weight: 700; margin-top: 2px; }

/* ── 세그먼트·칩 ─────────────────────────── */
.seg {
  display: grid; grid-auto-flow: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 13px; padding: 4px; margin-bottom: 14px;
}
.seg button { padding: 8px 0; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--acid); color: #101505; font-weight: 800; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chips button {
  padding: 7px 12px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line); color: var(--muted);
}
.chips button.on { color: var(--acid); border-color: var(--acid-dim); background: rgba(198, 245, 63, 0.08); }

/* ── 버튼 ────────────────────────────────── */
.btn {
  display: block; width: 100%; text-align: center;
  padding: 13px; border-radius: 14px; font-size: 14px; font-weight: 700;
  border: 1px solid var(--acid-dim); color: var(--acid);
}
.btn.solid { background: var(--acid); border-color: var(--acid); color: #0D1204; }
.btn.sm { display: inline-block; width: auto; padding: 8px 14px; font-size: 12px; border-radius: 10px; }

/* ── 게시판 ─────────────────────────────── */
.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; margin-bottom: 14px; font-size: 13px;
  border: 1px solid #5A2B22; background: #2A1410; color: #FFB4A8;
  border-radius: var(--r-md);
}
.banner svg { width: 18px; height: 18px; flex: none; }
.banner b { font-weight: 800; margin-right: 2px; }

.feed .post {
  display: block; padding: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.post h3 { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; }
.post .meta, .article .meta { display: flex; gap: 8px; color: var(--faint); font-size: 11px; margin-top: 6px; }
.badge {
  flex: none; font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 999px; border: 1px solid var(--line-bright); color: var(--muted);
}
.badge.acid { color: var(--acid); border-color: var(--acid-dim); }
.badge.red { color: #FF8F86; border-color: #5A2B22; }

.article h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin-top: 6px; }
.article .meta { font-size: 12px; margin: 8px 0 4px; }
.article .body { margin-top: 10px; }
.article .body p { margin: 12px 0; font-size: 14px; line-height: 1.75; color: #CFD9C8; }
.video-wrap {
  position: relative; aspect-ratio: 16 / 9; margin: 14px 0;
  border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden;
}
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ── 프로모션 ────────────────────────────── */
.promo { display: flex; align-items: center; gap: 12px; }
.promo-head { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.promo-head .ic { width: 44px; height: 44px; border-radius: 14px; }
.promo-head .ic svg { width: 24px; height: 24px; }
.promo-head b { font-size: 14px; }
.promo-head small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.gem360 { color: var(--green); }
.gem600 { color: var(--acid); }
.gemBond { color: #B78CFF; }

/* ── 온보딩 ─────────────────────────────── */
.steps { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.steps li {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.steps .n {
  flex: none; width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 999px; background: var(--surface-2); color: var(--acid);
  font-family: var(--mono); font-weight: 800; font-size: 13px;
}
.steps b { font-size: 14px; }
.steps small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

/* ── 내 정보 ─────────────────────────────── */
.profile { display: flex; align-items: center; gap: 12px; }
.avatar {
  flex: none; width: 46px; height: 46px; display: grid; place-items: center;
  border-radius: 14px; background: var(--surface-2); color: var(--green);
}
.avatar svg { width: 24px; height: 24px; }
.profile .tx { min-width: 0; }
.profile b { font-size: 15px; }
.profile small { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); word-break: break-all; }

/* ── 상태 표시 ───────────────────────────── */
.empty {
  padding: 28px 20px; text-align: center; font-size: 13px; color: var(--faint);
  border: 1px dashed var(--line); border-radius: var(--r-md);
}
.empty.big { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 52px 20px; }
.empty.big svg { width: 32px; height: 32px; }
.empty.big b { color: var(--muted); font-size: 15px; }
.demo-note { margin-top: 10px; text-align: center; font-size: 11px; color: var(--faint); }
