:root {
  --bg: #f6f1f4;
  --surface: #ffffff;
  --log-bg: #efe9ef;
  --text: #221f26;
  --muted: #7d7684;
  --line: #e4dce3;
  --brand: #d9467a;
  --brand-ink: #ffffff;
  --mine: #ffd3df;
  --mine-text: #2b1720;
  --other: #ffffff;
  --other-text: #221f26;
  --notice: #fff4d6;
  --notice-line: #f1d48a;
  --sys: rgba(60, 40, 60, .12);
  --danger: #d33c3c;
  --shadow: 0 10px 30px rgba(60, 20, 50, .12);
  --app-h: 100vh;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16151a;
    --surface: #211f27;
    --log-bg: #19181e;
    --text: #efeaf2;
    --muted: #9b94a3;
    --line: #2f2c36;
    --brand: #f06b98;
    --mine: #7c2e4b;
    --mine-text: #fff3f7;
    --other: #2a2831;
    --other-text: #efeaf2;
    --notice: #3a3220;
    --notice-line: #6d5a2a;
    --sys: rgba(255, 255, 255, .1);
    --shadow: 0 10px 30px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  --bg: #16151a; --surface: #211f27; --log-bg: #19181e; --text: #efeaf2; --muted: #9b94a3;
  --line: #2f2c36; --brand: #f06b98; --mine: #7c2e4b; --mine-text: #fff3f7; --other: #2a2831;
  --other-text: #efeaf2; --notice: #3a3220; --notice-line: #6d5a2a; --sys: rgba(255, 255, 255, .1);
  --shadow: 0 10px 30px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: var(--app-h); overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ── 입장 화면 ── */
.gate { height: var(--app-h); display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; }
.gate-card {
  width: 100%; max-width: 380px; background: var(--surface); border-radius: 24px;
  padding: 32px 24px 28px; box-shadow: var(--shadow); text-align: center;
}
.logo { display: block; margin: 0 auto 8px; }
.gate h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; }
.lead { margin: 0 0 22px; color: var(--muted); }
.hint, .muted-text { margin: 16px 0 0; color: var(--muted); font-size: 14px; }
.code-input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 16px; background: var(--bg);
  color: var(--text); text-align: center; font-size: 32px; letter-spacing: .35em; padding: 14px 0 14px .35em;
  font-variant-numeric: tabular-nums; outline: none;
}
.code-input:focus, .text-input:focus { border-color: var(--brand); }
.text-input {
  flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 14px; background: var(--bg);
  color: var(--text); font-size: 17px; padding: 12px 14px; outline: none;
}
.nick-row { display: flex; gap: 8px; }
.error { min-height: 22px; margin: 10px 0 6px; color: var(--danger); font-size: 14px; }
.btn { border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 600; }
.btn.primary { width: 100%; background: var(--brand); color: var(--brand-ink); }
.btn.primary:disabled { opacity: .5; }
.btn.ghost { background: var(--bg); border: 1.5px solid var(--line); }

