/* 535: 사이드바 접기, 폰 서랍 스크롤, 하나로 합친 안내 창. room-layout-519.css 뒤에 불러온다. */

/* ---------- 사이드바: 방과 참가자·초대를 각각 접는다 ---------- */
.room-workspace .rooms-pane { overflow: hidden; }
.rooms-pane .side-scroll {
  flex: 1 1 0; min-height: 0; min-width: 0;
  display: flex; flex-direction: column;
}
.rooms-pane .pane-topbar { flex-wrap: nowrap; gap: .25rem; padding-inline: 1rem .5rem; }
.rooms-pane .pane-topbar .chat-header-right { gap: 0; }
.rooms-pane .side-head {
  flex: none; box-sizing: border-box; min-height: 48px;
  padding: .25rem .6rem .25rem .35rem; gap: .5rem;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.side-head-title { flex: 1 1 auto; min-width: 0; margin: 0; font-size: inherit; }
.side-fold {
  display: flex; align-items: center; gap: .4rem;
  width: 100%; min-height: 40px; padding: .3rem .5rem;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text);
  text-align: start; cursor: pointer; list-style: none;
}
.side-fold::-webkit-details-marker { display: none; }
.side-fold:is(:hover, :focus-visible) { background: var(--accent-soft); }
.side-fold:focus-visible { outline: 2px solid var(--mailbox-highlight); outline-offset: -2px; }
.side-fold:disabled { cursor: default; background: transparent; }
.side-fold > .icon { flex: none; transform: rotate(-90deg); transition: transform .16s ease; }
.side-fold[aria-expanded="true"] > .icon,
.sidebar-members[open] > .side-fold > .icon { transform: none; }
.side-fold-label {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: "Gowun Batang", serif; font-size: 1.02rem; font-weight: 700;
}
.side-count {
  flex: none; margin-inline-start: auto; padding-inline: .15rem;
  color: var(--muted); font-size: var(--fs-13); font-weight: 600; font-variant-numeric: tabular-nums;
}
.side-count:empty { display: none; }

/* 방 목록은 남는 높이를 쓴다. 참가자를 접어도 목록을 반으로 자르지 않는다. */
.room-workspace .rooms-list { padding-top: .35rem; }
.room-workspace[data-members-folded="true"] .rooms-list { flex: 1 1 0; max-height: none; }
.room-workspace .sidebar-members { flex: none; padding-block: 0; border-top: 1px solid var(--line); background: var(--surface); }
.room-workspace .sidebar-members > summary {
  box-sizing: border-box; width: auto; min-height: 48px; margin: 0; padding: .25rem .9rem .25rem .85rem;
  border-radius: 0; border-bottom: 1px solid transparent; background: var(--surface); font-size: inherit;
}
.room-workspace .sidebar-members[open] > summary { border-bottom-color: var(--line); }
.room-workspace .sidebar-members .members-toolbar { padding: .6rem .75rem .4rem; }
.room-workspace .sidebar-splitter { flex-basis: 12px; border-block: 0; border-top: 1px solid var(--line); background: var(--surface); }
.room-workspace .sidebar-splitter::after { width: 32px; height: 3px; background: var(--line-strong); }

.side-foot {
  flex: none; display: flex; align-items: stretch;
  border-top: 1px solid var(--line); background: var(--surface);
}
.side-foot > * {
  flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .4rem .5rem; border: 0; background: transparent;
  color: var(--muted); font-size: var(--fs-13); font-weight: 600; text-decoration: none; cursor: pointer;
}
.side-foot > * + * { border-inline-start: 1px solid var(--line); }
.side-foot > *:is(:hover, :focus-visible) { color: var(--text); background: var(--accent-soft); }
.side-foot > *:focus-visible { outline: 2px solid var(--mailbox-highlight); outline-offset: -2px; }
.rooms-pane .side-foot .room-plaza { padding: .4rem .5rem; min-height: 44px; font-weight: 600; color: var(--muted); }

