:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #191f28;
  --muted: #6b7684;
  --line: #e5e8eb;
  --accent: #3182f6;
  --up: #e5383b;
  --down: #1b64da;
  --hover: #f2f4f6;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317;
    --card: #1a1e24;
    --text: #e9ecef;
    --muted: #8b95a1;
    --line: #2b3038;
    --accent: #4d94ff;
    --up: #ff5a5f;
    --down: #4f8fff;
    --hover: #232831;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* 상단바 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 10px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 18px; white-space: nowrap; }
.logo { color: var(--up); }
.badge { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: #ffe8a3; color: #6b4e00; }
.tabs { display: flex; gap: 4px; flex: 1; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: none; padding: 8px 14px; border-radius: 10px;
  font-weight: 600; color: var(--muted); white-space: nowrap; flex-shrink: 0;
}
.tabs button.active { color: var(--text); background: var(--hover); }
.account { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.account .eq { font-weight: 700; }

main { max-width: 1320px; margin: 0 auto; padding: 16px 24px 32px; }
.view { display: none; }
.view.active { display: block; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card-title { font-weight: 700; font-size: 16px; margin-bottom: 12px; }

/* 시장 */
.market { display: grid; grid-template-columns: 280px minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.stock-list { padding: 12px; position: sticky; top: 70px; }
.list-head { display: flex; gap: 6px; margin-bottom: 8px; }
.star {
  border: 0; background: none; padding: 0 2px; margin-left: 4px; font-size: 15px; line-height: 1; color: var(--muted);
  vertical-align: 1px; cursor: pointer;
}
.star.on { color: #f5b301; }
.star:hover { color: #f5b301; }
h1 .star { font-size: 20px; }
.kind-seg button { white-space: nowrap; padding: 6px 0; min-width: 0; font-size: 13px; }
.kind-seg { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; margin-bottom: 8px; }
.coin-tag { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 5px; vertical-align: 2px; background: #fff0c2; color: #8a5a00; }
.list-head input, .list-head select {
  min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card);
}
.list-head input { flex: 1; }
#stockList { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 160px); overflow-y: auto; }
.emblem {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: var(--sz); height: var(--sz); border-radius: calc(var(--sz) * 0.3);
  font-size: calc(var(--sz) * 0.8); line-height: 1; vertical-align: middle;
}
.name-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.head-name { display: flex; align-items: center; gap: 12px; }
#stockList li > .emblem { grid-row: span 2; align-self: center; }
#stockList li {
  display: grid; grid-template-columns: auto 1fr auto; gap: 0 10px;
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
}
#stockList li:hover { background: var(--hover); }
#stockList li.active { background: var(--hover); box-shadow: inset 3px 0 0 var(--accent); }
#stockList .nm { font-weight: 600; }
#stockList .sub { font-size: 12px; color: var(--muted); }
#stockList .px { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
#stockList .ch { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }

.stock-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 8px; }
.stock-head h1 { margin: 0; font-size: 20px; }
.stock-head .tag { font-size: 12px; color: var(--muted); margin-left: 6px; font-weight: 500; }
.big-price { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.price-box { text-align: right; }

.chart-card { padding: 12px 18px 18px; }
.chart-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 8px; }
.range { display: flex; gap: 4px; }
.range[hidden] { display: none; }
.tf-min { position: relative; }
.tf-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; display: flex; flex-direction: column; min-width: 90px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.tf-menu[hidden] { display: none; }
.tf-menu button { text-align: left; }
.check { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.indicators { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 12px; }
.indicators .muted { margin-right: 2px; }
.chip {
  border: 1px solid var(--line); background: none; border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--muted);
}
.chip.on { border-color: var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); font-weight: 700; }
.talk-link { margin-top: 12px; }
.range button, .seg button {
  border: 0; background: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600;
}
.range button.active, .seg button.active { background: var(--hover); color: var(--text); }
.chart-wrap { position: relative; height: 320px; }
#chart { width: 100%; height: 100%; display: block; }
.chart-tip {
  position: absolute; top: 22px; pointer-events: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 8px; font-size: 12px; white-space: nowrap; box-shadow: var(--shadow);
}

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 12px; }
.info-grid div span { display: block; font-size: 12px; color: var(--muted); }
.info-grid div b { font-variant-numeric: tabular-nums; }

/* 주문 */
.side { position: sticky; top: 70px; }
.order .seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--hover); padding: 4px; border-radius: 10px; margin-bottom: 14px; }
.order .seg button { padding: 8px; }
.order .seg button.buy.active { background: var(--up); color: #fff; }
.order .seg button.sell.active { background: var(--down); color: #fff; }
.order .row { display: flex; justify-content: space-between; margin: 8px 0; }
.order .row span:first-child { color: var(--muted); }
.qty { display: flex; align-items: center; gap: 6px; margin: 12px 0 8px; }
.qty input {
  flex: 1; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px;
  text-align: right; font-size: 16px; font-weight: 700; background: var(--card);
}
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 12px; }
.quick button { border: 1px solid var(--line); background: none; border-radius: 8px; padding: 5px 0; font-size: 12px; }
.quick button:hover { background: var(--hover); }
button.primary, .order .submit {
  width: 100%; border: 0; border-radius: 12px; padding: 13px; font-weight: 700; font-size: 15px;
  background: var(--accent); color: #fff;
}
.order .submit.buy { background: var(--up); }
.order .submit.sell { background: var(--down); }
.order .submit:disabled { opacity: .5; cursor: default; }
.order hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.login-cta { text-align: center; padding: 10px 0; }
.login-cta p { margin: 0 0 12px; color: var(--muted); }

.btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 7px 14px; font-weight: 600;
}
.btn.primary { width: auto; padding: 7px 14px; font-size: 14px; border-radius: 10px; border: 0; }