/* ── 관리자 입장 ── */
.admin-box { text-align: left; background: var(--bg); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 16px 16px; }
.admin-title { margin: 0 0 8px; font-weight: 700; font-size: 15px; }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; cursor: pointer; }
.switch-row > span:first-child { flex: 1; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 48px; height: 28px; border-radius: 999px; background: var(--line); transition: background .15s; flex: none; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch-row input:checked + .switch { background: var(--brand); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--brand); outline-offset: 2px; }
.admin-hint { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.admin-box .error { margin: 6px 0 4px; min-height: 0; }
.or { margin: 18px 0 12px; color: var(--muted); font-size: 13.5px; }

/* ── 채팅 ── */
.chat { height: var(--app-h); display: flex; flex-direction: column; background: var(--log-bg); }
.bar {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.bar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bar-title strong { font-size: 18px; letter-spacing: -.02em; }
.online { all: unset; cursor: pointer; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #3cbf6b; }
.conn { font-size: 12px; color: var(--muted); }
.icon-btn { border: 0; background: none; font-size: 24px; line-height: 1; width: 40px; height: 40px; border-radius: 12px; }
.icon-btn:active { background: var(--bg); }

.log {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px 12px 8px;
  display: flex; flex-direction: column;
}
.day-sep { align-self: center; margin: 14px 0 8px; padding: 4px 12px; border-radius: 999px; background: var(--sys); font-size: 12px; color: var(--muted); }
.sys { align-self: center; margin: 6px 0; padding: 4px 12px; border-radius: 999px; background: var(--sys); font-size: 12.5px; color: var(--muted); text-align: center; max-width: 90%; }

.row { display: flex; gap: 8px; margin-top: 10px; align-items: flex-start; }
.row.cont { margin-top: 3px; }
.row.mine { flex-direction: row-reverse; }
.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 14px; display: grid; place-items: center;
  font-size: 15px; font-weight: 700; color: #fff;
}
.row.cont .avatar { visibility: hidden; height: 0; }
.row.mine .avatar { display: none; }
.body { min-width: 0; max-width: min(78%, 520px); display: flex; flex-direction: column; }
.row.mine .body { align-items: flex-end; }
.name { font-size: 12.5px; color: var(--muted); margin: 0 0 3px 2px; }
.line { display: flex; align-items: flex-end; gap: 6px; }
.row.mine .line { flex-direction: row-reverse; }
.bubble {
  padding: 8px 12px; border-radius: 4px 16px 16px 16px; background: var(--other); color: var(--other-text);
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: keep-all;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
}
.row.cont .bubble { border-radius: 16px; }
.row.mine .bubble { background: var(--mine); color: var(--mine-text); border-radius: 16px 4px 16px 16px; }
.row.mine.cont .bubble { border-radius: 16px; }
.name.staff-name {
  display: inline-block; align-self: flex-start; color: var(--brand-ink); background: var(--brand);
  font-weight: 700; font-size: 11.5px; padding: 1px 8px; border-radius: 999px;
}
.row.staff .bubble { box-shadow: inset 0 0 0 1.5px var(--brand); }
.row.mine.staff .body::before {
  content: "운영자"; color: var(--brand-ink); background: var(--brand); font-weight: 700; font-size: 11.5px;
  padding: 1px 8px; border-radius: 999px; margin: 0 0 3px;
}
.row.mine.staff.cont .body::before { content: none; }
.row.pending .bubble { opacity: .55; }
.row.failed .bubble { opacity: .55; box-shadow: inset 0 0 0 1.5px var(--danger); }
.retry { border: 0; background: none; padding: 0; color: var(--danger); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.time { flex: none; font-size: 11px; color: var(--muted); white-space: nowrap; }

.notice {
  align-self: stretch; margin: 12px 4px 4px; padding: 10px 14px; border-radius: 14px;
  background: var(--notice); border: 1px solid var(--notice-line); white-space: pre-wrap; overflow-wrap: anywhere;
}
.notice .notice-head { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }
.notice .time { display: block; margin-top: 4px; }

.new-pill {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom));
  border: 0; border-radius: 999px; padding: 8px 16px; background: var(--brand); color: var(--brand-ink);
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
}

.composer {
  flex: none; display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; min-width: 0; resize: none; border: 0; border-radius: 20px; background: var(--bg); color: var(--text);
  font: inherit; font-size: 16px; line-height: 1.4; padding: 9px 14px; max-height: 140px; outline: none;
}
.send {
  flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink); display: grid; place-items: center;
}
.send:disabled { opacity: .35; }

/* ── 아래에서 올라오는 창 ── */
.sheet {
  border: 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); width: min(100%, 480px); max-width: 100%;
  margin: auto auto 0; border-radius: 22px 22px 0 0; background: var(--surface); color: var(--text);
}
.sheet::backdrop { background: rgba(0, 0, 0, .35); }
.sheet h2 { font-size: 17px; margin: 8px 8px 12px; }
.sheet p { margin: 0 8px 10px; }
.sheet ul { list-style: none; margin: 0 0 8px; padding: 0 8px; max-height: 50vh; overflow-y: auto; }
.sheet li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.sheet li .avatar { width: 30px; height: 30px; border-radius: 11px; font-size: 13px; }
.sheet-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 14px 12px; border-radius: 12px; font-size: 16px; }
.sheet-item:active { background: var(--bg); }
.sheet-item.danger { color: var(--danger); }
.sheet-item.muted { color: var(--muted); text-align: center; }
.sheet-actions { display: flex; gap: 8px; margin-top: 14px; }
.sheet-actions .btn { flex: 1; }
.sheet .nick-row { padding: 0 4px; }

