/* ───── 색상: 라이트(아이보리·딥네이비·앤틱 골드) / 다크(미드나이트·골드) ───── */
:root {
  --bg: #eceef2;
  --bg-grad: linear-gradient(180deg, #f3f4f7 0%, #e6e9ef 100%);
  --panel: #fcfbf8;
  --panel2: #f3f0e9;
  --line: #ddd6c6;
  --text: #1d2738;
  --muted: #6b7385;
  --head: #22385a;
  --gold: #8d6b2a;
  --accent: #26405f;
  --on-accent: #ffffff;
  --soft: #e4e9f1;
  --good: #2f7d5b;
  --warn: #a96a1f;
  --bad: #a8404a;
  --story: #8d6b2a;
  --event: #3b5b8f;
  --choice-bg: #eef1f7;
  --banner-bg: #f7f0dd;
  --banner-bad-bg: #f7e4e4;
  --tag-bg: #ebe7dc;
  --tag-fg: #4b4a45;
  --toast-bg: #1d2738ee;
  --shadow: 0 1px 2px rgba(31, 41, 61, .05), 0 6px 18px rgba(31, 41, 61, .05);
  --radius: 12px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d121c;
  --bg-grad: linear-gradient(180deg, #101726 0%, #0b0f18 100%);
  --panel: #151c2b;
  --panel2: #1c2537;
  --line: #2c3752;
  --text: #e9e6dc;
  --muted: #8e97aa;
  --head: #dcc48e;
  --gold: #d4b36a;
  --accent: #6c8bbf;
  --on-accent: #ffffff;
  --soft: #223250;
  --good: #7ed6a0;
  --warn: #f0a35e;
  --bad: #f07178;
  --story: #d4b36a;
  --event: #a9bdf0;
  --choice-bg: #1a2338;
  --banner-bg: #2a2616;
  --banner-bad-bg: #2b1a1d;
  --tag-bg: #26324b;
  --tag-fg: #c5cde0;
  --toast-bg: #000d;
  --shadow: 0 6px 18px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
html { font-size: 90%; }   /* 컴팩트 UI: rem 단위 글자·간격이 모두 같은 비율로 줄어든다 */
body {
  background: var(--bg-grad) fixed;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  line-height: 1.48;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}
#app { max-width: 720px; margin: 0 auto; padding: 12px max(12px, env(safe-area-inset-right, 0px)) calc(78px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
h1, h2, h3 { margin: 0 0 7px; font-weight: 700; }
h1 { font-size: 1.5rem; color: var(--gold); letter-spacing: .04em; font-family: Georgia, "Noto Serif KR", "Nanum Myeongjo", "Batang", serif; }
h2 { font-size: 1.05rem; color: var(--head); }
h3 { font-size: 1rem; color: var(--text); }
p { margin: 0 0 7px; }
.muted { color: var(--muted); font-size: .88rem; }
.small { font-size: .82rem; }
.center { text-align: center; }
.row { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 11px; }
.mb { margin-bottom: 11px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 11px;
  box-shadow: var(--shadow);
}

input[type=text], input[type=password], select, textarea {
  width: 100%;
  padding: 10px 11px;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 1rem;
}
textarea { font-size: .95rem; resize: vertical; }
select { padding: 9px 7px; font-size: .95rem; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; margin: 9px 0 4px; font-size: .88rem; color: var(--muted); }

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
button.ghost { background: transparent; }
button.block { width: 100%; padding: 11px; }
button.sm { padding: 4px 9px; }

/* 상단 바 */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 9px;
  margin-bottom: 9px; padding: 7px 11px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 9px; min-width: 0; flex-wrap: wrap; }
.brand { font-family: Georgia, "Noto Serif KR", "Nanum Myeongjo", "Batang", serif; font-weight: 700; letter-spacing: .06em; color: var(--gold); font-size: 1.15rem; display: none; }
.tb-mid { display: none; }
.pill { display: inline-flex; gap: 7px; align-items: center; padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel2); font-size: .86rem; color: var(--muted); }
.pill b { color: var(--text); font-variant-numeric: tabular-nums; }
.chip {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
}
.chip.house { color: var(--text); padding-left: 11px; }
.chip.gal { color: var(--gold); border-color: var(--gold); font-weight: 600; }
button.icon { padding: 4px 9px; font-size: .82rem; }

/* 탭 (폰: 아래 고정) */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: var(--panel); border-top: 1px solid var(--line);
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom) env(safe-area-inset-left, 0px);
}
.tabs button {
  flex: 1; border: 0; border-radius: 0; background: transparent; color: var(--muted);
  padding: 11px 2px; font-size: .8rem; white-space: nowrap;
}
.tabs .badge { color: var(--bad); font-weight: 700; }
.tabs button.active { color: var(--gold); box-shadow: inset 0 2px 0 var(--gold); font-weight: 700; }

.dash { display: block; }
.side, .side-right { display: none; }
.sidenav { display: none; }
.maincol, .content { min-width: 0; }