/* 광고 */
.ad { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; overflow: hidden; }
.ad.placeholder { border: 1px dashed var(--line); border-radius: var(--radius); background: repeating-linear-gradient(45deg, transparent 0 10px, var(--hover) 10px 20px); }
.ad-top { max-width: 1272px; margin: 16px auto 0; min-height: 90px; }
.ad-side { min-height: 250px; }
.ad-wide { min-height: 100px; margin-bottom: 16px; }
.ad > ins { width: 100%; }

/* 포트폴리오 */
.summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary .card { margin: 0; }
.summary span { display: block; color: var(--muted); font-size: 13px; }
.summary b { font-size: 20px; font-variant-numeric: tabular-nums; }
.summary small { display: block; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
.hold-group + .hold-group { margin-top: 22px; }
.hold-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 4px 8px 8px; border-bottom: 2px solid var(--line); }
.hold-head b { font-size: 15px; }
.hold-head .muted { font-size: 12px; }
.hold-sum { margin-left: auto; font-size: 13px; font-variant-numeric: tabular-nums; }
.mini-btns { display: inline-flex; gap: 4px; }
.mini { border: 0; border-radius: 7px; padding: 5px 10px; font-size: 12px; font-weight: 700; color: #fff; }
.mini.buy { background: var(--up); }
.mini.sell { background: var(--down); }
#tradeBox .seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--hover); padding: 4px; border-radius: 10px; margin-bottom: 14px; }
tr.clickable:hover td { background: var(--hover); }
tr.me td { background: color-mix(in srgb, var(--accent) 16%, transparent); font-weight: 700; }
tr.me td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 28px 0; }