.toast {
  position: fixed; left: 50%; top: calc(70px + env(safe-area-inset-top)); transform: translateX(-50%);
  background: rgba(30, 25, 35, .92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px;
  max-width: calc(100% - 32px); text-align: center; z-index: 10;
}

/* ── 안내·성별 ── */
.warn-note { margin: 14px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--notice); border: 1px solid var(--notice-line); font-size: 13.5px; text-align: left; }
.hint.small { margin: 8px 0 0; font-size: 12.5px; }
.gender-pick { display: flex; gap: 8px; margin-top: 12px; }
.g-opt { flex: 1; border: 1.5px solid var(--line); background: var(--bg); border-radius: 14px; padding: 12px 0; font-weight: 600; }
.g-opt[aria-checked="true"] { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.sheet .gender-pick { padding: 0 8px 8px; }
.sheet-sub { margin: -4px 8px 12px; color: var(--muted); font-size: 13.5px; }
.gtag { display: inline-block; margin-left: 5px; padding: 0 5px; border-radius: 6px; font-size: 10.5px; font-weight: 700; line-height: 16px; vertical-align: 1px; }
.gtag:empty { display: none; }
.gtag.g-m { background: #dbe8ff; color: #2456b8; }
.gtag.g-f { background: #ffe0ea; color: #c0285a; }

/* ── 진행 막대 ── */
.icon-btn[data-count]:not([data-count=""])::after {
  content: attr(data-count); position: absolute; margin: -6px 0 0 -8px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--brand); color: #fff; font-size: 10.5px; line-height: 16px; font-weight: 700;
}
#board-btn { position: relative; font-size: 20px; }
#op-btn { font-size: 20px; }
.gamebar {
  flex: none; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px; font-size: 13.5px;
}
.gb-lines { display: flex; flex-direction: column; gap: 2px; }
.gb-mode { font-size: 13px; color: var(--brand); }
.gb-me { font-weight: 700; color: var(--text); }
.gb-hands { color: var(--muted); overflow-wrap: anywhere; }
.gb-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.gb-actions:empty { display: none; }
.gb-btn { border: 1.5px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; }
.gb-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* ── 사진 ── */
.photo-btn { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--bg); color: var(--brand); display: grid; place-items: center; }
.bubble.photo-bubble { padding: 4px; }
.photo-frame { position: relative; border-radius: 12px; overflow: hidden; cursor: zoom-in; -webkit-touch-callout: none; user-select: none; }
.photo { display: block; width: min(62vw, 260px); max-height: 340px; object-fit: cover; pointer-events: none; }
.photo-mark {
  position: absolute; left: 6px; bottom: 6px; padding: 1px 7px; border-radius: 6px;
  background: rgba(0, 0, 0, .45); color: #fff; font-size: 10.5px; pointer-events: none;
}
.photo-gone { display: block; padding: 18px 14px; color: var(--muted); font-size: 13px; }
.photo-meta { display: flex; align-items: center; gap: 6px; padding: 5px 4px 1px; font-size: 11.5px; color: var(--muted); }
.photo-meta .photo-exp { flex: 1; }
.btn.mini { padding: 4px 9px; font-size: 12px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; }
.btn.mini.warn { color: var(--danger); }

.viewer { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; max-height: 100dvh; }
.viewer::backdrop { background: rgba(0, 0, 0, .88); }
.viewer img { display: block; max-width: 100vw; max-height: 88vh; max-height: 88dvh; object-fit: contain; -webkit-touch-callout: none; user-select: none; pointer-events: none; }
.viewer-mark { margin: 8px 0 0; text-align: center; color: rgba(255, 255, 255, .7); font-size: 12px; }
.viewer-close { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .18); color: #fff; font-size: 18px; }

/* ── 사람 고르기·현황판·운영자 창 ── */
.sheet.tall { max-height: 88vh; max-height: 88dvh; overflow-y: auto; }
.sheet li.pickable { cursor: pointer; border-radius: 12px; padding: 8px; }
.sheet li.pickable:active, .sheet li.on { background: var(--bg); }
.sheet li.on { box-shadow: inset 0 0 0 2px var(--brand); }
.sheet li.empty { color: var(--muted); }
#person-title { display: flex; align-items: center; }
#board-body { padding: 0 8px; max-height: 60vh; overflow-y: auto; }
#board-body .empty { color: var(--muted); }
.couple { border: 1.5px solid var(--line); border-radius: 16px; padding: 10px 12px; margin-bottom: 10px; }
.couple.odd { border-style: dashed; border-color: var(--notice-line); background: var(--notice); }
.couple-people { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--bg); font-weight: 600; font-size: 14px; }
.chip small { font-size: 10.5px; font-weight: 700; opacity: .75; }
.chip.g-m { background: #dbe8ff; color: #1d3f86; }
.chip.g-f { background: #ffe0ea; color: #9b1d48; }
.chip-x { border: 0; background: none; padding: 0 0 0 2px; font-size: 11px; opacity: .6; }
.heart { color: var(--brand); }
.odd-tag { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700; color: #8a6412; }
.couple-ops { display: flex; gap: 6px; margin-top: 8px; }
.solo { margin: 6px 0 10px; }
.solo h3 { font-size: 13.5px; color: var(--muted); margin: 0 0 6px; }
.op-sec { padding: 0 8px; margin-bottom: 12px; }
.op-sec h3 { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.op-row { display: flex; flex-wrap: wrap; gap: 6px; }
.op-row .btn { padding: 9px 12px; font-size: 14px; }
.op-help { margin: 4px 8px 8px; font-size: 13.5px; color: var(--muted); }
.op-help summary { cursor: pointer; font-weight: 600; color: var(--text); }
.op-help ul { margin: 6px 0 0; padding-left: 18px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .gtag.g-m, :root:not([data-theme="light"]) .chip.g-m { background: #1f3358; color: #bcd3ff; }
  :root:not([data-theme="light"]) .gtag.g-f, :root:not([data-theme="light"]) .chip.g-f { background: #4a2233; color: #ffc3d6; }
  :root:not([data-theme="light"]) .odd-tag { color: #f1d48a; }
}
.hand-chip { border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 999px; padding: 2px 9px; margin: 2px 4px 2px 0; font-size: 12.5px; font-weight: 600; }
.hand-chip:active { border-color: var(--danger); color: var(--danger); }

/* ── 방 모드 ── */
.mode-title { margin-top: 12px; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.m-opt { border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 9px 6px; font-size: 14px; font-weight: 600; }
.m-opt[aria-checked="true"] { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.mode-chip { font-size: 12px; font-weight: 600; color: var(--brand); margin-left: 4px; vertical-align: 2px; }
.mode-chip:empty { display: none; }
.op-soon { margin: 0 8px 12px; padding: 10px 12px; border-radius: 12px; background: var(--notice); border: 1px solid var(--notice-line); font-size: 13.5px; }
.sheet.ask { padding-top: 18px; }
.ask-text { margin: 0 8px 4px; font-size: 16px; line-height: 1.5; }
/* 🎮 창은 모드를 바꿔도 높이가 그대로(버튼이 위아래로 움직이지 않게) */
#op.sheet.tall { height: 88vh; height: min(88dvh, 860px); }
#op[open] { display: flex; flex-direction: column; }
#op[open] > form[method="dialog"] { margin-top: auto; }
#op[open] > * { flex: none; }

/* ── 운영자 고정 버튼 줄 ── */
.opbar {
  flex: none; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; padding: 7px 10px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.ob-break { flex-basis: 100%; height: 0; }
.opbar::-webkit-scrollbar { display: none; }
.ob {
  flex: none; border: 1.5px solid var(--line); background: var(--bg); border-radius: 999px;
  padding: 5px 10px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.ob.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.ob.hot { border-color: var(--brand); color: var(--brand); }
.ob.seg { padding: 6px 10px; }
.ob-gap { flex: none; width: 1px; height: 20px; background: var(--line); margin: 0 2px; }
.mode-chip { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; font-weight: 600; color: var(--brand); margin-left: 4px; vertical-align: 2px; }
.mode-chip:disabled { cursor: default; opacity: 1; }
.mode-chip.tappable { padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.mode-chip.tappable::after { content: " ▾"; font-size: 10px; }
#modes .mode-pick { padding: 0 8px 8px; }

/* 정상화 전 커플이 있으면 💞 숫자를 노랑으로 */
#board-btn.has-odd[data-count]:not([data-count=""])::after { background: #e0a21b; }
/* 게임 전환 펼침 목록 */
.opbar { position: relative; z-index: 3; }
.ob-menu { position: relative; flex: none; }
.ob-list {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 100%; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 4px; z-index: 5;
}
.ob-item { border: 0; background: none; text-align: left; padding: 9px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.ob-item:active, .ob-item:hover { background: var(--bg); }
.ob-item.cur { color: var(--brand); }
/* 제목 옆 모드 버튼 펼침 목록 */
.bar { position: relative; z-index: 4; }
.chip-wrap { position: relative; display: inline-block; }
.mode-list { top: calc(100% + 6px); min-width: 170px; font-size: 14px; letter-spacing: 0; }
.mode-list small { font-size: 11px; color: var(--muted); font-weight: 500; }

/* ── 경매 ── */
.gb-price { font-weight: 700; color: var(--text); }
.results { margin: 4px 0 12px; }
.results h3 { font-size: 13.5px; color: var(--muted); margin: 0 0 6px; }
.result { border: 1.5px solid var(--line); border-radius: 14px; padding: 9px 12px; margin-bottom: 8px; }
.result-meta { margin-top: 5px; font-size: 13px; color: var(--muted); }
/* 호가 표시 */
.calls { font-weight: 700; color: var(--muted); letter-spacing: .5px; }
.calls.on { color: var(--danger); }
.gb-btn.bid { font-variant-numeric: tabular-nums; }
.op-note { margin: 6px 0 0; }
/* 입찰 단위 스위치 */
.step-switch { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px; border-radius: 999px; background: var(--bg); border: 1px dashed var(--line); }
.step-label { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-right: 2px; }
.ob.step { padding: 3px 9px; font-size: 12px; background: var(--surface); color: var(--muted); }
.ob.step.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.gb-btn.bid.off, .gb-btn.bid:disabled { opacity: .4; cursor: not-allowed; }
.gb-wait { color: var(--muted); font-size: 13px; }
.step-switch[hidden] { display: none !important; }

/* ── 접이식 현황판: 제목 줄은 자리를 차지하고, 펼친 목록은 채팅 위에 겹친다 ── */
.boards { flex: none; position: relative; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); }
.bd-heads { display: flex; }
.bd-head {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; border: 0; background: none; text-align: left;
  padding: 7px 10px 7px 12px; font-size: 13.5px;
}
.bd-head + .bd-head { border-left: 1px solid var(--line); }
.bd-head b { flex: none; }
.bd-sum { flex: 1; min-width: 0; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-arrow { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--bg); color: var(--muted); font-size: 12px; transition: transform .15s; }
.bd-head.open .bd-arrow { transform: rotate(180deg); color: var(--brand); background: var(--notice); }
.bd-pop {
  position: absolute; top: 100%; left: 0; right: 0; max-height: 55vh; overflow-y: auto;
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 12px 24px rgba(40, 20, 40, .18);
  padding: 4px 12px 10px;
}
.bd-sec + .bd-sec { border-top: 1px dashed var(--line); margin-top: 6px; }
.bd-title { font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 8px 0 6px; }
.bd-body { display: flex; flex-direction: column; gap: 6px; }
.bd-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 12px; background: var(--bg); }
.bd-row.odd { background: var(--notice); }
.bd-row .chip { font-size: 13px; padding: 2px 8px; }
.bd-tag { margin-left: auto; font-size: 11.5px; font-weight: 700; color: #8a6412; }
.bd-tag.done { color: var(--brand); }
.bd-price { font-size: 12.5px; font-weight: 700; }
.bd-muted, .bd-empty { color: var(--muted); font-size: 13px; margin: 0; }
.bd-edit { align-self: flex-end; }

/* ── 옛 사파리 대비 ── */
@supports (height: 100dvh) { :root { --app-h: 100dvh; } }
dialog:not([open]) { display: none; }
.dlg-poly[open] { position: fixed; left: 0; right: 0; bottom: 0; display: block; margin: 0 auto; }
.dlg-poly.viewer[open] { top: 50%; bottom: auto; -webkit-transform: translateY(-50%); transform: translateY(-50%); }
#op.dlg-poly[open] { display: flex; }
.dlg-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, .35); }
.dlg-backdrop[hidden] { display: none; }

/* ── 방 목록(기본방 + 열린 이벤트방) ── */
.rooms { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.rooms::-webkit-scrollbar { display: none; }
.room-chip { flex: none; border: 1.5px solid var(--line); background: var(--bg); color: var(--text); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.room-chip.cur { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.ev-op-row { align-items: center; }
.ev-op-name { flex: 1 1 140px; font-weight: 600; font-size: 14px; }

/* ── 이벤트방 진행 막대 ── */
.gb-muted { color: var(--muted); font-size: 13px; }
.cho-big { font-size: 30px; font-weight: 800; letter-spacing: .18em; line-height: 1.25; color: var(--text); overflow-wrap: anywhere; }
.fw-board { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; max-height: 32vh; overflow-y: auto; }
.fw { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 11px; border-radius: 12px; background: var(--bg); border: 1.5px solid var(--line); font-size: 14px; }
.fw b { font-weight: 600; color: var(--muted); font-size: 12.5px; }
.fw-word { font-weight: 800; }
.fw small { font-size: 11.5px; color: var(--muted); }
.fw.mine { border-color: var(--brand); }
.fw.done { background: var(--notice); border-color: var(--notice-line); }
.fw.away { opacity: .55; }
.fw.tappable { cursor: pointer; }
.ev-area { width: 100%; min-height: 160px; resize: vertical; font: inherit; margin-bottom: 4px; }
#ev-form-input { width: 100%; margin-bottom: 4px; }
