/* ===== elenchos — hand-drawn wireframe ===== */
@font-face {
  font-family: 'ChosunNm';
  src: url('fonts/ChosunNm.woff2') format('woff2');
  font-weight: 400;        /* 단일 굵기 — 굵은 제목은 브라우저 합성 볼드 사용 */
  font-display: swap;
}
:root {
  /* ---- light theme ---- */
  --ink: #211f1b;
  --ink-2: #46423a;
  --muted: #8c877b;
  --line: #2a2823;
  --line-soft: #c3bdae;
  --paper: #fcfbf7;
  --paper-2: #f3f1e8;
  --paper-3: #e9e6da;
  --accent: #d6451f;       /* vermilion red-orange */
  --accent-ink: #a8350f;
  --accent-soft: #fbe9df;
  --green: #3f7d4e;
  --green-soft: #ecf3ec;
  --blue: #36699e;
  --blue-soft: #e8eef5;
  --dot: rgba(42, 40, 35, 0.05);
  --modal-back: rgba(33, 31, 27, 0.32);
  --shadow: 2px 3px 0 rgba(33, 31, 27, 0.07);
  --font-serif: 'ChosunNm', 'Nanum Myeongjo', 'Apple SD Gothic Neo', serif;
  --font-mono: 'JetBrains Mono', 'D2Coding', monospace;
  --r1: 14px 11px 13px 10px;
  --r2: 9px 12px 8px 11px;
}
/* ---- dark theme (기본값) ---- */
[data-theme="dark"] {
  --ink: #ece6da;
  --ink-2: #b3ac9d;
  --muted: #857e6f;
  --line: #4a463c;
  --line-soft: #3a362e;
  --paper: #1b1813;
  --paper-2: #24211a;
  --paper-3: #2e2a20;
  --accent: #e2632f;
  --accent-ink: #f2895c;
  --accent-soft: #3a241a;
  --green: #74b07d;
  --green-soft: #1f2d26;
  --blue: #74a3d2;
  --blue-soft: #1c2937;
  --dot: rgba(236, 230, 218, 0.05);
  --modal-back: rgba(0, 0, 0, 0.55);
  --shadow: 2px 3px 0 rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
/* 모바일: 가로 스와이프/오버스크롤 완전 차단 (상하 스크롤만 허용) */
html, body { overflow-x: hidden; max-width: 100%; width: 100%; overscroll-behavior-x: none; }
/* 긴 단어/URL 등으로 인한 가로 넘침 방지 (전역 줄바꿈) */
body { overflow-wrap: anywhere; word-break: break-word; }
body {
  margin: 0;
  font-family: var(--font-serif);
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 0);
  background-size: 22px 22px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
#app { height: 100%; }
.mono { font-family: var(--font-mono); }
button, input, textarea { font-family: inherit; color: inherit; }
:focus-visible { outline: 2px dashed var(--accent); outline-offset: 2px; }

/* ---------- shared atoms ---------- */
.sketch {
  border: 1.5px solid var(--line);
  border-radius: var(--r1);
  background: var(--paper);
}
.sketch--dashed { border-style: dashed; }
.sketch--soft { border-color: var(--line-soft); }

.legend {
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: var(--r1);
  background: var(--paper);
  padding: 16px 14px 14px;
}
.legend > .legend__t {
  position: absolute;
  top: -11px;
  left: 14px;
  padding: 0 7px;
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.legend--dashed { border-style: dashed; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  padding: 4px 11px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
}
.pill--on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pill--accent { color: var(--accent); border-color: var(--accent); }
.pill--accent.pill--on { background: var(--accent); color: #fff; border-color: var(--accent); }

.btn {
  border: 1.5px solid var(--line);
  border-radius: var(--r2);
  background: var(--paper);
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  font-family: var(--font-serif);
  transition: transform .04s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--ghost { border-style: dashed; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--sm { padding: 5px 10px; font-size: 13px; }

.dot { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--line); display: inline-block; flex: none; }
.dot--host { background: var(--accent); border-color: var(--accent-ink); }
.dot--guest { background: var(--blue); border-color: #244d77; }
.dot--empty { background: transparent; border-style: dashed; }

.txt-muted { color: var(--muted); }
.txt-accent { color: var(--accent); }
.strike { text-decoration: line-through; }
.hide { display: none !important; }

input.field, textarea.field {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--r2);
  background: var(--paper);
  padding: 10px 12px;
  font-size: 15px;
  resize: vertical;
}
textarea.field { min-height: 70px; line-height: 1.5; }
label.lbl { display: block; font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin: 12px 0 5px; }

/* ===================== LANDING ===================== */
.landing {
  position: relative;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 18px 60px;
  gap: 26px;
}
.brand { text-align: center; }
.brand__mark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(34px, 9vw, 60px);
  letter-spacing: -0.02em;
}
.brand__mark .x { color: var(--accent); }
.brand__sub { color: var(--muted); margin-top: 6px; font-size: 15px; }
.brand__el { font-family: var(--font-serif); }

.landing__cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  width: 100%;
  max-width: 720px;
}
.lcard { padding: 20px 18px 18px; }
.lcard h3 { margin: 2px 0 4px; font-size: 20px; }
.lcard p { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.landing__corner { position: absolute; top: 16px; right: 16px; }
.landing__foot { color: var(--muted); font-size: 12px; font-family: var(--font-mono); text-align: center; }
.landing__foot .mode { color: var(--accent); }

/* ===================== HOME (방 디렉토리) ===================== */
.home {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 18px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.home__bar { display: flex; align-items: center; gap: 12px; }
.home__me { font-size: 14px; color: var(--ink-2); margin-right: auto; background: none; border: 1.5px dashed transparent; cursor: pointer; padding: 4px 8px; border-radius: 8px; font-family: inherit; }
.home__me:hover { background: var(--paper-2); border-color: var(--line-soft); }
.authtabs { display: flex; gap: 8px; margin-bottom: 6px; }
.home .brand { margin-bottom: 4px; }
/* 로고 + 워드마크 */
.home__brand { text-align: center; }
.home__logo { width: 150px; height: 150px; object-fit: contain; display: block; margin: 0 auto; }
.home__word { font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.04em; font-size: 17px; color: var(--ink); margin-top: 2px; }
/* 정렬 + 검색 */
.home__controls { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.home__sort {
  flex: 0 0 auto; width: auto; cursor: pointer;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding: 10px 34px 10px 14px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999087' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  font-family: var(--font-serif); font-size: 14px;
}
.home__sort:focus-visible { outline: 2px dashed var(--accent); outline-offset: 2px; }
.home__search { flex: 1 1 auto; min-width: 0; }
/* 방 카드 */
.roomcard { display: flex; gap: 18px; align-items: stretch; border: 1.5px solid var(--line); border-radius: var(--r1); background: var(--paper); padding: 16px; cursor: pointer; box-shadow: var(--shadow); }
.roomcard:hover { background: var(--paper-2); }
.roomcard--closed { border-color: var(--line-soft); border-style: dashed; }
.roomcard__cover { flex: 0 0 200px; width: 200px; height: 150px; border: 1.5px solid var(--line-soft); border-radius: var(--r2); overflow: hidden; background: var(--paper-2); display: flex; align-items: center; justify-content: center; }
.roomcard__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.roomcard__cover--logo { background: var(--paper-2); }
.roomcard__cover--logo img { object-fit: contain; padding: 12px; }
.roomcard__body { min-width: 0; flex: 1 1 auto; }
.roomcard__l1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.roomcard__code { font-size: 13px; font-weight: 700; color: var(--accent); }
.roomcard__time { font-size: 11px; color: var(--muted); margin-left: auto; }
.roomcard__topic { font-size: 17px; margin: 5px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roomcard__desc { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.roomcard__people { font-size: 13px; color: var(--ink-2); }
.roomcard__people .vs { font-family: var(--font-mono); color: var(--muted); margin: 0 6px; font-size: 11px; }
.roomcard__btns { display: flex; gap: 8px; margin-top: 9px; }
@media (max-width: 560px) {
  .roomcard { gap: 12px; padding: 12px; }
  .roomcard__cover { flex-basis: 110px; width: 110px; height: 120px; }
  .roomcard__topic { font-size: 15px; }
}
.home__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.home__actions .btn { font-size: 15px; padding: 10px 18px; }
.home__list { padding-top: 18px; }
.roomlist { display: flex; flex-direction: column; gap: 10px; }
.roomlist__empty { color: var(--muted); font-size: 14px; padding: 6px 2px; }
.roomrow {
  display: flex; gap: 12px; align-items: stretch; justify-content: space-between;
  border: 1.5px solid var(--line); border-radius: var(--r1); background: var(--paper);
  padding: 12px 14px; cursor: pointer; box-shadow: var(--shadow);
}
.roomrow:hover { background: var(--paper-2); }
.roomrow__main { min-width: 0; flex: 1 1 auto; }
.roomrow__l1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.roomrow__code { font-size: 14px; font-weight: 700; color: var(--accent); }
.roomrow__topic { font-size: 16px; margin: 4px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roomrow__people { font-size: 13px; color: var(--ink-2); }
.roomrow__people .vs { font-family: var(--font-mono); color: var(--muted); margin: 0 6px; font-size: 11px; }
.roomrow__side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 8px; flex: none; }
.roomrow__time { font-size: 11px; color: var(--muted); }
.roomrow__btns { display: flex; gap: 6px; }
.rbadge { font-family: var(--font-mono); font-size: 10px; border: 1.5px solid var(--line-soft); border-radius: 999px; padding: 1px 7px; color: var(--muted); }
.rbadge--open { color: var(--green); border-color: var(--green); }
.rbadge--mine { color: var(--accent); border-color: var(--accent); }
.home__list--mine .roomrow { border-color: var(--accent); background: var(--accent-soft); }
.home__list--mine .legend__t { color: var(--accent); }
.rbadge--result { color: #fff; background: var(--accent); border-color: var(--accent); }

/* 토론 결과 */
.result-pill { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.result-opts { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.result-opts .btn { flex: 1; min-width: 90px; }
.result-votes { font-size: 14px; line-height: 1.7; border: 1.5px dashed var(--line-soft); border-radius: var(--r2); padding: 8px 12px; }
.result-force { margin-top: 14px; }
.result-final { font-size: 26px; text-align: center; padding: 18px 0 6px; }

/* 주제 변경 투표 배너 */
.topicvote { margin-top: 9px; padding: 8px 12px; border: 1.5px dashed var(--accent); border-radius: var(--r2); background: var(--accent-soft); font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topicvote__act { display: inline-flex; gap: 6px; margin-left: auto; }

/* ===================== transcript rows ===================== */
.rec__who { font-weight: 700; margin-right: 6px; white-space: nowrap; }
.rec--event { background: var(--paper-2); border-style: dashed; }
.rec__sys { color: var(--muted); font-style: italic; }
.rec__cite { color: var(--accent); font-size: 12px; }

/* ===================== ROOM ===================== */
.room {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 1640px;
  margin: 0 auto;
  padding: 14px 16px 0;
}

/* header */
.rhead { flex: none; padding-bottom: 12px; border-bottom: 1.5px dashed var(--line-soft); }
.rhead__top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rhead__back { flex: none; }
.rhead__title { font-size: clamp(22px, 3.4vw, 30px); font-weight: 800; margin: 0; }
.rhead__title .mono { font-weight: 700; }
.rhead__spacer { flex: 1 1 auto; }
.rhead__people { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.person { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.person .role { color: var(--muted); font-size: 12px; }
.rhead__topic { margin: 9px 0 0; color: var(--ink-2); font-size: 15px; }
.rhead__topic b { color: var(--muted); font-weight: 400; font-family: var(--font-mono); font-size: 12px; margin-right: 6px; }
.rhead__actions { display: flex; align-items: center; gap: 9px; }

/* grid */
.rgrid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 270px) minmax(0, 1fr) minmax(290px, 350px);
  gap: 16px;
  padding: 14px 0 14px;
}
.col { min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.col--mid { min-width: 0; }

/* left column boxes */
.box-scroll { overflow: auto; }
.left-stack { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.left-stack .legend { overflow: auto; }

/* left-panel scrollable body (라벨이 잘리지 않도록 박스가 아닌 본문만 스크롤) */
.lbody { overflow: auto; max-height: 32vh; }

/* term list */
.term { font-size: 15px; line-height: 1.7; }
.term b { font-weight: 700; }
.term .eq { color: var(--accent); margin: 0 5px; font-family: var(--font-mono); }
.addrow { margin-top: 10px; }
.linklike { background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; font-family: var(--font-serif); font-size: 14px; }
.linklike::before { content: "+ "; }

/* consensus */
.cs { border: 1.5px solid var(--line); border-left-width: 5px; border-radius: var(--r2); padding: 9px 11px; margin-bottom: 10px; background: var(--paper); }
.cs--ok { border-left-color: var(--green); background: var(--green-soft); }
.cs--pending { border-style: dashed; border-left-color: var(--line-soft); }
.cs__mark { font-family: var(--font-mono); margin-right: 6px; }
.cs--ok .cs__mark { color: var(--green); }
.cs--pending .cs__mark { color: var(--muted); }
.cs__txt { font-size: 15px; line-height: 1.45; }
.cs__meta { font-size: 12px; color: var(--muted); margin-top: 5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* tabs box (mobile-ish nav, shown on desktop too) */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- center: chat ---------- */
.chat { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 0; }
.chat .legend__t { z-index: 1; }
.chat__scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px 16px 10px; display: flex; flex-direction: column; gap: 14px; }

.event-line { align-self: stretch; text-align: center; color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 10px; }
.event-line::before, .event-line::after { content: ""; flex: 1; border-top: 1.5px dashed var(--line-soft); }
.event-line .mono { color: var(--ink-2); }
.event-line .cid { color: var(--accent); font-weight: 700; }

.msg { max-width: 78%; }
.msg--me { align-self: flex-end; }
.msg--them { align-self: flex-start; }
.msg__meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.msg--me .msg__meta { text-align: right; }
.msg__bubble { border: 1.5px solid var(--line); border-radius: var(--r1); padding: 11px 13px; background: var(--paper); font-size: 15px; line-height: 1.55; box-shadow: var(--shadow); }
.msg--me .msg__bubble { background: var(--paper-2); }

/* claim card inside chat */
.msg--claim .msg__bubble { border-color: var(--accent); background: var(--accent-soft); }
.claimcard__id { font-family: var(--font-mono); font-size: 12px; color: var(--accent); font-weight: 700; margin-bottom: 4px; }
.msg--claim.is-withdrawn .msg__bubble { border-color: var(--line-soft); background: var(--paper-2); color: var(--muted); }
.msg--claim.is-withdrawn .claimcard__body { text-decoration: line-through; }
.claimcard__act { display: flex; gap: 12px; margin-top: 9px; padding-top: 8px; border-top: 1.5px dashed var(--line-soft); flex-wrap: wrap; }
.cc-act { background: none; border: none; padding: 0; cursor: pointer; font-family: var(--font-serif); font-size: 13px; color: var(--accent-ink); }
.cc-act:last-child { color: var(--muted); margin-left: auto; }

/* chat image */
.msg__img { display: block; max-width: 100%; max-height: 300px; margin-top: 6px; border: 1.5px solid var(--line); border-radius: 10px; cursor: zoom-in; object-fit: contain; }
.img-pending { position: relative; display: inline-block; margin: 4px 0 10px; }
.img-pending img { max-height: 90px; max-width: 160px; border: 1.5px solid var(--line); border-radius: 8px; display: block; }
.img-pending__x { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--paper); cursor: pointer; font-size: 12px; line-height: 1; }
.btn--icon { padding: 8px 10px; }

/* reply / message actions */
.msg__quote { border-left: 3px solid var(--accent); background: var(--paper-2); padding: 4px 9px; margin-bottom: 6px; font-size: 12.5px; color: var(--ink-2); border-radius: 6px; cursor: pointer; }
.msg__quote b { color: var(--ink); }
.msg__acts { display: flex; gap: 12px; margin-top: 7px; }
.msg--me .msg__acts { justify-content: flex-end; }
.msg__act { background: none; border: none; padding: 0; cursor: pointer; font-size: 12px; color: var(--muted); font-family: var(--font-serif); }
.msg__act--del { color: var(--accent); }
.msg__edited { background: none; border: none; padding: 0; font-size: 11px; color: var(--muted); cursor: pointer; font-family: var(--font-serif); text-decoration: underline dotted; }
.reply-pending { display: flex; align-items: center; gap: 8px; background: var(--paper-2); border-left: 3px solid var(--accent); border-radius: 6px; padding: 6px 10px; margin: 4px 0 8px; font-size: 13px; }
.reply-pending__t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-pending .img-pending__x { position: static; width: 20px; height: 20px; flex: none; }
@keyframes msgflash { 0%, 100% { background: transparent; } 30% { background: var(--accent-soft); } }
.msg--flash .msg__bubble { animation: msgflash 1.3s ease; }
.modal--img { padding: 6px; background: transparent; border: none; box-shadow: none; width: auto; max-width: 92vw; }
.modal--img img { max-width: 92vw; max-height: 86vh; border-radius: 8px; display: block; }

/* ===================== 마인드맵 ===================== */
.modal--map { width: min(1100px, 96vw); max-width: 96vw; }
.map-scroll { overflow: auto; max-height: 72vh; border: 1.5px solid var(--line-soft); border-radius: var(--r2); background: var(--paper-2); padding: 24px; cursor: grab; }
.map-scroll.grabbing { cursor: grabbing; user-select: none; }
.map-tree { display: inline-block; min-width: 100%; }
.map-branch { display: flex; align-items: center; }
.map-wrap { flex: none; position: relative; }
.map-node { width: 200px; border: 1.5px solid var(--line); border-radius: var(--r2); background: var(--paper); padding: 8px 11px; box-shadow: var(--shadow); }
.map-node--claim { border-color: var(--accent); background: var(--accent-soft); }
.map-node--reb.is-open { border-color: var(--accent); }
.map-node--ev { border-left: 3px solid var(--blue); }
.map-node--wd { border-style: dashed; opacity: .65; }
.map-node--wd .map-node__txt { text-decoration: line-through; }
.map-node__id { font-size: 11px; color: var(--accent); font-weight: 700; }
.map-node--reb .map-node__id, .map-node--ev .map-node__id { color: var(--ink-2); }
.map-node__txt { font-size: 13.5px; line-height: 1.45; margin: 3px 0; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.map-node__by { font-size: 11px; color: var(--muted); }
.map-kids { display: flex; flex-direction: column; gap: 14px; margin-left: 36px; position: relative; }
.map-kids::before { content: ""; position: absolute; left: -18px; top: 22px; bottom: 22px; border-left: 2px solid var(--line-soft); }
.map-kids > .map-branch { position: relative; }
.map-kids > .map-branch::before { content: ""; position: absolute; left: -18px; top: 50%; width: 18px; border-top: 2px solid var(--line-soft); }
.map-branch:has(> .map-kids) > .map-wrap::after { content: ""; position: absolute; right: -18px; top: 50%; width: 18px; border-top: 2px solid var(--line-soft); }

/* citation chip */
.cite-chip { display: inline-flex; align-items: center; gap: 5px; border: 1.5px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: 12px; font-family: var(--font-mono); cursor: pointer; margin-bottom: 7px; background: var(--paper); }
.cite-chip .arr { color: var(--accent); }
.cite-chip.is-withdrawn { color: var(--muted); border-style: dashed; }
.cite-chip.is-withdrawn .arr { color: var(--muted); }

/* input bar */
.inputbar { flex: none; border-top: 1.5px dashed var(--line-soft); padding: 12px; display: flex; gap: 10px; align-items: flex-end; }
.inputbar textarea { flex: 1 1 auto; min-width: 0; min-height: 46px; max-height: 140px; }
.inputbar .actions { display: flex; gap: 8px; flex: none; }
.input-hint { display: block; font-size: 11px; color: var(--muted); font-family: var(--font-mono); padding: 0 12px 8px; }
.locked-note { padding: 14px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- right: claims panel ---------- */
.claims__filters { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.claims__list { display: flex; flex-direction: column; gap: 11px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.claim {
  border: 1.5px solid var(--accent);
  border-radius: var(--r1);
  background: var(--paper);
  padding: 11px 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.claim--mine { background: var(--accent-soft); }
.claim--withdrawn { border-color: var(--line-soft); border-style: dashed; background: var(--paper-2); color: var(--muted); cursor: pointer; }
.claim__top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.claim__id { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--accent); }
.claim--withdrawn .claim__id { color: var(--muted); }
.claim__meta { font-size: 11px; color: var(--muted); font-family: var(--font-mono); text-align: right; }
.claim__body { margin-top: 6px; font-size: 14.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.claim--withdrawn .claim__body { text-decoration: line-through; }
.claim__foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 7px; }
.claim__unans { color: var(--accent); font-size: 12px; display: flex; align-items: center; gap: 5px; }
.claim__unans .b { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }
.claim__reb { color: var(--ink-2); font-size: 12px; font-family: var(--font-mono); }
.claim__reb--open { color: var(--accent); font-weight: 700; }
.author-tag { font-family: var(--font-mono); }

/* ----- rebuttal tree (논증 트리) ----- */
.rebtree { margin-top: 8px; }
.rebkids { margin-left: 8px; border-left: 2px dashed var(--line-soft); padding-left: 10px; margin-top: 8px; display: flex; flex-direction: column; gap: 10px; }
/* 각 반박을 박스로 감싸 트리 구조가 잘 보이게 */
.rebnode { border: 1.5px solid var(--line-soft); border-radius: var(--r2); padding: 8px 10px; background: var(--paper); }
.rebnode--open { border-color: var(--accent); }
.rebnode__head { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.rebnode__id { color: var(--accent); font-weight: 700; }
.rebnode__who { font-weight: 700; }
.rebnode__t { color: var(--muted); }
.rebnode__wd { color: var(--muted); font-family: var(--font-mono); font-size: 10px; border: 1px dashed var(--line-soft); border-radius: 999px; padding: 0 6px; }
.rebnode__open { color: var(--accent); font-family: var(--font-mono); font-size: 10px; border: 1px solid var(--accent); border-radius: 999px; padding: 0 6px; }
.rebnode--open > .rebnode__txt { border-left: 3px solid var(--accent); padding-left: 8px; }
.rebnode__txt { font-size: 14.5px; line-height: 1.55; margin: 3px 0; }
.rebnode__act { display: flex; gap: 12px; align-items: center; }
.rebnode__src { color: var(--blue); font-size: 12px; font-family: var(--font-mono); text-decoration: none; }
.rebnode__tgt { color: var(--muted); }

/* 근거 자료 */
.ev-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.ev-list--sub { margin: 8px 0 2px; }
.ev-cap { font-size: 11px; color: var(--muted); font-family: var(--font-mono); margin-bottom: 4px; }
.ev-item { border: 1.5px solid var(--line-soft); border-left: 3px solid var(--blue); border-radius: var(--r2); padding: 8px 10px; background: var(--paper); }
.ev-item--wd { border-style: dashed; border-left-color: var(--line-soft); }
.ev-act { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.ev-meta { font-size: 11px; color: var(--muted); }
.ev-text { font-size: 14px; margin: 3px 0; line-height: 1.5; }
.ev-img { max-width: 100%; max-height: 160px; border-radius: 6px; border: 1px solid var(--line-soft); cursor: zoom-in; display: block; margin-top: 4px; }
.ev-link { font-size: 12px; word-break: break-all; color: var(--blue); display: inline-block; margin-top: 4px; }
.rebbtn { background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; font-family: var(--font-serif); font-size: 13px; }
.rebbtn::before { content: "⤳ "; }
.rebbtn--muted { color: var(--muted); }
.rebbtn--muted::before { content: ""; }
.modal__actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- records ---------- */
.records { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.records__bar { display: flex; gap: 9px; margin-bottom: 12px; flex-wrap: wrap; }
.records__list { overflow: auto; display: flex; flex-direction: column; gap: 9px; flex: 1 1 auto; min-height: 0; }
.rec { display: flex; gap: 12px; font-size: 14px; padding: 7px 10px; border: 1.5px solid var(--line-soft); border-radius: var(--r2); background: var(--paper); }
.rec__t { font-family: var(--font-mono); font-size: 12px; color: var(--muted); flex: none; padding-top: 1px; }
.rec .cid { color: var(--accent); font-family: var(--font-mono); font-weight: 700; }
.rec--withdraw { border-style: dashed; }

/* ===================== modal ===================== */
.modal-back { position: fixed; inset: 0; background: var(--modal-back); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 50; }
.modal { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r1); width: min(520px, 100%); max-height: 88vh; overflow: auto; padding: 22px 22px 20px; box-shadow: 5px 7px 0 rgba(33,31,27,.12); }
.modal h3 { margin: 0 0 4px; font-size: 21px; }
.modal__sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.modal__close { float: right; background: none; border: none; cursor: pointer; font-family: var(--font-mono); color: var(--muted); font-size: 18px; }
.kv { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin: 3px 0; }
.history { border-left: 3px solid var(--line-soft); padding-left: 12px; margin-top: 10px; }
.history .h-ver { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.history .h-txt { font-size: 14px; margin: 2px 0 10px; line-height: 1.5; }
.history .h-txt.strike { color: var(--muted); }
.src-link { color: var(--accent); word-break: break-all; font-size: 13px; }
.invite-row { display: flex; gap: 8px; align-items: center; }
.invite-row input { flex: 1; font-family: var(--font-mono); font-size: 12px; }

/* ===================== toast ===================== */
.toast-root { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 80; pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); animation: toastin .18s ease; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* ===================== mobile nav ===================== */
.mobilenav { display: none; }

@media (max-width: 920px) {
  /* 고정 높이 레이아웃: rhead(상단) + rgrid(내부 스크롤) + 하단탭(흐름 고정).
     → 페이지 자체가 스크롤되지 않아 입력바가 하단에 유지되고 가로 스와이프가 없다. */
  .room { height: 100vh; height: 100dvh; padding: 8px 10px 0; }
  .rhead__top { gap: 8px; }
  .rhead__people { width: 100%; order: 3; }
  .rhead__actions { order: 2; flex-wrap: wrap; }
  .rgrid { display: block; overflow: hidden; padding: 10px 0 0; }
  .col { display: none; height: 100%; min-height: 0; }
  .col.is-active { display: flex; flex-direction: column; }
  /* 채팅: 메시지 영역만 내부 스크롤, 입력바는 컬럼 하단에 고정 */
  .chat { min-height: 0; flex: 1 1 auto; }
  .records { min-height: 0; }
  #inputZone { flex: none; }
  /* 주장/합의 컬럼은 컬럼 자체를 스크롤 */
  .col--left.is-active { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .lbody { max-height: none; overflow: visible; }

  .mobilenav {
    display: flex;
    flex: none;
    background: var(--paper);
    border-top: 1.5px solid var(--line);
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    gap: 7px;
  }
  .mobilenav .pill { flex: 1; justify-content: center; }
  .landing__cards { grid-template-columns: 1fr; }
  .msg { max-width: 88%; }
}

@media (max-width: 920px) and (min-width: 561px) {
  /* nothing extra */
}

/* ===================== print (PDF export of records) ===================== */
@media print {
  body { background: #fff; }
  #app > *:not(.printing) { display: none !important; }
  .printing { display: block !important; }
  .records__bar, .mobilenav { display: none !important; }
  .rec { break-inside: avoid; border-color: #999; }
}

/* ===================== 추가 기능 (비밀방·알림·분석·이용방법 등) ===================== */
/* 깜빡이는 투표 버튼 */
@keyframes elenchos-blink { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.blink { animation: elenchos-blink 1s ease-in-out infinite; }

/* 메인 카드 잠금 뱃지 */
.rbadge--lock { color: var(--accent); border-color: var(--accent); }

/* 방 설정 모달 */
.modal--settings { width: min(560px, 100%); }
.settings-hr { border: none; border-top: 1.5px dashed var(--line-soft); margin: 18px 0 4px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 14px; color: var(--ink-2); }
label.setting-row { cursor: pointer; }
.setting-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); flex: none; margin: 0; }
.setting-row > span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.setting-row__btns { display: inline-flex; gap: 6px; flex: none; }

/* 이용 방법 모달 */
.modal--help { width: min(680px, 100%); }
.help h4 { margin: 18px 0 6px; font-size: 15px; color: var(--accent); }
.help ul { margin: 0; padding-left: 19px; }
.help li { font-size: 13.5px; line-height: 1.62; color: var(--ink-2); margin-bottom: 3px; }
.help li b { color: var(--ink); }
.modal__foot--wrap { flex-wrap: wrap; }

/* 알림(🔔) */
.home__notifwrap { position: relative; display: inline-flex; }
.notif-badge { position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-family: var(--font-mono); display: flex; align-items: center; justify-content: center; line-height: 1; }
.notif-badge[hidden] { display: none; }
.notif-panel { position: absolute; top: calc(100% + 8px); right: 0; width: min(320px, 86vw); background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px; box-shadow: 4px 6px 0 rgba(0,0,0,.14); z-index: 40; overflow: hidden; }
.notif-panel__head { padding: 10px 12px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); border-bottom: 1.5px dashed var(--line-soft); }
.notif-off { float: right; cursor: pointer; }
.notif-off::before { content: ""; }
.notif-item { display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--line-soft); padding: 10px 12px; cursor: pointer; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--paper-2); }
.notif-item__t { display: block; font-size: 13px; color: var(--ink); font-weight: 700; }
.notif-item__s { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.notif-empty { padding: 14px 12px; font-size: 13px; color: var(--muted); margin: 0; }

/* Claude 토론 분석 */
.claude-ic { width: 16px; height: 16px; border-radius: 4px; vertical-align: -3px; }
.btn--claude { display: inline-flex; align-items: center; gap: 6px; }
.modal--analyze { width: min(620px, 100%); }
.modal--analyze textarea { min-height: 64px; }
.analyze-out { margin-top: 14px; border-top: 1.5px dashed var(--line-soft); padding-top: 12px; }
.analyze-loading { color: var(--muted); font-size: 14px; padding: 8px 0; }
.analyze-err { color: var(--accent); font-size: 14px; white-space: pre-wrap; }
.analyze-text { white-space: pre-wrap; font-size: 14px; line-height: 1.7; color: var(--ink); max-height: 46vh; overflow: auto; }

@media (max-width: 920px) {
  .notif-panel { position: fixed; top: 58px; right: 10px; left: 10px; width: auto; }
}

/* 참여자 모달 */
.modal--participants { width: min(420px, 100%); }
.plist__sec { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
.plist { border: 1.5px solid var(--line-soft); border-radius: 10px; overflow: hidden; }
.prow { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.prow:last-child { border-bottom: none; }
.prole { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--accent); border: 1.5px solid var(--accent); border-radius: 999px; padding: 1px 8px; }
.pdot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; background: transparent; }
.pdot--on { background: var(--green, #3a9d5d); border-color: var(--green, #3a9d5d); }

/* AI 분석글 (채팅 공유) */
.ai-ic { width: 15px; height: 15px; border-radius: 4px; vertical-align: -3px; }
.msg--ai { max-width: 92% !important; align-self: center; width: 100%; }
.msg__meta--ai { color: var(--accent); font-weight: 700; }
.msg__bubble--ai { border: 1.5px solid var(--accent); background: var(--accent-soft); border-radius: 12px; }
.analyze-actions { margin-top: 12px; }

/* 읽음/안읽음 표시 */
.read-mark { display: block; font-size: 11px; font-family: var(--font-mono); margin-top: 3px; line-height: 1; }
.read-mark--read { color: var(--ink-2); }
.read-mark--unread { color: var(--accent); font-weight: 700; }
.msg--me .read-mark { text-align: right; }
.event-line .read-mark { display: inline; margin-left: 8px; font-weight: 700; }

/* 프로필 메뉴 / 건의함 */
.modal--profile { width: min(380px, 100%); }
.pmenu { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.pmenu .btn { width: 100%; }
.modal--suggestbox { width: min(560px, 100%); }
.sug-list { max-height: 56vh; overflow: auto; display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.sug-item { border: 1.5px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; }
.sug-meta { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.sug-text { font-size: 14px; line-height: 1.55; white-space: pre-wrap; }
.sug-reply { margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.sug-replybox { display: flex; gap: 6px; margin-top: 8px; }
.sug-replybox .field { flex: 1; min-width: 0; }

/* 대화 태그 */
.tag-grid { max-height: 40vh; overflow: auto; border: 1.5px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; margin-top: 4px; }
.tag-group { margin-bottom: 10px; }
.tag-group:last-child { margin-bottom: 0; }
.tag-group__name { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; border: 1.5px solid var(--line-soft); background: var(--paper); color: var(--ink-2); cursor: pointer; font-family: inherit; }
.tag-chip:hover { border-color: var(--accent); }
.tag-chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.roomcard__tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.rtag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--paper-3); color: var(--ink-2); border: 1px solid var(--line-soft); }
.home__tagbtn { white-space: nowrap; }
.modal--tagfilter { width: min(560px, 100%); }

/* 잠수(미응답) 배너 */
.inactive-banner { border-color: var(--accent) !important; }

/* 이용 방법 카테고리 버튼 */
.help-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.help-cat { cursor: pointer; }
.help-cat.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 용어 정의 (제안/승인) */
.term--pending { opacity: .92; }
.term__meta { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.term__meta .btn { margin-left: 6px; }
.linklike-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 4px; }
.linklike-x:hover { color: var(--accent); }