/* 랭킹 */
.rank-controls { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.seg { display: inline-flex; gap: 2px; background: var(--bg); padding: 3px; border-radius: 10px; }
.seg button.active { background: var(--card); box-shadow: var(--shadow); }
.league-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.lg-item {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--lg) 50%, transparent); background: color-mix(in srgb, var(--lg) 10%, transparent);
}
.lg-item.mine { box-shadow: 0 0 0 2px var(--lg) inset; }
.lg-item .lg-icon { font-size: 22px; }
.lg-item span:last-of-type { font-size: 13px; color: var(--muted); }
.lg-item small { color: var(--lg); font-weight: 700; }
.league-guide ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.8; }
.league-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.league-tabs button {
  border: 1px solid var(--line); background: none; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--muted);
}
.league-tabs button.active { color: var(--text); border-color: var(--lg, var(--accent)); background: color-mix(in srgb, var(--lg, var(--accent)) 18%, transparent); }
.league-badge {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; vertical-align: 1px;
  color: var(--text); border: 1px solid var(--lg); background: color-mix(in srgb, var(--lg) 18%, transparent);
}
.summary b .league-badge { font-size: 15px; padding: 3px 10px; }
.medal { display: inline-block; width: 26px; text-align: center; font-weight: 800; }
.my-rank-card {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 16px 20px; border-radius: 16px; margin: 10px 0 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--card)), color-mix(in srgb, var(--accent) 6%, var(--card)));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.my-rank-card.top {
  background: linear-gradient(135deg, color-mix(in srgb, #f59f00 26%, var(--card)), color-mix(in srgb, #f59f00 6%, var(--card)));
  border-color: color-mix(in srgb, #f59f00 60%, transparent);
}
.my-rank-card.empty-me { background: var(--hover); border-style: dashed; border-color: var(--line); }
.mr-rank { display: flex; flex-direction: column; min-width: 96px; }
.mr-rank small { color: var(--muted); font-size: 12px; }
.mr-rank b { font-size: 34px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mr-rank b span { font-size: 16px; margin-left: 2px; }
.mr-info { flex: 1; min-width: 180px; }
.mr-name { font-weight: 700; font-size: 16px; }
.mr-stats { display: flex; gap: 14px; flex-wrap: wrap; margin: 2px 0; font-size: 13px; color: var(--muted); }
.mr-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.mr-stats b.up { color: var(--up); }
.mr-stats b.down { color: var(--down); }
.mr-gap { font-size: 13px; color: var(--muted); }
.mr-gap b { color: var(--accent); }
/* 명예의 전당 */
.hof-hero { background: linear-gradient(135deg, color-mix(in srgb, #f59f00 18%, var(--card)), var(--card)); }
.hof-hero h2 { margin: 0 0 4px; }
.hof-hero p { margin: 0; }
.hof-hero .league-tabs { margin-top: 14px; }
.hof-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.hof { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.hof-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.hof-item.latest { border-color: #f59f00; box-shadow: 0 0 0 1px #f59f00 inset; }
.hof-item h3 { margin: 0 0 8px; font-size: 14px; }
.hof-top, .kings { list-style: none; margin: 0; padding: 0; }
.hof-top li, .kings li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; }
.kings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.kings-title { margin: 0 0 4px; font-size: 14px; color: var(--muted); }
.kings li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.kings li:last-child { border-bottom: 0; }
.hof-item details { margin-top: 6px; font-size: 13px; }
.hof-item summary { cursor: pointer; color: var(--muted); }

/* 토론 (카톡 스타일 채팅) */
:root { --chat-bg: #b2c7d9; --bubble: #ffffff; --bubble-text: #191919; --chat-time: #556677; }
@media (prefers-color-scheme: dark) {
  :root { --chat-bg: #1c242e; --bubble: #2e3540; --bubble-text: #e9ecef; --chat-time: #8b95a1; }
}
.chat {
  position: relative; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column;
  height: calc(100vh - 140px); min-height: 460px; border-radius: var(--radius); overflow: hidden;
  background: var(--chat-bg); box-shadow: var(--shadow);
}
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: color-mix(in srgb, var(--chat-bg) 80%, #000 6%);
}
.chat-head select {
  padding: 7px 10px; border: 0; border-radius: 8px; font-weight: 700; background: rgba(255, 255, 255, .6); color: #191919; min-width: 0;
}
.chat-head .muted { font-size: 12px; color: var(--chat-time); }
.chat-body { flex: 1; overflow-y: auto; padding: 12px 12px 6px; }
.chat-day { text-align: center; margin: 14px 0 10px; }
.chat-day span { display: inline-block; font-size: 11px; padding: 3px 12px; border-radius: 999px; background: rgba(0, 0, 0, .15); color: #fff; }
.chat-empty { text-align: center; color: var(--chat-time); margin-top: 40px; }
.msg { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; }
.msg.cont { margin-top: 4px; }
.avatar {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px;
}
.avatar.ghost { visibility: hidden; height: 0; }
.msg-col { min-width: 0; max-width: 72%; }
.nick { font-size: 12px; margin: 0 0 4px 2px; color: var(--bubble-text); opacity: .85; }
.msg-row { display: flex; align-items: flex-end; gap: 5px; }
.bubble {
  padding: 8px 11px; border-radius: 4px 14px 14px 14px; background: var(--bubble); color: var(--bubble-text);
  white-space: pre-wrap; word-break: break-word; line-height: 1.45; font-size: 14px;
}
.msg.cont .bubble { border-radius: 14px; }
.msg.me { justify-content: flex-end; align-items: flex-end; gap: 5px; }
.msg.me .bubble { background: #fee500; color: #191919; border-radius: 14px 4px 14px 14px; max-width: 72%; }
.msg.me.cont .bubble { border-radius: 14px; }
.time { font-size: 10px; color: var(--chat-time); white-space: nowrap; flex-shrink: 0; }
.chat-new {
  position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); border: 0; border-radius: 999px;
  padding: 6px 14px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; font-weight: 600;
}
.chat-input { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px; background: var(--card); }
.chat-input textarea {
  flex: 1; resize: none; border: 0; outline: none; padding: 9px 4px; max-height: 96px; background: transparent; font: inherit; line-height: 1.4;
  color: var(--text); caret-color: var(--text);
}
.chat-input textarea::placeholder { color: var(--muted); }
.chat-send { border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 700; background: #fee500; color: #191919; }
.chat-send:disabled { background: var(--hover); color: var(--muted); cursor: default; }
.chat-login { width: 100%; padding: 11px; }

/* 뉴스 */
.news-cal { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 18px; }
.news-cal input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color-scheme: light dark; }
.news-cal .btn:disabled { opacity: .4; cursor: default; }
.news-cal .muted { margin-left: auto; font-size: 13px; }
.hot-tag { font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 5px; vertical-align: 2px; color: #fff; white-space: nowrap;
  background: linear-gradient(90deg, #ff6b00, #f03e3e); }
.brk-tag { font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 5px; background: #e03131; color: #fff; white-space: nowrap; }
.news li.breaking .hl, .news-mini li.breaking { font-weight: 700; }
.mkt-tag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: var(--accent); color: #fff; }
.news li.market-news { cursor: default; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.limit-tag { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 5px; color: #fff; vertical-align: 1px; }
.up-bg { background: var(--up); }
.down-bg { background: var(--down); }
.news-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: flex; gap: 12px; align-items: baseline; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.news li:last-child { border-bottom: 0; }
.news li:hover { background: var(--hover); }
.news time { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.news .hl { flex: 1; }
.news-mini { list-style: none; margin: 8px 0 0; padding: 0; }
.news-mini li { padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }

/* 모달·토스트 */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal[hidden] { display: none; }
.confirm-modal { z-index: 55; }
.confirm-box h2 { margin: 0 0 4px; }
.confirm-rows { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; }
.confirm-rows .row { display: flex; justify-content: space-between; padding: 7px 0; }
.confirm-rows .row span:first-child { color: var(--muted); }
.confirm-rows .row.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; }
.confirm-rows .row.total b { font-size: 17px; }
.confirm-note { font-size: 12px; margin: 10px 0 14px; }
.confirm-btns { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.confirm-btns .submit { width: 100%; border: 0; border-radius: 12px; padding: 12px; font-weight: 700; font-size: 15px; color: #fff; }
.confirm-btns .submit.buy { background: var(--up); }
.confirm-btns .submit.sell { background: var(--down); }
.modal-box { position: relative; background: var(--card); border-radius: 18px; padding: 24px; width: 100%; max-width: 380px; }
.modal-box h2 { margin: 0 0 4px; }
.modal-box label { display: block; margin: 12px 0; font-weight: 600; font-size: 13px; }
.modal-box label[hidden] { display: none; }
.modal-box label input { display: block; width: 100%; margin-top: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.modal-box .error { color: var(--up); min-height: 1em; margin: 4px 0 10px; font-size: 13px; }
.modal-box .link { border: 0; background: none; color: var(--accent); width: 100%; margin-top: 10px; }
.modal-box .close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 22px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: #191f28; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25); max-width: calc(100% - 32px);
}
.toast.err { background: #c92a2a; }

.footer { max-width: 1320px; margin: 0 auto; padding: 8px 24px 40px; color: var(--muted); font-size: 12px; text-align: center; }

/* 제재 안내 · 관리자 링크 */
.ban-banner {
  display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; max-width: 1272px; margin: 16px auto 0;
  padding: 12px 16px; border-radius: 12px; font-size: 14px;
  background: color-mix(in srgb, #e03131 14%, var(--card)); border: 1px solid color-mix(in srgb, #e03131 50%, transparent);
}
.ban-banner[hidden] { display: none; }
.ban-banner span { color: var(--muted); }
.admin-link { text-decoration: none; color: #f59f00; border-color: #f59f00; }

/* 관리자 화면 */
.admin-badge { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: #f59f00; color: #191919; vertical-align: 2px; }
.admin { max-width: 1320px; margin: 0 auto; padding: 20px 24px 40px; }
.admin-login { max-width: 380px; margin: 40px auto; }
.admin-login h2 { margin: 0 0 8px; }
.admin-login label { display: block; margin: 12px 0; font-weight: 600; font-size: 13px; }
.admin-login label input { display: block; width: 100%; margin-top: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.admin-login .error { color: var(--up); min-height: 1em; font-size: 13px; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.admin-stats .card { margin: 0; }
.admin-stats span { display: block; color: var(--muted); font-size: 13px; }
.admin-stats b { font-size: 22px; font-variant-numeric: tabular-nums; }
.admin-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.admin-head .card-title { margin: 0; }
.admin-head > .btn, .admin-search { margin-left: auto; }
.admin-search { display: flex; gap: 6px; }
.admin-search input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); min-width: 200px; }
.admin-acts { display: flex; flex-wrap: wrap; gap: 4px; }
.mini-btn { border: 1px solid var(--line); background: none; border-radius: 7px; padding: 3px 8px; font-size: 12px; white-space: nowrap; }
.mini-btn:hover { background: var(--hover); }
.mini-btn.warn { border-color: color-mix(in srgb, #e03131 50%, transparent); color: var(--up); }
.st { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.st-ok { background: color-mix(in srgb, #2f9e44 18%, transparent); color: #2f9e44; }
.st-ban { background: color-mix(in srgb, #e03131 18%, transparent); color: var(--up); }
.st-admin { background: color-mix(in srgb, #f59f00 20%, transparent); color: #e67700; }
tr.banned td { opacity: .75; }
.admin-msgs { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow-y: auto; }
.admin-msgs li { display: flex; align-items: baseline; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.admin-msgs time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.admin-msgs .room { font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--hover); color: var(--muted); white-space: nowrap; }
.admin-msgs .body { flex: 1; word-break: break-word; }
#adminModal select { display: block; width: 100%; margin-top: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }

/* 복구 코드 · 계정 관리 */
.modal-box small { font-weight: 500; }
.code-box h2 { margin: 0 0 6px; font-size: 20px; }
.code-box h2 small { font-size: 13px; color: var(--muted); }
.code-display {
  margin: 14px 0 10px; padding: 16px; border-radius: 12px; text-align: center; user-select: all;
  font: 800 clamp(17px, 5.5vw, 24px)/1.2 ui-monospace, Consolas, monospace; letter-spacing: 1px; white-space: nowrap;
  background: var(--hover); border: 2px dashed var(--accent);
}
.code-box #codeCopy { width: 100%; }
.code-notes { margin: 14px 0; padding-left: 18px; font-size: 13px; line-height: 1.7; }
.modal-box .code-check { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; color: var(--text); font-size: 14px; }
.modal-box .code-check input { display: inline-block; width: 18px; height: 18px; margin: 1px 0 0; flex-shrink: 0; }
.code-box .primary:disabled { opacity: .45; cursor: default; }
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.acct-grid div { display: flex; flex-direction: column; gap: 2px; }
.acct-grid span { font-size: 13px; }
.acct-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.note-warn {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  background: color-mix(in srgb, #f59f00 14%, transparent); border-left: 4px solid #f59f00;
}

/* 공지사항 */
.notice-wrap { max-width: 820px; margin: 0 auto; }
.notice { border-bottom: 1px solid var(--line); }
.notice:last-child { border-bottom: 0; }
.notice summary { display: flex; align-items: center; gap: 8px; padding: 14px 4px; cursor: pointer; list-style: none; }
.notice summary::-webkit-details-marker { display: none; }
.notice-title { font-weight: 700; flex: 1; min-width: 0; }
.notice time { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pin-tag { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: var(--accent); color: #fff; white-space: nowrap; }
.new-tag { font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 5px; background: #e03131; color: #fff; }
.notice-body { padding: 4px 6px 18px; line-height: 1.75; font-size: 15px; }
.notice-body h4 { margin: 18px 0 6px; font-size: 15px; }
.notice-body li { margin-bottom: 4px; }
.tabs button.has-new { position: relative; }
.tabs button.has-new::after {
  content: ''; position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: #e03131;
}

/* 가이드·FAQ 등 글 페이지 */
.doc-top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 24px; background: var(--card); border-bottom: 1px solid var(--line);
}
.doc-top .brand { color: var(--text); text-decoration: none; }
.doc-top nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.doc-top { flex-wrap: wrap; }
.doc-top nav a { padding: 7px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; }
.doc-top nav a.active { color: var(--text); background: var(--hover); }
.doc-top nav a.btn.primary, .doc-cta .btn.primary { color: #fff; background: var(--accent); }
.doc section { scroll-margin-top: 110px; }
.doc { max-width: 820px; margin: 0 auto; padding: 32px 24px 24px; line-height: 1.75; font-size: 15px; }
.doc h1 { font-size: 30px; margin: 0 0 8px; }
.doc h2 { font-size: 21px; margin: 40px 0 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.doc h3 { font-size: 16px; margin: 22px 0 6px; }
.doc .lead { font-size: 16px; color: var(--muted); }
.doc a:not(.btn) { color: var(--accent); }
.doc table { margin: 12px 0; background: var(--card); border-radius: 12px; overflow: hidden; }
.doc td, .doc th { vertical-align: top; }
.doc td:first-child { white-space: nowrap; }
.doc ol.steps li, .doc ul li, .doc ol li { margin-bottom: 6px; }
.doc dt { font-weight: 700; margin-top: 12px; }
.doc dd { margin: 2px 0 0; color: var(--muted); }
.doc .note {
  padding: 12px 16px; border-radius: 12px; font-size: 14px;
  background: color-mix(in srgb, var(--accent) 10%, transparent); border-left: 4px solid var(--accent);
}
.toc { background: var(--card); border-radius: 14px; padding: 16px 20px; margin: 20px 0; }
.toc ol { margin: 8px 0 0; columns: 2; }
.toc li { margin-bottom: 4px; }
.doc details { background: var(--card); border-radius: 12px; margin: 8px 0; padding: 0 16px; }
.doc details summary { cursor: pointer; padding: 14px 0; font-weight: 700; list-style: none; position: relative; padding-right: 24px; }
.doc details summary::-webkit-details-marker { display: none; }
.doc details summary::after { content: '+'; position: absolute; right: 0; top: 12px; font-size: 20px; color: var(--muted); }
.doc details[open] summary::after { content: '−'; }
.doc details p { margin: 0 0 14px; color: var(--text); }
.doc-cta { margin: 40px 0 8px; padding: 22px; border-radius: 16px; background: var(--card); text-align: center; }
.doc-cta p { margin: 0 0 12px; font-weight: 700; }
.doc-cta .btn { display: inline-block; text-decoration: none; margin: 2px; }
.doc-cta .btn.primary { color: #fff; }

/* 반응형 */
@media (max-width: 1100px) {
  .market { grid-template-columns: 240px minmax(0, 1fr); }
  .side { grid-column: 1 / -1; position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .side .card { margin: 0; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; }
  .tabs { order: 3; flex-basis: 100%; overflow-x: auto; }
  .account { margin-left: auto; }
  main { padding: 12px 16px 24px; }
  .ad-top { margin: 12px 16px 0; min-height: 60px; }
  .market { grid-template-columns: minmax(0, 1fr); }
  .stock-list { position: static; }
  #stockList { max-height: 260px; }
  .side { grid-template-columns: minmax(0, 1fr); }
  .chart-wrap { height: 240px; }
  .big-price { font-size: 24px; }
  .hide-sm { display: none; }
  .chat { height: calc(100vh - 150px); margin: 0 -16px; border-radius: 0; }
  .msg-col, .msg.me .bubble { max-width: 80%; }
  .kings-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .notice summary { flex-wrap: wrap; }
  .notice-title { order: 3; flex-basis: 100%; }
  .notice time { margin-left: auto; }
  .doc-top { padding: 10px 16px; }
  .doc-top nav { width: 100%; }
  .doc-top nav a.btn { margin-left: auto; }
  .doc { padding: 22px 16px; }
  .doc h1 { font-size: 24px; }
  .toc ol { columns: 1; }
  .doc td:first-child { white-space: normal; }
  .news-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