/* 사이드바 통째 접기: 좁은 띠만 남긴다(PC).
   조건은 폰·낮은 창 배치 "(max-width: 960px), (max-height: 500px) and (max-width: 1100px)"의 정확한 여집합이다.
   그 배치에서는 사이드바가 서랍으로 들어가므로 접힘 표시가 저장돼 있어도 대화 영역을 줄이지 않는다. */
.side-strip { display: none; }
.side-collapse .icon { transition: transform .16s ease; }
@media (min-width: 1101px), (min-width: 961px) and (min-height: 501px) {
  .room-workspace[data-sidebar-folded="true"] { grid-template-columns: 52px minmax(0, 1fr); }
  .room-workspace[data-sidebar-folded="true"] > .rooms-pane { display: flex; }
  .room-workspace[data-sidebar-folded="true"] > .rooms-pane > :not(.side-strip) { display: none; }
  .room-workspace[data-sidebar-folded="true"] .side-strip:not([hidden]) {
    display: flex; flex-direction: column; align-items: center; gap: .25rem; padding-top: .6rem;
  }
  .side-strip .icon-btn { inline-size: 40px; block-size: 40px; color: var(--text); }
  .side-strip .icon-btn:is(:hover, :focus-visible) { background: var(--accent-soft); }
}

/* ---------- 폰 서랍: 목록 전체가 한 번에 스크롤된다 ---------- */
@media (max-width: 960px), (max-height: 500px) and (max-width: 1100px) {
  .rooms-drawer[open] { width: min(360px, 100%); }
  .rooms-drawer .rooms-pane { overflow: hidden; }
  .rooms-drawer .side-scroll {
    display: block; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  }
  .rooms-drawer .rooms-list,
  .rooms-drawer .sidebar-members .members-body,
  .room-workspace[data-room-list-folded="true"] .rooms-drawer .sidebar-members .members-body,
  .rooms-drawer .sidebar-splitter + .sidebar-members[open] .members-body,
  .rooms-drawer .assistant-shortcuts {
    flex: none; max-height: none; min-height: 0; overflow: visible;
  }
  .rooms-drawer .sidebar-members[open],
  .room-workspace[data-room-list-folded="true"] .rooms-drawer .sidebar-members[open] { display: block; flex: none; }
  .rooms-drawer .sidebar-members[open]::details-content { display: block; }
  .rooms-drawer .sidebar-splitter { display: none; }
  /* 두 머리글은 스크롤해도 위에 붙어 있어 어디서든 접을 수 있다. */
  .rooms-drawer .side-head { position: sticky; top: 0; z-index: 3; }
  .rooms-drawer .sidebar-members > summary { position: sticky; top: 48px; z-index: 2; }
  .room-workspace[data-room-list-folded="true"] .rooms-drawer .sidebar-members > summary { top: 48px; }
  .rooms-drawer .side-fold { min-height: 44px; }
  .rooms-drawer .side-foot { padding-bottom: env(safe-area-inset-bottom); }
}

