/* duniverse
 *
 * 그라데이션 없이 평평하게. 면과 1px 선으로만 구분합니다.
 *
 * 라이트/다크는 light-dark() 로 처리합니다.
 * 값을 한 번만 적으면 되고, :root 의 color-scheme 만 바꾸면 전체가 따라옵니다.
 *   - 지정 안 함  → 운영체제 설정을 따라감
 *   - data-theme="light" / "dark" → 강제 지정
 */

:root {
  color-scheme: light dark;

  /* 바탕 */
  --bg: light-dark(#ffffff, #0f1115);
  --surface: light-dark(#f7f8fa, #171a20);
  --surface-2: light-dark(#eef0f4, #1f242c);
  --surface-3: light-dark(#e6e9ee, #262c35);

  /* 선 */
  --line: light-dark(#e3e5ea, #272c35);
  --line-soft: light-dark(#edeef1, #21252c);

  /* 글자 */
  --text: light-dark(#16181d, #e9ebef);
  --text-dim: light-dark(#4a4f59, #b4bac4);
  --text-muted: light-dark(#767c88, #858c98);
  --text-faint: light-dark(#9aa0aa, #6b727e);

  /* 강조 — 올리브
   *
   * 라이트는 지정한 #636B2F 그대로 씁니다. 흰 배경에서 대비 5.7:1 로 충분합니다.
   * 다크는 같은 색조(H 68°)를 밝기만 올린 값입니다.
   * 어두운 배경에 #636B2F 를 그대로 쓰면 대비가 3.3:1 까지 떨어져서 글자가 묻힙니다. */
  --accent: light-dark(#636b2f, #b0bb6a);
  --accent-text: light-dark(#ffffff, #1a1d0c);
  --accent-soft: light-dark(#f1f3e4, #21240f);
  --accent-line: light-dark(#dde2c2, #3c4222);

  --danger: light-dark(#b42318, #ff9a9a);
  --danger-soft: light-dark(#fef3f2, #2a1717);
  --danger-line: light-dark(#f5c6c2, #4d2626);

  /* 시세 — 오르면 빨강, 내리면 파랑 (국내 관습) */
  --up: light-dark(#d6173a, #ff5a75);
  --down: light-dark(#1160c4, #5aa8ff);

  --header-h: 56px;
  --panel-w: 252px;
  --radius: 12px;
}

:root[data-theme='light'] {
  color-scheme: light;
}

:root[data-theme='dark'] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── 상단 바 ─────────────────────────────────────────── */

.header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

/* 앱으로 설치했을 때 — 우리 머리줄이 곧 창의 제목줄이 됩니다.
 *
 * 브라우저가 그리던 얇은 제목줄(주소가 글자로 표시되던 그 줄)이 사라지고,
 * 그 자리를 이 헤더가 대신 차지합니다. 창 조절 버튼만 오른쪽에 얹힙니다.
 * 브라우저 탭으로 열었을 때는 아무 영향이 없습니다. */
@media (display-mode: window-controls-overlay) {
  .header {
    /* 이 영역을 잡고 창을 끌 수 있게 합니다. */
    -webkit-app-region: drag;
    app-region: drag;
    /* 오른쪽 끝 창 조절 버튼(－ □ ×)과 겹치지 않도록 자리를 비웁니다. */
    padding-right: calc(100vw - env(titlebar-area-width, 100vw) + 14px);
  }

  /* 누를 수 있는 것들은 끌기 대상에서 빼야 클릭이 먹습니다. */
  .header button,
  .header .online-pill {
    -webkit-app-region: no-drag;
    app-region: no-drag;
  }
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.3px;
  user-select: none;
}

.logo .mark {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}

.logo b {
  font-weight: 650;
  color: var(--accent);
}

.header-spacer {
  flex: 1;
}

/* 몇 명 있는지 */
.online-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  user-select: none;
}

.online-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text-dim);
}

.icon-btn.active {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--accent);
}

/* 테마 버튼 — 해와 달 중 하나만 보여줍니다.
   theme.js 가 data-show 를 정해줍니다. 스크립트가 늦게 붙어도 겹쳐 보이지 않게
   기본값은 둘 다 숨김입니다. */
[data-theme-toggle] [data-icon] {
  display: none;
}

[data-theme-toggle][data-show='sun'] [data-icon='sun'],
[data-theme-toggle][data-show='moon'] [data-icon='moon'] {
  display: block;
}

/* ── 본문 ───────────────────────────────────────────── */

.body {
  display: flex;
  height: calc(100% - var(--header-h));
}

/* ── 왼쪽 이동 메뉴 ──────────────────────────────────── */

.nav {
  width: 178px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 10px;
  border-right: 1px solid var(--line);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 550;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text-dim);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 20px;
}

.view[hidden] {
  display: none;
}

/* ── 홈 ──────────────────────────────────────────────── */

#viewHome {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 620px;
  margin: 0 auto;
  padding-top: 24px;
}

/* id 선택자가 .view[hidden] 보다 세서, 숨김 규칙도 id 로 적어줘야 합니다. */
#viewHome[hidden] {
  display: none;
}

.home-greeting {
  text-align: center;
}

.home-portrait {
  width: 68px;
  height: 68px;
  margin: 0 auto 14px;
}

.home-portrait img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.home-greeting h1 {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.4px;
}

.home-sub {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

.home-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.12s, background 0.12s;
}

.home-card:hover {
  background: var(--surface-2);
  border-color: var(--surface-3);
}

.home-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.home-card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.home-card-go {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
}

.home-card-body {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
}

.home-card-empty {
  margin: 0;
  font-size: 13px;
  color: var(--text-faint);
}

.home-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.home-stat .label {
  font-size: 12px;
  color: var(--text-muted);
}

.home-stat .value {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
}

.home-stat.is-up .value {
  color: var(--up);
}

.home-stat.is-down .value {
  color: var(--down);
}

.home-soon {
  padding: 15px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.home-soon h2 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.home-soon p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-faint);
}

/* ═══════════════════════════════════════════════════════
 * 모의투자
 *
 * 오르면 빨강, 내리면 파랑. 국내 관습대로 갑니다.
 * ═══════════════════════════════════════════════════════ */

#viewInvest {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 780px;
  margin: 0 auto;
}

#viewInvest[hidden] {
  display: none;
}

.trade-loading,
.trade-empty,
.trade-note {
  color: var(--text-faint);
  font-size: 13.5px;
  text-align: center;
  padding: 22px 8px;
  margin: 0;
}

.trade-note {
  padding: 6px 8px 0;
  font-size: 12.5px;
}

/* 처음 불러오기 실패 */
.load-error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
}

.load-error strong {
  color: var(--danger);
  font-size: 15px;
}

.load-error p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-dim);
  word-break: break-word;
}

.load-error .hint {
  color: var(--text-muted);
  font-size: 12.5px;
}

.retry-btn {
  margin-top: 4px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
}

.retry-btn:hover {
  background: var(--surface-2);
}

/* ── 자산 요약 ───────────────────────────────────────── */

.account-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.account-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 15px;
  background: var(--surface);
}

.account-cell .label {
  font-size: 12px;
  color: var(--text-muted);
}

.account-cell .value {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
}

.account-cell.is-up .value {
  color: var(--up);
}

.account-cell.is-down .value {
  color: var(--down);
}

/* ── 알림 ────────────────────────────────────────────── */

.trade-message {
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13.5px;
  border: 1px solid;
}

.trade-message.ok {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

.trade-message.bad {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger);
}

/* ── 탭 ──────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.tab {
  flex: 1;
  height: 34px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
}

.tab:hover {
  color: var(--text-dim);
}

.tab.active {
  background: var(--surface-3);
  color: var(--text);
}

/* ── 종목 목록 · 보유 목록 ───────────────────────────── */

.stock-list,
.holdings,
.ranking {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stock-row,
.holding-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 13px 15px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.12s, background 0.12s;
}

.stock-row:hover,
.holding-row:hover {
  background: var(--surface-2);
  border-color: var(--surface-3);
}

.stock-name {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.stock-name strong {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.3px;
}

.stock-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-muted);
}

.held-badge {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-weight: 600;
  font-size: 11px;
}

.stock-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.stock-price strong {
  font-size: 15.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.stock-price .change {
  font-size: 12.5px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.is-up .change,
.is-up .stock-price strong {
  color: var(--up);
}

.is-down .change,
.is-down .stock-price strong {
  color: var(--down);
}

/* ── 거래 내역 ───────────────────────────────────────── */

.section-title {
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.trade-log {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.trade-log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 13px;
  background: var(--surface);
}

.trade-log-row + .trade-log-row {
  border-top: 1px solid var(--line-soft);
}

.trade-log-row .side {
  flex-shrink: 0;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.trade-log-row .side.buy {
  color: var(--up);
  background: color-mix(in srgb, var(--up) 12%, transparent);
}

.trade-log-row .side.sell {
  color: var(--down);
  background: color-mix(in srgb, var(--down) 12%, transparent);
}

.trade-log-row .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-log-row .qty,
.trade-log-row .at {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ── 순위 ────────────────────────────────────────────── */

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.rank-row.is-me {
  border-color: var(--accent);
}

.rank-no {
  width: 22px;
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.rank-row:first-child .rank-no {
  color: var(--accent);
}

.rank-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--surface-2);
}

.rank-who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rank-who strong {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.rank-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.rank-value strong {
  font-size: 14.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.rank-value .change {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.rank-value.is-up strong,
.rank-value.is-up .change {
  color: var(--up);
}

.rank-value.is-down strong,
.rank-value.is-down .change {
  color: var(--down);
}

/* ── 종목 상세 ───────────────────────────────────────── */

.detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.back-btn {
  align-self: flex-start;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--line);
  background: var(--surface);
}

.back-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.detail-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.detail-title h2 {
  margin: 0 0 4px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.detail-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.detail-price strong {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
}

.detail-price .change {
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.detail-head.is-up .detail-price strong,
.detail-head.is-up .detail-price .change {
  color: var(--up);
}

.detail-head.is-down .detail-price strong,
.detail-head.is-down .detail-price .change {
  color: var(--down);
}

/* ── 차트 ────────────────────────────────────────────── */

.range-bar {
  display: flex;
  gap: 4px;
}

.range-btn {
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.range-btn:hover {
  color: var(--text-dim);
  background: var(--surface-2);
}

.range-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.chart-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
  min-height: 180px;
}

.chart {
  display: block;
  width: 100%;
  height: auto;
  touch-action: pan-y;
}

.chart-empty {
  margin: 0;
  padding: 66px 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* 오르면 빨강, 내리면 파랑 */
.chart.is-up {
  --trend: var(--up);
}

.chart.is-down {
  --trend: var(--down);
}

.chart-line {
  fill: none;
  stroke: var(--trend);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-area {
  fill: color-mix(in srgb, var(--trend) 12%, transparent);
  stroke: none;
}

.chart-base {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.chart-peak {
  fill: var(--text-faint);
}

.chart-peak-label,
.chart-time {
  fill: var(--text-faint);
  font-size: 10.5px;
  font-family: inherit;
}

.chart-now {
  fill: var(--trend);
}

.chart-now-label {
  fill: var(--trend);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
}

.chart-hover-line {
  stroke: var(--text-muted);
  stroke-width: 1;
}

.chart-hover-dot {
  fill: var(--trend);
  stroke: var(--surface);
  stroke-width: 2;
}

.chart-readout {
  position: absolute;
  top: 10px;
  left: 12px;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* ── 매매 ────────────────────────────────────────────── */

.trade-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.side-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.side-tab {
  flex: 1;
  height: 32px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text-muted);
}

.side-tab.buy.active {
  color: #fff;
  background: var(--up);
}

.side-tab.sell.active {
  color: #fff;
  background: var(--down);
}

.qty-input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.qty-input:focus {
  outline: none;
  border-color: var(--accent);
}

.quick-bar {
  display: flex;
  gap: 5px;
}

.quick-btn {
  flex: 1;
  height: 30px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.quick-btn:hover:not(:disabled) {
  background: var(--surface-3);
}

.quick-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.trade-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 20px;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.trade-summary strong {
  color: var(--text);
  font-weight: 650;
}

.trade-summary .hint,
.trade-summary .fee {
  color: var(--text-faint);
  font-size: 12.5px;
}

.submit-btn {
  height: 46px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  transition: filter 0.12s;
}

.submit-btn.buy {
  background: var(--up);
}

.submit-btn.sell {
  background: var(--down);
}

.submit-btn:hover:not(:disabled) {
  filter: brightness(1.07);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

@media (max-width: 560px) {
  .account-bar {
    grid-template-columns: 1fr 1fr;
  }

  .account-cell:first-child {
    grid-column: span 2;
  }
}

/* ── 오른쪽 명단 ─────────────────────────────────────── */

.members {
  width: var(--panel-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
}

.members[hidden] {
  display: none;
}

.members-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.members-group + .members-group {
  margin-top: 18px;
}

.members-group h2 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 6px;
  padding: 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: -0.1px;
}

.members-group h2 .count {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
}

.members-group.is-online-group h2 {
  color: var(--accent);
}

.members-group.is-online-group h2 .count {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

.member {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 44px;
  padding: 0 8px;
  border-radius: 8px;
  cursor: default;
  transition: background 0.1s;
}

.member:hover {
  background: var(--surface-2);
}

.member .avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.member .avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
  background: var(--surface-2);
  transition: filter 0.2s, opacity 0.2s;
}

/* 접속중 — 강조색 테두리 한 줄 */
.member.is-online .avatar img {
  border: 2px solid var(--accent);
}

/* 오프라인 — 색이 빠지고 흐려집니다 */
.member.is-offline .avatar img {
  filter: grayscale(1);
  opacity: 0.45;
}

.member.is-offline:hover .avatar img {
  opacity: 0.7;
}

.member .name {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member.is-offline .name {
  color: var(--text-faint);
}

.member.is-me .name::after {
  content: '나';
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  vertical-align: 1.5px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
}

.members-empty {
  padding: 10px 8px;
  font-size: 13px;
  color: var(--text-faint);
}

/* ── 하단 내 정보 ────────────────────────────────────── */

.me-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.me-bar img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
}

.me-bar .name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.me-bar button {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-faint);
  padding: 5px 9px;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}

.me-bar button:hover {
  background: var(--surface-2);
  color: var(--text-dim);
}

/* ── 로그인 화면 ─────────────────────────────────────── */

.login-page {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 36px 28px;
  text-align: center;
}

.login-card .logo {
  justify-content: center;
  font-size: 25px;
  margin-bottom: 24px;
}

.login-card .logo .mark {
  width: 25px;
  height: 25px;
}

.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 44px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 650;
  font-size: 14.5px;
  text-decoration: none;
  transition: filter 0.12s;
}

.login-btn:hover {
  filter: brightness(1.06);
}

.login-error {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  color: var(--danger);
  font-size: 13px;
  text-align: left;
}

/* ── 좁은 화면 ───────────────────────────────────────── */

@media (max-width: 640px) {
  .members {
    position: fixed;
    top: var(--header-h);
    right: 0;
    bottom: 0;
    z-index: 20;
    border-left: 1px solid var(--line);
  }

  /* 좁은 화면에서는 접속 인원 알약을 숨깁니다. 머리줄이 두 줄로 깨지거든요.
     인원수는 명단을 열면 보입니다. */
  .online-pill {
    display: none;
  }
}

/* 좁은 화면에서는 왼쪽 메뉴를 위쪽 가로줄로 눕힙니다. */
@media (max-width: 760px) {
  .body {
    flex-direction: column;
  }

  .nav {
    width: auto;
    flex-direction: row;
    gap: 4px;
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }

  .nav-item {
    flex-shrink: 0;
    height: 34px;
  }

  .main {
    padding: 14px;
  }
}

/* ═══════════════════════════════════════════════════════
 * 라임 스킨 — #E8F48C
 *
 * 머리쪽 동그란 버튼으로 올리브와 번갈아 바꿉니다.
 *
 * #E8F48C 는 아주 밝은 색이라 흰 배경 위 글자로 쓰면 대비가 1.2:1 밖에
 * 안 나옵니다. 사실상 안 보입니다. 그래서 두 갈래로 나눠 씁니다.
 *   - 칠하는 자리(알약, 버튼, 뱃지)  → 지정하신 #E8F48C 그대로
 *   - 글자·테두리                    → 라이트에서는 어둡게 낮춘 같은 색조
 * 어두운 화면에서는 글자에도 #E8F48C 를 그대로 씁니다. 대비 16:1 로 넉넉합니다.
 * ═══════════════════════════════════════════════════════ */

:root[data-skin='lime'] {
  --accent: light-dark(#616e0b, #e8f48c);
  --accent-text: light-dark(#ffffff, #232806);
  --accent-soft: light-dark(#f6fadb, #262c10);
  --accent-line: light-dark(#e2ecab, #47521d);

  /* 지정하신 색 그대로. 라이트든 다크든 같습니다. */
  --accent-fill: #e8f48c;
  --on-fill: #262c08;
}

/* 색을 그대로 보여주는 자리들 */

:root[data-skin='lime'] .online-pill {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--on-fill);
}

:root[data-skin='lime'] .online-pill .dot {
  background: var(--on-fill);
}

:root[data-skin='lime'] .login-btn {
  background: var(--accent-fill);
  color: var(--on-fill);
}

:root[data-skin='lime'] .member.is-me .name::after {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--on-fill);
}

/* ── 스킨 버튼 ───────────────────────────────────────── */

/* 누르면 바뀔 색을 미리 보여줍니다. */
.icon-btn[data-skin-toggle] .swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(128, 128, 128, 0.35);
}

.icon-btn[data-skin-toggle][data-skin='basic'] .swatch {
  background: #e8f48c;
}

.icon-btn[data-skin-toggle][data-skin='lime'] .swatch {
  background: #636b2f;
}

/* 로그인 화면 오른쪽 위 버튼들 */
.corner-buttons {
  position: fixed;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 4px;
}
