/* 퇴마학교 — 먹빛 밤의 학적부
   먹(배경) · 한지빛(글자) · 부적 황지(주요 버튼·현재 위치) · 주사(경고·인장).
   한 가지 어두운 화면으로 통일한다. */
:root {
  --paper: #0d0e12;      /* 바탕: 먹 */
  --paper-2: #1b1c22;    /* 움푹한 곳: 입력칸·막대 */
  --sheet: #15161b;      /* 기록지 */
  --sheet-2: #1d1e25;    /* 기록지 위 강조 */
  --ink: #ece4d2;        /* 글자: 한지빛 */
  --ink-2: #c3baa7;
  --ink-3: #91897b;
  --rule: #2a292e;
  --rule-2: #3b3934;
  --gold: #e3b955;       /* 부적 황지: 주요 버튼·현재 위치 */
  --gold-ink: #17120a;
  --gold-soft: #2a2313;
  --link: #e8c77a;
  --cinnabar: #e2644c;   /* 주사: 경고·인장 */
  --cinnabar-soft: #301913;
  --jade: #86c0a7;       /* 성공·가능 */
  --jade-soft: #14251f;
  --amber: #e8c15e;
  --amber-soft: #2a2312;
  --me: #211e17;
  --hdr: rgba(11, 12, 15, .92);
  --radius-s: 6px;
  --radius-m: 10px;
  --serif: "Gowun Batang", "Noto Serif KR", "AppleMyungjo", serif;
  --sans: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --focus: 0 0 0 3px rgba(227, 185, 85, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); }
body { margin: 0; color: var(--ink); font: 16px/1.65 var(--sans); min-height: 100vh; word-break: keep-all; overflow-wrap: break-word;
       background: radial-gradient(1100px 520px at 50% -260px, rgba(227, 185, 85, .08), transparent 70%),
                   radial-gradient(900px 600px at 100% 120%, rgba(226, 100, 76, .05), transparent 70%), var(--paper);
       background-attachment: fixed; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.3; margin: 0 0 .6em; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
::selection { background: rgba(227, 185, 85, .35); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sr-only:focus { position: fixed; z-index: 99; left: 16px; top: 16px; width: auto; height: auto; clip: auto; background: var(--gold); color: var(--gold-ink); padding: 8px 12px; border-radius: 6px; }
.muted { color: var(--ink-3); } .small { font-size: .875rem; } .tiny { font-size: .78rem; }
.prose { max-width: 68ch; }
.nowrap { white-space: nowrap; }

/* ── 머리: 학교 인장 + 핵심 메뉴 5개 + 알림·내 캐릭터 ── */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 31; background: var(--hdr); }
.hdr { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: var(--hdr); backdrop-filter: blur(8px);
       border-bottom: 1px solid var(--rule); }
.hdr-in { max-width: 1160px; margin: 0 auto; display: flex; align-items: center; gap: 18px; min-height: 60px;
          padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none; }
.brand-seal { width: 34px; height: 34px; border: 2px solid var(--cinnabar); color: var(--cinnabar); display: grid; place-items: center;
              font-family: var(--serif); font-weight: 700; font-size: 18px; border-radius: 4px; transform: rotate(-4deg);
              background: rgba(226, 100, 76, .1); flex: none; }
.brand-name { font-family: var(--serif); font-size: 1.05rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: flex; gap: 2px; flex: 1; justify-content: center; }
.topnav a { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 8px;
            color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .98rem; }
.topnav a .glyph { font-family: var(--serif); font-size: .9rem; color: var(--ink-3); }
.topnav a:hover { color: var(--ink); background: rgba(255, 255, 255, .04); }
.topnav a[aria-current="page"] { color: var(--ink); }
.topnav a[aria-current="page"] .glyph { color: var(--gold); }
.topnav a[aria-current="page"]::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -11px; height: 2px; background: var(--gold); border-radius: 2px; }
.hdr-tools { display: flex; align-items: center; gap: 14px; flex: none; }
.bell { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--ink-2); border: 1px solid var(--rule); }
.bell:hover, .bell[aria-current="page"] { color: var(--gold); border-color: var(--rule-2); }
.bell .badge { position: absolute; top: -4px; right: -6px; }
.me-chip { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.me-chip .avatar { border-radius: 50%; }
.me-chip span { display: grid; line-height: 1.2; }
.me-chip b { font-weight: 600; font-size: .9rem; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-chip small { color: var(--ink-3); font-size: .74rem; }
.logout .linkbtn { color: var(--ink-3); text-decoration: none; }
.logout .linkbtn:hover { color: var(--ink); }
.badge { display: inline-block; background: var(--cinnabar); color: #fff; border-radius: 999px; font: 700 .7rem/1.6 var(--sans); padding: 0 6px; min-width: 19px; text-align: center; }
.badge.soft { background: rgba(255, 255, 255, .16); }

/* 하위 메뉴 줄: 메뉴를 누르면 그 아래 열린다 */
.subnav { border-top: 1px solid var(--rule); background: rgba(21, 22, 27, .7); }
.subnav-in { max-width: 1160px; margin: 0 auto; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
             padding-block: 7px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.subnav-in::-webkit-scrollbar { display: none; }
.subnav a { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; font-size: .9rem;
            color: var(--ink-2); text-decoration: none; border: 1px solid transparent; }
.subnav a:hover { color: var(--ink); border-color: var(--rule-2); }
.subnav a[aria-current="page"] { background: var(--gold); color: var(--gold-ink); font-weight: 700; }
.subnav a[aria-current="page"] .badge { background: var(--gold-ink); color: var(--gold); }

main { max-width: 1160px; margin: 0 auto; width: 100%; padding-block: 18px 80px;
       padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
main.public { padding-block: 28px 60px; }
/* 현재 위치 + 교실로 돌아가기 */
.crumbs { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; font-size: .88rem; }
.home-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--rule-2);
            color: var(--ink); text-decoration: none; font-weight: 600; background: var(--sheet); }
.home-btn:hover { border-color: var(--gold); color: var(--gold); }
.crumb-path { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-3); min-width: 0; }
.crumb-path a { color: var(--ink-3); text-decoration: none; }
.crumb-path a:hover { color: var(--ink); text-decoration: underline; }
.crumb-path a[aria-current="page"] { color: var(--ink-2); }
.crumb-path .sep { color: var(--rule-2); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }

/* 휴대폰: 아래 탭 5개 (위 메뉴와 같은 5개) */
.tabbar { display: none; }
@media (max-width: 860px) {
  .hdr { position: relative; top: 0; }
  .hdr-in { min-height: 54px; gap: 10px; }
  .topnav, .me-chip, .logout { display: none; }
  .brand { flex: 1; min-width: 0; }
  main { padding-block: 14px 104px; }
  h1 { font-size: 1.5rem; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
            background: rgba(11, 12, 15, .96); border-top: 1px solid var(--rule); backdrop-filter: blur(8px);
            padding: 6px max(4px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px)); }
  .tabbar a { text-align: center; text-decoration: none; color: var(--ink-3); font-size: .74rem; padding: 4px 0 2px; position: relative; border-radius: 8px; }
  .tabbar a span.glyph { display: block; font-family: var(--serif); font-size: 1.2rem; line-height: 1.25; }
  .tabbar a[aria-current="page"] { color: var(--gold); font-weight: 700; }
  .tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: -7px; left: 36%; right: 36%; height: 2px; background: var(--gold); border-radius: 2px; }
  .tabbar .badge { position: absolute; top: 0; right: 30%; }
  .crumbs { margin-bottom: 14px; }
  .subnav-in.more { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); }
}

