/* 오르베 ORVÉ — 테마: 앰버 페이퍼(기본) · 포슬린 블루 · 로즈우드 · 그래파이트 · 클래식 보라, 각각 라이트·다크 */
:root { --bg: #fbf8f2; --panel: #fffdf8; --panel-2: #f3ecdf; --rail: #f1e8d8; --text: #2b2116; --muted: #74614c; --line: #e8dcc8; --accent: #99590f; --accent-text: #ffffff; --accent-soft: #f6e3c4; --chip-bg: #f8d9a8; --chip-text: #7f4a0e; --mention-bg: #fbeccf; --mention-line: #d99a3d; --mine: #f6ead6; --system: #f1e9da; --ok: #4b7536; --danger: #b8322a; --shadow: 0 8px 30px rgba(0, 0, 0, .14); color-scheme: light; --radius: 10px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #1e1912; --panel: #241e16; --panel-2: #2f271d; --rail: #17130d; --text: #f6ecdc; --muted: #b9a587; --line: #3a3024; --accent: #efbb6a; --accent-text: #2a1d0c; --accent-soft: #4a3820; --chip-bg: #8a6431; --chip-text: #fff3df; --mention-bg: #3d3020; --mention-line: #efbb6a; --mine: #3a2e1f; --system: #2a2219; --ok: #8fbf6f; --danger: #ef6a5a; --shadow: 0 8px 30px rgba(0, 0, 0, .45); color-scheme: dark; } }
:root[data-theme="dark"] { --bg: #1e1912; --panel: #241e16; --panel-2: #2f271d; --rail: #17130d; --text: #f6ecdc; --muted: #b9a587; --line: #3a3024; --accent: #efbb6a; --accent-text: #2a1d0c; --accent-soft: #4a3820; --chip-bg: #8a6431; --chip-text: #fff3df; --mention-bg: #3d3020; --mention-line: #efbb6a; --mine: #3a2e1f; --system: #2a2219; --ok: #8fbf6f; --danger: #ef6a5a; --shadow: 0 8px 30px rgba(0, 0, 0, .45); color-scheme: dark; }
:root[data-palette="porcelain"] { --bg: #f7f9fe; --panel: #ffffff; --panel-2: #ecf1fb; --rail: #e6ecf8; --text: #18213a; --muted: #5c6885; --line: #dbe3f2; --accent: #2150d0; --accent-text: #ffffff; --accent-soft: #dde6fc; --chip-bg: #d9e4fd; --chip-text: #1f45b0; --mention-bg: #e9effd; --mention-line: #4f7af0; --mine: #e6edfc; --system: #ecf0f9; --ok: #2b8152; --danger: #c9343a; --shadow: 0 8px 30px rgba(0, 0, 0, .14); color-scheme: light; }
@media (prefers-color-scheme: dark) { :root[data-palette="porcelain"]:not([data-theme="light"]) { --bg: #121a30; --panel: #17203a; --panel-2: #1f2a48; --rail: #0e1527; --text: #e8edfb; --muted: #9aa6c6; --line: #2a3658; --accent: #8aa4f5; --accent-text: #0f1730; --accent-soft: #2a3a6e; --chip-bg: #3a4d8c; --chip-text: #eef2ff; --mention-bg: #23305a; --mention-line: #8aa4f5; --mine: #22305a; --system: #1b2440; --ok: #5cc28a; --danger: #f07272; --shadow: 0 8px 30px rgba(0, 0, 0, .45); color-scheme: dark; } }
:root[data-palette="porcelain"][data-theme="dark"] { --bg: #121a30; --panel: #17203a; --panel-2: #1f2a48; --rail: #0e1527; --text: #e8edfb; --muted: #9aa6c6; --line: #2a3658; --accent: #8aa4f5; --accent-text: #0f1730; --accent-soft: #2a3a6e; --chip-bg: #3a4d8c; --chip-text: #eef2ff; --mention-bg: #23305a; --mention-line: #8aa4f5; --mine: #22305a; --system: #1b2440; --ok: #5cc28a; --danger: #f07272; --shadow: 0 8px 30px rgba(0, 0, 0, .45); color-scheme: dark; }
:root[data-palette="rosewood"] { --bg: #fcf7f8; --panel: #fffcfc; --panel-2: #f5eaed; --rail: #f2e4e8; --text: #2d1a21; --muted: #7f606a; --line: #ecdbe0; --accent: #8e3550; --accent-text: #ffffff; --accent-soft: #f6dbe3; --chip-bg: #f6d3dd; --chip-text: #842f49; --mention-bg: #fbeaef; --mention-line: #c45a7a; --mine: #f7e6eb; --system: #f3e7ea; --ok: #3b7650; --danger: #c02c38; --shadow: 0 8px 30px rgba(0, 0, 0, .14); color-scheme: light; }
@media (prefers-color-scheme: dark) { :root[data-palette="rosewood"]:not([data-theme="light"]) { --bg: #211a1e; --panel: #281f24; --panel-2: #33282e; --rail: #1a1417; --text: #f6e9ee; --muted: #bba2ac; --line: #3d2f36; --accent: #ec9ab0; --accent-text: #2a1219; --accent-soft: #4d2c38; --chip-bg: #86475b; --chip-text: #ffeef3; --mention-bg: #3e2731; --mention-line: #ec9ab0; --mine: #3b2730; --system: #2b2227; --ok: #8fc49a; --danger: #f07272; --shadow: 0 8px 30px rgba(0, 0, 0, .45); color-scheme: dark; } }
:root[data-palette="rosewood"][data-theme="dark"] { --bg: #211a1e; --panel: #281f24; --panel-2: #33282e; --rail: #1a1417; --text: #f6e9ee; --muted: #bba2ac; --line: #3d2f36; --accent: #ec9ab0; --accent-text: #2a1219; --accent-soft: #4d2c38; --chip-bg: #86475b; --chip-text: #ffeef3; --mention-bg: #3e2731; --mention-line: #ec9ab0; --mine: #3b2730; --system: #2b2227; --ok: #8fc49a; --danger: #f07272; --shadow: 0 8px 30px rgba(0, 0, 0, .45); color-scheme: dark; }
:root[data-palette="graphite"] { --bg: #f6f6f7; --panel: #ffffff; --panel-2: #ececee; --rail: #e7e7e9; --text: #18181a; --muted: #64646a; --line: #dedee1; --accent: #232326; --accent-text: #ffffff; --accent-soft: #e2e2e5; --chip-bg: #e3e3e6; --chip-text: #232326; --mention-bg: #efeff1; --mention-line: #6b6b70; --mine: #ececee; --system: #ececee; --ok: #287a4c; --danger: #c43333; --shadow: 0 8px 30px rgba(0, 0, 0, .14); color-scheme: light; }
@media (prefers-color-scheme: dark) { :root[data-palette="graphite"]:not([data-theme="light"]) { --bg: #1b1c1e; --panel: #212225; --panel-2: #2b2c30; --rail: #151618; --text: #ededee; --muted: #a0a1a6; --line: #35363a; --accent: #ececed; --accent-text: #18181a; --accent-soft: #3a3b40; --chip-bg: #4a4b50; --chip-text: #f4f4f5; --mention-bg: #2f3034; --mention-line: #c9c9cc; --mine: #2e2f33; --system: #26272a; --ok: #6cc28f; --danger: #f07272; --shadow: 0 8px 30px rgba(0, 0, 0, .45); color-scheme: dark; } }
:root[data-palette="graphite"][data-theme="dark"] { --bg: #1b1c1e; --panel: #212225; --panel-2: #2b2c30; --rail: #151618; --text: #ededee; --muted: #a0a1a6; --line: #35363a; --accent: #ececed; --accent-text: #18181a; --accent-soft: #3a3b40; --chip-bg: #4a4b50; --chip-text: #f4f4f5; --mention-bg: #2f3034; --mention-line: #c9c9cc; --mine: #2e2f33; --system: #26272a; --ok: #6cc28f; --danger: #f07272; --shadow: 0 8px 30px rgba(0, 0, 0, .45); color-scheme: dark; }
/* 클래식 보라 (예전 테마) */
:root[data-palette="classic"] { --bg: #f4f4f7; --panel: #ffffff; --panel-2: #ebebf0; --rail: #e2e2ea; --text: #1c1c22; --muted: #62626e; --line: #dcdce3; --accent: #5b5bd6; --accent-text: #ffffff; --accent-soft: #e6e6fb; --chip-bg: #e3e3fb; --chip-text: #4747c2; --mention-bg: #fff4d6; --mention-line: #e0a400; --mine: #e6e6fb; --system: #f0f0f4; --ok: #1f7844; --danger: #c43030; --shadow: 0 8px 30px rgba(0, 0, 0, .14); color-scheme: light; }
@media (prefers-color-scheme: dark) { :root[data-palette="classic"]:not([data-theme="light"]) { --bg: #17171c; --panel: #1f1f26; --panel-2: #2a2a33; --rail: #121216; --text: #ececf1; --muted: #9a9aa8; --line: #34343f; --accent: #8a8af5; --accent-text: #13132a; --accent-soft: #2d2d52; --chip-bg: #3a3a78; --chip-text: #eeeeff; --mention-bg: #3a3220; --mention-line: #e0a400; --mine: #2d2d52; --system: #26262e; --ok: #4cc27f; --danger: #f06363; --shadow: 0 8px 30px rgba(0, 0, 0, .45); color-scheme: dark; } }
:root[data-palette="classic"][data-theme="dark"] { --bg: #17171c; --panel: #1f1f26; --panel-2: #2a2a33; --rail: #121216; --text: #ececf1; --muted: #9a9aa8; --line: #34343f; --accent: #8a8af5; --accent-text: #13132a; --accent-soft: #2d2d52; --chip-bg: #3a3a78; --chip-text: #eeeeff; --mention-bg: #3a3220; --mention-line: #e0a400; --mine: #2d2d52; --system: #26262e; --ok: #4cc27f; --danger: #f06363; --shadow: 0 8px 30px rgba(0, 0, 0, .45); color-scheme: dark; }
.theme-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.theme-opt { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); cursor: pointer; font: inherit; }
.theme-opt.on { border-color: var(--accent); }
.theme-opt .sw { display: flex; }
.theme-opt .sw i { width: 14px; height: 14px; border-radius: 50%; margin-left: -4px; border: 1px solid rgba(0,0,0,.15); }
.theme-opt .sw i:first-child { margin-left: 0; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
#root { height: 100%; }
.splash { display: grid; place-items: center; height: 100%; color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.danger { color: var(--danger); }

/* 버튼·입력 */
.btn {
  border: 0; border-radius: 8px; padding: 9px 14px; background: var(--accent); color: var(--accent-text);
  font-weight: 600;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--panel-2); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.icon-btn {
  border: 0; background: transparent; width: 36px; height: 36px; border-radius: 8px; display: inline-grid;
  place-items: center; color: var(--muted); font-size: 18px; flex: none;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.input, textarea.input, select.input {
  width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 10px 12px; outline: none;
}
.input:focus { border-color: var(--accent); }
.error-text { color: var(--danger); font-size: 14px; min-height: 20px; margin: 4px 0 8px; }

/* 로그인 화면 */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; overflow: auto; height: 100%; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border-radius: 14px; padding: 28px 24px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-card p { margin: 0 0 20px; }
.tabs { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 7px; font-weight: 600; color: var(--muted); }
.tabs button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.auth-card .btn { width: 100%; padding: 11px; }

/* 전체 배치: 왼쪽 띠(커뮤니티) | 목록 | 대화 */
.layout { display: grid; grid-template-columns: 72px 260px 1fr; height: 100%; }
.rail {
  background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0;
  overflow-y: auto; padding-top: max(12px, env(safe-area-inset-top));
}
.rail-item {
  width: 48px; height: 48px; border-radius: 16px; border: 0; background: var(--panel); color: var(--text);
  font-weight: 700; font-size: 16px; display: grid; place-items: center; flex: none; position: relative;
  transition: border-radius .15s;
}
.rail-item:hover, .rail-item.on { border-radius: 12px; background: var(--accent); color: var(--accent-text); }
.rail-item.add { color: var(--ok); font-size: 24px; font-weight: 400; }
.rail-item.add:hover { background: var(--ok); color: #fff; }
.rail-sep { width: 32px; height: 2px; background: var(--line); border-radius: 1px; flex: none; }

.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.sidebar-head {
  height: 52px; display: flex; align-items: center; gap: 6px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line);
  font-weight: 700; flex: none;
}
.sidebar-head .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-body { flex: 1; overflow-y: auto; padding: 8px; }
.cat {
  display: flex; align-items: center; gap: 4px; width: 100%; border: 0; background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 700; padding: 12px 6px 4px; text-transform: uppercase; letter-spacing: .02em; text-align: left;
}
.cat .arrow { display: inline-block; transition: transform .15s; font-size: 10px; }
.cat.closed .arrow { transform: rotate(-90deg); }
.item {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 7px 10px;
  border-radius: 7px; color: var(--muted); text-align: left; min-height: 36px;
}
.item:hover { background: var(--panel-2); color: var(--text); }
.item.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.item.on .name, .item.on .ico { color: inherit; }
.item.on .muted, .item.on .small, .item.on .game-count { color: inherit; opacity: .85; }
.item .hash { opacity: .7; font-weight: 700; width: 16px; text-align: center; flex: none; }
.item .grow { flex: 1; min-width: 0; }
.item .name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.item .preview { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  color: #fff; flex: none; position: relative; user-select: none;
}
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--panel); background: var(--muted); }
.dot.on { background: var(--ok); }
.me-bar {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 8px; border-top: 1px solid var(--line); background: var(--panel-2);
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.me-bar .grow { flex: 1; min-width: 0; }
.me-bar .name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-list { padding: 24px 12px; text-align: center; color: var(--muted); font-size: 14px; }

/* 대화 화면 */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); height: 100%; }
.chat-head {
  height: 52px; display: flex; align-items: center; gap: 6px; padding: 0 8px 0 12px; border-bottom: 1px solid var(--line);
  background: var(--panel); flex: none;
}
.chat-head .title { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { display: none; }
.banner { background: #f3b33d; color: #2a1d00; text-align: center; font-size: 13px; padding: 4px 8px; flex: none; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 0 8px; overscroll-behavior: contain; }
.load-more { display: block; margin: 4px auto 12px; }
.day { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 16px 6px; }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { display: grid; grid-template-columns: 40px 1fr; gap: 0 10px; padding: 2px 16px; position: relative; }
.msg:hover { background: color-mix(in srgb, var(--panel-2) 50%, transparent); }
.msg.first { margin-top: 10px; }
.msg .avatar-col { grid-row: span 2; }
.msg:not(.first) .avatar-col { visibility: hidden; height: 0; }
.msg-head { display: flex; gap: 8px; align-items: baseline; }
.msg-head .author { font-weight: 700; }
.msg-head time, .msg .side-time { color: var(--muted); font-size: 12px; }
.msg .body { grid-column: 2; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.msg .body .edited { color: var(--muted); font-size: 12px; margin-left: 4px; }
.msg .body.deleted { color: var(--muted); font-style: italic; }
.msg.pending .body { opacity: .55; }
.msg.failed .body { color: var(--danger); }
.msg .retry { grid-column: 2; font-size: 13px; }
.msg .actions {
  position: absolute; right: 16px; top: -10px; display: none; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.1); padding: 2px;
}
.msg:hover .actions, .msg.show-actions .actions { display: flex; }
.msg .actions button { border: 0; background: transparent; padding: 4px 8px; border-radius: 6px; font-size: 13px; }
.msg .actions button:hover { background: var(--panel-2); }
.msg.system { display: block; text-align: center; padding: 6px 16px; }
.msg.system .pill { display: inline-block; background: var(--system); color: var(--muted); padding: 3px 12px; border-radius: 12px; font-size: 13px; }
.atts { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.atts img { max-width: min(320px, 100%); max-height: 320px; border-radius: 8px; display: block; background: var(--panel-2); cursor: zoom-in; }
.file-card {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); text-decoration: none; color: var(--text); max-width: 320px;
}
.file-card .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-box { grid-column: 2; display: grid; gap: 6px; }
.edit-box .row { display: flex; gap: 6px; }

.composer { flex: none; padding: 8px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--bg); }
.composer-box { display: flex; align-items: flex-end; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.composer textarea {
  flex: 1; border: 0; outline: none; resize: none; background: transparent; padding: 8px 6px; max-height: 160px; min-height: 38px;
  line-height: 1.4;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip { display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px 4px 4px 10px; font-size: 13px; max-width: 240px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: 0; background: transparent; color: var(--muted); padding: 0 6px; }
.welcome { flex: 1; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }
.welcome h2 { color: var(--text); margin: 0 0 6px; }

/* 창(모달) */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal {
  background: var(--panel); border-radius: 14px; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex;
  flex-direction: column; box-shadow: var(--shadow);
}
.modal.wide { max-width: 640px; }
.modal.wide:has(.bluemap-frame) { max-width: min(1100px, 96vw); }
.modal-head { display: flex; align-items: center; padding: 14px 14px 10px 20px; font-weight: 700; font-size: 17px; }
.modal-head .title { flex: 1; }
.modal-body { padding: 4px 20px 16px; overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.section { margin: 6px 0 18px; }
.section h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: 0 0 8px; }
.list { display: grid; gap: 2px; }
.row-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; }
.row-item:hover { background: var(--panel-2); }
.row-item .grow { flex: 1; min-width: 0; }
.row-item label { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; min-width: 0; }
.doc { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 8px; }
.doc .doc-title { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.doc .doc-body { font-size: 14px; color: var(--muted); margin: 6px 0 8px; white-space: pre-wrap; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--panel-2); color: var(--muted); font-weight: 600; }
.tag.req { background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.code-box { font: 700 28px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .15em; text-align: center; padding: 16px; background: var(--panel-2); border-radius: 10px; margin: 8px 0; user-select: all; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
.inline-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline-form .input { flex: 1; min-width: 120px; width: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl td, table.tbl th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.tbl th { color: var(--muted); font-size: 12px; font-weight: 600; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text);
  color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 100; font-size: 14px; max-width: calc(100% - 32px); box-shadow: var(--shadow);
}
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 60; cursor: zoom-out; }
.viewer img { max-width: 96vw; max-height: 92vh; }

/* ===== 2단계: 안 읽음·태그·답장·투표·고정·관리 ===== */
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--muted); color: #fff; font-size: 11px;
  font-weight: 700; display: inline-grid; place-items: center; line-height: 1; flex: none;
}
.badge.mention { background: var(--danger); }
.rail-item .badge { position: absolute; right: -4px; bottom: -4px; border: 3px solid var(--rail); height: 22px; min-width: 22px; border-radius: 11px; }
.rail-item.has-unread::before {
  content: ""; position: absolute; left: -12px; top: 50%; width: 6px; height: 8px; margin-top: -4px; border-radius: 0 4px 4px 0; background: var(--text);
}
.item.unread .name { font-weight: 700; }
.item.unread { color: var(--text); }
.item.muted-ch { opacity: .55; }
.item .side { display: grid; justify-items: end; gap: 3px; flex: none; }
.title-btn { border: 0; background: transparent; text-align: left; font-weight: 700; padding: 6px 0; cursor: pointer; }
.notice { display: block; width: 100%; border: 0; text-align: left; background: var(--accent-soft); color: var(--text); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.notice.warn { background: color-mix(in srgb, #f3b33d 25%, transparent); }
.notice-box { background: var(--panel-2); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
.chat-head .title { display: grid; min-width: 0; }
.chat-head .title-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .topic { font-size: 12px; color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .tag { margin-left: 6px; vertical-align: middle; }
.mention { background: var(--chip-bg); color: var(--chip-text); border-radius: 6px; padding: 0 4px; font-weight: 600; }
.mention.me { background: color-mix(in srgb, var(--mention-line) 30%, transparent); color: inherit; }
.msg.mentioned { background: var(--mention-bg); box-shadow: inset 3px 0 0 var(--mention-line); }
.msg.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--accent) 25%, transparent); } 100% { background: transparent; } }
.reply-quote {
  grid-column: 2; display: flex; gap: 6px; align-items: center; border: 0; background: transparent; padding: 0; color: var(--muted);
  font-size: 13px; text-align: left; min-width: 0; margin-top: 2px;
}
.reply-quote .arrow { opacity: .7; }
.reply-quote b { color: var(--text); flex: none; }
.reply-quote .q { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-quote:hover .q { color: var(--text); }
.pin-mark { font-size: 12px; }
.pin-mark.line { grid-column: 2; color: var(--muted); }
.unread-by { grid-column: 2; color: #d68a1f; font-size: 11px; font-weight: 700; }
.unread-divider { display: flex; align-items: center; gap: 8px; color: var(--danger); font-size: 12px; font-weight: 700; margin: 10px 16px 0; }
.unread-divider::before, .unread-divider::after { content: ""; flex: 1; height: 1px; background: var(--danger); }
.reply-bar {
  display: flex; align-items: center; gap: 6px; background: var(--panel-2); border-radius: 10px 10px 0 0; padding: 2px 4px 2px 12px;
  font-size: 13px; margin-bottom: -4px; min-width: 0;
}
.reply-bar .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer { position: relative; }
.composer-blocked { background: var(--panel-2); color: var(--muted); border-radius: 12px; padding: 12px 14px; font-size: 14px; text-align: center; }
.mention-pop {
  position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 4px; max-height: 280px; overflow-y: auto; z-index: 5;
}
.mention-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 6px 8px; border-radius: 6px; text-align: left; }
.mention-item.on, .mention-item:hover { background: var(--accent-soft); }
.mention-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poll { grid-column: 2; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 12px; margin-top: 4px; max-width: 440px; display: grid; gap: 6px; }
.poll-q { font-weight: 700; }
.poll-opt {
  position: relative; overflow: hidden; display: flex; justify-content: space-between; gap: 8px; border: 1px solid var(--line);
  background: var(--bg); border-radius: 8px; padding: 8px 10px; text-align: left; min-height: 38px; align-items: center;
}
.poll-opt:disabled { cursor: default; }
.poll-opt.on { border-color: var(--accent); }
.poll-opt .bar { position: absolute; inset: 0 auto 0 0; background: var(--accent-soft); transition: width .3s; }
.poll-opt .label, .poll-opt .pct { position: relative; }
.poll-opt .pct { color: var(--muted); font-size: 12px; white-space: nowrap; }
.poll-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.poll-inputs { display: grid; gap: 6px; }
.check { display: flex; align-items: center; gap: 6px; padding: 4px 0; cursor: pointer; font-size: 14px; }
.check input { width: 16px; height: 16px; flex: none; }
.menu-list { display: grid; gap: 2px; }
.menu-item { border: 0; background: transparent; text-align: left; padding: 10px 12px; border-radius: 8px; font-size: 15px; }
.menu-item:hover, .menu-item.on { background: var(--panel-2); }
.menu-item.danger { color: var(--danger); }
.menu-block { padding: 8px 12px; }
.menu-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; margin: 12px 0 6px; }
.seg { display: flex; gap: 4px; background: var(--panel-2); padding: 3px; border-radius: 8px; flex-wrap: wrap; }
.seg button { flex: 1; border: 0; background: transparent; padding: 6px 8px; border-radius: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.rules-text { white-space: pre-wrap; background: var(--panel-2); border-radius: 10px; padding: 12px 14px; line-height: 1.6; }
.pin-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 6px; justify-items: start; }
.pin-item .body { white-space: pre-wrap; word-break: break-word; }
.roles-layout { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; }
.role-list { display: grid; gap: 2px; }
.role-item { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 7px 8px; border-radius: 7px; text-align: left; min-width: 0; }
.role-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-item.on, .role-item:hover { background: var(--panel-2); }
.role-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.role-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.role-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; background: var(--panel-2); border-radius: 6px; padding: 1px 6px; }
.role-chip.warn { background: color-mix(in srgb, #f3b33d 25%, transparent); }
.member-row { border-bottom: 1px solid var(--line); padding: 4px 0 8px; }
.member-actions { padding-left: 46px; }
.small-select { width: auto !important; flex: none !important; min-width: 0 !important; padding: 5px 8px; font-size: 13px; }
.perm-groups { display: grid; gap: 4px; }
.perm.danger { color: var(--danger); }
.color-input { width: 44px; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--panel); flex: none; }
.tri-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.tri-row .grow { flex: 1; }
.tri-group { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; }
.tri { border: 0; background: var(--panel); width: 34px; height: 30px; font-weight: 700; color: var(--muted); }
.tri + .tri { border-left: 1px solid var(--line); }
.tri.deny.on { background: var(--danger); color: #fff; }
.tri.inherit.on { background: var(--panel-2); color: var(--text); }
.tri.allow.on { background: var(--ok); color: #fff; }
.input.time { width: auto; flex: none; }
.modal .tabs { margin-bottom: 14px; flex-wrap: wrap; }
.toast.notify { border: 0; text-align: left; display: grid; gap: 2px; cursor: pointer; min-width: 240px; background: var(--panel); color: var(--text); border-left: 4px solid var(--accent); }
.toast.notify.mention { border-left-color: var(--mention-line); }
.toast.notify .n-title { font-weight: 700; font-size: 13px; }
.toast.notify .n-body { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70vw; }
.audit .grow { font-size: 14px; }

/* 휴대폰: 목록과 대화를 한 화면씩 */
@media (max-width: 760px) {
  .layout { grid-template-columns: 64px 1fr; }
  .rail-item { width: 44px; height: 44px; }
  .chat { position: fixed; inset: 0; z-index: 10; transform: translateX(100%); transition: transform .2s ease; }
  .layout.show-chat .chat { transform: none; }
  .back { display: inline-grid; }
  .chat-head { padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); }
  .msg .actions { right: 8px; }
  .msg { padding: 2px 12px; }
  .roles-layout { grid-template-columns: 1fr; }
  .member-actions { padding-left: 0; }
  .msg .actions { flex-wrap: wrap; max-width: calc(100% - 24px); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ================= 3단계: 피드 ================= */
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.add { background: var(--panel-2); color: var(--accent); font-size: 26px; font-weight: 400; }
.layout.feed-mode { grid-template-columns: 72px 1fr; }
.layout.feed-mode .sidebar { display: none; }
.feed-head { gap: 8px; }
.feed-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.feed-col { max-width: 520px; margin: 0 auto; padding: 12px 12px 40px; }
.feed-tabs { margin-bottom: 12px; }
.feed-more { text-align: center; padding: 12px; }
.link-btn { border: 0; background: transparent; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.link-btn.muted { color: var(--muted); font-weight: 400; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }

.stories-row { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.stories-row::-webkit-scrollbar { display: none; }
.story-bubble { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; width: 70px; position: relative; color: var(--text); padding: 0; }
.story-bubble .ring { padding: 3px; border-radius: 50%; background: linear-gradient(45deg, #f5a623, #e2336b, #8f3fd6); }
.story-bubble .ring.seen { background: var(--line); }
.story-bubble .ring.none { background: transparent; }
.story-bubble .ring .avatar { border: 2px solid var(--bg); }
.story-bubble .plus { position: absolute; right: 6px; top: 40px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 15px; line-height: 16px; border: 2px solid var(--bg); }
.story-bubble .label { font-size: 12px; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.profile-head { display: flex; align-items: center; gap: 14px; padding: 4px 4px 16px; }
.profile-head .name { font-size: 18px; font-weight: 700; }

.post { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; overflow: hidden; }
.post-head { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 12px; min-height: 48px; }
.author-btn { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 0; color: var(--text); font: inherit; cursor: pointer; }
.post-media-wrap { position: relative; background: #000; }
.post-media { display: block; width: 100%; max-height: 75vh; object-fit: contain; background: #000; }
img.post-media { cursor: zoom-in; }
.carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.carousel .slide { flex: 0 0 100%; scroll-snap-align: center; display: grid; place-items: center; }
.carousel .post-media { aspect-ratio: auto !important; height: min(75vh, 520px); }
.count-pill { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.nav-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(255,255,255,.85); color: #222; font-size: 20px; line-height: 1; display: grid; place-items: center; }
.nav-btn.prev { left: 8px; }
.nav-btn.next { right: 8px; }
.dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; pointer-events: none; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.5); }
.dots span.on { background: #fff; }
.media-wait { min-height: 220px; display: grid; place-items: center; align-content: center; gap: 8px; color: #ddd; background: #111; text-align: center; padding: 24px; font-size: 14px; }
.media-wait.failed { color: #ffa0b4; }
.spinner { width: 28px; height: 28px; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.post-actions { display: flex; align-items: center; gap: 2px; padding: 4px 6px 0; }
.post-actions .icon-btn { font-size: 22px; width: 40px; height: 40px; text-decoration: none; }
.post-actions .like.on { animation: pop .25s ease; }
@keyframes pop { 50% { transform: scale(1.25); } }
.likes { display: block; padding: 0 12px; color: var(--text); font-size: 14px; }
.post-body { padding: 4px 12px 10px; font-size: 14px; display: grid; gap: 4px; overflow-wrap: anywhere; }
.caption { display: inline; white-space: pre-wrap; }
.caption.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.comment-line { white-space: pre-wrap; }
.comment-form { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line); margin: 6px -12px -10px; padding: 4px 12px; }
.comment-form .link-btn { white-space: nowrap; flex: none; }
.comment-input { border: 0 !important; background: transparent !important; padding: 8px 0 !important; box-shadow: none !important; }
.post-detail .post-media { max-height: 50vh; }
.post-detail .post-body { padding: 10px 0; border-bottom: 1px solid var(--line); }
.comments-list { max-height: 40vh; overflow-y: auto; padding-top: 8px; }
.comment { display: flex; gap: 10px; padding: 6px 0; align-items: flex-start; font-size: 14px; }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; }

.compose-post textarea { margin-top: 12px; }
.upload-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.upload-item, .upload-add { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.upload-item img, .upload-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload-add { border: 2px dashed var(--line); color: var(--muted); display: grid; place-items: center; align-content: center; font-size: 13px; cursor: pointer; }
.up-bar { position: absolute; left: 0; right: 0; bottom: 22px; height: 4px; background: rgba(0,0,0,.35); }
.up-bar > div { height: 100%; background: var(--accent); transition: width .2s; }
.up-status { position: absolute; left: 0; right: 0; bottom: 0; height: 22px; display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 0 6px; font-size: 11px; background: rgba(0,0,0,.6); color: #fff; white-space: nowrap; overflow: hidden; }
.up-status .muted { color: #ccc; }
.up-status .err { color: #ff9a9a; overflow: hidden; text-overflow: ellipsis; }
.up-remove { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; }

.story-viewer { position: fixed; inset: 0; z-index: 70; background: #000; display: grid; place-items: center; }
.story-frame { position: relative; width: min(100vw, calc(100vh * 9 / 16)); height: 100%; max-height: 100vh; background: #111; overflow: hidden; color: #fff; }
.story-stage { position: absolute; inset: 0; display: grid; place-items: center; }
.story-stage img, .story-stage video { width: 100%; height: 100%; object-fit: contain; }
.story-bars { position: absolute; top: calc(8px + env(safe-area-inset-top)); left: 8px; right: 8px; display: flex; gap: 3px; z-index: 3; }
.sbar { flex: 1; height: 3px; background: rgba(255,255,255,.35); border-radius: 2px; overflow: hidden; }
.sbar .fill { height: 100%; background: #fff; }
.story-head { position: absolute; top: calc(18px + env(safe-area-inset-top)); left: 8px; right: 4px; display: flex; align-items: center; gap: 8px; z-index: 3; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.story-head .icon-btn { color: #fff; }
.story-foot { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); left: 12px; right: 12px; z-index: 3; display: grid; gap: 8px; justify-items: center; text-align: center; }
.story-caption { background: rgba(0,0,0,.5); padding: 6px 12px; border-radius: 10px; }
.story-frame .tap { position: absolute; top: 70px; bottom: 80px; width: 35%; border: 0; background: transparent; z-index: 2; }
.story-frame .tap.prev { left: 0; }
.story-frame .tap.next { right: 0; width: 65%; }

@media (max-width: 760px) {
  .layout.feed-mode { grid-template-columns: 64px 1fr; }
  .layout.feed-mode .chat { position: static; transform: none; }
  .feed-col { padding: 8px 0 40px; }
  .post { border-radius: 0; border-left: 0; border-right: 0; }
  .feed-tabs, .stories-row, .profile-head { margin-left: 8px; margin-right: 8px; }
  .nav-btn { display: none; }
}
.post-head .grow, .post-actions .grow, .story-head .grow { flex: 1; }

/* ================= 4단계: 음성 채널 ================= */
.avatar.xs { width: 22px; height: 22px; font-size: 10px; }
.item.voice-ch .chat-of-voice { opacity: 0; font-size: 13px; width: 26px; height: 26px; }
.item.voice-ch:hover .chat-of-voice, .item.voice-ch.on .chat-of-voice, .item.voice-ch:focus-within .chat-of-voice { opacity: 1; }
@media (hover: none) { .item.voice-ch .chat-of-voice { opacity: .7; } }
.vp-row {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; color: var(--muted);
  padding: 3px 10px 3px 34px; font-size: 13px; border-radius: 6px; text-align: left; cursor: pointer;
}
.vp-row:hover { background: var(--panel-2); color: var(--text); }
.vp-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-row .avatar { box-shadow: 0 0 0 2px transparent; transition: box-shadow .1s; }
.vp-row.speaking { color: var(--text); }
.vp-row.speaking .avatar { box-shadow: 0 0 0 2px var(--ok); }

.voice-panel { border-top: 1px solid var(--line); padding: 8px 10px; background: var(--panel); flex: none; }
.vp-top { display: flex; align-items: center; gap: 6px; }
.vp-top .grow { flex: 1; min-width: 0; }
.vp-status { font-size: 13px; font-weight: 700; color: var(--ok); }
.vp-status.connecting, .vp-status.reconnecting { color: #d68a1f; }
.vp-where { font-size: 12px; color: var(--muted); font-weight: 400; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.ptt-badge { font-weight: 400; color: var(--muted); font-size: 12px; }
.ptt-badge.on { color: var(--ok); font-weight: 700; }
.vp-buttons { display: flex; gap: 6px; margin-top: 6px; }
.vp-buttons .icon-btn { flex: 1; height: 34px; background: var(--panel-2); border-radius: 8px; font-size: 17px; }
.vp-buttons .icon-btn.off { background: color-mix(in srgb, var(--danger) 18%, var(--panel-2)); }
.danger-btn { color: var(--danger); }

.slider { flex: 1; min-width: 120px; accent-color: var(--accent); }
.range-val { min-width: 48px; text-align: right; }
.mic-meter { position: relative; height: 10px; border-radius: 5px; background: var(--panel-2); overflow: hidden; margin-top: 8px; }
.mic-level { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--muted); transition: width .05s linear; }
.mic-level.open { background: var(--ok); }
.mic-threshold { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--danger); }
.voice-settings .section { margin-bottom: 14px; }

/* ================= 5단계: 화상·화면 공유·통화 ================= */
.vp-buttons .icon-btn.on { background: var(--accent-soft, color-mix(in srgb, var(--accent) 22%, var(--panel-2))); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 420px) { .two-col { grid-template-columns: 1fr; } }
.live-badge, .tile-live { background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; border-radius: 4px; padding: 1px 5px; letter-spacing: .03em; }
.call-dot { font-size: 12px; color: var(--ok); font-weight: 700; }
.call-join { background: var(--ok); color: #fff; border-color: transparent; }
.call-live { background: var(--ok); color: #fff; border-color: transparent; }

/* 화상 화면 */
.video-stage { position: fixed; z-index: 40; background: #101014; color: #f2f2f5; display: flex; flex-direction: column; }
.video-stage.big { top: 0; right: 0; bottom: 0; left: 332px; }
.video-stage.mini { right: 16px; bottom: 84px; width: 320px; border-radius: 12px; overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,.45); }
.video-stage:fullscreen { inset: 0; }
@media (max-width: 760px) {
  .video-stage.big { inset: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .video-stage.mini { width: 46vw; max-width: 220px; right: 10px; bottom: calc(80px + env(safe-area-inset-bottom)); }
}
.video-stage .icon-btn { color: #f2f2f5; }
.video-stage .icon-btn:hover { background: rgba(255,255,255,.12); }
.video-stage .muted { color: #a8a8b3; }
.stage-head { display: flex; align-items: center; gap: 4px; padding: 8px 10px; flex: none; }
.stage-head .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-grid { flex: 1; min-height: 0; display: grid; gap: 8px; padding: 8px; grid-template-columns: repeat(var(--cols), 1fr); grid-auto-rows: 1fr; }
@media (max-width: 760px) { .stage-grid { overflow-y: auto; grid-auto-rows: minmax(140px, 1fr); } }
.stage-focus { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 8px; }
.stage-focus .big-tile { flex: 1; min-height: 0; }
.stage-strip { display: flex; gap: 8px; overflow-x: auto; flex: none; height: 110px; }
.stage-strip .tile { width: 170px; flex: none; }
.tile { position: relative; background: #1d1d24; border-radius: 10px; overflow: hidden; display: grid; place-items: center; cursor: pointer; min-height: 0; outline: 2px solid transparent; transition: outline-color .1s; }
.tile:focus-visible { outline-color: var(--accent); }
.tile.speaking { outline-color: var(--ok); }
.tile-video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tile-video.contain, .tile.screen .tile-video { object-fit: contain; }
.mirror { transform: scaleX(-1); }
.tile-avatar .avatar { width: 72px; height: 72px; font-size: 28px; }
.strip-tile .tile-avatar .avatar, .mini-tile .tile-avatar .avatar { width: 44px; height: 44px; font-size: 18px; }
.tile-name { position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px); background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-live { position: absolute; top: 6px; left: 6px; }
.mini-tile { aspect-ratio: 16 / 9; border-radius: 0; }
.stage-mini-bar { display: flex; align-items: center; gap: 2px; padding: 4px 6px 4px 10px; font-size: 12px; }
.stage-mini-bar .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-controls { display: flex; justify-content: center; gap: 10px; padding: 10px; flex: none; flex-wrap: wrap; }
.stage-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: #2a2a33; color: #fff; font-size: 20px; cursor: pointer; }
.stage-btn:hover { background: #3a3a45; }
.stage-btn.on { background: #f2f2f5; }
.stage-btn.off { background: color-mix(in srgb, var(--danger) 45%, #2a2a33); }
.stage-btn.hangup { background: var(--danger); }
.stage-btn.hangup:hover { filter: brightness(1.1); }

/* 걸려 온 전화 */
.call-ring {
  position: fixed; z-index: 90; top: calc(16px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: min(420px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.35);
  animation: ring-in .25s ease;
}
@keyframes ring-in { from { transform: translate(-50%, -20px); opacity: 0; } }
.call-ring .grow { flex: 1; min-width: 0; }
.ring-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-ring .avatar { animation: ring-pulse 1.2s ease-in-out infinite; }
@keyframes ring-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ok) 35%, transparent); } }
.ring-btns { display: flex; gap: 8px; }
.ring-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; font-size: 18px; cursor: pointer; color: #fff; }
.ring-btn.accept { background: var(--ok); }
.ring-btn.decline { background: var(--danger); }
@media (prefers-reduced-motion: reduce) { .call-ring, .call-ring .avatar { animation: none; } }

.cam-preview { margin-top: 8px; }
.cam-preview video { width: 100%; max-width: 360px; border-radius: 10px; background: #000; display: block; }

/* ================= 6단계: 게임 서버 연동·일정 ================= */
.game-card {
  display: flex; align-items: center; gap: 10px; width: calc(100% - 16px); margin: 8px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--text); text-align: left; cursor: pointer; font: inherit;
}
.game-card:hover { border-color: var(--accent); }
.game-card .grow { flex: 1; min-width: 0; display: grid; }
.game-card .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-card-title { font-size: 13px; }
.game-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.game-card.on .game-dot, .game-dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.game-dot.big { width: 16px; height: 16px; }
.game-heads { display: flex; }
.game-heads .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--panel-2); }
.game-count { font-size: 11px; color: var(--ok); font-weight: 700; margin-right: 4px; }
.game-head { white-space: nowrap; }
.game-head.on { background: color-mix(in srgb, var(--ok) 18%, var(--panel)); color: var(--ok); border-color: transparent; }
.game-tag { font-size: 11px; font-weight: 700; color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); padding: 1px 6px; border-radius: 6px; margin-left: 6px; }
.game-status-big { display: flex; align-items: center; gap: 12px; padding: 4px 2px 8px; }
.game-status-big .title { font-weight: 800; font-size: 18px; }
.game-players { display: grid; gap: 4px; }
.game-player { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 8px; }
.game-player:hover { background: var(--panel-2); }
.game-player .grow { flex: 1; min-width: 0; }
.game-inbox { display: grid; gap: 6px; max-height: 60vh; overflow-y: auto; }
.game-alert { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); }
.game-alert .gi { font-size: 18px; line-height: 1.3; }
.game-alert .grow { flex: 1; min-width: 0; }
.game-alert .title { font-weight: 700; }
.game-alert.territory { background: color-mix(in srgb, var(--danger) 14%, var(--panel-2)); }
.toast.notify.urgent { border-left-color: var(--danger); }

.event-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--panel); }
.event-card.past { opacity: .6; }
.event-card.live { border-color: var(--danger); }
.event-when { font-size: 12px; font-weight: 700; color: var(--accent); }
.event-title { font-size: 16px; font-weight: 800; margin: 2px 0 4px; }
.event-rsvp { display: flex; gap: 6px; margin-top: 8px; }
.event-tools { display: flex; gap: 12px; margin-top: 8px; }

/* ================= 채팅 다듬기: 마크다운, 리액션, 입력 중, 링크 미리보기 ================= */
.md-code-inline { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; }
.md-code { grid-column: 2; margin: 4px 0; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; white-space: pre; font-size: 13px; line-height: 1.45; }
.md-code code { font-family: ui-monospace, Consolas, monospace; }
.md-quote { margin: 2px 0; padding: 0 0 0 10px; border-left: 3px solid var(--line); color: var(--text); white-space: pre-wrap; }
.spoiler { background: color-mix(in srgb, var(--muted) 75%, var(--panel-2)); color: transparent; border-radius: 4px; cursor: pointer; padding: 0 2px; transition: background .15s; }
.spoiler * { visibility: hidden; }
.spoiler.shown { background: color-mix(in srgb, var(--text) 12%, transparent); color: inherit; cursor: text; }
.spoiler.shown * { visibility: visible; }
.spoiler:focus-visible { outline: 2px solid var(--accent); }

.reactions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.react .e { font-size: 15px; line-height: 1; }
.react .n { font-weight: 700; font-size: 12px; }
.react.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--panel-2)); }
.react:disabled { cursor: default; opacity: .8; }
.react.add { color: var(--muted); opacity: 0; }
.msg:hover .react.add, .msg.show-actions .react.add, .react.add:focus-visible { opacity: 1; }
@media (hover: none) { .react.add { opacity: 1; } }
.emoji-pop { position: fixed; z-index: 60; width: min(300px, calc(100vw - 16px)); padding: 8px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(0,0,0,.28); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-grid button { font-size: 20px; line-height: 1; padding: 6px 0; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.emoji-grid button:hover, .emoji-grid button:focus-visible { background: var(--panel-2); }
.emoji-pop .input { flex: 1; min-width: 0; }

.composer { position: relative; }
.typing-line { position: absolute; left: 16px; top: -20px; height: 18px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; pointer-events: none; opacity: 0; transition: opacity .15s; }
.typing-line.on { opacity: 1; }
.typing-line .dots { display: inline-flex; gap: 2px; }
.typing-line .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); animation: typing-dot 1.2s infinite ease-in-out; }
.typing-line .dots i:nth-child(2) { animation-delay: .15s; }
.typing-line .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typing-dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .typing-line .dots i { animation: none; } }

.link-card { grid-column: 2; display: flex; gap: 10px; max-width: 460px; margin-top: 6px; padding: 10px 12px; border-left: 4px solid var(--accent); border-radius: 8px; background: var(--panel-2); color: var(--text); text-decoration: none; }
.link-card:hover { background: color-mix(in srgb, var(--accent) 8%, var(--panel-2)); }
.link-card .lc-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.lc-site { font-size: 12px; color: var(--muted); }
.lc-title { font-weight: 700; color: var(--accent); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lc-desc { font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.lc-img { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; flex: none; }
.link-slot { display: none; }

/* 오르베 이름 */
.auth-card .brand { font-size: 34px; letter-spacing: .06em; font-weight: 800; margin-bottom: 0; color: var(--text); }
.auth-card .brand-sub { margin: 0 0 6px; letter-spacing: .3em; }

/* ---------- 프로필·접속 상태 ---------- */
.row { display: flex; align-items: center; }
.avatar.has-img { background: var(--panel-2) !important; }
.avatar > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar.xl { width: 88px; height: 88px; font-size: 34px; }
.avatar.xl .dot { width: 22px; height: 22px; border-width: 4px; right: 2px; bottom: 2px; }
.dot.away, .dot-inline.away { background: #e0a32e; }
.dot.dnd, .dot-inline.dnd { background: var(--danger); }
.dot.dnd::after, .dot-inline.dnd::after { content: ''; position: absolute; left: 20%; right: 20%; top: calc(50% - 1px); height: 2px; background: var(--panel); border-radius: 1px; }
.dot.offline, .dot-inline.offline { background: var(--muted); }
.dot.online, .dot-inline.online { background: var(--ok); }
.dot-inline { position: relative; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; flex: none; }
.msg .avatar[data-uid], .msg .author[data-uid], .user-row .avatar[data-uid], .row-item .avatar[data-uid] { cursor: pointer; }
.msg .author[data-uid]:hover { text-decoration: underline; }
.me-btn { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; border: 0; background: transparent; color: inherit; padding: 4px; margin: -4px; border-radius: 8px; text-align: left; font: inherit; cursor: pointer; }
.me-btn:hover { background: var(--panel); }
.me-btn .dot { border-color: var(--panel-2); }
.me-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-item { display: flex; align-items: center; gap: 4px; color: var(--text); font: inherit; cursor: pointer; }
.modal.profile-modal { max-width: 380px; }
.profile-modal .modal-body { padding: 0; }
.profile-modal .modal-head { position: absolute; right: 6px; top: 6px; z-index: 2; background: transparent; border: 0; padding: 0; }
.profile-modal .modal-head .title { display: none; }
.profile-modal .modal-head .icon-btn { background: rgba(0,0,0,.35); color: #fff; }
.profile-modal { position: relative; overflow: hidden; }
.pc-banner { height: 120px; background-size: cover; background-position: center; position: relative; }
.pc-head { margin: -48px 0 0 16px; position: relative; display: flex; align-items: flex-end; gap: 10px; }
.pc-head .avatar { border: 5px solid var(--panel); box-sizing: content-box; }
.pc-body { padding: 8px 18px 16px; }
.pc-name { font-size: 20px; font-weight: 800; }
.pc-status { margin-top: 10px; padding: 8px 10px; background: var(--panel-2); border-radius: 10px; word-break: break-word; }
.pc-status .e { margin-right: 6px; }
.pc-presence { margin-top: 10px; display: flex; align-items: center; flex-wrap: wrap; font-size: 14px; }
.pc-game { margin-top: 6px; font-size: 14px; }
.pc-section { margin-top: 6px; border-top: 1px solid var(--line); }
.pc-bio { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.profile-editor .pe-preview { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 14px; padding-bottom: 12px; }
.pe-banner-btns { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.pe-avatar-btns { display: flex; gap: 6px; flex-wrap: wrap; padding-bottom: 6px; }
.status-emoji { width: 56px; flex: none; text-align: center; font-size: 18px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip-btn { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 999px; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.chip-btn:hover { border-color: var(--accent); }
.stack { display: grid; gap: 2px; }

/* ---------- 커스텀 이모티콘·스티커 ---------- */
.cemoji { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; display: inline-block; }
.cemoji.sm { width: 18px; height: 18px; vertical-align: -4px; }
.cemoji.lg { width: 36px; height: 36px; }
.body.jumbo .cemoji { width: 48px; height: 48px; vertical-align: middle; }
.emoji-grid.custom button { padding: 4px 0; display: grid; place-items: center; }
.emoji-grid.custom .cemoji { width: 28px; height: 28px; }
.sticker { display: block; width: 160px; height: 160px; object-fit: contain; margin-top: 4px; }
.expr-pop { width: min(340px, calc(100vw - 16px)); }
.expr-tabs { display: flex; gap: 4px; margin-bottom: 8px; background: var(--panel-2); padding: 3px; border-radius: 8px; }
.expr-tabs button { flex: 1; border: 0; background: transparent; padding: 6px 4px; border-radius: 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.expr-tabs button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.expr-content { max-height: 300px; overflow-y: auto; }
.expr-empty { text-align: center; color: var(--muted); padding: 18px 8px; font-size: 14px; line-height: 2; }
.sticker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sticker-grid button { border: 0; background: transparent; border-radius: 10px; padding: 4px; cursor: pointer; aspect-ratio: 1; }
.sticker-grid button:hover, .sticker-grid button:focus-visible { background: var(--panel-2); }
.sticker-thumb { width: 100%; height: 100%; object-fit: contain; max-width: 96px; max-height: 96px; }
.expr-item .sticker-thumb { width: 56px; height: 56px; }
.expr-upload { display: flex; gap: 8px; align-items: center; margin: 10px 0 14px; }
.expr-thumb { width: 52px; height: 52px; flex: none; border: 2px dashed var(--line); border-radius: 10px; display: grid; place-items: center; font-size: 22px; color: var(--muted); cursor: pointer; overflow: hidden; }
.expr-thumb img { width: 100%; height: 100%; object-fit: contain; }
.expr-list { display: grid; gap: 4px; }
.expr-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.expr-item:hover { background: var(--panel-2); }
@media (max-width: 520px) { .expr-upload { flex-wrap: wrap; } .expr-upload .input { min-width: 0; } }
.menu-item .grow { flex: 1; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.expr-upload .btn { flex: none; white-space: nowrap; }

/* ================= 게임 경제 (내 지갑·상점 시세·영토) ================= */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs button { white-space: nowrap; }
.eco .menu-label { margin-top: 16px; }
.eco-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.eco-tile { background: var(--panel-2); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.eco-big { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.eco-mid { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.eco-in { color: var(--ok); font-variant-numeric: tabular-nums; font-weight: 600; }
.eco-out { color: var(--danger); font-variant-numeric: tabular-nums; font-weight: 600; }
.eco-legend { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.eco-legend .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.eco-legend .sw.in, .eco-pair .bar.in { background: var(--ok); }
.eco-legend .sw.out, .eco-pair .bar.out { background: var(--danger); opacity: .8; }
.eco-bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 6px 2px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.eco-day { flex: 1 0 18px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.eco-pair { flex: 1; display: flex; align-items: flex-end; gap: 2px; width: 100%; justify-content: center; }
.eco-pair .bar { width: 7px; min-height: 1px; border-radius: 2px 2px 0 0; }
.eco-dl { font-size: 10px; color: var(--muted); padding: 3px 0; }
.eco-kinds, .eco-ledger, .eco-shop { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.eco-kind, .eco-row, .eco-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); min-width: 0; }
.eco-kind:first-child, .eco-row:first-child, .eco-item:first-child { border-top: 0; }
.eco-row time { flex: none; width: 76px; }
.eco-row .grow, .eco-item .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eco-bal { flex: none; width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.eco-price { flex: none; font-variant-numeric: tabular-nums; }
.eco-stock { flex: none; font-size: 12px; padding: 2px 7px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-variant-numeric: tabular-nums; }
.eco-stock.low { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.eco-stock.high { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.eco-land { background: var(--panel-2); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 560px) {
  .eco-bal { display: none; }
  .eco-row time { width: 62px; }
  .eco-item { flex-wrap: wrap; row-gap: 2px; }
  .eco-item .grow { flex-basis: 100%; }
}
.eco input[type=search] { width: 100%; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.report-grid .eco-tile { gap: 6px; }
.tag.fine-warned { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.tag.fine-appealed { background: var(--accent-soft); }
.tag.fine-paid, .tag.fine-waived { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.eco select { flex: none; }
.eco input[type=text], .eco input[type=url] { width: 100%; }

/* 게임 연동 보강: 렉 표시·법·내 기록·지도·상자·즐겨찾기 */
.perf-tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.perf-tag.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.perf-tag.warn { background: color-mix(in srgb, #e0a020 22%, transparent); color: #b07800; }
.perf-tag.bad { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.law-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.law-item .small { line-height: 1.45; }
.fav-btn { flex: none; border: 0; background: none; padding: 0 2px; font-size: 17px; line-height: 1; color: var(--muted); cursor: pointer; }
.fav-btn.on, .fav-btn:hover { color: #e0a020; }
.chip-btn.on { border-color: var(--accent); background: var(--accent-soft); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row .chip-btn { padding: 3px 9px; font-size: 12px; font-family: ui-monospace, monospace; }
.game-map { display: block; width: 100%; height: min(56vh, 420px); border-radius: var(--radius); background: #1d2126; touch-action: none; cursor: grab; }
.game-map:active { cursor: grabbing; }
.bluemap-frame { display: block; width: 100%; height: min(75vh, 760px); border: 0; border-radius: var(--radius); background: #1d2126; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.map-key { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 999px; padding: 3px 9px 3px 6px; font: inherit; font-size: 12px; cursor: pointer; }
.map-key .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.modal .tabs.game-tabs { gap: 2px; }
.game-tabs button { flex: 0 0 auto; padding: 7px 11px; }
.chest-list { display: flex; flex-direction: column; gap: 6px; }
.chest-card { background: var(--panel-2); border-radius: var(--radius); }
.chest-card summary { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; list-style: none; }
.chest-card summary::-webkit-details-marker { display: none; }
.chest-card summary::before { content: '▸'; display: inline-block; color: var(--muted); flex: none; transition: transform .15s; }
.chest-card[open] summary::before { transform: rotate(90deg); }
.chest-card summary .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chest-body { padding: 0 12px 10px 28px; display: flex; flex-direction: column; gap: 6px; }
.chest-items { display: flex; flex-wrap: wrap; gap: 4px; }
.chest-items .chip-btn { cursor: default; padding: 2px 8px; font-size: 12px; }
.chest-items .chip-btn:hover { border-color: var(--line); }

/* 주식 */
.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.stock-card .spark svg { display: block; width: 100%; height: 40px; }
.spark polyline.up { stroke: var(--ok); }
.spark polyline.down { stroke: var(--danger); }
.stock-news { line-height: 1.4; }
.tag.news-호재 { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.tag.news-악재 { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }

/* 방송 중 배너 (통화방) */
.stream-banner { margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }

/* 스킨 프로필 */
.skin-box canvas { image-rendering: pixelated; flex: none; }
.skin-default { font-size: 48px; width: 64px; text-align: center; }
.tag.verified { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); margin-left: 4px; }

/* 건축물 갤러리 */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.gallery-card { border: 1px solid var(--line, #8883); border-radius: 12px; overflow: hidden; background: var(--panel, transparent); display: flex; flex-direction: column; }
.gallery-cover { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; cursor: pointer; background: #8882; }
.gallery-cover.empty { display: grid; place-items: center; font-size: 36px; cursor: default; }
.gallery-meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.gallery-meta .inline-form { flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.gallery-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.gallery-pick-item { display: flex; flex-direction: column; gap: 4px; align-items: stretch; text-align: left; padding: 6px; border-radius: 10px; border: 1px solid var(--line, #8883); background: none; color: inherit; cursor: pointer; }
.gallery-pick-item img, .gallery-noimg { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: grid; place-items: center; background: #8882; font-size: 28px; }
.learning-box { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #8881; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* 서버 네트워크 속도 */
.net-box { display: grid; gap: 10px; }
.net-row { display: grid; gap: 4px; }
.net-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.net-nums { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.net-bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.net-bar > span { display: block; height: 100%; background: var(--ok); transition: width .4s; }
.net-bar.hot > span { background: var(--danger); }

/* ===== 마인크래프트 테마 (게임 느낌 픽셀 테마) — 설정 → 마인크래프트. 그림은 app.js 가 직접 그린 픽셀 무늬 ===== */
@font-face { font-family: "Galmuri11"; src: url("/fonts/Galmuri11.woff2") format("woff2"); font-display: swap; }
:root[data-block] { --blk-veil: color-mix(in srgb, var(--bg) 72%, transparent); --blk-stone: #e6e2d8; --blk-stone-edge: #8f8a80; --blk-ink: #2a2620;
  --blk-wood-a: #dcae6e; --blk-wood-b: #d1a160; --blk-wood-edge: #8a5a26; --blk-wood-ink: #2b1a07; --blk-shadow: rgba(0, 0, 0, .28); }
@media (prefers-color-scheme: dark) { :root[data-block]:not([data-theme="light"]) { --blk-veil: color-mix(in srgb, var(--bg) 80%, transparent); --blk-stone: #3a3a3a; --blk-stone-edge: #1c1c1c; --blk-ink: #f1f1f1;
  --blk-wood-a: #7a5328; --blk-wood-b: #6e4a22; --blk-wood-edge: #3b2510; --blk-wood-ink: #fff4e0; --blk-shadow: rgba(0, 0, 0, .55); } }
:root[data-block][data-theme="dark"] { --blk-veil: color-mix(in srgb, var(--bg) 80%, transparent); --blk-stone: #3a3a3a; --blk-stone-edge: #1c1c1c; --blk-ink: #f1f1f1;
  --blk-wood-a: #7a5328; --blk-wood-b: #6e4a22; --blk-wood-edge: #3b2510; --blk-wood-ink: #fff4e0; --blk-shadow: rgba(0, 0, 0, .55); }
:root[data-block="night"] { --blk-veil: color-mix(in srgb, var(--bg) 55%, transparent); }
:root[data-block] .messages, :root[data-block] .welcome { background: linear-gradient(var(--blk-veil), var(--blk-veil)), var(--block-tex) 0 0 / 64px 64px; background-attachment: local, local; }
/* 말풍선: 남의 말은 돌, 내 말은 나무판자 */
:root[data-block] .msg:not(.system) > .body:not(.jumbo):not(.deleted) {
  justify-self: start; max-width: 100%; padding: 4px 10px; margin: 2px 0 3px; color: var(--blk-ink);
  background: var(--blk-stone); border: 2px solid var(--blk-stone-edge); box-shadow: 3px 3px 0 var(--blk-shadow); border-radius: 0;
}
:root[data-block] .msg.mine:not(.system) > .body:not(.jumbo):not(.deleted) {
  color: var(--blk-wood-ink); border-color: var(--blk-wood-edge);
  background: repeating-linear-gradient(180deg, var(--blk-wood-a) 0 7px, var(--blk-wood-b) 7px 8px);
}
:root[data-block] .msg:not(.system) > .body a { color: inherit; text-decoration: underline; }
:root[data-block] .msg.system .pill { border-radius: 0; border: 2px solid var(--line); }
/* 네모난 버튼·칸 (블록 모서리) */
:root[data-block] .btn, :root[data-block] .input, :root[data-block] .theme-opt, :root[data-block] .rail-item, :root[data-block] .rail-item:hover, :root[data-block] .rail-item.on,
:root[data-block] .modal, :root[data-block] .toast, :root[data-block] .avatar { border-radius: 2px; }
:root[data-block] .btn { box-shadow: inset -2px -3px 0 rgba(0, 0, 0, .25), inset 2px 2px 0 rgba(255, 255, 255, .22); }
:root[data-block] .btn:active:not(:disabled) { box-shadow: inset 2px 3px 0 rgba(0, 0, 0, .25); }
/* 픽셀 글꼴: 제목·이름·버튼만 또는 모든 글자 */
:root[data-pixel-font="all"] body,
:root[data-pixel-font] .modal-head, :root[data-pixel-font] .sidebar-head, :root[data-pixel-font] .section h3, :root[data-pixel-font] .btn,
:root[data-pixel-font] .msg .author, :root[data-pixel-font] .rail-item, :root[data-pixel-font] .theme-opt { font-family: "Galmuri11", ui-monospace, monospace; }
:root[data-pixel-font] .section h3 { text-transform: none; letter-spacing: 0; }
/* 움직임 줄이기 (설정 또는 기기 설정) */
:root[data-reduce-motion] *, :root[data-reduce-motion] *::before, :root[data-reduce-motion] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* 스레드 · 검색 · 단축키 */
.msg .thread-chip { grid-column: 2; justify-self: start; margin: 4px 0 2px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 8px; padding: 3px 10px; font-size: 13px; }
.msg .thread-chip:hover { border-color: var(--accent); }
.thread-box { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.thread-list { max-height: min(60vh, 560px); overflow-y: auto; overscroll-behavior: contain; margin: 0 -16px; }
.thread-list .msg.thread-root { background: var(--panel-2); padding-top: 6px; padding-bottom: 6px; }
.thread-composer { display: flex; gap: 8px; align-items: flex-end; }
.thread-composer textarea { flex: 1; resize: vertical; min-height: 44px; }
.search-results { display: grid; gap: 4px; margin-top: 8px; max-height: min(60vh, 520px); overflow-y: auto; }
.search-item { text-align: left; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 8px; padding: 8px 10px; }
.search-item:hover, .search-item.on { border-color: var(--accent); background: var(--panel-2); }
.search-item .msg-head { display: flex; gap: 6px; align-items: baseline; }
.search-item time { color: var(--muted); font-size: 12px; margin-left: auto; }
mark { background: var(--accent-soft); color: var(--text); border-radius: 3px; padding: 0 1px; }
kbd { font: 12px ui-monospace, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--panel-2); white-space: nowrap; }
.avatar.bot { color: #fff; font-size: 18px; }