/* 시간 / 진행 */
.bar { height: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.fatigue > i { background: var(--good); }
.bar.fatigue.mid > i { background: var(--warn); }
.bar.fatigue.high > i { background: var(--bad); }
.bar.mp > i { background: #4f86c6; }
.bar.hp > i { background: var(--good); }
.bar.foe > i { background: var(--bad); }

.stat-row { display: grid; grid-template-columns: 52px 1fr 52px; gap: 7px; align-items: center; margin: 5px 0; }
.stat-row .val { text-align: right; font-variant-numeric: tabular-nums; }

/* 일지 */
.log { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .93rem; }
.log:last-child { border-bottom: 0; }
.log .t { color: var(--muted); font-size: .74rem; display: block; }
.log.story { color: var(--story); }
.log.event { color: var(--event); }
.log.warn { color: var(--warn); }
.log.exam { color: var(--text); padding-left: 9px; }
.log.week { color: var(--muted); font-size: .85rem; }
.log.info { color: var(--good); }
.log.choice { color: var(--warn); }
.log.battle { color: var(--bad); }
.log.shop { color: var(--gold); }
.log.post { font-size: .92rem; }
.log.post .row { margin: 2px 0; }

/* 시간표 */
.pick {
  display: block; width: 100%; text-align: left; margin-bottom: 7px; padding: 9px 11px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
}
.pick.on { border-color: var(--accent); background: var(--soft); }
.pick.locked { opacity: .45; }
.pick .nm { font-weight: 700; }
button.pick .nm + .muted { margin-top: 2px; }
.tag {
  display: inline-block; font-size: .74rem; padding: 1px 6px; margin: 3px 4px 0 0;
  border-radius: 999px; background: var(--tag-bg); color: var(--tag-fg);
}

/* 캐릭터 생성 */
.alloc { display: grid; grid-template-columns: 70px 1fr auto; gap: 7px; align-items: center; margin: 7px 0; }
.alloc .ctrl { display: flex; align-items: center; gap: 7px; }
.alloc .ctrl b { min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.bg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.bg-grid .pick { margin: 0; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.grade { font-weight: 800; }
.grade.S { color: var(--gold); }
.grade.A { color: var(--good); }
.grade.B { color: var(--event); }
.grade.C { color: var(--warn); }
.grade.F { color: var(--bad); }

.banner { border-color: var(--gold); background: var(--banner-bg); }
.banner.bad { border-color: var(--bad); background: var(--banner-bad-bg); }

.toast {
  position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
  background: var(--toast-bg); color: #fff; padding: 9px 14px; border-radius: 999px; font-size: .9rem;
  z-index: 50; max-width: 90vw; text-align: center;
}
.toast.err { background: #8a2a36ee; }

/* 선택지 / 교류 */
.card.choice { border-color: var(--accent); background: var(--choice-bg); }

/* 전투 */
.card.battle { border-color: var(--bad); }
.blog { margin: 9px 0; padding: 7px 9px; background: var(--panel2); border-radius: 8px; font-size: .88rem; max-height: 190px; overflow-y: auto; }
.blog > div { padding: 2px 0; }
.warnline { color: var(--warn); font-size: .88rem; margin: 7px 0 0; }
.acts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.acts button { padding: 9px 2px; font-size: .88rem; }

/* 채팅 */
.chanbar { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 5px; }
.chan { white-space: nowrap; padding: 4px 11px; border-radius: 999px; font-size: .85rem; }
.chan.on { border-color: var(--accent); background: var(--soft); }
.chan .dot { display: inline-block; margin-left: 5px; min-width: 18px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff; font-size: .72rem; text-align: center; }
.chatbox { height: 52vh; min-height: 260px; overflow-y: auto; padding: 7px; background: var(--panel2); border-radius: 10px; }
.msg { margin-bottom: 9px; max-width: 92%; }
.msg .t { color: var(--muted); font-size: .72rem; }
.msg .tx { margin-top: 2px; padding: 6px 9px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; word-break: break-word; display: inline-block; }
.msg.mine { margin-left: auto; text-align: right; }
.msg.mine .row { justify-content: flex-end; }
.msg.mine .tx { background: var(--soft); text-align: left; }

/* 프로필 */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; flex: none; vertical-align: middle; border: 1px solid var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.def { color: #fbf8ef; font-weight: 700; }
input.numin { width: 58px; padding: 4px 4px; text-align: center; font-size: .95rem; }
input.numin.wide { width: 84px; }
.pick.house .nm { font-weight: 700; }

/* 성격 · 출신 */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.kw { padding: 4px 11px; border-radius: 999px; font-size: .88rem; }
.kw.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
button.sm.on { border-color: var(--accent); background: var(--soft); }
.tag.kwtag { font-size: .85rem; padding: 3px 9px; }
.bgnote { margin: 7px 0 0; padding: 7px 9px; border-left: 3px solid var(--gold); color: var(--muted); font-size: .9rem; }

/* 상점 */
.itemcard { cursor: default; }

/* 왼쪽·오른쪽 패널 내용 */
.sidecard h2 { display: flex; align-items: center; gap: 5px; font-size: .92rem; }
.sidecard .who { display: flex; gap: 11px; align-items: center; }
.sidecard .who b { font-size: 1.05rem; }
.mini { display: grid; grid-template-columns: 44px 1fr 38px; gap: 7px; align-items: center; margin: 4px 0; font-size: .85rem; }
.mini { grid-template-columns: 44px 1fr auto; }
.wandtag { display: block; font-size: .72rem; color: var(--accent, #6b7fb0); font-weight: 600; white-space: nowrap; }
.stat-row .wandtag { display: inline; margin-left: 2px; }
.mini .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.logs-side { max-height: calc(100vh - 220px); overflow-y: auto; }
.logs-side .log { font-size: .86rem; }

/* ───── 넓은 화면 ───── */
@media (min-width: 560px) {
  .bg-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 900px) {
  #app { max-width: 1640px; padding: 16px max(21px, env(safe-area-inset-right, 0px)) 35px max(21px, env(safe-area-inset-left, 0px)); }
  body { padding-bottom: 0; }
  #app.auth, #app.create { max-width: 760px; }
  .brand, .tb-mid { display: inline-flex; }
  .topbar { position: sticky; top: 10px; z-index: 20; padding: 9px 16px; }
  .prog { display: none; }
  .dash { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 14px; align-items: start; }
  .side { display: block; position: sticky; top: 84px; }
  .tabs { display: none; }
  .side { max-height: calc(100vh - 100px); overflow-y: auto; scrollbar-width: thin; }
  .sidenav { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 7px; }
  .sidenav button { padding: 8px 4px; border-radius: 8px; font-size: .9rem; text-align: center; background: transparent; border-color: transparent; color: var(--muted); }
  .sidenav button:hover { background: var(--panel2); }
  .sidenav button.active { background: var(--soft); color: var(--head); border-color: var(--line); font-weight: 700; box-shadow: inset 0 -2px 0 var(--gold); }
  .toast { bottom: 24px; }
  .chatbox { height: 56vh; }
  .content.tab-stats > div { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: start; }
  .content.tab-stats > div > .card:first-child { grid-column: 1 / -1; }
}
@media (min-width: 1700px) {
  .content.tab-stats > div { display: grid; }
}

.clickable { cursor: pointer; }
.clickable:hover b { text-decoration: underline; }

/* 관리자 */
#app.admin { max-width: 1100px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 9px; margin-bottom: 11px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px; box-shadow: var(--shadow); }
.tile .tv { font-size: 1.5rem; font-weight: 700; color: var(--head); font-variant-numeric: tabular-nums; }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 7px 11px; margin-top: 9px; }
.wgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 7px; margin-top: 4px; }
label.fld { margin: 0; display: block; }
label.fld > span { display: block; margin-bottom: 3px; font-size: .78rem; color: var(--muted); }
label.fld input.numin { width: 100%; }
.urow { padding: 11px 0; border-bottom: 1px dashed var(--line); }
.urow:last-child { border-bottom: 0; }
.urow input[type=text], .urow input.numin { width: auto; min-width: 110px; padding: 5px 7px; }
input[type=checkbox] { accent-color: var(--accent); }
input[type=number] { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit; padding: 7px 7px; }
input[type=number]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.urow input.numin { width: 110px; }

/* 퀴디치 */
.chip.live { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 700; }
.qboard { display: grid; grid-template-columns: 1fr auto 1fr; gap: 9px; align-items: stretch; }
.qteam { background: var(--panel2); border-radius: 10px; padding: 11px; text-align: center; }
.qname { font-weight: 700; }
.qscore { font-size: 2.2rem; font-weight: 800; color: var(--head); font-variant-numeric: tabular-nums; }
.qvs { align-self: center; color: var(--muted); font-weight: 700; }
.qlineups, .qrosters { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.qroster { background: var(--panel2); border-radius: 10px; padding: 9px; }
.qp { display: inline-block; margin: 0 5px 0 0; color: var(--muted); }
.qp.human { color: var(--text); font-weight: 700; }
.qp.me { color: var(--gold); text-decoration: underline; }
.qmatch { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.qmatch:last-child { border-bottom: 0; }
.qmatch b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.qmatch b.win { color: var(--gold); }
.log.q-goal { color: var(--good); font-weight: 600; }
.log.q-snitch { color: var(--gold); font-weight: 700; }
.log.q-bludger { color: var(--warn); }
.log.q-end { color: var(--head); font-weight: 700; }

/* v14: 스크롤 영역 · 학생 상태 · 제안 · 초대장 */
.scrollbox { max-height: 440px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.scrollbox.short { max-height: 220px; }
.blog { scrollbar-width: thin; }
.plink { cursor: pointer; text-decoration: underline dotted var(--line); text-underline-offset: 3px; }
.plink:hover { color: var(--gold); }
.qp.plink { cursor: pointer; }
.big { font-size: 1.1rem; }
.prow { display: grid; grid-template-columns: 52px 1fr 44px; gap: 7px; align-items: center; margin: 5px 0; }
.prow .pk { color: var(--muted); font-size: .86rem; }
.prow .pv { text-align: right; font-variant-numeric: tabular-nums; font-size: .86rem; }
.kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 7px; margin: 9px 0; }
.kinds .pick { text-align: left; }
.invrow code { font-size: 1.05rem; letter-spacing: .12em; padding: 4px 9px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; color: var(--head); }
.invrow code.used { text-decoration: line-through; opacity: .5; }

/* v15: 로그인 화면(프로필 자리) · 노트 · 제보 */
.authgrid { display: grid; gap: 14px; margin-top: 14px; }
.authmain h1 { margin: 0 0 5px; }
.note { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.note:last-child { border-bottom: 0; }
.note ul { margin: 5px 0 0; padding-left: 18px; }
.note li { margin: 3px 0; font-size: .92rem; }
.pre { white-space: pre-wrap; word-break: break-word; margin: 4px 0; }
textarea { width: 100%; }
@media (min-width: 900px) {
  #app.auth { max-width: 1100px; }
  .authgrid { grid-template-columns: 290px minmax(0, 1fr); align-items: start; }
}

/* v16: 사이드 카드 · 접속자 · 이동 경로 */
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.gauge { margin: 7px 0; font-size: .85rem; }
.gauge .val { color: var(--muted); font-variant-numeric: tabular-nums; }
.gauge .bar { margin-top: 3px; }
.bchips { display: flex; flex-wrap: wrap; gap: 4px; margin: 7px 0 2px; }
.bchip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .76rem; border: 1px solid var(--line); background: var(--panel2); color: var(--muted); }
.bchip.good { border-color: var(--good); color: var(--good); }
.bchip.warn { border-color: var(--warn); color: var(--warn); }
.bchip.bad { border-color: var(--bad); color: var(--bad); }
.bchip b { font-variant-numeric: tabular-nums; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 12px; }
.card.res { padding: 9px 11px; margin: 0; }
.res .rv { font-size: 1.2rem; font-weight: 700; color: var(--head); }
.eqrow { display: flex; justify-content: space-between; gap: 7px; padding: 4px 0; font-size: .86rem; border-bottom: 1px dashed var(--line); }
.eqrow:last-child { border-bottom: 0; }
.prs { display: flex; align-items: center; gap: 9px; padding: 5px 4px; border-radius: 8px; cursor: pointer; }
.prs:hover { background: var(--panel2); }
.dot-on { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.grow-r { margin-left: auto; }
.peek { max-height: 170px; overflow-y: auto; font-size: .85rem; scrollbar-width: thin; }
.peek .pk { padding: 3px 0; word-break: break-word; }
ul.plain { margin: 5px 0 0; padding-left: 18px; } ul.plain li { margin: 4px 0; }
.crumbs { display: inline-flex; gap: 5px; align-items: center; font-size: .84rem; color: var(--muted); margin-right: 9px; }
.crumbs i { font-style: normal; opacity: .5; }
.crumbs .cur { color: var(--text); font-weight: 600; }
.tb-mid { gap: 5px; align-items: center; }

/* v17: 참고 화면식 3분할 — 넓은 화면에서는 세 칸이 각각 스크롤 */
@media (min-width: 1100px) {
  body.shell-on { overflow: hidden; }
  #app.main { max-width: 1900px; height: 100vh; box-sizing: border-box; padding: 11px 14px; overflow: clip; }
  .shell { height: 100%; display: flex; flex-direction: column; min-height: 0; }
  .shell > div:first-child { flex: none; }
  .shell .topbar { position: static; margin-bottom: 11px; }
  .shell > .dash { flex: 1; min-height: 0; display: grid; grid-template-columns: 270px minmax(0, 1fr) 360px; gap: 12px; align-items: stretch; }
  .shell .side, .shell .maincol { display: block; position: static; max-height: none; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding-right: 2px; }
  .shell .side-right { display: flex; flex-direction: column; gap: 11px; position: static; min-height: 0; overflow: hidden; }
  .shell .side-right > .card { margin: 0; }
  .shell .onlinecard { flex: 0 1 auto; max-height: 42%; display: flex; flex-direction: column; min-height: 0; }
  .shell .onlist { overflow-y: auto; min-height: 0; scrollbar-width: thin; }
  .shell .dockcard { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .shell .dockcard .chatbox { flex: 1; height: auto; min-height: 0; }
  .shell .content.tab-stats > div { display: block; }
}
@media (min-width: 1700px) {
  .shell .content.tab-stats > div { display: grid; }
}

.dockcard .msg { padding: 3px 4px; }
.dockcard .msg .tx { padding: 2px 0; background: transparent; border: 0; }

/* 입력칸은 모바일에서 확대되지 않도록 16px 유지 */
input, textarea, select { font-size: max(16px, 1rem); }
@media (min-width: 1100px) { input, textarea, select { font-size: .95rem; } }

/* v20: 아주 넓은 화면에서는 가운데 본문 안의 카드를 두 열로 나눠 세로 길이를 줄인다 */
@media (min-width: 1650px) {
  .shell .content.tab-sched > div, .shell .content.tab-battle > div, .shell .content.tab-shop > div,
  .shell .content.tab-quid > div, .shell .content.tab-social > div, .shell .content.tab-rank > div,
  .shell .content.tab-profile > div, .shell .content.tab-help > div, .shell .content.tab-notes > div,
  .shell .content.tab-alerts > div, .shell .content.tab-report > div {
    column-count: 2; column-gap: 12px;
  }
  .shell .content > div .card { break-inside: avoid; }
  .shell .content .rolepick, .shell .content .skillpick { break-inside: avoid; }
}

/* 이름이 최대 99자까지 길어질 수 있으므로 공백 없는 긴 글자도 칸 안에서 줄바꿈한다 */
body { overflow-wrap: anywhere; }
.topbar .brand, .pill, .chip, button, .tag { overflow-wrap: normal; }

/* 긴 이름: 상단 바·접속자 목록은 말줄임, 상태 카드는 두 줄까지 */
.tb-left > .row { flex-wrap: nowrap; min-width: 0; }
.tb-left > .row > div { min-width: 0; }
.tb-left b { display: block; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-left .muted { max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-mid { flex-shrink: 0; white-space: nowrap; }
.crumbs, .pill, .countdown { white-space: nowrap; }
.sidecard .who b, .sidecard .who .nm { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.onlist b { display: inline-block; max-width: calc(100% - 2.6em); vertical-align: bottom; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* 마을 지도 + 실시간 소식 */
.guidelink { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); text-decoration: none; font-size: .9rem; background: transparent; }
.guidelink:hover { background: var(--soft); }
.townrow { display: grid; grid-template-columns: 1fr; gap: 0 14px; align-items: start; }
@media (min-width: 760px) { .townrow { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.townsvg { width: 100%; height: auto; display: block; }
.tm-road { fill: none; stroke: #8a6a3c; stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 1 6; }
.tm-dot { stroke: var(--panel); stroke-width: 1.5; cursor: pointer; }
.tm-dot.me { stroke: var(--gold); stroke-width: 2.5; }
.townlist { margin-top: 10px; display: grid; gap: 8px; }
.tl-group b { font-size: .95rem; }
.tl-who { font-size: .9rem; padding-left: 6px; overflow-wrap: anywhere; }
.feed { max-height: 360px; }
.feeditem { padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; overflow-wrap: anywhere; }
.feeditem .t { color: var(--muted); font-size: .8rem; }

/* 학교 안 사람들 */
.npclist { display: grid; gap: 6px; margin-top: 8px; }
.npcrow { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
.npcrow.on { border-color: var(--gold); }
.npcrow.locked { opacity: .6; }
.npctalk { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--gold); background: var(--panel2); border-radius: 8px; }
.npcline { font-size: 1rem; line-height: 1.6; margin: 0 0 6px; overflow-wrap: anywhere; }
.npcchoices { display: grid; gap: 6px; margin-top: 8px; }

/* 양피지 지도 */
.tm-paper { fill: #e8d9b0; }
.tm-stain { fill: #000; opacity: .55; mix-blend-mode: multiply; }
.tm-frame { fill: none; stroke: #5b4426; stroke-width: 2; }
.tm-frame2 { fill: none; stroke: #5b4426; stroke-width: .8; stroke-dasharray: 4 3; }
.tm-ink { stroke: #4a3720; stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; fill: none; }
.tm-hill { stroke-width: 1.3; }
.tm-bld rect, .tm-bld path, .tm-bld circle { fill: #f1e6c4; stroke: #4a3720; stroke-width: 1.3; stroke-linejoin: round; }
.tm-lake { fill: #9db8b0; stroke: #4a3720; stroke-width: 1.4; opacity: .9; }
.tm-wave { fill: none; stroke: #4a6b6b; stroke-width: 1; stroke-linecap: round; }
.tm-tree { fill: #b9c58f; stroke: #4a3720; stroke-width: 1; stroke-linejoin: round; }
.tm-rail { fill: none; stroke: #4a3720; stroke-width: 1.2; }
.tm-compass circle, .tm-compass path { fill: #f1e6c4; stroke: #4a3720; stroke-width: 1; }
.tm-n { fill: #4a3720; stroke: none; font-size: 9px; font-weight: 700; }
.tm-title { fill: #4a3720; font-size: 13px; font-weight: 700; letter-spacing: .08em; }
.tm-name { fill: #3a2a14; stroke: none; font-size: 11px; font-weight: 700; }
.tm-halo { fill: #e8d9b0; stroke: #e8d9b0; stroke-width: 3.5; stroke-linejoin: round; }
:root[data-theme="dark"] .tm-paper { fill: #b9a77c; }
:root[data-theme="dark"] .tm-halo { fill: #b9a77c; stroke: #b9a77c; }

/* 양피지 지도 - 펜화 디테일 */
.tm-edge { fill: none; stroke: #5b4426; stroke-width: 1.6; stroke-linejoin: round; }
.tm-hatch { fill: none; stroke: #6b4f2a; stroke-width: .7; stroke-linecap: round; opacity: .8; }
.tm-cliff { fill: #d9c79c; stroke: #4a3720; stroke-width: 1.3; stroke-linejoin: round; }
.tm-trunk { fill: none; stroke: #4a3720; stroke-width: 1.4; }
.tm-smoke { fill: none; stroke: #8a7a5a; stroke-width: 1.2; stroke-linecap: round; opacity: .8; }
.tm-ribbon { fill: #f1e6c4; stroke: #4a3720; stroke-width: 1.2; stroke-linejoin: round; }
.tm-flag { fill: #9c4a58; stroke: #4a3720; stroke-width: 1; }
.tm-boat { fill: #f1e6c4; }
.tm-bld path { stroke-linecap: round; }
.tm-title { font-size: 11px; letter-spacing: .06em; }
.tm-bld .tm-smoke, .tm-bld .tm-ink { fill: none; }
.tm-bld .tm-flag { fill: #9c4a58; }

/* 중요 공지 */
.noticecard { border-left: 3px solid var(--gold); }
.noticetitle { margin: 6px 0 4px; overflow-wrap: anywhere; }
.noticebody { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; font-size: .92rem; max-height: 300px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.noticeform textarea { width: 100%; box-sizing: border-box; font: inherit; line-height: 1.5; resize: vertical; }
.noticeclose { font-size: 1.2rem; line-height: 1; padding: 2px 9px; margin-left: 6px; }

/* ───── v32: 점검 화면 · 도박장 · 쪽지 ───── */
.maintwrap { min-height: 80vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.maintcard { max-width: 460px; width: 100%; text-align: center; }
.maintcard h1 { margin: 0 0 4px; font-size: 1.3rem; }
.maintmsg { white-space: pre-wrap; word-break: break-word; margin: 8px 0; }
.maintcard .row { justify-content: center; }
.casino-res { margin-top: 12px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); border-left-width: 4px; }
.casino-res.win { border-left-color: var(--good); }
.casino-res.lose { border-left-color: var(--bad); }
.casino-res.even { border-left-color: var(--warn); }
.dmlist { max-height: 340px; overflow-y: auto; }
.dmmsg { padding: 8px 10px; margin: 6px 0; border: 1px solid var(--line); border-radius: 8px; max-width: 88%; }
.dmmsg.mine { margin-left: auto; background: color-mix(in srgb, var(--accent, #b8942f) 12%, transparent); }
.dmtext { white-space: pre-wrap; word-break: break-word; margin: 3px 0; }
.dmmsg .ghost { padding: 1px 8px; }
.dmconv { cursor: pointer; padding: 4px 0; }
.dmconv:hover { background: color-mix(in srgb, var(--line) 35%, transparent); }
.dmconv .badge { color: var(--bad); font-weight: 700; }
#dm-in { width: 100%; box-sizing: border-box; resize: vertical; }

/* v33: 전투 기록은 높이 제한 + 스크롤, 행동 버튼은 기록 위에 */
.blog.battlelog { max-height: 220px; overflow-y: auto; margin-top: 10px; }
.card.battle .acts { margin-top: 10px; }

/* v33: 오늘의 운세 · 화면 배치 바꾸기 */
.fortune p { margin: 6px 0; }
.fortune .row { flex-wrap: wrap; gap: 6px; }
.chip.fl-great { background: color-mix(in srgb, var(--good) 22%, transparent); }
.chip.fl-quiet { opacity: .8; }
@media (min-width: 1100px) {
  .shell > .dash.swap { grid-template-columns: 360px minmax(0, 1fr) 270px; }
  .shell > .dash.swap .side-right { order: 1; }
  .shell > .dash.swap .maincol { order: 2; }
  .shell > .dash.swap .side { order: 3; }
}

/* v34: 이미지 크게 보기 */
.avatar.zoomable { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(8, 10, 18, .78); cursor: zoom-out; padding: 16px; }
.lb-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 100%; }
.lb-inner img { width: min(80vw, 420px); height: min(80vw, 420px); object-fit: contain; background: var(--panel); border-radius: 12px; border: 1px solid var(--line); image-rendering: auto; }
.lb-cap { color: #fff; font-weight: 700; }

/* v35: 사람마다 말풍선 + 수정구 */
.msg .tx, .dmmsg { background: var(--bbg, var(--panel)); color: var(--bfg, inherit); border-color: var(--bbd, var(--line)); }
.dockcard .msg .tx { padding: 5px 9px; background: var(--bbg, var(--panel)); border: 1px solid var(--bbd, var(--line)); }
.msg.mine .tx, .dmmsg.mine { background: var(--bbg, var(--soft)); }
.b-c-parchment { --bbg: #f3e7c9; --bfg: #3d3220; --bbd: #cdb98a; }
.b-c-sky { --bbg: #dcecf9; --bfg: #1e3347; --bbd: #9fc3e3; }
.b-c-mint { --bbg: #dcf1e4; --bfg: #1f3a2b; --bbd: #9fd0b2; }
.b-c-rose { --bbg: #f7dde0; --bfg: #4a232a; --bbd: #e0a3ab; }
.b-c-lavender { --bbg: #e6e0f5; --bfg: #2f2750; --bbd: #b9abe0; }
.b-c-gold { --bbg: #f6e4b0; --bfg: #4a3910; --bbd: #d4b04a; }
.b-c-ink { --bbg: #2c3a52; --bfg: #f2efe4; --bbd: #4a5c7c; }
:root[data-theme="dark"] .b-c-parchment { --bbg: #4a4130; --bfg: #f3e7c9; --bbd: #6b5e43; }
:root[data-theme="dark"] .b-c-sky { --bbg: #263c52; --bfg: #dcecf9; --bbd: #3f6389; }
:root[data-theme="dark"] .b-c-mint { --bbg: #25423a; --bfg: #dcf1e4; --bbd: #3d6e5c; }
:root[data-theme="dark"] .b-c-rose { --bbg: #4a2c32; --bfg: #f7dde0; --bbd: #7a4750; }
:root[data-theme="dark"] .b-c-lavender { --bbg: #3a3358; --bfg: #e6e0f5; --bbd: #5d5190; }
:root[data-theme="dark"] .b-c-gold { --bbg: #55451c; --bfg: #f6e4b0; --bbd: #8a7230; }
:root[data-theme="dark"] .b-c-ink { --bbg: #0f1726; --bfg: #f2efe4; --bbd: #4a5c7c; }
.tx.b-s-round, .dmmsg.b-s-round { border-radius: 16px; }
.tx.b-s-leaf, .dmmsg.b-s-leaf { border-radius: 16px 16px 16px 3px; }
.msg.mine .tx.b-s-leaf, .dmmsg.mine.b-s-leaf { border-radius: 16px 16px 3px 16px; }
.tx.b-s-square, .dmmsg.b-s-square { border-radius: 3px; }
.tx.b-s-frame, .dmmsg.b-s-frame { border-radius: 6px; border-width: 3px; border-style: double; }
.tx.b-s-dashed, .dmmsg.b-s-dashed { border-radius: 12px; border-style: dashed; }
.bubpreview { margin-top: 8px; }
.crystalrow { display: flex; gap: 14px; align-items: center; }
.crystal { flex: none; width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #ffffff 0, #d9cff7 22%, #8d7fd0 58%, #4b3f8f 100%); box-shadow: 0 0 14px rgba(141, 127, 208, .55), inset 0 -6px 10px rgba(30, 20, 80, .35); }
.crystal.busy { animation: crystalpulse .9s ease-in-out infinite alternate; }
@keyframes crystalpulse { from { box-shadow: 0 0 8px rgba(141, 127, 208, .4); } to { box-shadow: 0 0 26px rgba(190, 170, 255, .95); } }
.crystalstory { padding: 7px 9px; margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; font-size: .92rem; }
.crystalstory.fresh { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* v36: 채팅·쪽지 이름 옆에 사진 + 기숙사 + 학년 */
.lvtag { color: var(--muted); font-size: .72rem; margin: 0 2px; white-space: nowrap; }
.msg > .row, .dmwho { flex-wrap: wrap; gap: 4px; align-items: center; }
.dockcard .msg .chip.house { font-size: .68rem; padding: 0 6px; }
.dmwho .chip.house { font-size: .68rem; padding: 0 6px; }
.chip.warn { border-color: var(--warn); color: var(--warn); font-weight: 600; }

/* 상대 고르기 드롭다운 */
.picker { position: relative; }
.pickfield { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: var(--panel, var(--card)); color: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; min-height: 40px; cursor: pointer; }
.pickfield .pickwho { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pickcaret { margin-left: auto; opacity: .6; }
.pickpanel { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.25); padding: 8px; }
.picksearch { width: 100%; margin-bottom: 6px; }
.picklist { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.pickrow { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: transparent; color: inherit; border: 0; border-radius: 6px; padding: 5px 6px; cursor: pointer; }
.pickrow:hover, .pickrow:focus { background: rgba(127,127,127,.15); }
.pickrow .pickwho { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 투표 */
.pollopts { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pollopt { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; overflow: hidden; background: var(--panel2); color: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; cursor: pointer; }
.pollopt:disabled { cursor: default; opacity: 1; }
.pollopt.on { border-color: var(--gold); }
.pollopt.static { cursor: default; }
.pollfill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(127,127,127,.22); width: 0; }
.pollopt.on .pollfill { background: rgba(200,160,60,.30); }
.polltext, .pollnum { position: relative; z-index: 1; }
.polltext { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pollnum { font-size: .82rem; opacity: .85; white-space: nowrap; }
.pollvoters { margin-top: 2px; max-height: 6.5em; overflow-y: auto; overflow-wrap: anywhere; }

/* 공지·투표: 기본은 제목 한 줄, 누르면 펼침 */
.noticecard.compact { padding: 6px 10px; }
.noticecard.compact + .noticecard.compact { margin-top: 6px; }
.cardhead { gap: 6px; flex-wrap: nowrap; }
.cardtitlewrap { min-width: 0; flex: 1; gap: 6px; flex-wrap: nowrap; }
.cardtitle { flex: 1; min-width: 0; text-align: left; padding: 2px 4px; font-size: .9rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: transparent; border: 0; color: inherit; cursor: pointer; }
.noticecard.compact .noticebody { max-height: 160px; margin-top: 4px; }
.noticecard.compact .pollopts { margin-top: 6px; }
.noticecard.compact .noticeclose { margin-left: 0; flex: none; }
.giftcount { width: 4.5em; flex: none; }

/* v45 스킬·탐험·토벌 */
.raidmeters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 14px; margin: 8px 0; }
.raidmeter .bar { margin-top: 2px; }
.raidhints { margin: 6px 0; padding: 6px 8px; border-left: 3px solid var(--gold); background: var(--panel2); border-radius: 6px; }
.skillrow .bar { margin: 6px 0 2px; }
.tunegroup > summary { cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tunefld { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.tunefld.edited .fld > span { color: var(--gold); }
.tunefld .fld { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tunefld .fld input[type=text] { flex: 1; min-width: 0; }

.ruledoc > summary { cursor: pointer; font-weight: 700; margin-bottom: 6px; }
.tablewrap { overflow-x: auto; margin: 6px 0; }
.ruletable { border-collapse: collapse; width: 100%; font-size: .86rem; }
.ruletable th, .ruletable td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
.ruletable th { background: var(--panel2); white-space: nowrap; }
.skillpick { display: grid; gap: 6px; margin-top: 6px; }
.pick.sm { padding: 6px 10px; }

/* 마을 지도(그림) */
.townmap { position: relative; width: 100%; line-height: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.townmap img { width: 100%; height: auto; display: block; user-select: none; -webkit-user-drag: none; }
.tm-chip { position: absolute; transform: translate(-50%, -50%); padding: 2px 8px; border-radius: 999px; background: rgba(241, 230, 196, .92); border: 1px solid #5b4426; color: #3a2a14; font-size: .74rem; font-weight: 700; line-height: 1.4; white-space: nowrap; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); pointer-events: none; }
.tm-dots { position: absolute; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; width: 26%; line-height: 0; }
.tm-dotb { width: 14px; height: 14px; padding: 0; border-radius: 50%; border: 2px solid #f6ecd0; box-shadow: 0 0 0 1px #4a3720; cursor: pointer; }
.tm-dotb.me { border-color: var(--gold); box-shadow: 0 0 0 2px #4a3720; }
@media (max-width: 520px) { .tm-chip { font-size: .66rem; padding: 1px 6px; } .tm-dotb { width: 12px; height: 12px; } }

/* 프로필 장식: 사진 둘레에 고리를 씌운다 (사진 지름 = 고리 안쪽 구멍) */
.avatar.hasdeco { overflow: visible; position: relative; }
.avatar.hasdeco > img:not(.avdeco) { border-radius: 50%; }
.avatar .avdeco { position: absolute; left: -22%; top: -22%; width: 144%; height: 144%; max-width: none; object-fit: contain; pointer-events: none; z-index: 2; }
.frameprev { display: flex; justify-content: center; padding: 14px 0 12px; }

/* 접속 대기 화면 (서버가 깨는 동안 검은 화면 대신) */
.bootmsg { max-width: 360px; margin: 18vh auto 0; padding: 0 20px; text-align: center; color: var(--text); }
.bootmsg b { display: block; font-size: 1.1rem; margin-top: 14px; }
.bootmsg p { margin: 8px 0 0; color: var(--muted, #8b8372); font-size: .9rem; line-height: 1.5; }
.boot-spin { width: 34px; height: 34px; margin: 0 auto; border-radius: 50%; border: 3px solid rgba(160, 130, 80, .25); border-top-color: #b8893f; animation: bootspin 1s linear infinite; }
.boot-late { opacity: 0; animation: bootlate .6s ease 6s forwards; }
@keyframes bootspin { to { transform: rotate(360deg); } }
@keyframes bootlate { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .boot-spin { animation-duration: 3s; } }

/* 니플러 이벤트 알림 카드 */
.nifbanner { border-color: var(--accent); }
.nifbanner p { margin: 6px 0; }
.nifbanner .row { gap: 8px; margin-top: 8px; }

/* 니플러 이벤트 배너·상세 (청록 바탕 + 낡은 금빛 테두리) */
:root { --nif-bg: #E4EEEA; --nif-text: #302A24; --nif-sub: #6A6054; --nif-gold: #927038; --nif-btn: #365D55; --nif-btn-text: #FFFAF0; --nif-ok: #365D55; --nif-plate: transparent; }
:root[data-theme="dark"] { --nif-bg: #243C39; --nif-text: #F1E8D6; --nif-sub: #C1B39F; --nif-gold: #D5B66C; --nif-btn: #D5B66C; --nif-btn-text: #302A24; --nif-ok: #A7CEC2; --nif-plate: #F3ECDD; }
.card.nifhero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; padding: 22px 24px; background: var(--nif-bg); color: var(--nif-text); border: 1px solid var(--nif-gold); }
.nifhero h3 { margin: 0 0 6px; color: var(--nif-gold); }
.nifhero p { margin: 6px 0; }
.nifhero .nifsmall { color: var(--nif-sub); font-size: .85rem; }
.nifhero .nifline { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--nif-gold); }
.nifhero button.primary { background: var(--nif-btn); color: var(--nif-btn-text); border-color: var(--nif-btn); min-height: 44px; padding: 0 18px; }
.nifhero-img { width: 290px; max-width: 100%; height: auto; background: none; pointer-events: none; }
:root[data-theme="dark"] .nifhero-img { filter: drop-shadow(0 0 1px #F1E8D6) drop-shadow(0 0 1px #F1E8D6); }
.nifhero.detail .nifhero-img { width: 200px; }
.nifhero.detail .niftrail { grid-column: 1 / -1; width: min(420px, 100%); height: auto; justify-self: center; pointer-events: none; }
.nifchestcell { display: flex; align-items: center; justify-content: center; }
.nifchest { width: 170px; max-width: 100%; height: auto; pointer-events: none; }
.nifreward { text-align: center; }
.nifreward .frameprev { margin: 4px auto; }
.nifstate { margin: 6px 0; font-weight: 700; color: var(--muted); }
.nifstate.ready { color: var(--nif-ok); }
.nifstate.done { color: var(--nif-ok); }
@media (max-width: 700px) {
  .nifhero { grid-template-columns: 1fr; padding: 18px 16px; }
  .nifhero-img, .nifhero.detail .nifhero-img { width: 140px; justify-self: center; }
  .nifchest { width: 130px; }
  .nifhero.detail .niftrail { width: 100%; }
}

/* 니플러: 상단 작은 표시, 오른쪽 한 줄 */
.nifchip { margin-left: 8px; padding: 2px 9px; font-size: .78rem; background: transparent; color: var(--nif-gold); border: 1px solid var(--nif-gold); border-radius: 999px; }
.nifside { display: block; width: 100%; text-align: left; margin-bottom: 10px; padding: 9px 12px; background: var(--nif-bg); color: var(--nif-text); border: 1px solid var(--nif-gold); border-radius: var(--radius); font-size: .85rem; min-height: 44px; }
.nifside b { color: var(--nif-gold); }

/* 첫눈 이벤트 (은청색 바탕 + 낡은 금빛 테두리, 그림은 라이트·다크 모두 색을 그대로 둔다) */
:root { --ball-bg: #E9EEF4; --ball-text: #1F2A3A; --ball-sub: #5B6B80; --ball-gold: #8A6D2F; --ball-btn: #4A6688; --ball-btn-text: #FFFFFF; --ball-pad: #FFFFFF; }
:root[data-theme="dark"] { --ball-bg: #1E2633; --ball-text: #E6ECF3; --ball-sub: #9AA9BD; --ball-gold: #D6BA7E; --ball-btn: #8FA8C9; --ball-btn-text: #161C26; --ball-pad: #222B3A; }
.card.ballhero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; padding: 18px 24px; min-height: 120px; background: var(--ball-bg); color: var(--ball-text); border: 1px solid var(--ball-gold); overflow: hidden; }
.ballhero h3 { margin: 0 0 4px; font-size: 20px; font-weight: 600; color: var(--ball-gold); }
.ballhero p { margin: 4px 0; }
.ballhero .ballsub { font-size: 14px; }
.ballhero .ballsmall { color: var(--ball-sub); font-size: 13px; }
.ballhero .ballline { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--ball-gold); display: flex; align-items: center; gap: 8px; }
.ballhero button.primary { background: var(--ball-btn); color: var(--ball-btn-text); border-color: var(--ball-btn); min-height: 44px; padding: 0 18px; }
.ballhero-img { width: 270px; max-width: 100%; height: auto; object-fit: contain; background: none; pointer-events: none; justify-self: end; }
.ballhero.detail { padding: 22px 24px; }
.flakenum { display: inline-flex; align-items: center; gap: 4px; line-height: 24px; height: 24px; font-variant-numeric: tabular-nums; }
.flakeico { width: 22px; height: auto; max-height: 24px; object-fit: contain; flex: none; pointer-events: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ballseal { width: 44px; height: auto; vertical-align: middle; margin-right: 6px; pointer-events: none; }
.ballseal.big { width: 48px; margin: 0; }
.ballempty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 0; text-align: center; }
.ballreward { text-align: center; }
.ballslot { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 110px; background: var(--ball-pad); border-radius: var(--radius); }
.ballslot .frameprev { margin: 0; }
.ballprice { display: flex; justify-content: center; height: 24px; margin: 12px 0 2px; }
.ballside b { color: var(--ball-gold); }
.ballside { background: var(--ball-bg); color: var(--ball-text); border-color: var(--ball-gold); }
.ballchip { color: var(--ball-gold); border-color: var(--ball-gold); }
@media (max-width: 640px) {
  .card.ballhero { grid-template-columns: 1fr; padding: 14px 16px; min-height: 104px; }
  .ballhero h3 { font-size: 17px; }
  .ballhero .ballsub { font-size: 13px; }
  .ballhero .ballsmall { font-size: 12px; }
  .ballhero-img { width: 140px; justify-self: center; }
  .ballseal { width: 34px; }
}

/* 전체 화면 눈 내림(app.js syncSnow): 눌러지지 않고 모달·확대 그림보다 아래 */
#snowfx { position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 100; pointer-events: none; }

/* 눈사람 만들기: 그림을 가운데에, 선택칸은 아래 두 줄 격자로 */
.snowbuild { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 8px; }
.snowstage { display: flex; justify-content: center; align-items: flex-end; width: 100%; max-width: 260px; padding: 10px 0 4px; border: 1px solid var(--line, #c9d3e3); border-radius: 12px; background: rgba(160, 190, 230, .12); }
.snowsels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; width: 100%; max-width: 420px; }
.snowsels select { width: 100%; }
.snowsels label.fld:last-child { grid-column: 1 / -1; }

/* 토벌·현상금 역할 고르기: 넓은 화면에서는 한 줄(4칸), 좁으면 알아서 줄바꿈 */
.rolepick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.rolepick .pick { margin: 0; height: 100%; }

/* ───── 타임라인 (v62) ───── */
.tl-card { cursor: pointer; }
.tl-card .tl-text, .tl-post .tl-text { margin: 6px 0; overflow-wrap: anywhere; }
.tl-head { flex-wrap: wrap; gap: 6px; align-items: center; }
.tl-acts { gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tl-acts .ghost.on { border-color: var(--gold); color: var(--gold); font-weight: 600; }
.tl-last { margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--line, #8883); background: color-mix(in srgb, var(--text) 5%, transparent); border-radius: 4px; }
.tl-lastline { font-size: .9rem; overflow-wrap: anywhere; }
.tl-edited { font-size: .7rem; opacity: .75; }
.tl-to { margin-top: 2px; }
.tl-node { margin-top: 8px; }
.tl-node.d1 { margin-left: 14px; } .tl-node.d2 { margin-left: 28px; } .tl-node.d3 { margin-left: 42px; }
.tl-node.d4 { margin-left: 56px; } .tl-node.d5 { margin-left: 70px; }
.tl-post { padding: 8px 10px; border-left: 6px solid #8885; border-radius: 4px; }
.tl-post.mine { border-left-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.tl-post.target { outline: 2px solid var(--gold); }
.tl-me { font-size: .7rem; }
.tl-post.focus { background: color-mix(in srgb, var(--gold) 14%, transparent); }
.tl-gone { padding: 6px 10px; }
.hashtag { color: var(--gold); cursor: pointer; font-weight: 600; margin-right: 4px; overflow-wrap: anywhere; }
.hashtag:hover { text-decoration: underline; }
.tl-hot { flex-wrap: wrap; gap: 4px 10px; }
.tl-nav { gap: 6px; flex-wrap: wrap; }
.tl-quote { margin: 4px 0; overflow-wrap: anywhere; }
.tl-backbar { padding: 8px 12px; position: sticky; top: 0; z-index: 6; background: var(--panel, var(--bg)); box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.tl-note { padding: 8px 4px; border-bottom: 1px solid #8883; cursor: pointer; }
.tl-note.new { background: color-mix(in srgb, var(--gold) 12%, transparent); }
.tl-tagrow { padding: 8px 4px; border-bottom: 1px solid #8883; cursor: pointer; }
.tl-hist { margin-top: 6px; padding: 8px 10px; border: 1px dashed #8886; border-radius: 6px; }
.tl-hist-row { margin-top: 6px; }
.tl-reply textarea, .tl-card textarea, .tl-post textarea { width: 100%; box-sizing: border-box; }
@media (max-width: 700px) {
  .tl-node.d1 { margin-left: 8px; } .tl-node.d2 { margin-left: 16px; } .tl-node.d3 { margin-left: 24px; }
  .tl-node.d4 { margin-left: 30px; } .tl-node.d5 { margin-left: 36px; }
}
.tl-compose { padding: 8px 10px; margin-bottom: 8px; }
.tl-compose textarea, .tl-reply textarea { min-height: 0; }
.tl-reply { padding: 8px 10px; margin-bottom: 8px; }
.tl-cols { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 10px; align-items: start; }
.tl-left, .tl-right { max-height: calc(100vh - 250px); min-height: 260px; overflow-y: auto; scrollbar-width: thin; padding-right: 4px; }
.tl-noteslist { max-height: none; overflow: visible; }
.tl-notehead { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tl-live { margin-bottom: 4px; }
.tl-notes { padding: 8px 10px; }
@media (max-width: 800px) {
  .tl-cols { grid-template-columns: minmax(0, 1fr); }
  .tl-left { max-height: none; overflow: visible; }
  .tl-right { order: -1; min-height: 0; max-height: 180px; }
}

.tl-ab { background: none; border: 0; box-shadow: none; padding: 4px 8px; display: inline-flex; align-items: center; gap: 4px; color: var(--muted, #888); cursor: pointer; border-radius: 14px; min-width: 40px; }
.tl-ab:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.tl-ab.like.on, .tl-ab.like.on:hover { color: #d6456b; }
.tl-ab.like.on .tl-ico { fill: currentColor; }
.tl-ico { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }

/* 타임라인 컴팩트 */
.tl-cols { grid-template-columns: minmax(0, 1fr) 240px; gap: 8px; }
.tl-left, .tl-right { max-height: calc(100vh - 220px); }
.tl-compose, .tl-reply { padding: 6px 8px; margin-bottom: 6px; }
.tl-compose textarea, .tl-reply textarea { font-size: .88rem; padding: 6px 8px; }
.tl-left .card, .tl-right .card { padding: 6px 10px; margin-bottom: 6px; }
.tl-card, .tl-post { font-size: .9rem; }
.tl-card .tl-text, .tl-post .tl-text { margin: 3px 0; line-height: 1.4; }
.tl-head { gap: 4px; font-size: .85rem; }
.tl-head .chip { font-size: .68rem; padding: 0 6px; }
.tl-head .t, .tl-note .t { font-size: .72rem; }
.tl-acts { margin-top: 0; gap: 2px; }
.tl-acts .ghost.sm { padding: 1px 8px; font-size: .75rem; }
.tl-ab { padding: 2px 6px; min-width: 34px; font-size: .78rem; }
.tl-ico { width: 15px; height: 15px; }
.tl-last { margin-top: 3px; padding: 4px 8px; }
.tl-lastline { font-size: .82rem; }
.tl-node { margin-top: 4px; }
.tl-post { padding: 5px 8px; }
.tl-to { font-size: .72rem; }
.tl-backbar { padding: 4px 8px; margin-bottom: 6px; }
.tl-notes h3 { font-size: .95rem; margin: 0 0 4px; }
.tl-note { padding: 5px 2px; font-size: .85rem; }
.tl-quote { font-size: .78rem; margin: 2px 0; }
.tl-hot { margin-bottom: 4px; }
@media (max-width: 800px) {
  .tl-cols { grid-template-columns: minmax(0, 1fr); }
  .tl-left { max-height: none; }
  .tl-right { max-height: 150px; }
}

/* 타임라인 @이름 추천 */
.tl-tabox{position:relative}
.tl-tabox .mentionsug.down{top:100%;bottom:auto;margin:4px 0 0}

/* 타래 접기 */
.tl-more{display:block;width:100%;margin:4px 0;padding:6px;border:1px dashed var(--line,#8886);border-radius:8px;background:transparent;color:inherit;font-size:.85em;cursor:pointer}
.tl-more:hover{background:#8882}

/* 답글 대상 글은 전체를 보여 주고, 답글은 들여쓰지 않고 한 줄로 이어 붙인다 */
.tl-node.d1,.tl-node.d2,.tl-node.d3,.tl-node.d4,.tl-node.d5{margin-left:0}
.tl-qfull{max-height:9em;overflow-y:auto;padding:4px 8px;border-left:3px solid var(--gold,#b8923a);background:#8881;border-radius:4px;font-size:.85rem;line-height:1.4}
@media (max-width:800px){.tl-node.d1,.tl-node.d2,.tl-node.d3,.tl-node.d4,.tl-node.d5{margin-left:0}}

.tl-x{min-width:26px;padding:2px 8px;font-size:1.1em;line-height:1;margin-left:4px}

.tl-node.gap { margin-top: 12px; }
.tl-post.target { background: color-mix(in srgb, var(--gold) 20%, transparent); outline: 1px dashed var(--gold); }
.tl-tgt { font-size: .72rem; }

.ntitle { font-weight: normal; font-size: .85em; color: var(--muted, #888); }

/* 시간 옆 알림 표시 */
.alertchip { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font-size: .8rem; font-weight: 700; line-height: 1.3; cursor: pointer; white-space: nowrap; }
.alertchip:hover { filter: brightness(1.08); }
.prog .row.small { gap: 8px; align-items: center; }

.tl-kind { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.tl-kind .tl-ico { width: 16px; height: 16px; flex: none; }
.tl-kind.kreply { color: #3f78c4; }
.tl-kind.klike { color: #d6456b; }
.tl-kind.klike .tl-ico { fill: currentColor; }
.tl-kind.kment { color: var(--gold); }
.tl-kind span { color: var(--text); }
.tl-note { border-left: 4px solid transparent; padding-left: 8px; }
.tl-note:has(.kreply) { border-left-color: #3f78c4; }
.tl-note:has(.klike) { border-left-color: #d6456b; }
.tl-note:has(.kment) { border-left-color: var(--gold); }

.tl-kbadge { width: 26px; height: 26px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; background: currentColor; }
.tl-kbadge .tl-ico { width: 15px; height: 15px; stroke: #fff; fill: none; }
.tl-kind.klike .tl-kbadge .tl-ico { fill: #fff; }
.tl-kbadge .tl-at { color: #fff; font-size: 1rem; line-height: 1; }
.tl-kind { font-size: .95rem; }
.row.wrap { flex-wrap: wrap; gap: 6px; }

/* 채팅 글자 크기·높이(이 기기 설정) */
.chatbox.fs1 .msg .tx, .chatbox.fs1 .msg .row { font-size: 1.12rem; }
.chatbox.fs2 .msg .tx, .chatbox.fs2 .msg .row { font-size: 1.3rem; }
.chatbox.fs3 .msg .tx, .chatbox.fs3 .msg .row { font-size: 1.55rem; }
.chatbox.fs1 .msg .t, .chatbox.fs2 .msg .t, .chatbox.fs3 .msg .t { font-size: .8rem; }
.chatbox.tall { height: 78vh; }
.shell .dockcard .chatbox.tall { flex: 1; height: auto; }
.shell .lh-chat .dockcard .chatbox.tall { height: 560px; flex: none; }
.chatsize { gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.chatsize .on { background: var(--soft); }

/* 채팅 「높이 키우기」: 오른쪽 칸에서는 공지·접속자 카드를 숨기고 채팅이 칸 전체를 채운다 */
@media (min-width: 1100px) {
  .shell .side-right:has(.dockcard .chatbox.tall) > :not(.dockcard) { display: none; }
  .shell .side-right:has(.dockcard .chatbox.tall) > .dockcard { flex: 1 1 0; min-height: 0; }
  .shell .side-right .dockcard .chatbox.tall { flex: 1; height: auto; min-height: 0; }
}