/* ---------- 안내 창: 첫 화면과 방 안에서 같은 창, 같은 크기 ---------- */
.guide-dialog {
  box-sizing: border-box;
  width: min(960px, 80vw); height: min(820px, 80dvh);
  max-width: none; max-height: none; margin: auto; padding: 0;
  border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); overflow: hidden;
}
.guide-dialog::backdrop { background: var(--backdrop); }
.guide-shell {
  display: grid; height: 100%;
  grid-template: "head head" auto "tabs body" minmax(0, 1fr) / 13.5rem minmax(0, 1fr);
}
.guide-head {
  grid-area: head; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem .75rem .75rem 1.5rem; border-bottom: 1px solid var(--line);
}
.guide-head h2 { margin: 0; font-size: 1.4rem; line-height: 1.3; outline: none; }
.guide-head .icon-btn { min-inline-size: var(--touch-min); min-block-size: var(--touch-min); }
.guide-tabs {
  grid-area: tabs; display: flex; flex-direction: column; gap: 2px; padding: .75rem .6rem;
  border-inline-end: 1px solid var(--line); background: var(--surface-subtle); overflow: auto;
}
.guide-tab {
  flex: none; min-height: 44px; padding: .5rem .8rem; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font-size: var(--fs-14); font-weight: 600; text-align: start; cursor: pointer;
}
.guide-tab:hover { color: var(--text); }
.guide-tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.guide-tab:focus-visible { outline: 2px solid var(--mailbox-highlight); outline-offset: -2px; }
.guide-body {
  grid-area: body; min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 1.5rem 2rem 2.25rem;
  line-height: var(--lh-relaxed, 1.65);
}
.guide-body:focus-visible { outline: 2px solid var(--mailbox-highlight); outline-offset: -2px; }
.guide-section {
  display: flex; flex-direction: column; gap: var(--sp-4); max-width: 44rem;
  padding: 0; border: 0; border-radius: 0; background: transparent;
  word-break: keep-all; overflow-wrap: anywhere;
}
.guide-section > h3:first-child { margin: 0; font-size: 1.3rem; line-height: 1.35; }
.guide-section h2 { margin: 0; font-size: 1.3rem; }
.guide-section h3 { margin: .5rem 0 0; font-size: 1.05rem; }
.guide-section h4 { margin: .75rem 0 0; font-size: 1rem; }
.guide-section :is(p, ul, ol) { margin: 0; }
.guide-section .mailbox-faq-filters .btn { min-height: var(--touch-min); }
.guide-state { display: flex; flex-direction: column; gap: .75rem; margin: 0; color: var(--muted); }
.guide-state p { margin: 0; }

@media (max-width: 640px) {
  .guide-dialog {
    width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh;
    margin: 0; border: 0; border-radius: 0;
  }
  .guide-shell { grid-template: "head" auto "tabs" auto "body" minmax(0, 1fr) / minmax(0, 1fr); }
  .guide-head { padding: max(.5rem, env(safe-area-inset-top)) .5rem .5rem 1rem; }
  .guide-head h2 { font-size: 1.2rem; }
  .guide-tabs {
    flex-direction: row; gap: 0; padding: 0 .5rem; overflow-x: auto; scrollbar-width: none;
    border-inline-end: 0; border-bottom: 1px solid var(--line);
  }
  .guide-tab { white-space: nowrap; border-radius: 0; padding-inline: .7rem; }
  .guide-tab[aria-selected="true"] { background: transparent; box-shadow: inset 0 -3px 0 var(--accent); }
  .guide-body { padding: 1rem 1rem max(1.5rem, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .side-fold > .icon, .side-collapse .icon { transition: none; }
}

/* 541: 처음 온 사람용 4단계 안내(첫 화면·열쇠 화면) */
.first-steps { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.first-steps > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 14px; cursor: pointer; list-style: none; font-weight: 600; }
.first-steps > summary::-webkit-details-marker { display: none; }
.first-steps > summary::after { content: ""; width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); margin: -4px 2px 0 0; }
.first-steps[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.first-steps-title { flex: 1; }
.first-steps-count { color: var(--muted); font-weight: 400; font-size: var(--fs-13); }
.first-steps > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 12px; }
.first-steps ol { margin: 0; padding: 4px 14px 0; list-style: none; counter-reset: first-step; display: grid; gap: 12px; }
.first-steps li { counter-increment: first-step; display: grid; grid-template-columns: 24px 1fr; column-gap: 10px; row-gap: 2px; text-align: left; }
.first-steps li::before { content: counter(first-step); grid-row: span 2; width: 24px; height: 24px; border-radius: 6px; background: var(--surface-subtle); color: var(--text); font-size: var(--fs-13); display: grid; place-items: center; }
.first-steps li strong { font-weight: 600; }
.first-steps li span { color: var(--muted); font-size: var(--fs-14); line-height: 1.5; word-break: keep-all; }
.first-steps > .field-hint { margin: 12px 14px 14px; }
.hero-card > .first-steps { grid-column: 1 / -1; }
@media (min-width: 860px) { .hero-card > .first-steps ol { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 20px; } }
.first-steps li { align-content: start; } .first-steps li::before { align-self: start; }