/* ── 기록지(시트) ── */
.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 20px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03); }
@media (max-width: 860px) { .sheet { padding: 16px; } }
.sheet + .sheet, .grid + .sheet, .sheet + .grid, .grid + .grid, .places + p { margin-top: 16px; }
.grid > .sheet + .sheet { margin-top: 0; }
.sheet h2 { font-size: 1.12rem; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .grid-2, .grid-3, .grid-main { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: 12px; }

/* 기록 목록 (학적부의 줄) */
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger > li { border-top: 1px solid var(--rule); padding: 12px 0; display: flex; gap: 12px; align-items: center; }
.ledger > li:first-child { border-top: 0; }
.ledger .grow { flex: 1; min-width: 0; }
.ledger .title { font-weight: 600; }
.ledger .sub { color: var(--ink-3); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger a.rowlink { color: inherit; text-decoration: none; display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; }
.ledger a.rowlink:hover .title { text-decoration: underline; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.facts dt { color: var(--ink-3); font-size: .88rem; }
dl.facts dd { margin: 0; }

/* 아바타: 인장 테두리 */
.avatar { display: inline-grid; place-items: center; object-fit: cover; flex: none; border-radius: 8px; background: var(--paper-2);
          border: 1px solid var(--rule); color: var(--ink-2); font-family: var(--serif); font-weight: 700; }
.avatar-sm { width: 34px; height: 34px; font-size: .95rem; }
.avatar-md { width: 46px; height: 46px; font-size: 1.15rem; }
.avatar-lg { width: 112px; height: 112px; font-size: 2.6rem; border-radius: 14px; }

/* 상태 표지 */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: .78rem;
       border: 1px solid var(--rule); color: var(--ink-2); background: var(--paper); white-space: nowrap; }
.tag.jade { background: var(--jade-soft); color: var(--jade); border-color: transparent; }
.tag.amber { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.tag.red { background: var(--cinnabar-soft); color: var(--cinnabar); border-color: transparent; }
.tag.ink { background: var(--gold-soft); color: var(--gold); border-color: rgba(227, 185, 85, .35); }

/* ── 버튼·폼 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 700 .95rem/1 var(--sans); padding: 11px 16px;
       border-radius: var(--radius-s); border: 1px solid var(--gold); background: var(--gold); color: var(--gold-ink); cursor: pointer; text-decoration: none; min-height: 42px;
       box-shadow: 0 0 0 0 rgba(227, 185, 85, 0); transition: box-shadow .15s, filter .15s; }
.btn:hover { filter: brightness(1.06); box-shadow: 0 0 18px rgba(227, 185, 85, .22); }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--rule-2); font-weight: 600; }
.btn.secondary:hover { border-color: var(--ink-3); filter: none; box-shadow: none; }
.btn.jade { background: var(--jade); border-color: var(--jade); color: #0c1a14; }
.btn.danger { background: transparent; color: var(--cinnabar); border-color: var(--cinnabar); font-weight: 600; }
.btn.danger:hover { background: var(--cinnabar-soft); box-shadow: none; }
.btn.small { padding: 6px 10px; min-height: 32px; font-size: .85rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; filter: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--link); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn.danger { color: var(--cinnabar); }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.field .hint { font-weight: 400; color: var(--ink-3); font-size: .82rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #0f1014; border: 1px solid var(--rule-2); border-radius: var(--radius-s); padding: 9px 11px; }
input::placeholder, textarea::placeholder { color: #6f695f; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: var(--focus); }
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 5px; }
fieldset { border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 14px; margin: 0 0 14px; }
legend { font-weight: 700; padding: 0 6px; }

/* ── 알림 메시지 ── */
.flashes { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.flash { padding: 11px 14px; border-radius: var(--radius-s); border: 1px solid var(--rule); background: var(--sheet); }
.flash.success { border-color: var(--jade); background: var(--jade-soft); }
.flash.error { border-color: var(--cinnabar); background: var(--cinnabar-soft); }
.flash.info { border-color: var(--rule); }

/* ── 부적: 7일 제한 안내 (사이트에서 가장 강한 시각 요소) ── */
.talisman { position: relative; background: linear-gradient(var(--cinnabar-soft), var(--sheet)); border: 2px solid var(--cinnabar); border-radius: 4px; padding: 16px 18px 16px 64px; margin-bottom: 18px; }
.talisman::before { content: "禁"; position: absolute; left: 14px; top: 14px; width: 36px; height: 36px; display: grid; place-items: center;
                    background: var(--cinnabar); color: #fff; font-family: var(--serif); font-size: 20px; border-radius: 3px; }
.talisman h2 { color: var(--cinnabar); font-size: 1.05rem; margin-bottom: .3em; }
.talisman p { margin: 0 0 .5em; }
.talisman ul { margin: .4em 0 .8em; padding-left: 1.1em; }
.talisman.compact { padding: 10px 14px 10px 50px; border-width: 1.5px; }
.talisman.compact::before { width: 26px; height: 26px; font-size: 15px; left: 12px; top: 10px; }
.talisman.compact p { margin: 0; font-size: .92rem; }
.talisman.compact strong { color: var(--cinnabar); font-family: var(--serif); margin-right: 6px; }

/* 기한 막대 */
.deadline { height: 4px; background: var(--paper-2); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.deadline > i { display: block; height: 100%; background: var(--jade); }
.deadline.warn > i { background: var(--amber); }
.deadline.over > i { background: var(--cinnabar); }

/* ── 채팅 ── */
.room { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .room { grid-template-columns: minmax(0, 1fr); } }
.room-main { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-m); display: flex; flex-direction: column;
             height: calc(100vh - 110px); min-height: 460px; }
@media (max-width: 860px) { .room-main { height: calc(100dvh - 210px); } }
.room-head { padding: 12px 16px; border-bottom: 1px solid var(--rule); display: flex; gap: 12px; align-items: center; }
.room-place { font-family: var(--serif); }
.lockbar { border: 2px solid var(--cinnabar); background: var(--cinnabar-soft); border-radius: 4px; padding: 8px 12px; margin-bottom: 12px;
           display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: .92rem; }
.lockbar strong { color: var(--cinnabar); font-family: var(--serif); }
.lockbar a { color: var(--cinnabar); font-weight: 600; }
textarea:disabled, input:disabled, select:disabled { background: var(--paper-2); color: var(--ink-3); cursor: not-allowed; }
.log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { max-width: min(78%, 62ch); align-self: flex-start; }
.msg .body { background: var(--paper); border: 1px solid var(--rule); padding: 10px 13px; border-radius: 4px 14px 14px 14px;
             white-space: pre-wrap; word-break: break-word; line-height: 1.7; }
.msg .meta { font-size: .74rem; color: var(--ink-3); margin-top: 3px; padding: 0 4px; }
.msg.mine { align-self: flex-end; }
.msg.mine .body { background: var(--me); border-color: transparent; border-radius: 14px 4px 14px 14px; }
.msg.mine .meta { text-align: right; }
.msg.pending .body { opacity: .6; }
.msg.failed .body { border: 1px dashed var(--cinnabar); }
.msg-system { align-self: center; font-size: .82rem; color: var(--ink-3); font-family: var(--serif); text-align: center; padding: 4px 12px;
              border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.msg-prompt { align-self: center; max-width: 90%; font-size: .9rem; background: var(--amber-soft); color: var(--amber); padding: 8px 14px; border-radius: var(--radius-s); }
.composer { border-top: 1px solid var(--rule); padding: 10px; display: grid; gap: 8px; }
.composer textarea { min-height: 52px; max-height: 40vh; }
.composer-bar { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.composer .locked { color: var(--cinnabar); font-size: .88rem; }
.conn { font-size: .78rem; color: var(--ink-3); }
.conn.bad { color: var(--cinnabar); }
.prompt-card { background: var(--amber-soft); color: var(--ink); border-radius: var(--radius-s); padding: 10px 12px; font-size: .92rem; }

/* 장소 선택 (조우) */
.places { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .places { grid-template-columns: minmax(0, 1fr); } }
.place { border: 1px solid var(--rule); background: var(--sheet); border-radius: var(--radius-m); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.place h3 { margin: 0; font-size: 1.15rem; }
.place .btn { margin-top: auto; }
.waiting { border: 1px dashed var(--jade); background: var(--jade-soft); border-radius: var(--radius-m); padding: 18px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--jade); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } .log { scroll-behavior: auto; } }

/* 필터 탭 */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--ink-2); border: 1px solid var(--rule); background: var(--sheet); font-size: .9rem; }
.tabs a[aria-current="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 600; }

/* 선택형 이벤트 */
.scene { font-family: var(--serif); font-size: 1.12rem; line-height: 1.85; }
.choices { display: grid; gap: 8px; margin: 16px 0; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 12px 14px;
          background: var(--sheet); cursor: pointer; font-weight: 400; }
.choice:hover { border-color: var(--rule-2); }
.choice:has(input:checked) { border-color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); background: var(--gold-soft); }
.choice input { accent-color: var(--gold); }
.choice input { margin-top: 6px; }
.result-mark { display: inline-block; font-family: var(--serif); font-size: 1.3rem; padding: 4px 14px; border: 2px solid currentColor; border-radius: 4px; transform: rotate(-3deg); }

/* 감각 */
.senses { display: flex; gap: 6px; flex-wrap: wrap; }
.sense { font-family: var(--serif); width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--rule); font-size: .95rem; }
.sense.lost { background: var(--paper-2); color: var(--ink-3); border-color: var(--cinnabar); text-decoration: line-through; }
.sense.healing { border: 2px dashed var(--jade); color: var(--jade); }

.meter { display: flex; gap: 4px; }
.meter i { width: 22px; height: 10px; border-radius: 2px; background: var(--paper-2); border: 1px solid var(--rule); }
.meter i.on { background: var(--cinnabar); border-color: var(--cinnabar); }

/* 상점 */
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.item { border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--sheet); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.item-icon { width: 44px; height: 44px; display: grid; place-items: center; font-family: var(--serif); font-size: 1.4rem; background: var(--paper-2); border-radius: 8px; }
.item .price { font-weight: 700; }
.item form { margin-top: auto; display: flex; gap: 6px; }
.item form input { width: 64px; }

/* 표 */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.data th { color: var(--ink-3); font-weight: 600; background: var(--paper); position: sticky; top: 0; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
.policy select { padding: 4px 6px; font-size: .85rem; }
.policy select[data-mode="deny"] { color: var(--cinnabar); }
.policy select[data-mode="limited"] { color: var(--amber); }

details > summary { cursor: pointer; font-weight: 600; }
.empty { padding: 24px; text-align: center; color: var(--ink-3); border: 1px dashed var(--rule); border-radius: var(--radius-m); }
.empty .btn { margin-top: 10px; }

/* 랜딩 */
.landing { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.landing-art { background: radial-gradient(700px 500px at 20% 30%, rgba(226, 100, 76, .14), transparent 70%), linear-gradient(160deg, #15130f, #0a0b0e); border-right: 1px solid var(--rule); color: var(--ink); padding: clamp(28px, 6vw, 72px); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.landing-art .big-seal { font-family: var(--serif); font-size: clamp(120px, 20vw, 260px); line-height: 1; color: var(--cinnabar); opacity: .9;
                         border: 6px solid var(--cinnabar); width: max-content; padding: 0 .08em; border-radius: 10px; transform: rotate(-6deg); margin: 20px 0; }
.landing-art h1 { font-size: clamp(2rem, 4vw, 3.2rem); color: var(--ink); margin: 0; }
.landing-art p { color: var(--ink-2); max-width: 36ch; }
.landing-art a { color: var(--ink-2); }
.landing-form { padding: clamp(28px, 6vw, 72px); display: flex; flex-direction: column; justify-content: center; max-width: 520px; }
@media (max-width: 860px) { .landing { grid-template-columns: minmax(0, 1fr); } .landing-art { min-height: 46vh; border-right: 0; border-bottom: 1px solid var(--rule); } }
.auth-wrap { max-width: 440px; margin: 6vh auto; padding: 0 16px; }

/* ───────── v2: 게시글형 대화 스레드 ───────── */
.thread { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-m); min-width: 0; }
.posts { padding: 4px 18px 10px; display: flex; flex-direction: column; }
.post { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding-top: 14px; }
.post-av { position: relative; display: flex; justify-content: center; }
.post-av .avatar { position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 50%; }
/* 이어지는 글끼리 세로선으로 연결 */
.post:has(+ .post) .post-av::after { content: ""; position: absolute; top: 44px; bottom: -14px; left: 50%; width: 2px; transform: translateX(-50%); background: var(--rule); }
.post-main { min-width: 0; padding-bottom: 4px; }
.post-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.post-head b { font-family: var(--serif); font-size: 1.02rem; }
.post.mine .post-head b { color: var(--gold); }
.post-body { margin-top: 4px; white-space: pre-wrap; word-break: break-word; font-family: var(--serif); font-size: 1.02rem; line-height: 1.85; }
.post.pending .post-body { opacity: .6; }
.post-img { display: block; margin-top: 6px; max-width: min(100%, 360px); }
.post-img img { display: block; max-width: 100%; max-height: 420px; border-radius: 8px; border: 1px solid var(--rule); object-fit: contain; }
.post.pending .post-img { opacity: .6; }
.post.failed .post-body { border-left: 3px solid var(--cinnabar); padding-left: 8px; }
.post.failed .meta { color: var(--cinnabar); }
.posts .sys { align-self: center; font-family: var(--serif); font-size: .82rem; color: var(--ink-3); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 3px 12px; text-align: center; margin: 14px 0 2px; }
.posts .dice { align-self: center; font-size: .86rem; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 999px; padding: 3px 14px; margin: 10px 0 0; font-variant-numeric: tabular-nums; text-align: center; }
.pquote { margin: 14px 0 0 52px; border-left: 3px solid var(--amber); background: var(--amber-soft); padding: 8px 12px; border-radius: 0 6px 6px 0; }
.pquote .tiny { color: var(--amber); font-weight: 600; }
.pquote p { margin: 2px 0 0; }
.reply-box { border-top: 1px solid var(--rule); padding: 14px 18px; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; scroll-margin-bottom: 24px; }
.reply-box > .avatar { width: 40px; height: 40px; border-radius: 50%; }
.reply-main { display: grid; gap: 8px; min-width: 0; }
.reply-box textarea { min-height: 96px; width: 100%; font-family: var(--serif); line-height: 1.8; }
.scene-card { margin: 14px 18px 2px; padding: 12px 16px; background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; }
.scene-label { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.scene-seal { width: 20px; height: 20px; display: grid; place-items: center; border: 1.5px solid var(--cinnabar); color: var(--cinnabar); border-radius: 3px; font-family: var(--serif); font-size: .72rem; transform: rotate(-4deg); flex: none; }
.scene-text { margin: 8px 0 6px; font-family: var(--serif); font-size: 1.08rem; line-height: 1.75; text-wrap: pretty; }
@media (max-width: 860px) {
  .posts, .reply-box { padding-left: 12px; padding-right: 12px; }
  .post, .reply-box { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
  .post-av .avatar, .reply-box > .avatar { width: 34px; height: 34px; }
  .post:has(+ .post) .post-av::after { top: 38px; }
  .pquote { margin-left: 44px; }
  .scene-card { margin: 12px 12px 2px; padding: 10px 12px; }
  .reply-box { scroll-margin-bottom: 84px; }
}

/* 대련 기력 */
.pips { display: inline-flex; gap: 4px; vertical-align: middle; margin-left: 4px; }
.pips i { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--cinnabar); }
.pips i.on { background: var(--cinnabar); }

/* 순찰 추리 */
.probe-row { display: flex; gap: 8px; flex-wrap: wrap; }
.probe-row form { display: contents; }
.glyph-s { font-family: var(--serif); }
.clue { border-left: 3px solid var(--rule); padding-left: 12px; }
.clue b { font-size: .9rem; }
.clue p { margin: 2px 0 0; font-family: var(--serif); font-size: 1.02rem; line-height: 1.8; }
.mana { display: inline-flex; gap: 4px; vertical-align: middle; }
.mana i { width: 18px; height: 10px; border-radius: 2px; background: var(--paper-2); border: 1px solid var(--rule); }
.mana i.on { background: var(--jade); border-color: var(--jade); }
.guide-list { list-style: none; margin: 0; padding: 0; }
.guide-list > li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--rule); align-items: flex-start; }
.guide-list > li:first-child { border-top: 0; }
.guide-list .g { font-family: var(--serif); font-size: 1.15rem; width: 24px; flex: none; }
.guide-list ul { margin: 4px 0 0; padding-left: 1.1em; }
.note-ok { background: var(--jade-soft); border-radius: var(--radius-s); padding: 9px 12px; }
.note-warn { border: 1px dashed var(--cinnabar); border-radius: var(--radius-s); padding: 9px 12px; }
.stat-big { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; }

/* 게시판 */
.board-list > li { align-items: flex-start; }
.board-list .title a { color: inherit; text-decoration: none; }
.board-list .title a:hover { text-decoration: underline; }
.comment { border-top: 1px solid var(--rule); padding: 12px 0; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
.comment:first-child { border-top: 0; }
.comment .who { font-weight: 600; font-size: .92rem; }
.comment .text { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.admin-reveal { font-size: .76rem; color: var(--amber); background: var(--amber-soft); border-radius: 4px; padding: 0 6px; }
.article-body { white-space: pre-wrap; word-break: break-word; line-height: 1.8; }
.ic .article-body { font-family: var(--serif); font-size: 1.04rem; }
.link-card { display: flex; gap: 10px; align-items: center; border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 10px 12px; background: var(--paper); }

/* 버그 제보 (테스트 기간) */
#bugbtn { position: fixed; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  font: 600 .8rem/1 var(--sans); padding: 9px 12px; border-radius: 999px; border: 1px dashed var(--cinnabar); background: var(--sheet); color: var(--cinnabar); cursor: pointer; }
@media (max-width: 860px) { #bugbtn { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); } }
#bugpanel { position: fixed; inset: auto 16px 16px auto; z-index: 50; width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-m); box-shadow: 0 10px 40px rgba(0,0,0,.25); padding: 16px; }
#bugpanel img { max-width: 100%; border: 1px solid var(--rule); border-radius: 6px; }
#bugpanel textarea { min-height: 70px; }
.report-tools { display: inline-flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.report-tools details[open] { flex-basis: 100%; }
.linkbtn.tiny { font-size: .78rem; } .linkbtn.small { font-size: .875rem; }
.link-card .btn, .btn { white-space: nowrap; }
.link-card .btn { flex: none; }

/* ── 학교생활 한눈에 ── */
.hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.hub-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius-m); background: var(--sheet);
            border: 1px solid var(--rule); color: var(--ink); text-decoration: none; min-width: 0; transition: border-color .15s, background .15s; }
.hub-card:hover { border-color: rgba(227, 185, 85, .45); background: var(--sheet-2); }
.hub-card.quiet { background: transparent; border-style: dashed; }
.hub-glyph { width: 46px; height: 46px; flex: none; display: grid; place-items: center; font-family: var(--serif); font-size: 1.35rem; color: var(--gold);
             border: 1px solid rgba(227, 185, 85, .35); border-radius: 8px; background: var(--gold-soft); }
.hub-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.hub-body b { font-family: var(--serif); font-size: 1.1rem; }
.hub-body span { color: var(--ink-3); font-size: .86rem; }

/* ───────── 개인실 (로비) ───────── */
.room-card { background: var(--sheet); border: 1px solid var(--rule); border-radius: 14px; padding: 16px; margin-bottom: 14px; scroll-margin-top: 80px; }
.rc-head { display: flex; gap: 14px; align-items: center; }
.rc-head h1 { font-size: 1.5rem; margin: 0; }
.rc-head p { margin: 2px 0 0; color: var(--ink-3); font-size: .9rem; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rc-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rule-2); border-radius: 8px; padding: 7px 13px;
        font-size: .9rem; font-weight: 600; color: var(--ink); text-decoration: none; background: transparent; }
.pill:hover { border-color: var(--ink-3); }
.pill.on { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.info-panel { margin-top: 14px; border-top: 1px solid var(--rule); }
.info-panel .f { padding: 12px 0; border-bottom: 1px solid var(--rule); scroll-margin-top: 80px; }
.fl { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-3); margin-bottom: 6px; }
.fl .lock { font-size: .72rem; border: 1px solid var(--rule-2); border-radius: 4px; padding: 0 6px; }
.fl .pub { font-size: .72rem; border-radius: 4px; padding: 0 6px; background: var(--jade-soft); color: var(--jade); }
.fl .sec { font-size: .72rem; border-radius: 4px; padding: 0 6px; background: var(--cinnabar-soft); color: var(--cinnabar); }
.fl .cnt { margin-left: auto; font-size: .75rem; }
.fl .edit { font-size: .82rem; font-weight: 700; color: var(--gold); text-decoration: none; }
.trio { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 6px; }
.trio div { background: var(--paper-2); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.trio small { display: block; color: var(--ink-3); font-size: .74rem; }
.trio b { font-size: 1rem; overflow-wrap: anywhere; }
.txt { font: 1rem/1.8 var(--serif); color: var(--ink-2); background: var(--paper-2); border-radius: 8px; padding: 10px 12px;
       white-space: pre-wrap; max-height: 240px; overflow: auto; }
.hint { color: var(--ink-3); font-size: .8rem; margin: 6px 0 0; }
.fam { display: flex; align-items: center; gap: 10px; background: var(--paper-2); border-radius: 8px; padding: 8px 10px; }
.fam .avatar { border-radius: 50%; }
.info-links { display: flex; gap: 6px 16px; flex-wrap: wrap; padding-top: 12px; }
.info-links a { color: var(--ink-2); }
.msg-card { border: 1px solid rgba(227, 185, 85, .45); background: linear-gradient(var(--gold-soft), var(--sheet) 70%); border-radius: 14px; padding: 14px 16px; }
.mc-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.mc-head h2 { font-size: 1.05rem; margin: 0; font-family: var(--sans); }
.mc-list { list-style: none; margin: 0; padding: 0; }
.mc-list li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.mc-list li:first-child { border-top: 0; }
.mc-list b { display: block; font-size: .95rem; }
.mc-list .grow span { color: var(--ink-3); font-size: .82rem; }
.mc-list .grow span.over { color: var(--cinnabar); font-weight: 600; }
.lob-sec { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; flex-wrap: wrap; }
.lob-sec h2 { font-size: 1.12rem; margin: 0; white-space: nowrap; }
.lob-sec::after { content: ""; flex: 1; height: 1px; background: var(--rule); min-width: 20px; order: 1; }
.lob-sec .tiny { order: 2; }
.tiles { display: grid; gap: 10px; }
.tiles.t2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles.t3 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 861px) { .tiles:not(.t2):not(.t3) { grid-template-columns: repeat(3, minmax(0, 1fr)); } .tiles.t2 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .tiles.t3 { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.tile { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 13px; border-radius: 12px;
        background: var(--sheet); border: 1px solid var(--rule); color: var(--ink); text-decoration: none; transition: border-color .15s, background .15s; }
.tile:hover { border-color: rgba(227, 185, 85, .45); background: var(--sheet-2); }
.tile .g { width: 38px; height: 38px; flex: none; border-radius: 8px; border: 1px solid rgba(227, 185, 85, .35); background: var(--gold-soft);
           color: var(--gold); display: grid; place-items: center; font: 1.25rem/1 var(--serif); }
.tile b { font-size: 1rem; line-height: 1.3; }
.tile b small { font-weight: 400; color: var(--ink-3); font-size: .78rem; margin-left: 2px; }
.tile .s { color: var(--ink-3); font-size: .82rem; line-height: 1.45; }
.tile .corner { position: absolute; top: 10px; right: 10px; }
.tile.big { flex-direction: row; align-items: center; gap: 12px; padding: 14px; }
.tile.big .g { width: 46px; height: 46px; font-size: 1.45rem; }
.tile.big .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tile.sm { align-items: center; text-align: center; padding: 12px 6px; }
.tile.sm .g { width: 34px; height: 34px; font-size: 1.1rem; }
.tile.sm b { font-size: .9rem; }
.tile.sm .corner { top: 6px; right: 6px; }
.notice > summary { font-family: var(--serif); }
.gold { color: var(--gold); }
.ic-text { font-family: var(--serif); font-size: 1.04rem; }
.diary-list > li { align-items: flex-start; }
.diary-body { white-space: pre-wrap; font: 1rem/1.8 var(--serif); color: var(--ink-2); margin-top: 2px; }
@media (max-width: 400px) { .tile.big .g { width: 40px; height: 40px; } .rc-head h1 { font-size: 1.3rem; } }
.mc-list .grow { flex: 1; min-width: 0; }
.talisman.compact p + p { margin-top: 6px; }

/* ───────── 마을 의뢰 ───────── */
.vq-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.vq-card { background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.vq-card.accepted { border-color: rgba(227, 185, 85, .45); background: linear-gradient(var(--gold-soft), var(--sheet) 60%); }
.vq-card.done, .vq-card.abandoned { opacity: .7; }
.vq-card h3 { font-size: 1.08rem; margin: 0; }
.vq-top { display: flex; gap: 10px; align-items: center; }
.vq-top .avatar { border-radius: 50%; }
.vq-top .grow { min-width: 0; display: grid; line-height: 1.3; }
.vq-top .grow b { font-size: .95rem; }
.vq-top .grow span { color: var(--ink-3); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vq-req { margin: 0; color: var(--ink-2); font-family: var(--serif); font-size: .98rem; line-height: 1.7; }
.vq-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .9rem; font-weight: 600; }
.tag.st2 { background: var(--jade-soft); color: var(--jade); border-color: transparent; }
.tag.st3 { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.tag.st4 { background: var(--cinnabar-soft); color: var(--cinnabar); border-color: transparent; }
.npc-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); }
.npc-cell { display: flex; gap: 8px; align-items: center; padding: 9px 10px; border-radius: 10px; background: var(--sheet); border: 1px solid var(--rule); color: var(--ink); text-decoration: none; min-width: 0; }
.npc-cell:hover { border-color: rgba(227, 185, 85, .45); }
.npc-cell .avatar { border-radius: 50%; }
.npc-cell .grow { display: grid; min-width: 0; line-height: 1.35; }
.npc-cell .grow > span { color: var(--ink-3); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.npc-cell .npc-prog { color: var(--gold) !important; font-size: .76rem !important; }
.vq-play { max-width: 720px; }
.vq-play h1 { margin: 14px 0 8px; }
.vq-play .scene { font-family: var(--serif); font-size: 1.1rem; line-height: 1.9; margin: 0 0 6px; }
.vq-ask { font-size: 1rem; font-family: var(--sans); margin: 18px 0 10px; }
.vq-choices { display: grid; gap: 10px; }
.vq-choice { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 14px 16px; border-radius: 10px; cursor: pointer;
             background: var(--sheet); border: 1px solid var(--rule-2); color: var(--ink); font: 600 1rem/1.5 var(--sans); }
.vq-choice:hover { border-color: var(--gold); background: var(--gold-soft); }
.vq-choice .k { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--gold); color: var(--gold); font-weight: 700; }
.vq-result { margin-top: 14px; padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(227, 185, 85, .45); background: linear-gradient(var(--gold-soft), var(--sheet) 70%); }
.vq-result .chosen { margin: 2px 0 8px; font-weight: 700; }
.memory { display: flex; gap: 12px; align-items: flex-start; margin-top: 10px; padding: 12px; border-radius: 10px; background: var(--paper-2); }
.memory p { margin: 2px 0 0; font-family: var(--serif); color: var(--ink-2); }
.seal-s { width: 30px; height: 30px; flex: none; border: 1.5px solid var(--cinnabar); color: var(--cinnabar); border-radius: 4px; display: grid; place-items: center; font-family: var(--serif); transform: rotate(-4deg); }
.hook { margin-top: 12px; }
.hook summary { font-size: .85rem; color: var(--ink-3); font-weight: 600; }
.hook p { margin: 6px 0 0; font-family: var(--serif); color: var(--ink-2); }
.stages { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.stages li { border: 1px solid var(--rule); border-radius: 8px; padding: 8px; display: grid; gap: 2px; color: var(--ink-3); font-size: .78rem; }
.stages li b { font-size: .86rem; color: var(--ink-3); }
.stages li.open { border-color: rgba(227, 185, 85, .45); } .stages li.open b { color: var(--gold); }
.stages li.done { background: var(--cinnabar-soft); border-color: var(--cinnabar); } .stages li.done b { color: var(--cinnabar); }
@media (max-width: 560px) { .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ───────── Google 로그인 ───────── */
.google-btn { width: 100%; }
.or-line { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--ink-3); font-size: .8rem; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--rule-2); }
.linked { display: inline-flex; align-items: center; gap: 6px; color: var(--jade); font-weight: 700; }
.back-link { display: inline-flex; gap: 6px; align-items: center; margin-bottom: 10px; color: var(--ink-3); font-size: .875rem; text-decoration: none; min-height: 32px; }
.back-link:hover { color: var(--ink); }

/* ───────── 공지 · 로그아웃 · 이름 ───────── */
.notice-bar { display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin-bottom: 14px; border: 1px solid var(--gold); border-radius: 12px;
  background: linear-gradient(90deg, rgba(227, 185, 85, .16), rgba(227, 185, 85, .04)); color: var(--ink); text-decoration: none; min-width: 0; }
.notice-bar:hover { background: rgba(227, 185, 85, .2); }
.nb-tag { flex: none; background: var(--gold); color: #17120a; font-weight: 800; font-size: .78rem; padding: 3px 9px; border-radius: 999px; }
.nb-title { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-more { flex: none; color: var(--ink-3); font-size: .8rem; }
.notice-card h2 .nb-tag { vertical-align: middle; font-family: var(--sans); }
.pill-end { margin-left: auto; display: inline-flex; }
.pill.quiet { color: var(--ink-3); background: transparent; font: inherit; cursor: pointer; }
.trio.duo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.room-who { color: inherit; text-decoration: none; }
.room-who:hover strong, h2 .room-who:hover { text-decoration: underline; text-underline-offset: 3px; }
.glass { color: #9fd3e6; }
.agree-box { border: 1px solid var(--rule-2); border-radius: 10px; padding: 10px 12px; margin: 0 0 4px; display: grid; gap: 8px; }
.agree-box .agree-all { border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
.fam-new { border: 1px solid var(--rule-2); border-radius: 10px; padding: 12px 14px; margin: 10px 0 14px; min-width: 0; }
.fam-new legend { padding: 0 6px; }
.invite-code { font: 800 1.8rem/1.2 var(--mono, ui-monospace, monospace); letter-spacing: .08em; color: var(--gold); margin: 6px 0 12px; }
.default-avatar { width: 96px; height: 96px; object-fit: cover; border-radius: 50%; border: 1px solid var(--rule-2); }
.notice-cats { margin-bottom: 12px; }
.notice-img { display: block; max-width: 100%; max-height: 520px; border-radius: 8px; margin: 6px 0 10px; object-fit: contain; }
.notice-body { white-space: pre-wrap; }
.guide-main { max-width: 760px; margin: 0 auto; padding-block: 18px 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.title-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--gold); font-size: .82em; font-weight: 700; vertical-align: .05em; }
.title-img { width: 1.25em; height: 1.25em; object-fit: contain; border-radius: 4px; }
.title-img.lg { width: 36px; height: 36px; }
.set-jump { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.set-jump a { border: 1px solid var(--rule-2); border-radius: 999px; padding: 5px 12px; font-size: .85rem; color: var(--ink-2); text-decoration: none; }
.set-jump a:hover { border-color: var(--gold); color: var(--ink); }
#titles, #profile, #email, #push, #theme, #status { scroll-margin-top: 70px; margin-bottom: 14px; }
.title-pick { display: grid; gap: 8px; }
.my-titles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule); }
.title-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--rule-2); border-radius: 999px; padding: 2px 9px; font-size: .8rem; color: var(--ink-2); }
.title-chip.on { border-color: var(--gold); color: var(--gold); font-weight: 700; }

/* ───────── 라이트 모드 (한지빛) ─────────
   어두운 화면을 기본으로 두고, 설정 › 화면 모드에서 고르면 html[data-theme="light"]로 바뀐다. */
:root[data-theme="light"] {
  --paper: #f3eee3; --paper-2: #e9e2d3; --sheet: #fffdf8; --sheet-2: #f6f1e6;
  --ink: #2a2520; --ink-2: #514a40; --ink-3: #776d60;
  --rule: #e2d9c8; --rule-2: #cfc3ad;
  --gold: #a87914; --gold-ink: #fffaf0; --gold-soft: #f4e8c8; --link: #8a5f0c;
  --cinnabar: #b9412b; --cinnabar-soft: #f8e1da; --jade: #2f7a5b; --jade-soft: #dcefe5;
  --amber: #9a6b06; --amber-soft: #f6ebcf; --me: #f6efe0; --hdr: rgba(250, 246, 238, .94);
  --focus: 0 0 0 3px rgba(168, 121, 20, .35);
  color-scheme: light;
}
:root[data-theme="light"] body { background: radial-gradient(1100px 520px at 50% -260px, rgba(168, 121, 20, .08), transparent 70%), var(--paper); }
:root[data-theme="light"] input, :root[data-theme="light"] select, :root[data-theme="light"] textarea { background: #fffdf8; color: var(--ink); }
:root[data-theme="light"] .tabbar { background: rgba(250, 246, 238, .97); }
:root[data-theme="light"] .landing-art { background: linear-gradient(160deg, #efe6d4, #f8f3e9); }
:root[data-theme="light"] .btn:not(.secondary):not(.danger) { color: #fffaf0; }
:root[data-theme="light"] .glass { color: #1f6f8b; }
:root[data-theme="light"] textarea:disabled, :root[data-theme="light"] input:disabled, :root[data-theme="light"] select:disabled { background: var(--paper-2); color: var(--ink-3); }
:root[data-theme="light"] input::placeholder, :root[data-theme="light"] textarea::placeholder { color: #9a8f7f; }

/* 점검 화면 */
.maint-main { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; }
.maint-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding-block: 34px; }
.maint-card h1 { margin: 0; }
.maint-seal { width: 56px; height: 56px; font-size: 1.6rem; }
.maint-msg { font-family: var(--serif); font-size: 1.1rem; line-height: 1.8; white-space: pre-wrap; margin: 0; }
.maint-bar { background: var(--cinnabar-soft); border-bottom: 1px solid var(--cinnabar); color: var(--ink); padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); font-size: .9rem; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.any-place { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; border-color: rgba(227, 185, 85, .45); }
.any-place form { flex: 0 0 auto; }
@media (max-width: 560px) { .any-place form, .any-place form .btn { width: 100%; } }

/* 운영진 전원 팝업 */
.site-popup { position: fixed; inset: 0; z-index: 200; background: rgba(5, 6, 8, .62); display: grid; place-items: center;
  padding-block: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.site-popup[hidden] { display: none; }
.site-popup-box { background: var(--sheet); color: var(--ink); border: 1px solid var(--gold); border-radius: var(--radius-m);
  width: min(440px, 100%); max-height: 80vh; overflow: auto; padding: 22px 20px 18px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .45); animation: popIn .22s ease-out; }
.site-popup-head { display: flex; align-items: center; gap: 8px; }
.site-popup-head .brand-seal { width: 28px; height: 28px; font-size: .9rem; }
.site-popup-box h2 { margin: 0; font-family: var(--serif); }
.site-popup-body { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: var(--serif); line-height: 1.8; }
.popup-preview { border: 1px dashed var(--rule); border-radius: var(--radius-s); padding: 10px 12px; margin-bottom: 8px; }
@keyframes popIn { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .site-popup-box { animation: none; } }

/* 대련 상대 검색 */
.opp-list { margin-top: 8px; max-height: 260px; overflow: auto; border: 1px solid var(--rule); border-radius: var(--radius-s); display: flex; flex-direction: column; }
.opp-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--rule); }
.opp-item:last-of-type { border-bottom: 0; }
.opp-item[hidden] { display: none; }
.opp-item input { width: auto; margin: 0; }
.opp-item:has(input:checked) { background: var(--gold-soft); }
.opp-empty { padding: 10px; margin: 0; }

/* 글 꾸미기 */
.fs-s { font-size: .85em; }
.fs-l { font-size: 1.3em; line-height: 1.5; }
.fs-xl { font-size: 1.7em; line-height: 1.4; }
.ta-left { text-align: left; }
.ta-center { text-align: center; }
.ta-right { text-align: right; }
.rich-bar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.rich-bar button, .rich-bar select { min-height: 32px; padding: 2px 10px; border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--sheet); color: var(--ink); font-size: .85rem; cursor: pointer; width: auto; }
.rich-bar button:hover, .rich-bar select:hover { border-color: var(--gold); }
.rich-bar .sep { width: 1px; background: var(--rule); margin: 2px 2px; }
.rich-help { margin: 4px 0 0; }

/* 대댓글 (깊이 제한 없음, 들여쓰기는 6단계까지) */
.comment.reply { display: flex; align-items: flex-start; gap: 8px; padding-left: calc(var(--depth, 1) * 18px); border-top-style: dashed; }
.comment.reply > .grow { flex: 1; }
.comment .comment-gone { grid-column: 1 / -1; padding: 2px 0; }
.reply-mark { color: var(--ink-3); font-size: .9rem; padding-top: 6px; }
.reply-to { color: var(--link); font-weight: 600; }
.reply-box-inline summary { list-style: none; cursor: pointer; }
.reply-box-inline summary::-webkit-details-marker { display: none; }
.reply-box-inline[open] { flex-basis: 100%; }
@media (max-width: 560px) { .comment.reply { padding-left: calc(var(--depth, 1) * 10px); } }

/* 새 글 N */
.new-n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--cinnabar); color: #fff; font: 700 .7rem/1 var(--sans); vertical-align: middle; }

/* 사역마 스트레스·친밀도 */
.fam-meters { display: grid; gap: 12px; }
.fam-meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.bar { height: 10px; border-radius: 6px; background: var(--rule); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--amber); border-radius: 6px; transition: width .3s; }
.bar.bar-warn > span { background: var(--gold); }
.bar.bar-bad > span { background: var(--cinnabar); }
.bar.bar-good > span { background: var(--jade); }
.danger-text { color: var(--cinnabar); }

/* 글자 크기 (글쓰기 칸·본문 공통) */
.fs-11 { font-size: 11px; line-height: 1.75; }
.fs-13 { font-size: 13px; line-height: 1.75; }
.fs-15 { font-size: 15px; line-height: 1.75; }
.fs-16 { font-size: 16px; line-height: 1.75; }
.fs-19 { font-size: 19px; line-height: 1.55; }
.fs-24 { font-size: 24px; line-height: 1.55; }
.fs-28 { font-size: 28px; line-height: 1.35; }
.fs-30 { font-size: 30px; line-height: 1.35; }
.fs-34 { font-size: 34px; line-height: 1.35; }
.fs-38 { font-size: 38px; line-height: 1.35; }
.rich-editor { position: relative; min-height: 180px; max-height: 60vh; overflow: auto; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--radius-s);
  background: var(--paper); color: var(--ink); line-height: 1.8; white-space: pre-wrap; word-break: break-word; outline: none; font-family: var(--serif); }
.rich-editor:focus { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.rich-editor.empty::before { content: attr(data-placeholder); color: var(--ink-3); pointer-events: none; position: absolute; }
.rich-editor.disabled { opacity: .55; }
.rich-editor b, .rich-editor strong { font-weight: 700; }
.rich-bar button.on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }

/* 러너 조율: 캐릭터 대화와 구분되는 회색 말풍선 */
.ooc-log { display: flex; flex-direction: column; gap: 12px; max-height: 62vh; overflow: auto; padding-right: 2px; }
.ooc-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 86%; }
.ooc-msg.mine { align-self: flex-end; align-items: flex-end; }
.ooc-meta { color: var(--ink-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.ooc-bubble { background: var(--rule); color: var(--ink); border-radius: 12px 12px 12px 4px; padding: 8px 12px; white-space: pre-wrap; word-break: break-word;
  font-family: var(--sans); font-size: .95rem; line-height: 1.6; }
.ooc-msg.mine .ooc-bubble { border-radius: 12px 12px 4px 12px; background: var(--gold-soft); }
.ooc-report summary { list-style: none; cursor: pointer; } .ooc-report summary::-webkit-details-marker { display: none; }
.ooc-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ooc-form textarea { min-height: 80px; }
a.opp-item { color: inherit; text-decoration: none; }
.ooc-btn { flex: 0 0 auto; }

/* 유일관 */
.excl-tag { display: inline-flex; gap: 6px; align-items: center; margin: 2px 0 8px; padding: 3px 10px; border-radius: 999px;
  background: var(--cinnabar-soft); color: var(--cinnabar); font-size: .88rem; font-weight: 600; }
.excl-tag a { color: inherit; }
.excl-card { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--cinnabar); border-radius: var(--radius-s); background: var(--cinnabar-soft); }

/* ───────── 운영 화면: 왼쪽 메뉴 + 본문 ───────── */
.admin-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-main { min-width: 0; }
.admin-side { position: sticky; top: 76px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 8px; max-height: calc(100vh - 96px); overflow: auto; }
.admin-side-toggle { display: none; }
.admin-side-nav { display: flex; flex-direction: column; gap: 2px; }
.admin-side .ai { flex: 0 0 auto; opacity: .85; }
.admin-side .ag-top, .admin-side .ag > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; cursor: pointer; font-weight: 600; font-size: .95rem; list-style: none; }
.admin-side .ag > summary::-webkit-details-marker { display: none; }
.admin-side .ag-top:hover, .admin-side .ag > summary:hover { background: var(--gold-soft); }
.admin-side .ag-top.on { background: var(--gold-soft); color: var(--gold); }
.admin-side .grow { flex: 1; min-width: 0; }
.admin-side .chev { opacity: .6; transition: transform .15s; }
.admin-side .ag[open] > summary .chev { transform: rotate(180deg); }
.admin-side .ag-items { display: flex; flex-direction: column; padding: 2px 0 6px 40px; }
.admin-side .ag-items a { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 6px; color: var(--ink-2, var(--ink)); text-decoration: none; font-size: .9rem; opacity: .85; }
.admin-side .ag-items a:hover { background: var(--gold-soft); opacity: 1; }
.admin-side .ag-items a.on { color: var(--gold); background: var(--gold-soft); opacity: 1; font-weight: 600; }
.admin-side .badge { position: static; display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--cinnabar); color: #fff; font-size: .7rem; font-weight: 700; }
@media (max-width: 860px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .admin-side { position: static; max-height: none; padding: 0; }
  .admin-side-toggle { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 700; cursor: pointer; list-style: none; }
  .admin-side-toggle::-webkit-details-marker { display: none; }
  .admin-side-toggle .badge { margin-left: auto; }
  .admin-side[open] .admin-side-toggle { border-bottom: 1px solid var(--rule); }
  .admin-side-nav { padding: 6px; }
}

/* 운영 현황 카드 */
.dash-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.dash-stat { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--sheet); color: var(--ink); text-decoration: none; }
.dash-stat:hover { border-color: var(--gold); }
.dash-stat-head { display: flex; justify-content: space-between; align-items: center; color: var(--ink-3); font-size: .85rem; }
.dash-stat-num { font-family: var(--serif); font-size: 1.9rem; line-height: 1; color: var(--ink); }
.dash-stat.hot .dash-stat-num { color: var(--gold); }
.quick-list { display: flex; flex-direction: column; gap: 8px; }
.quick-list a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--paper); border: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; }
.quick-list a:hover { border-color: var(--gold); }
.quick-list .badge { position: static; display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--cinnabar); color: #fff; font-size: .75rem; }

/* 로그인·가입 화면의 세계관·공지 버튼 */
.guide-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 12px; }

/* ───────── SNS ───────── */
.sns-feed { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.sns-card { padding: 16px; }
.sns-head { display: flex; align-items: center; gap: 10px; }
.sns-head .who { font-weight: 700; }
.sns-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ink, #222); color: var(--paper, #fff); font-size: 1rem; flex: none; }
.sns-body { margin-top: 10px; overflow-wrap: anywhere; }
.sns-img { display: block; margin-top: 10px; border-radius: 10px; max-width: 100%; max-height: 520px; object-fit: contain; background: var(--paper-2, transparent); }
.sns-foot { display: flex; gap: 14px; align-items: center; margin-top: 10px; font-size: .85rem; }
.anon-dot { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: .78rem; font-weight: 700; flex: none;
  background: var(--amber-soft); color: var(--amber); }
.anon-dot.staff { background: var(--ink, #222); color: var(--paper, #fff); }
.comment .mine-tag { font-size: .7rem; }

/* 버그 제보 답장 */
.bug-reply { padding: 10px 12px; border-radius: 10px; background: var(--paper-2); margin-bottom: 8px; overflow-wrap: anywhere; }
.bug-reply.staff { background: var(--amber-soft); }
