/* 성 에블린 괴담록 — 고딕 테마 6종. 인라인 스타일 없이 이 파일만 쓴다 (CSP style-src 'self'). */
@font-face {
  font-family: 'Pretendard Variable';
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url('/fonts/PretendardVariable.woff2') format('woff2-variations'), url('/fonts/PretendardVariable.woff2') format('woff2');
}

/* ---------- 테마: 무채색 (기본) ---------- */
:root, [data-theme="mono"] {
  --bg: #17171a; --bg-2: #1c1c20; --panel: #1d1d21; --panel-2: #232328; --panel-3: #2e2e34; --here: #2f2f36;
  --line: #2b2b31; --line-2: #3a3a41; --line-3: #5a5a63; --row: #26262b; --input: #141417;
  --text: #d8d8de; --text-2: #c4c2ca; --muted: #9a9aa6; --faint: #84848f; --accent: #d64a5b; --danger-text: #ec9aa4;
  --heading: #c3bfcf; --paper: #e9e2cf; --paper-ink: #2b2420;
  --overlay: rgba(8, 8, 12, 0.86);
  color-scheme: dark;
}
[data-theme="blood"] {
  --bg: #0d0808; --bg-2: #130b0b; --panel: #170e0e; --panel-2: #1d1212; --panel-3: #2a1818; --here: #321c1c;
  --line: #34201f; --line-2: #47292a; --line-3: #6b3a3a; --row: #261616; --input: #110909;
  --text: #f0e3df; --text-2: #d8c4c0; --muted: #b8a19d; --faint: #937a76; --accent: #d0473e; --danger-text: #f0a39c;
  --overlay: rgba(10, 3, 3, 0.88);
  color-scheme: dark;
}
[data-theme="bronze"] {
  --bg: #0d0b07; --bg-2: #120f0a; --panel: #16120b; --panel-2: #1c170e; --panel-3: #2a2214; --here: #302717;
  --line: #352b1b; --line-2: #4a3c25; --line-3: #6e5935; --row: #241d12; --input: #100d08;
  --text: #efe6d2; --text-2: #d7cbb0; --muted: #b8a985; --faint: #928463; --accent: #c9973f; --danger-text: #e8b9a0;
  --overlay: rgba(8, 6, 3, 0.88);
  color-scheme: dark;
}
[data-theme="moss"] {
  --bg: #080c09; --bg-2: #0c110d; --panel: #0f1511; --panel-2: #141c16; --panel-3: #1f2a21; --here: #243127;
  --line: #26332a; --line-2: #354639; --line-3: #4f6854; --row: #19221b; --input: #0a0f0b;
  --text: #e3ece2; --text-2: #c3d1c2; --muted: #9fb29e; --faint: #7c907c; --accent: #8fbf6a; --danger-text: #e4b0a5;
  --overlay: rgba(3, 7, 4, 0.88);
  color-scheme: dark;
}
[data-theme="moon"] {
  --bg: #090b10; --bg-2: #0c0f15; --panel: #0f131b; --panel-2: #141a24; --panel-3: #1f2735; --here: #242e3f;
  --line: #26303f; --line-2: #354257; --line-3: #50607c; --row: #19202b; --input: #0a0d13;
  --text: #e4e9f2; --text-2: #c4ccdb; --muted: #9eaabf; --faint: #7c889e; --accent: #8fb4e8; --danger-text: #e8b0b0;
  --overlay: rgba(4, 5, 9, 0.88);
  color-scheme: dark;
}
[data-theme="parchment"] {
  --bg: #efe7d6; --bg-2: #e7dcc5; --panel: #f6f0e2; --panel-2: #ece3cf; --panel-3: #ddd1b6; --here: #e3d4b3;
  --line: #d3c6a8; --line-2: #bfae88; --line-3: #9c8a63; --row: #e2d8c2; --input: #fbf7ee;
  --text: #2b2218; --text-2: #3f3427; --muted: #5c4f3e; --faint: #74654f; --accent: #8e2f25; --danger-text: #8e2f25;
  --overlay: rgba(43, 34, 24, 0.55);
  color-scheme: light;
}

/* ---------- 밝은 테마: 눈꽃(흰 바탕·핏빛), 백합(따뜻한 흰 바탕·밤색 보라), 안개(옅은 회청색·청록) ---------- */
[data-theme="snow"] {
  --bg: #f6f6f8; --bg-2: #eeeef2; --panel: #ffffff; --panel-2: #f3f3f6; --panel-3: #e4e4ea; --here: #fbe9ec;
  --line: #e1e1e7; --line-2: #cdcdd6; --line-3: #a3a3b0; --row: #ececf1; --input: #ffffff;
  --text: #1d1d24; --text-2: #34343e; --muted: #5d5d6b; --faint: #74747f; --accent: #b3263a; --danger-text: #a3202f;
  --heading: #2a2a33; --overlay: rgba(28, 28, 36, 0.5);
  color-scheme: light;
}
[data-theme="lily"] {
  --bg: #fbf8f4; --bg-2: #f4efe8; --panel: #fffdfa; --panel-2: #f7f2ec; --panel-3: #ebe3d9; --here: #efe6f3;
  --line: #e8e0d6; --line-2: #d6cabc; --line-3: #ab9d8c; --row: #f1ebe3; --input: #fffdfa;
  --text: #272130; --text-2: #3b3445; --muted: #625a6b; --faint: #786f80; --accent: #6b3f8f; --danger-text: #a12d3a;
  --heading: #2f2838; --overlay: rgba(39, 33, 48, 0.5);
  color-scheme: light;
}
[data-theme="mist"] {
  --bg: #eef2f4; --bg-2: #e5eaee; --panel: #f9fbfc; --panel-2: #eef2f5; --panel-3: #dce3e8; --here: #dcecea;
  --line: #d8e0e5; --line-2: #c2ccd3; --line-3: #90a0ab; --row: #e6ecf0; --input: #ffffff;
  --text: #1c262d; --text-2: #2f3b43; --muted: #536169; --faint: #6b7880; --accent: #2a7a73; --danger-text: #a3302c;
  --heading: #22303a; --overlay: rgba(20, 30, 36, 0.5);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--text); }
/* 제목은 명조체 (운영체제에 깔린 것을 쓴다 — 외부 글꼴을 불러오지 않는다) */
:root { --serif: 'Nanum Myeongjo', 'Noto Serif KR', 'Noto Serif CJK KR', AppleMyungjo, Batang, 'Source Han Serif K', serif; }
h1, h2, h3, .char-name, .brand-name b { font-family: var(--serif); color: var(--heading, var(--text)); font-weight: 700; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
button:not(:disabled):hover, a.btn:hover { filter: brightness(1.18); }
:is([data-theme="parchment"], [data-theme="snow"], [data-theme="lily"], [data-theme="mist"]) button:not(:disabled):hover { filter: brightness(0.94); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
svg.ic { flex: none; display: block; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 상단 ---------- */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-mark { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border: 1px solid var(--line-2); }
.brand-name { display: flex; flex-direction: column; gap: 2px; }
.brand-name b { font-size: 18px; letter-spacing: -0.01em; }
.eng { font-size: 10px; letter-spacing: 0.22em; color: var(--faint); }
.nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1 1 auto; }
.nav a, .nav button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; font-size: 14px; color: var(--muted); text-decoration: none; background: transparent; border: 0; border-bottom: 1px solid transparent; white-space: nowrap; }
.nav a[aria-current="page"], .nav button[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.nav a.locked { color: var(--faint); }
.top-actions { position: relative; display: flex; gap: 6px; }
.icon-btn { position: relative; display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--line); color: var(--text); }

.theme-menu { position: absolute; top: 52px; right: 0; z-index: 30; width: 240px; padding: 10px; background: var(--panel); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 4px; }
.theme-menu button { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; background: transparent; border: 1px solid transparent; color: var(--text); font-size: 13px; text-align: left; }
.theme-menu button[aria-pressed="true"] { border-color: var(--text); }
.swatch { display: inline-flex; width: 36px; height: 20px; border: 1px solid var(--line-3); flex: none; }
.swatch i { flex: 1; }
.sw-mono i:nth-child(1) { background: #17171a; } .sw-mono i:nth-child(2) { background: #d8d8de; } .sw-mono i:nth-child(3) { background: #d64a5b; }
.sw-blood i:nth-child(1) { background: #0d0808; } .sw-blood i:nth-child(2) { background: #f0e3df; } .sw-blood i:nth-child(3) { background: #d0473e; }
.sw-bronze i:nth-child(1) { background: #0d0b07; } .sw-bronze i:nth-child(2) { background: #efe6d2; } .sw-bronze i:nth-child(3) { background: #c9973f; }
.sw-moss i:nth-child(1) { background: #080c09; } .sw-moss i:nth-child(2) { background: #e3ece2; } .sw-moss i:nth-child(3) { background: #8fbf6a; }
.sw-moon i:nth-child(1) { background: #090b10; } .sw-moon i:nth-child(2) { background: #e4e9f2; } .sw-moon i:nth-child(3) { background: #8fb4e8; }
.sw-parchment i:nth-child(1) { background: #efe7d6; } .sw-parchment i:nth-child(2) { background: #2b2218; } .sw-parchment i:nth-child(3) { background: #8e2f25; }
.sw-snow i:nth-child(1) { background: #f6f6f8; } .sw-snow i:nth-child(2) { background: #1d1d24; } .sw-snow i:nth-child(3) { background: #b3263a; }
.sw-lily i:nth-child(1) { background: #fbf8f4; } .sw-lily i:nth-child(2) { background: #272130; } .sw-lily i:nth-child(3) { background: #6b3f8f; }
.sw-mist i:nth-child(1) { background: #eef2f4; } .sw-mist i:nth-child(2) { background: #1c262d; } .sw-mist i:nth-child(3) { background: #2a7a73; }

.statusbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: var(--bg-2); font-size: 13px; color: var(--muted); }
.statusbar span { display: inline-flex; align-items: center; gap: 8px; }
.statusbar .strong { color: var(--text); font-weight: 600; }
.statusbar .grow { flex: 1 1 auto; }
.phase-pill { padding: 2px 10px; border: 1px solid var(--line-2); color: var(--text); }
.phase-pill.night { border-color: var(--accent); color: var(--accent); }

/* ---------- 3단 배치 (게임 화면) ----------
   넓은 화면: 왼쪽 학생 · 가운데 활동 · 오른쪽 대화, 각 칸이 따로 스크롤된다.
   1180px 이하: 대화가 오른쪽 서랍으로. 820px 이하: 내 학생도 왼쪽 서랍으로. */
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr) 300px; gap: 16px; width: 100%; max-width: 1560px; margin: 0 auto; padding: 16px 20px 24px; }
.col-left, .col-center, .col-right { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.view { display: flex; flex-direction: column; gap: 16px; }
body.game { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.game .layout { flex: 1 1 auto; min-height: 0; }
body.game .col-left, body.game .col-center, body.game .col-right { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; padding-bottom: 8px; }
body.game .col-right .chat { flex: 1 1 auto; min-height: 0; }
body.game .col-right .chat-log { flex: 1 1 auto; max-height: none; }
.toggle-left, .toggle-right, .close-drawer { display: none; }
.icon-btn.small { width: 36px; height: 36px; }
.scrim { position: fixed; inset: 0; z-index: 25; background: var(--overlay); }

.panel { background: var(--panel); border: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.panel-head h2 small { font-weight: 400; color: var(--faint); }
.note { margin: 0; font-size: 12px; line-height: 1.6; color: var(--faint); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.tag { padding: 3px 8px; border: 1px solid var(--line-2); font-size: 11px; color: var(--muted); }

/* ---------- 인물 ---------- */
.portrait { position: relative; display: block; aspect-ratio: 3 / 4; border: 1px dashed var(--line-2); background: var(--panel-2); cursor: pointer; overflow: hidden; }
.portrait img { display: block; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
.portrait .placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 13px; }
.portrait input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.char-name { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.char-sub { font-size: 13px; color: var(--muted); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.facts dt { color: var(--faint); }
.facts dd { margin: 0; }

.gauge { display: flex; flex-direction: column; gap: 6px; }
.gauge-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.gauge-row > span:first-child { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.bar { height: 6px; background: var(--panel-3); }
.bar > span { display: block; height: 100%; width: 0; background: var(--text); transition: width 0.4s; }
.bar.dim > span { background: var(--muted); }
.bar.danger > span { background: var(--accent); }
.bar.thin { height: 4px; }
.pips { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.pip { height: 8px; border: 1px solid var(--line-3); }
.pip.on { background: var(--text); }
.hint { font-size: 12px; color: var(--faint); }
.stats { display: grid; grid-template-columns: 48px 1fr 24px; align-items: center; gap: 10px 12px; font-size: 13px; }
.stats .k { color: var(--muted); }
.stats .v { text-align: right; font-variant-numeric: tabular-nums; }

.quests { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.quests li { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.quests li .box { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; border: 1px solid var(--line-3); flex: none; }
.quests li.done { color: var(--faint); text-decoration: line-through; }
.quests li.done .box { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- 지도 ---------- */
.loc-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.loc-title { display: flex; flex-direction: column; gap: 6px; }
.loc-title h2 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.floors { display: flex; flex-wrap: wrap; border: 1px solid var(--line); }
.floors button { min-height: 38px; min-width: 56px; padding: 0 12px; border: 0; background: transparent; color: var(--muted); font-size: 13px; }
.floors button[aria-pressed="true"] { background: var(--text); color: var(--bg); font-weight: 600; }
.floors button .dot { display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }
.wings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 12px; background: var(--input); border: 1px solid var(--line); }
.wing { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wing-name { display: flex; align-items: center; justify-content: space-between; font-size: 11px; letter-spacing: 0.18em; color: var(--faint); }
.rooms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.zone { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 10px; min-height: 76px; padding: 10px 12px; min-width: 0; text-align: left; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.zone.locked { color: var(--muted); background: var(--bg-2); }
.zone.here { background: var(--here); }
.zone.sel { border-color: var(--text); }
.zone .zname { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.zone .zmarks { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.zone .zmarks .pin { color: var(--text); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }

.zone-info { flex-direction: row; flex-wrap: wrap; gap: 20px 28px; }
.zone-info .about { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.zone-info .about h3 { margin: 0; font-size: 18px; }
.zone-info .about p { margin: 0; font-size: 14px; line-height: 1.75; color: var(--text-2); }
.zone-info .actions { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.risk { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.risk .pips4 { display: inline-flex; gap: 3px; }
.risk .pips4 i { width: 10px; height: 10px; background: var(--line); }
.risk .pips4 i.on { background: var(--text); }

.people { display: flex; flex-direction: column; gap: 8px; width: 100%; padding-top: 14px; border-top: 1px solid var(--line); }
.person { display: flex; align-items: center; gap: 12px; }
.avatar { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; border: 1px solid var(--line-2); color: var(--text); flex: none; }
.person .who { flex: 1 1 auto; display: flex; flex-direction: column; gap: 1px; font-size: 14px; }
.person .who small { font-size: 11px; color: var(--faint); }
.hearts { display: inline-flex; gap: 2px; color: var(--accent); font-size: 11px; }

.dialogue { width: 100%; display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--line-2); background: var(--panel-2); }
.dialogue .speaker { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.dialogue .speaker small { font-weight: 400; color: var(--faint); }
.dialogue p { margin: 0; font-size: 15px; line-height: 1.8; color: var(--text); white-space: pre-wrap; }
.dialogue .opts { display: flex; flex-direction: column; gap: 6px; }
.dialogue .opts button { min-height: 42px; padding: 8px 14px; text-align: left; background: transparent; border: 1px solid var(--line-2); color: var(--text); font-size: 14px; line-height: 1.5; }
.dialogue .reward { font-size: 12px; color: var(--accent); }

.btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 14px; background: transparent; color: var(--text); border: 1px solid var(--line-2); font-size: 14px; text-decoration: none; }
.btn > span:first-child { display: inline-flex; align-items: center; gap: 10px; }
.btn .cost { font-size: 12px; color: var(--muted); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.btn.primary .cost { color: var(--bg); font-weight: 500; }
.btn.quiet { color: var(--muted); border-color: var(--line); }
.btn.center { justify-content: center; }
.btn.small { min-height: 36px; font-size: 13px; padding: 0 12px; }
.btn.inline { display: inline-flex; }

/* ---------- 기록 ---------- */
.log-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.log-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: 0.12em; color: var(--muted); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-3); }
.live-dot.on { background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); }
.seg button { min-height: 36px; padding: 0 12px; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.log { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow-y: auto; }
.log li { display: grid; grid-template-columns: 46px 18px minmax(0, 1fr); align-items: start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--row); }
.log .t { font-size: 12px; color: var(--faint); padding-top: 2px; font-variant-numeric: tabular-nums; }
.log .i { padding-top: 3px; color: var(--faint); }
.log .i.me { color: var(--text); }
.log .i.danger { color: var(--accent); }
.log .x { font-size: 14px; line-height: 1.65; color: var(--muted); overflow-wrap: anywhere; }
.log li:nth-child(-n+4) .x { color: var(--text-2); }
.log li:first-child .x { color: var(--text); }
.caret { display: inline-block; width: 7px; height: 15px; margin-left: 2px; vertical-align: -2px; background: var(--text); animation: blink 0.9s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.event-pin { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 16px; border: 1px solid var(--accent); background: var(--panel-2); }
.event-pin .grow { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.event-pin b { font-size: 14px; }
.event-pin small { font-size: 12px; color: var(--muted); }
.event-pin .mark { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border: 1px solid var(--line-2); color: var(--accent); }

/* ---------- 오른쪽 탭 ---------- */
.tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; border-bottom: 1px solid var(--line); }
.tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 40px; padding: 0 2px; white-space: nowrap; letter-spacing: -0.02em; background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.silver { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); background: var(--panel-2); }
.silver .grow { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.silver .grow small { font-size: 11px; color: var(--faint); }
.silver b { font-size: 24px; font-variant-numeric: tabular-nums; }
.inv { display: grid; grid-template-columns: repeat(auto-fill, 60px); gap: 4px; }
.slot { position: relative; width: 60px; height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px 3px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); cursor: pointer; }
.slot:hover { border-color: var(--line-2); }
.slot.sel { border-color: var(--text); }
.slot .nm { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 10px; color: var(--muted); line-height: 1.2; }
.slot .qty { position: absolute; top: 2px; right: 3px; min-width: 14px; padding: 0 3px; font-size: 10px; line-height: 14px; text-align: center; color: var(--text); background: var(--bg-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.detail { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line-2); background: var(--panel-2); }
.detail b { font-size: 15px; }
.detail p { margin: 0; font-size: 13px; line-height: 1.65; color: var(--text-2); }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.card { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); background: var(--panel-2); }
.card .title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.card .meta { font-size: 12px; color: var(--muted); line-height: 1.6; }
.card .meta b { color: var(--text-2); font-weight: 500; }
.card.locked { opacity: 0.6; }
.need.lack { color: var(--danger-text); }
.progress { height: 6px; background: var(--panel-3); }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 1s linear; }
.room { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.room .spot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 88px; padding: 8px; border: 1px dashed var(--line-2); background: transparent; color: var(--muted); font-size: 12px; text-align: center; }
.room .spot.filled { border-style: solid; background: var(--panel-2); color: var(--text); }
.subjects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.subjects .btn { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 8px 12px; min-height: 52px; }
.subjects .btn small { font-size: 11px; color: var(--muted); }
.codex-entry { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); background: var(--panel-2); }
.codex-entry.unknown { border-style: dashed; background: transparent; color: var(--faint); }
.codex-entry b { font-size: 14px; }
.codex-entry p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--text-2); }
.codex-entry small { font-size: 11px; color: var(--faint); }

/* ---------- 폼 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.field input, .field textarea, .field select { padding: 10px 12px; min-height: 42px; background: var(--input); color: var(--text); border: 1px solid var(--line-2); font-size: 14px; }
.field textarea { resize: vertical; line-height: 1.7; }
.grid2f { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.counter { align-self: flex-end; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.form { display: flex; flex-direction: column; gap: 12px; }
.error { min-height: 20px; font-size: 13px; color: var(--danger-text); }
.check { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.check input { width: 18px; height: 18px; accent-color: var(--text); }

.nb-mini { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.nb-mini:last-of-type { border-bottom: 0; }
.nb-mini small { font-size: 11px; color: var(--faint); }
.nb-mini p { margin: 0; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }

/* ---------- 공책 ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 32px 24px 48px; display: flex; flex-direction: column; gap: 28px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.page-head h1 { margin: 0; font-size: 34px; letter-spacing: -0.02em; }
.page-head p { margin: 0; max-width: 640px; font-size: 15px; line-height: 1.7; color: var(--muted); }
.page-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; }
.page-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.page-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.entry { display: flex; flex-direction: column; gap: 14px; padding: 22px 24px; background: var(--panel); border: 1px solid var(--line); }
.entry.dead { border-style: dashed; border-color: var(--line-3); }
.entry .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 12px; color: var(--muted); }
.entry .meta .author { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; }
.entry .trace { font-size: 12px; font-style: italic; color: var(--faint); }
.entry p { margin: 0; font-size: 17px; line-height: 1.8; overflow-wrap: anywhere; white-space: pre-wrap; }
.entry.torn p { font-size: 14px; font-style: italic; color: var(--faint); }
.reacts { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 14px; border-top: 1px solid var(--row); }
.reacts button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; font-size: 12px; border: 1px solid var(--line); background: transparent; color: var(--muted); }
.reacts button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.empty-state { margin: 0; padding: 32px; border: 1px dashed var(--line); text-align: center; font-size: 14px; color: var(--faint); }
.meanings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.meanings li { display: flex; align-items: center; gap: 10px; }
.meanings li span:nth-child(2) { flex: 1 1 auto; }
.meanings li small { font-size: 12px; color: var(--faint); }

/* ---------- 로그인 ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; padding: 32px; background: var(--panel); border: 1px solid var(--line); }
.auth-card h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.auth-card p { margin: 0; font-size: 14px; line-height: 1.7; color: var(--muted); }

/* ---------- 알림·오버레이 ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(560px, calc(100% - 32px)); padding: 12px 16px; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 14px; line-height: 1.6; z-index: 50; }
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--overlay); z-index: 40; }
.overlay .card { max-width: 440px; padding: 28px; gap: 16px; border: 1px dashed var(--line-3); background: var(--panel); }
.overlay h2 { margin: 0; font-size: 22px; }
.overlay p { margin: 0; font-size: 14px; line-height: 1.75; color: var(--text-2); }

/* ---------- 운영자 ---------- */
.admin { display: flex; flex-wrap: wrap; min-height: 100vh; }
.admin-nav { flex: 1 1 220px; min-width: 0; padding: 20px 16px; border-right: 1px solid var(--line); background: var(--input); display: flex; flex-direction: column; gap: 4px; }
.admin-nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; color: var(--muted); text-decoration: none; font-size: 14px; }
.admin-main { flex: 999 1 640px; min-width: 0; padding: 28px 28px 48px; display: flex; flex-direction: column; gap: 20px; }
.admin-main h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.grid2 { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.grid2 > .panel { flex: 1 1 380px; min-width: 0; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 500; font-size: 12px; color: var(--faint); padding: 8px; border-bottom: 1px solid var(--line); }
table.data td { padding: 10px 8px; border-bottom: 1px solid var(--row); vertical-align: top; overflow-wrap: anywhere; }
table.data td .orig { display: block; margin-top: 4px; font-size: 12px; color: var(--faint); }
.status-pill { display: inline-block; padding: 2px 8px; border: 1px solid var(--line-2); font-size: 11px; color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.row-actions button { min-height: 32px; padding: 0 10px; font-size: 12px; background: transparent; color: var(--text); border: 1px solid var(--line-2); }

/* ---------------------------------------------------------------- 실시간 활동·사건 */
.progress { height: 6px; border: 1px solid var(--line-2); background: var(--input); }
.progress > span { display: block; height: 100%; width: 0; background: var(--text-2); transition: width 1s linear; }
.activity .panel-head h2 { display: inline-flex; align-items: center; gap: 8px; }
.activity #act-buttons, .activity #trip-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.incidents { display: flex; flex-direction: column; gap: 10px; }
.incident { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--line-2); background: var(--panel-2); }
.incident.pending { border-color: var(--accent); }
.incident.encounter { border-style: double; border-width: 3px; }
.incident .ihead { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; }
.incident .ihead small { font-weight: 400; color: var(--faint); }
.incident p { margin: 0; font-size: 15px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.incident .opts { display: flex; flex-direction: column; gap: 6px; }
.incident .opts button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 44px; padding: 8px 14px; text-align: left; background: transparent; border: 1px solid var(--line-2); color: var(--text); font-size: 14px; line-height: 1.5; }
.incident .opts button small { font-size: 12px; color: var(--muted); }
.incident .result { font-size: 13px; color: var(--text-2); line-height: 1.7; }
.incident .result b { color: var(--muted); font-weight: 500; }

/* ---------------------------------------------------------------- 같은 방 대화 */
.chat .panel-head h2 { display: inline-flex; align-items: center; gap: 8px; }
.chat.club { border-color: var(--accent); }
.chat.club #chat-room { color: var(--accent); }
.chat-log { list-style: none; margin: 0; padding: 0; min-height: 80px; max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.chat-log li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; font-size: 14px; line-height: 1.6; }
.chat-log .who { font-weight: 600; color: var(--text-2); white-space: nowrap; }
.chat-log .who.me { color: var(--accent); }
.chat-log .msg { overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-log .t { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; padding-top: 3px; }
.chat-log .empty { display: block; color: var(--faint); font-size: 13px; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; background: var(--input); color: var(--text); border: 1px solid var(--line-2); font: inherit; font-size: 14px; }

/* 광기: 이성 10 이하 — 화면이 조금씩 흔들린다 */
body.mad .log li .x, body.mad .char-name { animation: mad-drift 7s ease-in-out infinite; }
@keyframes mad-drift { 0%, 100% { transform: none; filter: none; } 48% { transform: translateX(0.5px) skewX(-0.6deg); filter: blur(0.2px); } 52% { transform: translateX(-0.5px); } }
.tag.mad { border-color: var(--accent); color: var(--accent); }

/* ---------- 수업 탭 ---------- */
#tab-body .class-head { margin-bottom: 10px; }
#tab-body .class-head h3 { margin: 0; font-size: 13px; font-weight: 600; }
#tab-body .subjects + .note { margin-top: 10px; }

/* ---------- 팝업 (기숙사 공책) ---------- */
.overlay.modal { align-items: flex-start; overflow-y: auto; padding: 48px 24px; z-index: 45; }
body.modal-open { overflow: hidden; }
.modal-card { width: 100%; max-width: 980px; display: flex; flex-direction: column; gap: 20px; padding: 24px 28px 28px; background: var(--bg-2); border: 1px solid var(--line-2); outline: none; }
.modal-card.narrow { max-width: 560px; }
.field.grow { flex: 1 1 220px; }
.grad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.grad-card { display: flex; flex-direction: column; gap: 4px; padding: 10px; background: var(--panel); border: 1px solid var(--line); }
.grad-card b { font-size: 14px; margin-top: 6px; }
.grad-card small { font-size: 11px; color: var(--muted); line-height: 1.5; }
.grad-face { aspect-ratio: 3 / 4; background: var(--panel-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.grad-face img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.35) sepia(0.15); }
.grad-noface { color: var(--faint); }
.market-body { display: flex; flex-direction: column; gap: 14px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 2px 0 6px; font-size: 22px; }
.modal-head .note { margin: 0; }
.modal-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; }
.nb-list { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.nb-list #nb-entries { display: flex; flex-direction: column; gap: 12px; }
.nb-list .entry { padding: 18px 20px; gap: 12px; }
.nb-list .entry p { font-size: 15px; }
.nb-side { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 18px; background: var(--panel); border: 1px solid var(--line); position: sticky; top: 0; }
.nb-side h3 { margin: 0; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.nb-help summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.nb-help[open] summary { margin-bottom: 8px; }
.page-main #nb-entries { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 640px) {
  .overlay.modal { padding: 0; }
  .modal-card { min-height: 100%; padding: 18px 16px 24px; border: 0; }
  .nb-side { position: static; }
}

@media (max-width: 640px) {
  .top, .statusbar { padding-left: 16px; padding-right: 16px; }
  .layout, .page { padding-left: 16px; padding-right: 16px; }
  .admin-nav { border-right: 0; border-bottom: 1px solid var(--line); }
  .wings { grid-template-columns: 1fr; }
  .grid2f { grid-template-columns: 1fr; }
}
/* ---------------------------------------------------------------- 새 화면 조각 */
.link-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 0 4px; background: transparent; border: 0; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.who-row { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 14px; align-items: start; }
.who-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.who-text .char-name { font-size: 20px; overflow-wrap: anywhere; }
.pips.ten { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; }
.pip.on.danger { background: var(--accent); border-color: var(--accent); }
.promo { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.promo .bar > span { background: var(--accent); }
.tag.danger { border-color: var(--accent); color: var(--danger-text); }
.card.service { border-left: 2px solid var(--accent); }

/* 시간표 (왼쪽 요약) */
.tt-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tt-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 7px 8px; border-bottom: 1px solid var(--row); font-size: 13px; }
.tt-row:last-child { border-bottom: 0; }
.tt-row .tt-p { color: var(--faint); font-size: 12px; }
.tt-row .tt-s { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-row .tt-st { color: var(--faint); font-size: 11px; }
.tt-row.after .tt-s { color: var(--muted); }
.tt-row.now { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.tt-row.now .tt-s { color: var(--text); font-weight: 600; }
.tt-row.active .tt-st { color: var(--accent); }
.tt-row.done .tt-s, .tt-row.skipped .tt-s { color: var(--faint); }
.tt-row.skipped .tt-s { text-decoration: line-through; }

/* 시간표 (가운데 크게) */
.tt-table { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tt-line { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: start; padding: 12px 14px; border: 1px solid var(--line); background: var(--panel-2); }
.tt-when { display: flex; flex-direction: column; gap: 2px; }
.tt-when b { font-family: var(--serif); font-size: 15px; color: var(--heading, var(--text)); }
.tt-when small { font-size: 11px; color: var(--faint); }
.tt-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 13px; }
.tt-cell small { color: var(--muted); }
.tt-cell .result { color: var(--text-2); }
.tt-line.empty { border-style: dashed; background: transparent; }
.tt-line.past { background: transparent; opacity: 0.7; }
.tt-line.draft { border-color: var(--line-3); border-style: dashed; }
.tt-line.active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.tt-line.done { opacity: 0.85; }
.tt-line.skipped .tt-cell b { text-decoration: line-through; color: var(--muted); }
.tt-build { display: flex; flex-direction: column; gap: 12px; padding-top: 6px; }
.tt-build h3 { margin: 0; font-size: 14px; }
.tt-after { flex: none; width: 100%; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px dashed var(--line-3); }
.day-flow .tt-after p { margin: 0; flex: none; }
#routine-first { align-items: stretch; flex-wrap: nowrap; }

/* 학사일정 */
.cal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cal-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 9px 10px; border-bottom: 1px solid var(--row); }
.cal-row:last-child { border-bottom: 0; }
.cal-day { color: var(--faint); font-size: 12px; }
.cal-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; }
.cal-body small { color: var(--muted); }
.cal-row.past { opacity: 0.55; }
.cal-row.now { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.cal-row.k-exam .tag { color: var(--accent); border-color: var(--accent); }
#season-panel .link-btn { align-self: flex-start; }

/* 운영자 이벤트방 */
.panel.scene { border-color: var(--accent); }
.scene-lines { list-style: none; margin: 0; padding: 0 2px; display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.scene-line { font-size: 14px; line-height: 1.75; color: var(--text); }
.scene-line.k-narr span { font-style: italic; color: var(--text-2); }
.scene-line.k-npc .speaker { display: block; font-size: 12px; color: var(--accent); }
.scene-line.k-system, .scene-line.k-roll { font-size: 12px; color: var(--muted); }
.scene-line.k-roll { padding-left: 8px; border-left: 2px solid var(--line-2); }
.scene-acts { display: flex; flex-direction: column; gap: 8px; }
.scene-acts:not(:empty) { padding-top: 10px; border-top: 1px solid var(--line); }
.scene-check { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: var(--r-md); background: var(--panel-2); }
.scene-check .row { flex-wrap: wrap; gap: 8px; align-items: center; }
.scene-result { margin: 0; font-size: 13px; line-height: 1.6; }
.scene-result.o-crit, .scene-result.o-success { color: var(--text); }
.scene-result.o-fumble { color: var(--danger-text); }
.scene-opts button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* 운영자 콘솔: 이벤트방 */
.scene-console { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.scene-lines.gm { max-height: 360px; padding: 10px; border-radius: var(--r-md); background: var(--panel-2); }
.scene-lines.gm .scene-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.scene-lines.gm .scene-line .speaker { display: inline; }
.scene-line.deleted { opacity: 0.45; text-decoration: line-through; }
.scene-tools { display: flex; flex-direction: column; gap: 8px; }
.scene-tool { border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 12px; }
.scene-tool summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.scene-tool[open] summary { margin-bottom: 10px; }
.outcome-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.outcome { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; margin: 0; min-width: 0; }
.outcome legend { font-size: 13px; color: var(--muted); padding: 0 4px; }
.scene-live { display: flex; flex-direction: column; gap: 8px; }
.scene-live small { color: var(--muted); font-size: 12px; line-height: 1.6; }

/* 에블린의 징조 · 놀이 · 회색 종 */
.omen { margin: 10px 0 0; font-size: 12px; line-height: 1.6; color: var(--danger-text); font-style: italic; }
.event-pin.evelyn { border-color: var(--accent); }
.event-pin.evelyn .row { gap: 6px; flex-wrap: wrap; }

/* 괴담록 */
.rumor-list { display: flex; flex-direction: column; gap: 8px; }
.rumor-card { border: 1px solid var(--line); border-radius: var(--r-md, 12px); background: var(--panel-2); }
.rumor-card.locked { opacity: 0.55; }
.rumor-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; cursor: pointer; list-style: none; }
.rumor-head::-webkit-details-marker { display: none; }
.rumor-card.locked .rumor-head { cursor: default; }
.rumor-head b { flex: 1 1 auto; min-width: 0; font-size: 14px; }
.rumor-head small { flex-basis: 100%; color: var(--faint); font-size: 12px; }
.rumor-no { color: var(--faint); font-size: 12px; }
.rumor-pips { display: inline-flex; gap: 3px; }
.rumor-pips i { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--line-3); }
.rumor-pips i.on { background: var(--accent); border-color: var(--accent); }
.rumor-card.stage-record { border-color: var(--accent); }
.rumor-card.stage-record .tag { color: var(--accent); border-color: var(--accent); }
.rumor-body { display: flex; flex-direction: column; gap: 8px; padding: 0 12px 12px; }
.rumor-line { margin: 0; font-size: 13px; color: var(--text-2); font-style: italic; }
.rumor-zones, .rumor-first { color: var(--muted); font-size: 12px; }
.rumor-story { margin: 0; font-size: 14px; line-height: 1.75; color: var(--text); }
.rumor-clues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rumor-clue { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border-radius: var(--r-sm, 8px); background: var(--panel); font-size: 13px; line-height: 1.6; }
.rumor-clue small { color: var(--faint); font-size: 12px; }
.rumor-clue.missing .rc-text { color: var(--faint); }
.rc-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.rc-acts select { max-width: 140px; }

/* 학생 수첩 */
.banner { border-color: var(--accent); }
.banner p { margin: 0; font-size: 14px; line-height: 1.7; color: var(--text-2); }
.here-card .loc-title h2 { font-size: 22px; }
.day-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.day-flow p { margin: 0; flex: 1 1 260px; font-size: 14px; line-height: 1.7; color: var(--text-2); }

/* 수업 중 몰래 하기 */
.activity.in-class { border-color: var(--line-3); }
.sneak { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border: 1px dashed var(--line-2); background: var(--bg-2); }
.sneak b { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.sneak .row { gap: 8px; }
.attention { display: inline-flex; gap: 3px; margin-left: 6px; }
.attention i { width: 10px; height: 10px; border: 1px solid var(--line-3); border-radius: 50%; }
.attention i.on { background: var(--accent); border-color: var(--accent); }
.sneak-craft { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.sneak-craft select { min-height: 36px; padding: 0 8px; background: var(--input); border: 1px solid var(--line-2); color: var(--text); font-size: 13px; max-width: 100%; }

/* 수업 중 쪽지: 화면 아래에서 올라온다 */
.note-dock { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 35; width: min(460px, calc(100% - 24px)); display: flex; flex-direction: column; align-items: stretch; gap: 8px; pointer-events: none; }
.note-dock > * { pointer-events: auto; }
.note-pops { display: flex; flex-direction: column; gap: 6px; }
.note-pop { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; background: var(--paper); color: var(--paper-ink); border: 1px solid #b9ab8a; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); animation: note-up 0.35s ease-out; transform: rotate(-0.6deg); }
.note-pop span { display: flex; flex-direction: column; gap: 2px; }
.note-pop b { font-family: var(--serif); font-size: 14px; }
.note-pop small { font-size: 12px; color: #5d5245; }
.note-pop.trap { background: #d9d3c4; color: #3a1e1e; border-color: #8c3b3b; transform: rotate(0.8deg); }
@keyframes note-up { from { transform: translateY(40px); opacity: 0; } to { opacity: 1; } }
.note-drawer { display: flex; flex-direction: column; gap: 10px; max-height: min(70vh, 560px); padding: 16px; background: var(--panel); border: 1px solid var(--line-2); border-bottom: 0; box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.45); animation: note-up 0.25s ease-out; }
.note-drawer.hidden { display: none; }
.note-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note-drawer-head h2 { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-size: 15px; }
.note-drawer-head .row { gap: 6px; flex-wrap: nowrap; }
#note-sound[aria-pressed="false"] { color: var(--faint); }
.note-mates { display: flex; flex-wrap: wrap; gap: 6px; }
.note-mates button { display: inline-flex; align-items: baseline; gap: 6px; min-height: 34px; padding: 0 10px; background: transparent; border: 1px solid var(--line-2); color: var(--text-2); font-size: 13px; }
.note-mates button small { font-size: 11px; color: var(--faint); }
.note-mates button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }
.note-list { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; min-height: 60px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.note-list li { display: flex; flex-direction: column; gap: 6px; max-width: 88%; padding: 10px 12px; background: var(--paper); color: var(--paper-ink); font-size: 14px; line-height: 1.6; }
.note-list li .row { gap: 8px; }
.note-list li b { font-size: 12px; }
.note-list li small { font-size: 11px; color: #6b6052; }
.note-list li p { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.note-list li.mine { align-self: flex-end; background: #d8d2c0; }
.note-list li.empty { max-width: none; background: transparent; color: var(--faint); font-size: 13px; padding: 4px 0; }
.note-list li.note-trap { max-width: none; background: #1c1416; color: var(--text); border: 1px dashed var(--accent); }
.note-list li.note-trap small, .note-list li.note-trap .hint { color: var(--muted); }
.note-list li.note-trap b { color: var(--danger-text); }
.note-tab { align-self: center; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; background: var(--panel); border: 1px solid var(--line-2); border-bottom: 0; color: var(--text); font-size: 13px; }
.badge { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; align-items: center; justify-content: center; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }

/* 오른쪽 대화 */
.chat-room { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }


/* ================================================================ 게임 화면 틀 (참고 시안)
   머리말(학교 이름 · 시계 · 촛불·은단추) → 가로 메뉴 → 왼쪽 학생 · 가운데 카드 · 오른쪽 속삭임.
   좌우 칸은 화면 끝까지 붙고 선으로만 나뉜다. 가운데 카드는 가운데 정렬된 한 줄 폭. */
.game-top { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px 24px; min-height: 64px; padding: 10px 24px; background: var(--bg-2); border-bottom: 1px solid var(--line); flex-wrap: nowrap; }
.game-top .brand { justify-self: start; min-width: 0; }
.game-top .brand-mark { width: 38px; height: 38px; border: 0; color: var(--text-2); }
.game-top .brand-name b { font-size: 20px; letter-spacing: 0.24em; font-weight: 500; white-space: nowrap; }
.game-top .brand-name .eng { font-size: 9px; letter-spacing: 0.32em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clockbar { display: inline-flex; align-items: center; gap: 14px; white-space: nowrap; }
.phase-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.phase-label.night { color: var(--accent); }
.big-clock { font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: 0.08em; color: var(--heading, var(--text)); }
.clock-sep { width: 1px; height: 16px; background: var(--line-2); }
.clock-next { font-size: 12px; color: var(--muted); }
.purse { justify-self: end; display: inline-flex; align-items: center; gap: 20px; min-width: 0; }
.purse > span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.purse-item small { font-size: 12px; color: var(--muted); }
.purse-item b { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--heading, var(--text)); }
.purse-seats { font-size: 12px; color: var(--faint); }
.game-top .top-actions { gap: 2px; padding-left: 14px; border-left: 1px solid var(--line); }
.game-top .top-actions .icon-btn { border-color: transparent; color: var(--muted); }
.game-top .top-actions .icon-btn:hover { color: var(--text); }

.menubar { flex: none; display: flex; flex-wrap: nowrap; gap: 4px; padding: 0 18px; background: var(--bg); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.menubar a, .menubar button { min-height: 48px; padding: 0 16px; gap: 7px; font-size: 13px; border-bottom: 2px solid transparent; }
.menubar .ic { color: var(--faint); }
.menubar a[aria-current="page"], .menubar button[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.menubar [aria-current="page"] .ic { color: var(--accent); }

body.game .layout { grid-template-columns: 300px minmax(0, 1fr) 340px; gap: 0; max-width: none; padding: 0; }
body.game .col-left { gap: 0; padding: 0; background: var(--bg-2); border-right: 1px solid var(--line); }
body.game .col-right { padding: 0; background: var(--bg-2); border-left: 1px solid var(--line); }
body.game .col-center { align-items: center; gap: 22px; padding: 24px 28px 40px; }
body.game .col-center > * { width: 100%; max-width: 860px; }
body.game .col-center .view { gap: 22px; }

/* 가운데 카드: 넓은 여백, 또렷한 테두리, 영어 작은 머리글 */
body.game .col-center .panel { padding: 26px 28px; gap: 16px; background: var(--panel); border-color: var(--line-2); }
body.game .col-center .panel-head h2 { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; }
body.game .col-center .panel-head .eng { letter-spacing: 0.26em; }
body.game .col-center .loc-title .eng { letter-spacing: 0.26em; font-size: 10px; }
body.game .here-card .loc-title h2 { font-size: 26px; font-weight: 600; letter-spacing: 0.02em; }
body.game .col-center .activity { border-color: var(--accent); }
.log-head h2 { display: inline-flex; align-items: baseline; gap: 10px; font-size: 12px; letter-spacing: 0.14em; }
.log-head h2 .eng { font-family: 'Pretendard Variable', Pretendard, sans-serif; font-size: 11px; font-weight: 700; letter-spacing: 0.26em; color: var(--text-2); }
.log-head h2 .eng::after { content: '·'; margin-left: 10px; color: var(--faint); }
.seg { gap: 6px; border: 0; }
.seg button { min-height: 30px; padding: 0 10px; border: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] { background: var(--panel-3); color: var(--text); border-color: var(--line-3); }
#event-pins:empty { display: none; }
.log li { grid-template-columns: 64px 18px minmax(0, 1fr); padding: 9px 0; border-bottom-color: transparent; }
.log .t { font-size: 12px; letter-spacing: 0.04em; }
.event-pin { padding: 18px 22px; }
.btn.small.inline { min-height: 34px; }

/* 왼쪽: 학생 기록 — 상자 없이 선으로만 구분 */
.side-sec { display: flex; flex-direction: column; gap: 14px; padding: 22px 20px; border-bottom: 1px solid var(--line); }
.side-sec:last-child { border-bottom: 0; }
.side-sec .panel-head h2 { margin: 0; font-size: 14px; font-weight: 700; }
.profile { gap: 6px; }
.profile .who-row { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.profile .portrait { width: 52px; height: 52px; aspect-ratio: auto; border: 1px solid var(--line-2); border-radius: 0; background: var(--panel); }
.profile .portrait .placeholder { gap: 2px; font-size: 10px; }
.grade-badge { padding: 3px 8px; border: 1px solid var(--accent); color: var(--accent); font-size: 11px; }
.profile .eng { font-size: 9px; letter-spacing: 0.3em; }
.profile .char-name { font-size: 24px; font-weight: 600; letter-spacing: 0.02em; overflow-wrap: anywhere; margin-bottom: 2px; }
.profile .char-sub { font-size: 12px; }
.profile .facts { margin-top: 12px; padding-top: 12px; gap: 6px 14px; font-size: 12px; }
.col-left .gauge { gap: 7px; }
.col-left .gauge-row { font-size: 12px; }
.col-left .gauge-row > span:first-child { color: var(--text-2); }
.col-left .gauge-row .num { font-size: 11px; color: var(--muted); }
.col-left .bar { height: 3px; }
.col-left .pip { height: 6px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 6px; text-align: center; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.stat small { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 10px; color: var(--faint); }
.stat b { font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--heading, var(--text)); }
.promo { margin-top: 4px; padding-top: 16px; }
.promo .gauge-row b { font-size: 13px; }
.col-left .link-btn { text-decoration: none; }

/* 왼쪽: 오늘의 시간표 — 세로 시간선 */
.tt-mini { position: relative; gap: 4px; }
.tt-mini::before { content: ''; position: absolute; left: 13px; top: 14px; bottom: 14px; width: 1px; background: var(--line-2); }
.tt-row { position: relative; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 0; }
.tt-dot { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border: 1px solid var(--line-2); border-radius: 50%; background: var(--bg-2); color: var(--muted); }
.tt-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tt-row .tt-p { font-size: 11px; letter-spacing: 0.04em; }
.tt-row .tt-s { font-size: 13px; font-weight: 600; }
.tt-row.now { background: transparent; box-shadow: none; }
.tt-row.now .tt-dot { border-color: var(--accent); color: var(--accent); }
.tt-row.now .tt-p { color: var(--accent); }

/* 오른쪽: 복도의 속삭임 — 칸 전체를 쓰는 대화창 */
body.game .col-right .chat { display: flex; flex-direction: column; gap: 0; height: 100%; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 20px 20px 14px; }
.chat-head h2 { margin: 0; flex: 1 1 auto; display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; letter-spacing: 0.04em; }
.chat-head .eng { font-size: 9px; }
.chat-tabs { display: flex; border-bottom: 1px solid var(--line); }
.chat-tabs > span { flex: 1 1 0; min-width: 0; padding: 10px 12px; text-align: center; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-tabs > span.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.chat.club { border: 0; }
.chat .chat-room { padding: 12px 20px; background: transparent; border: 0; border-bottom: 1px solid var(--line); }
body.game .col-right .chat-log { flex: 1 1 auto; min-height: 120px; max-height: none; gap: 18px; padding: 18px 20px; }
.chat-log li { display: flex; flex-direction: column; gap: 4px; }
.chat-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chat-log .who { font-size: 13px; font-weight: 700; color: var(--text); }
.chat-log .msg { margin: 0; font-size: 14px; line-height: 1.65; color: var(--text-2); }
.chat-log li.mine .msg { color: var(--text); }
.chat-form { flex-direction: column; gap: 8px; padding: 16px 20px 10px; border-top: 1px solid var(--line); }
.chat-label { font-size: 12px; color: var(--muted); }
.chat-form input { min-height: 64px; padding: 10px 12px; }
.chat-send { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-send .btn { gap: 8px; }
.chat > .note { padding: 0 20px 18px; font-size: 11px; }
#note-form { flex-direction: row; padding: 0; border-top: 0; }
#note-form input { min-height: 44px; }

@media (max-width: 1400px) {
  body.game .layout { grid-template-columns: 270px minmax(0, 1fr) 310px; }
  .purse-seats { display: none !important; }
}

@media (max-width: 1180px) {
  .layout { grid-template-columns: 260px minmax(0, 1fr); }
  .toggle-right, .close-drawer { display: inline-flex; }
  body.game .col-right { position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; width: min(360px, 92vw); padding: 12px; background: var(--bg); border-left: 1px solid var(--line-2); transform: translateX(105%); transition: transform 0.2s ease-out; }
  body.show-right .col-right { transform: none; }
  body.game .layout { grid-template-columns: 270px minmax(0, 1fr); }
  body.game .col-right { padding: 0; background: var(--bg-2); }
  .game-top { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; }
  .purse-item small { display: none; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 20px; }
  .toggle-left { display: inline-flex; }
  body.game .col-left { position: fixed; top: 0; left: 0; bottom: 0; z-index: 30; width: min(320px, 88vw); padding: 12px; background: var(--bg); border-right: 1px solid var(--line-2); transform: translateX(-105%); transition: transform 0.2s ease-out; }
  body.show-left .col-left { transform: none; }
  .top { gap: 8px 12px; padding: 10px 12px; }
  .nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav a, .nav button { min-height: 40px; padding: 0 10px; font-size: 13px; }
  .statusbar { gap: 6px 12px; padding: 8px 12px; }
  .hide-sm { display: none !important; }
  .tt-line { grid-template-columns: 72px minmax(0, 1fr); gap: 10px; }
  body.game .layout { grid-template-columns: minmax(0, 1fr); padding: 0; }
  body.game .col-left { padding: 0; background: var(--bg-2); }
  body.game .col-center { padding: 16px 12px 28px; gap: 16px; }
  body.game .col-center .panel { padding: 20px 18px; }
  .game-top { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 8px 12px; }
  .game-top .brand { flex: 1 1 0; }
  .game-top .brand-mark { display: none; }
  .game-top .brand-name b { font-size: 17px; letter-spacing: 0.14em; }
  .clockbar { order: 4; gap: 10px; }
  .big-clock { font-size: 20px; }
  .purse { order: 5; margin-left: auto; gap: 12px; }
  .game-top .top-actions { padding-left: 6px; }
  .menubar { order: 0; flex: none; padding: 0 6px; }
  .menubar a, .menubar button { min-height: 44px; padding: 0 12px; }
}
@media (max-width: 480px) {
  .phase-label #sb-phase-text, .clock-sep { display: none; }
  .clockbar { flex: 1 1 100%; }
  .purse { flex: 1 1 100%; justify-content: space-between; margin-left: 0; }
}

/* ---------- 교우 관계: 작은 카드 격자 ---------- */
.folk { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.kin { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; padding: 10px 8px 9px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); text-align: center; }
.kin:hover { border-color: var(--line-2); }
.kin.sel { border-color: var(--text); }
.kin.unmet { color: var(--faint); }
.kin .avatar { width: 32px; height: 32px; }
.kin.unmet .avatar { border-style: dashed; color: var(--faint); }
.kin .nm { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; line-height: 1.3; }
.kin .bar { width: 100%; }
.kin .bar > span { background: var(--text-2); }
.kin .bar.danger > span { background: var(--accent); }
#social-people { display: flex; flex-direction: column; gap: 10px; }
#social-people .note { margin: 0; }
.list.clubs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.list.clubs .card > :last-child { margin-top: auto; }
.kin-detail { animation: rise 0.25s ease-out; }

/* ---------- 은은한 움직임 (괴담 분위기). 움직임 줄이기 설정이면 아래에서 모두 멈춘다 ---------- */
/* 촛불: 불꽃 아이콘과 마지막 남은 촛불 칸이 가늘게 일렁인다 */
.flicker { display: inline-flex; color: var(--accent); animation: flicker 3.2s ease-in-out infinite; }
.pip.on:has(+ .pip:not(.on)), .pip.on:last-child { animation: flicker 3.2s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 12% { opacity: 0.72; } 18% { opacity: 0.95; } 46% { opacity: 0.8; } 52% { opacity: 1; } 78% { opacity: 0.66; } 84% { opacity: 0.92; } }

/* 안개: 화면 아래쪽으로 아주 옅은 안개가 천천히 흘러간다. 밤에는 조금 짙어진다 */
body.game::after { content: ''; position: fixed; left: -20%; right: -20%; bottom: -10vh; height: 45vh; z-index: 5; pointer-events: none;
  background: radial-gradient(ellipse 40% 60% at 25% 80%, var(--muted), transparent 70%), radial-gradient(ellipse 35% 50% at 70% 90%, var(--muted), transparent 70%);
  opacity: 0.035; filter: blur(30px); animation: fog 48s ease-in-out infinite alternate; }
body.game.night::after { opacity: 0.07; }
@keyframes fog { from { transform: translateX(-6%); } to { transform: translateX(6%); } }

/* 진행 중인 일: 모래시계가 천천히 뒤집히고, 진행 막대 위로 희미한 빛이 지나간다 */
.activity #act-title .ic:first-child { animation: hourglass 6s ease-in-out infinite; transform-origin: 50% 50%; }
.activity.trip #trip-title .ic:first-child { animation: fp-head 1.6s ease-in-out infinite; }
@keyframes hourglass { 0%, 70% { transform: rotate(0); } 85%, 100% { transform: rotate(180deg); } }
.activity .progress { position: relative; overflow: hidden; }
.activity .progress::after { content: ''; position: absolute; inset: 0; width: 30%; background: linear-gradient(90deg, transparent, var(--text), transparent); opacity: 0.18; animation: gleam 3.6s ease-in-out infinite; }
@keyframes gleam { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

/* 아직 고르지 않은 사건: 테두리가 숨 쉬듯 붉게 */
.incident.pending { animation: breathe 2.8s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { border-color: var(--accent); } 50% { border-color: var(--line-2); } }

/* 새 기록 한 줄은 희미하게 스며 나온다 */
.log li.fresh { animation: rise 0.5s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* 가장 깊은 밤(자정 피크): 화면 가장자리가 붉게 물들고 천천히 맥박친다. 테마와 상관없이 같은 핏빛 */
body.game.peak::before { content: ''; position: fixed; inset: 0; z-index: 6; pointer-events: none;
  background: radial-gradient(ellipse 75% 70% at 50% 45%, transparent 55%, rgba(150, 12, 20, 0.34) 100%);
  animation: peak-pulse 5s ease-in-out infinite; }
body.game.peak .big-clock, body.game.peak #sb-phase { color: #e0505c; }
@keyframes peak-pulse { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }

/* 금기: 내려와 있는 동안 위쪽에 붙는 경고 */
.banner.taboo { border-color: var(--accent); background: var(--panel-2); animation: breathe 2.8s ease-in-out infinite; }
.banner.taboo .taboo-text { font-family: var(--serif); font-size: 17px; color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
/* 게임 화면에서는 알림이 쪽지 탭을 가리지 않게 조금 위에 띄운다 */
body.game .toast { bottom: 72px; }

/* ---------- 메뉴 다섯 묶음 + 세부 탭 ---------- */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; }
.subnav button { min-height: 36px; padding: 0 14px; background: transparent; color: var(--muted); border: 1px solid var(--line-2); font: inherit; font-size: 13px; }
.subnav button[aria-pressed="true"] { background: var(--panel-3); color: var(--text); border-color: var(--line-3); font-weight: 600; }
.menubar a, .menubar button { font-size: 14px; padding: 0 20px; }

/* ---------- 오른쪽: 학교의 기록(위, 늘 보임) + 속삭임(아래) ---------- */
body.game .col-right { gap: 0; }
.feed { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line-2); }
body.game .col-right .feed { flex: 1 1 0; min-height: 240px; }
body.game .col-right .chat { flex: 0 0 auto; min-height: 0; height: auto; }
body.game .col-right .chat-log { flex: 0 1 auto; min-height: 72px; max-height: 220px; gap: 12px; padding: 12px 20px; }
body.game .col-right .chat-form input { min-height: 44px; }
.chat .chat-room { padding: 8px 20px; }
.feed .log-head { flex-wrap: nowrap; }
.feed .log-head h2 { flex: 1 1 auto; display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; letter-spacing: 0.04em; color: var(--text); }
.feed .log-tools { justify-content: space-between; }
.feed .log { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; scrollbar-width: thin; }
.feed .log li { grid-template-columns: 40px 16px minmax(0, 1fr); gap: 8px; padding: 7px 0; }
.feed .log .x { font-size: 13.5px; line-height: 1.6; }
.feed .log li:first-child .x { font-size: 14.5px; font-weight: 500; }
.feed > .note { margin: 0; font-size: 11px; }
.chat-head { padding-top: 16px; }

/* 좁은 화면: 오른쪽이 서랍이 되면, 최신 기록 한 줄을 메뉴 아래 늘 띄운다 */
.log-ticker { display: none; }
@media (max-width: 1180px) {
  .log-ticker { flex: none; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 16px; background: var(--bg-2); color: var(--text); border: 0; border-bottom: 1px solid var(--line); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
  .log-ticker .t { flex: none; color: var(--faint); font-size: 12px; }
  .log-ticker .x { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .log-ticker .live-dot { flex: none; }
  .log-ticker > .ic:last-child { color: var(--faint); }
}
@media (max-width: 820px) {
  .menubar a, .menubar button { padding: 0 14px; }
}
@media (max-width: 480px) {
  .menubar { padding: 0; }
  .menubar a, .menubar button { flex: 1 1 0; justify-content: center; gap: 5px; padding: 0 4px; font-size: 13px; }
}

/* ---------- 지도: 내 위치와 지나온 발자국 ---------- */
.wings { position: relative; }
.zone.here { position: relative; border-color: var(--accent); }
.zone.here::after { content: ''; position: absolute; inset: -1px; border: 1px solid var(--accent); pointer-events: none; animation: here-ring 2.4s ease-out infinite; }
@keyframes here-ring { 0% { opacity: 0.7; inset: -1px; } 100% { opacity: 0; inset: -7px; } }
.zone.arrive { animation: arrive 0.45s ease-out both; animation-delay: 0.6s; }
@keyframes arrive { 0% { background: var(--panel-2); } 50% { background: var(--panel-3); } 100% { background: var(--here); } }
.zone .zmarks .pin { color: var(--accent); }
.here-tag { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: var(--bg); font-size: 11px; font-weight: 800; }
.trail { position: absolute; inset: 0; z-index: 2; pointer-events: none; color: var(--accent); }
.trail .fp { position: absolute; width: 10px; height: 15px; margin: -7px 0 0 -5px; fill: currentColor; }
.trail.fresh .fp { opacity: 0; animation: fp-step 0.5s ease-out forwards; }
.trail.old .fp { opacity: 0.35; }
@keyframes fp-step { 0% { opacity: 0; } 40% { opacity: 1; } 100% { opacity: 0.75; } }
/* 걷는 중: 지나온 발자국은 진하게, 남은 길은 흐리게, 지금 발걸음은 숨 쉬듯 깜빡인다 */
.trail.walking .fp { opacity: 0.14; transition: opacity 0.6s ease-out; }
.trail.walking .fp.on { opacity: 0.7; }
.trail.walking .fp.head { opacity: 1; animation: fp-head 1.6s ease-in-out infinite; }
@keyframes fp-head { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
  .zone.here::after, .zone.arrive { animation: none; }
  .trail.fresh .fp { animation: none; opacity: 0.75; }
  .trail.walking .fp.head { animation: none; }
}

/* ================================================================
   부드러운 카드 (2026-10): 모서리를 둥글게, 글씨 간격은 좁혀 읽기 쉽게.
   테마 색은 그대로 두고 모양만 바꾼다. 맨 뒤에 두어 위의 규칙을 덮는다.
   ================================================================ */
:root { --r-lg: 18px; --r-md: 12px; --r-sm: 9px; --r-pill: 999px; --shadow: 0 1px 0 rgba(255, 255, 255, 0.025) inset, 0 8px 24px rgba(0, 0, 0, 0.18); }
[data-theme="parchment"] { --shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 6px 18px rgba(60, 40, 20, 0.08); }
:is([data-theme="snow"], [data-theme="lily"], [data-theme="mist"]) { --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 6px 18px rgba(20, 20, 40, 0.07); }

.panel, .entry, .nb-side, .modal-card, .grad-card, .event-pin { border-radius: var(--r-lg); box-shadow: var(--shadow); }
.panel { padding: 22px; }
.card, .incident, .chat-room, .zone, .wings { border-radius: 14px; }
.btn, .incident .opts button, .field input, .field textarea, .field select, .chat-form input, .toast { border-radius: var(--r-md); }
.btn.small { border-radius: 10px; }
.tag, .grade-badge { border-radius: var(--r-pill); }
.portrait { border-radius: 14px; }
.event-pin .mark { border-radius: 50%; }
.bar, .bar > span { border-radius: var(--r-pill); }
.toast { box-shadow: var(--shadow); }

/* 층·필터 고르기: 알약 모양 */
.floors { gap: 4px; padding: 4px; border-radius: 14px; background: var(--input); }
.floors button { border-radius: 10px; }
.seg button { border-radius: var(--r-pill); padding: 0 12px; }
.seg button[aria-pressed="true"] { border-color: var(--text); }

/* 가운데 칸 제목: 넓은 자간 대신 또렷한 글씨 */
body.game .col-center .panel-head h2 { font-size: 15px; letter-spacing: 0; }
body.game .col-center .panel-head .eng, body.game .col-center .loc-title .eng { letter-spacing: 0.16em; }
.wing-name { letter-spacing: 0.08em; }

/* 사건 카드: 상황은 말풍선처럼, 선택지는 둥근 버튼 */
.incident { gap: 12px; padding: 16px; }
.incident p { padding: 12px 14px; border-radius: 4px 14px 14px 14px; background: var(--panel-3); }
.incident .opts { gap: 8px; }
.incident .opts button { padding: 10px 14px; background: var(--panel); }
.incident .opts button:not(:disabled):hover { border-color: var(--text); filter: none; }
.temper-tag { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--line-2); font-size: 11px; font-style: normal; color: var(--muted); }
.temper-tag.good { border-color: var(--accent); color: var(--text); }

/* ---------- 입학 첫날 밤 이야기 ---------- */
.story-overlay { align-items: center; }
.story-card { width: 100%; max-width: 560px; max-height: min(820px, calc(100vh - 48px)); display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45); outline: none; overflow: hidden; }
.story-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.story-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--r-pill); background: var(--panel-3); font-size: 12px; font-weight: 600; color: var(--text-2); }
.story-pill h2, .story-pill span { margin: 0; font: inherit; }
.story-steps { display: inline-flex; gap: 6px; }
.story-steps span { width: 8px; height: 8px; border-radius: 50%; background: var(--panel-3); border: 1px solid var(--line-2); transition: background 0.3s; }
.story-steps span.on { background: var(--accent); border-color: var(--accent); }
.story-log { flex: 1 1 auto; min-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 22px 20px 12px; }
.story-log > * { animation: sl-in 0.32s ease-out both; }
@keyframes sl-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .story-log > * { animation: none; } }
.story-card .sl-narr { margin: 6px 12px; text-align: center; font-family: var(--serif); font-size: 14px; line-height: 1.85; color: var(--muted); }
.sl-row { display: flex; gap: 10px; max-width: 100%; }
.sl-row.npc.cont { margin-top: -4px; }
.sl-row.me { justify-content: flex-end; }
.sl-ava { flex: none; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--panel-3); color: var(--text-2); }
.sl-row.cont .sl-ava { background: transparent; }
.sl-col { min-width: 0; max-width: 84%; display: flex; flex-direction: column; gap: 4px; }
.sl-name { display: inline-flex; align-items: baseline; gap: 6px; font-size: 13px; }
.sl-name small { font-size: 11px; color: var(--faint); }
.story-card .sl-bubble { margin: 0; padding: 11px 15px; border-radius: 4px 18px 18px 18px; background: var(--panel-2); border: 1px solid var(--line); font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
.story-card .sl-row.me .sl-bubble { max-width: 80%; border-radius: 18px 4px 18px 18px; background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 500; }
.story-foot { padding: 14px 20px 18px; border-top: 1px solid var(--line); background: var(--bg-2); }
.story-choices { display: flex; flex-direction: column; gap: 8px; }
.story-choice { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 10px 16px; text-align: left; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font-size: 14px; line-height: 1.5; }
.story-choice:not(:disabled):hover { border-color: var(--text); filter: none; }
.story-choice .ic { color: var(--muted); }
.story-next-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.story-next-row .hint { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.story-next { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 6px 0 18px; border-radius: var(--r-pill); border: 0; background: var(--panel-3); color: var(--text); font-size: 14px; font-weight: 600; }
.story-next .round { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--text); color: var(--bg); }
.story-result { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 10px 0 4px; padding: 24px 20px; text-align: center; border-radius: 20px; background: var(--panel); border: 1px solid var(--line-2); }
.story-result .sr-ic { width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--panel-3); color: var(--accent); }
.story-result .eng { font-size: 10px; letter-spacing: 0.24em; color: var(--faint); }
.story-result h3 { margin: 0; font-size: 21px; }
.story-card .story-result p { margin: 0; font-size: 14px; line-height: 1.75; color: var(--text-2); }
.sr-chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0 0; padding: 0; }
.sr-chips li { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: var(--r-pill); background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.sr-chips li.good { border-color: var(--accent); color: var(--text); }
@media (max-width: 640px) {
  .story-overlay { align-items: stretch; }
  .story-card { max-width: none; max-height: none; min-height: 100%; border-radius: 0; border: 0; }
  .sl-col { max-width: 88%; }
}
.tt-line, .tt-after, .sneak, .room .spot, .codex-entry, .empty-state, .overlay .card, .subjects .btn { border-radius: 14px; }

/* 탑뷰 평면도 (학교 지도) */
.wings.plan { display: grid; grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr); gap: 0; padding: 14px;
  background: var(--input) repeating-linear-gradient(45deg, transparent 0 10px, color-mix(in srgb, var(--line) 35%, transparent) 10px 11px); }
.plan-wing { display: grid; grid-template-rows: auto auto 30px auto; gap: 0; min-width: 0; padding: 8px; border: 2px solid var(--line-2); border-radius: 12px; background: var(--bg-2); }
.plan-wing .wing-name { padding: 0 2px 8px; }
.plan-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; min-height: 84px; }
.plan-row.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plan-row.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.plan-row.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.plan-row.n5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.plan-row.n6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.plan-wall { border-radius: 8px; background: repeating-linear-gradient(-45deg, var(--panel) 0 6px, var(--bg-2) 6px 12px); }
.plan-hall { margin: 4px 0; border-radius: 6px; background: var(--panel-3);
  background-image: linear-gradient(90deg, transparent 0 46%, color-mix(in srgb, var(--accent) 28%, transparent) 46% 54%, transparent 54%);
  background-size: 22px 2px; background-repeat: repeat-x; background-position: 0 50%; }
.plan-stair { align-self: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 30px; margin-top: 26px;
  color: var(--faint); font-size: 10px; background: var(--panel-3); border-block: 2px solid var(--line-2); }
.plan-stair span { writing-mode: horizontal-tb; letter-spacing: 0.1em; }
.zone.tile { position: relative; min-height: 84px; padding: 8px 9px; gap: 6px; border-radius: 8px; overflow: visible; }
.zone.tile .zname { align-items: flex-start; gap: 6px; font-size: 12px; line-height: 1.35; word-break: keep-all; }
.zone.tile .zname .ic { flex: none; margin-top: 1px; }
.zone.tile .zfoot { display: flex; align-items: center; justify-content: space-between; gap: 4px; width: 100%; }
.zone.tile .zmarks .mine { font-size: 10px; }
/* 문: 복도 쪽 벽에 난 틈 */
.zone.tile::before { content: ''; position: absolute; left: 50%; width: 20px; height: 4px; margin-left: -10px; background: var(--panel-3); border-radius: 2px; }
.zone.tile.door-down::before { bottom: -3px; }
.zone.tile.door-up::before { top: -3px; }
.zone.tile.secret { border-style: dashed; }
.zone.tile.locked { background: repeating-linear-gradient(-45deg, var(--bg-2) 0 6px, var(--panel) 6px 12px); }
.zrisk { display: inline-flex; gap: 2px; }
.zrisk i { width: 4px; height: 4px; border-radius: 50%; background: var(--danger-text); opacity: 0.8; }
.tokens { position: absolute; top: 6px; right: 6px; display: inline-flex; flex-direction: row-reverse; }
.token { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: -6px; border-radius: 50%; font-size: 10px; font-weight: 700;
  color: var(--text); background: var(--panel-3); border: 2px solid var(--bg-2); }
.token.me { color: var(--bg); background: var(--accent); }
.token.more { font-size: 9px; }
body.night .zone.tile:not(.here):not(.sel) { filter: brightness(0.82); }
:is([data-theme="parchment"], [data-theme="snow"], [data-theme="lily"], [data-theme="mist"]) body.night .zone.tile:not(.here):not(.sel) { filter: none; opacity: 0.78; }
@media (max-width: 760px) {
  .wings.plan { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  .plan-stair { flex-direction: row; height: 28px; margin: 0 auto; width: 46px; border-block: 0; border-inline: 2px solid var(--line-2); }
  .plan-row { min-height: 72px; }
  .zone.tile { min-height: 72px; }
}

/* 기숙사 방: 룸메이트·방 열쇠 코드·방 옮기기 */
.roommates { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; padding: 14px; border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--r-lg); }
.roommates .mates { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.roommates .mates li { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-md); font-size: 13px; min-width: 0; }
.roommates .mates li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roommates .mates li small { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.roommates .mates li.empty { border-style: dashed; color: var(--muted); }
.roommates .mates li.empty:only-child { grid-column: 1 / -1; }
.roommates .code { letter-spacing: 0.12em; padding: 1px 8px; border-radius: var(--r-pill); background: var(--panel-3); color: var(--text); }
.room-move summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.room-move[open] summary { margin-bottom: 8px; }
.room-move .row { margin-top: 6px; gap: 6px; }
.mate-form input { flex: 1 1 180px; min-height: 36px; padding: 0 10px; background: var(--input); border: 1px solid var(--line-2); border-radius: var(--r-md); color: var(--text); font-size: 13px; }
@media (max-width: 520px) { .roommates .mates { grid-template-columns: minmax(0, 1fr); } }

/* ================================================================
   입학 페이지 '교문' — 테마와 상관없이 늘 어둡다. 안개·달빛 창·촛불·핏빛 봉인
   (움직임은 prefers-reduced-motion이면 멈춘다)
   ================================================================ */
body.gate {
  --bg: #0b0a0d; --panel: rgba(18, 15, 20, 0.82); --panel-2: rgba(28, 22, 28, 0.9); --panel-3: #2a2027;
  --line: rgba(160, 120, 130, 0.16); --line-2: rgba(170, 130, 140, 0.24); --line-3: rgba(200, 150, 160, 0.4);
  --text: #e9e1dc; --muted: #a99c98; --faint: #7d716f; --heading: #f3ebe6; --input: rgba(10, 8, 11, 0.75);
  --blood: #8e1b22; --blood-2: #b3262f; --wax: #5c0f15; --moon: rgba(190, 205, 230, 0.3);
  color-scheme: dark;
  background: radial-gradient(120% 80% at 50% -10%, #241a24 0%, #120e13 45%, #070608 100%);
  color: var(--text);
  overflow-x: hidden;
}
.gate-sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
/* 가장자리를 어둡게 */
.gate-sky::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.75) 100%); }
/* 달빛이 드는 고딕 아치 창 (카드 뒤) */
.gate-window {
  position: absolute; left: 50%; top: 4vh; width: min(680px, 96vw); height: min(860px, 92vh); transform: translateX(-50%);
  border-radius: 50% 50% 6px 6px / 34% 34% 6px 6px;
  background: radial-gradient(70% 50% at 50% 28%, var(--moon), rgba(120, 140, 180, 0.08) 60%, rgba(60, 70, 100, 0.04) 100%);
  box-shadow: 0 0 160px 40px rgba(120, 140, 190, 0.08), inset 0 0 0 10px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(180, 190, 220, 0.1);
  animation: gate-breathe 9s ease-in-out infinite;
}
.gate-window span { position: absolute; background: rgba(0, 0, 0, 0.55); }
.gate-window span:first-child { left: 50%; top: 3%; bottom: 0; width: 10px; transform: translateX(-50%); }
.gate-window span:last-child { left: 0; right: 0; top: 40%; height: 10px; }
/* 바닥을 기는 안개 두 겹 */
.gate-fog { position: absolute; left: -50%; width: 200%; height: 60vh; bottom: -12vh; opacity: 0.8; }
.gate-fog.f1 { background: radial-gradient(40% 50% at 30% 60%, rgba(150, 140, 160, 0.16), transparent 70%), radial-gradient(35% 45% at 75% 70%, rgba(140, 130, 150, 0.14), transparent 70%); animation: gate-drift 38s linear infinite; }
.gate-fog.f2 { bottom: -20vh; background: radial-gradient(30% 40% at 55% 55%, rgba(120, 100, 120, 0.18), transparent 70%), radial-gradient(45% 50% at 10% 70%, rgba(110, 100, 120, 0.12), transparent 70%); animation: gate-drift 56s linear infinite reverse; }
/* 아주 옅은 먼지 */
.gate-dust { position: absolute; inset: 0; opacity: 0.35;
  background-image: radial-gradient(1px 1px at 12% 22%, #fff3, transparent), radial-gradient(1px 1px at 68% 14%, #fff2, transparent), radial-gradient(1px 1px at 82% 61%, #fff2, transparent), radial-gradient(1px 1px at 28% 78%, #fff2, transparent), radial-gradient(1.5px 1.5px at 47% 40%, #fff1, transparent);
  animation: gate-float 24s ease-in-out infinite; }

body.gate .auth { position: relative; z-index: 1; padding: 40px 16px; }
body.gate .auth-card {
  max-width: 440px; gap: 18px; padding: 34px 30px 26px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(26, 20, 26, 0.86), rgba(12, 10, 13, 0.9));
  border: 1px solid var(--line-2);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 30px 80px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.04), inset 0 0 60px rgba(90, 20, 30, 0.12);
  backdrop-filter: blur(3px);
}
.gate-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.gate-eng { margin: 6px 0 0; font-size: 10px; letter-spacing: 0.24em; color: var(--faint); }
.gate-eng span { display: block; margin-top: 4px; font-size: 9px; letter-spacing: 0.4em; opacity: 0.7; }
body.gate .auth-card { word-break: keep-all; }
body.gate .gate-title { margin: 0; font-size: 34px; letter-spacing: 0.02em; color: var(--heading); text-shadow: 0 0 18px rgba(179, 38, 47, 0.25); animation: gate-flicker 7s infinite; }
.gate-title em { position: relative; font-style: normal; color: var(--blood-2); text-shadow: 0 0 14px rgba(179, 38, 47, 0.55); }
/* '괴담록' 글자 아래로 흘러내리는 핏방울 */
.gate-title em::before, .gate-title em::after { content: ''; position: absolute; top: 86%; width: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(180deg, var(--blood-2), var(--blood)); transform-origin: top; animation: gate-drip 6s ease-in infinite; }
.gate-title em::before { left: 22%; height: 14px; }
.gate-title em::after { left: 71%; height: 22px; animation-delay: 2.4s; }
body.gate .gate-lede { margin: 2px 0 0; font-family: var(--serif); font-size: 14px; line-height: 1.8; color: var(--muted); }
/* 촛불 */
.gate-candle { position: relative; width: 10px; height: 34px; margin-top: 4px; border-radius: 3px 3px 2px 2px; background: linear-gradient(180deg, #e8dccb, #b9a88f); box-shadow: 0 0 30px 10px rgba(255, 170, 80, 0.12); }
.gate-candle::before { content: ''; position: absolute; left: 50%; top: -3px; width: 1px; height: 5px; background: #2a201a; transform: translateX(-50%); }
.gate-candle i { position: absolute; left: 50%; bottom: 100%; width: 10px; height: 18px; margin-left: -5px; margin-bottom: 1px; border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%;
  background: radial-gradient(50% 60% at 50% 70%, #fff6d8 0%, #ffcf6b 35%, rgba(255, 120, 40, 0.7) 70%, transparent 100%);
  filter: blur(0.3px); transform-origin: 50% 100%; animation: gate-flame 2.6s ease-in-out infinite; }
/* 입학 수칙 */
.gate-rules { margin: 0; padding: 14px 16px 14px 34px; border-radius: var(--r-md); border: 1px dashed var(--line-2); background: rgba(0, 0, 0, 0.25);
  font-family: var(--serif); font-size: 13px; line-height: 1.75; color: var(--muted); }
.gate-rules li::marker { color: var(--blood-2); font-family: inherit; }
.gate-rules .smudge { color: var(--text); text-decoration: underline wavy rgba(179, 38, 47, 0.55); text-underline-offset: 4px; }
/* 탭 */
body.gate .seg { align-self: center; padding: 4px; gap: 4px; border: 1px solid var(--line-2); border-radius: var(--r-pill); background: rgba(0, 0, 0, 0.35); }
body.gate .seg button { border: 0; color: var(--muted); border-radius: var(--r-pill); padding: 0 16px; min-height: 34px; }
body.gate .seg button[aria-selected="true"] { background: var(--panel-3); color: var(--heading); box-shadow: inset 0 0 0 1px var(--line-3); }
/* 입력칸 */
body.gate .field { color: var(--muted); }
body.gate .field input, body.gate .field select { background: var(--input); border-color: var(--line-2); color: var(--text); transition: border-color 0.2s, box-shadow 0.2s; }
body.gate .field input:focus, body.gate .field select:focus { outline: none; border-color: rgba(179, 38, 47, 0.7); box-shadow: 0 0 0 3px rgba(142, 27, 34, 0.25), 0 0 18px rgba(142, 27, 34, 0.2); }
body.gate .field input::placeholder { color: var(--faint); }
body.gate .error { color: #e0646b; }
/* 핏빛 봉인 단추 */
body.gate .btn.seal { min-height: 48px; border: 1px solid #c2343d; border-radius: var(--r-md); letter-spacing: 0.08em; font-family: var(--serif); font-weight: 700;
  color: #fbeeee; background: radial-gradient(120% 140% at 50% 0%, var(--blood-2), var(--blood) 55%, var(--wax));
  box-shadow: 0 8px 24px rgba(92, 15, 21, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12); transition: transform 0.15s, box-shadow 0.2s, filter 0.2s; }
body.gate .btn.seal:not(:disabled):hover { filter: brightness(1.1); box-shadow: 0 10px 30px rgba(142, 27, 34, 0.6), 0 0 24px rgba(179, 38, 47, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.14); }
body.gate .btn.seal:not(:disabled):active { transform: translateY(1px); }
/* 서명 */
.gate-sign { margin: 4px 0 0; text-align: right; font-family: var(--serif); font-size: 13px; color: var(--muted); }
.gate-sign span { display: block; margin-top: 2px; font-size: 11px; color: var(--faint); font-style: italic; }

@keyframes gate-drip { 0% { transform: scaleY(0.2); opacity: 0.9; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1.15); opacity: 0; } }
@keyframes gate-drift { from { transform: translateX(0); } to { transform: translateX(25%); } }
@keyframes gate-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes gate-breathe { 0%, 100% { opacity: 0.85; } 50% { opacity: 1; } }
@keyframes gate-flame { 0%, 100% { transform: scale(1, 1) rotate(-1deg); opacity: 1; } 25% { transform: scale(0.94, 1.06) rotate(2deg); } 50% { transform: scale(1.04, 0.95) rotate(-2deg); opacity: 0.92; } 75% { transform: scale(0.97, 1.04) rotate(1deg); } }
/* 제목이 가끔 깜빡인다 (전등이 나가는 것처럼) */
@keyframes gate-flicker { 0%, 91%, 93%, 96%, 100% { opacity: 1; } 92% { opacity: 0.35; } 94% { opacity: 0.8; } 95% { opacity: 0.2; } }
@media (prefers-reduced-motion: reduce) {
  .gate-window, .gate-fog, .gate-dust, .gate-candle i, body.gate .gate-title, .gate-title em::before, .gate-title em::after { animation: none; }
}
@media (max-width: 520px) {
  body.gate .auth-card { padding: 28px 20px 22px; }
  body.gate .gate-title { font-size: 28px; }
}

/* ---------- 사감실 (운영자 화면) ---------- */
.admin-nav { position: sticky; top: 0; align-self: flex-start; height: 100vh; max-height: 100vh; overflow-y: auto; gap: 2px; }
.admin-nav .brand { margin-bottom: 10px; }
.admin-nav .nav-group { margin: 14px 12px 4px; font-size: 11px; letter-spacing: 0.12em; color: var(--faint); }
.admin-nav a { border-radius: var(--r-md); min-height: 40px; }
.admin-nav a:hover { background: var(--panel-2); color: var(--text); }
.admin-nav a[aria-current="page"] { background: var(--panel-3); color: var(--text); font-weight: 600; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: #b3262f; color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.nav-foot { margin-top: auto; padding-top: 16px; display: flex; align-items: center; gap: 8px; position: relative; }
.admin-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dash-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.dash-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel-2); color: var(--text); text-decoration: none; }
a.dash-card:hover { border-color: var(--line-3); }
.dash-card small { font-size: 12px; color: var(--muted); }
.dash-card b { font-size: 28px; line-height: 1.1; }
.dash-card span { font-size: 11px; color: var(--faint); }
.dash-card.warn b { color: #d0525a; }
.tk-list .tk { display: flex; flex-direction: column; gap: 8px; }
.tk .tk-body { margin: 0; white-space: pre-wrap; font-size: 14px; line-height: 1.7; }
.tk .tk-reply { margin: 0; font-size: 12px; color: var(--muted); }
.tk textarea { width: 100%; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--input); color: var(--text); font-size: 13px; resize: vertical; }
.tk.s-closed { opacity: 0.7; }
.tag.k-bug, .tag.k-report, .tag.lv-warn { border-color: #b3262f; color: #d0525a; }
.tag.lv-event { border-color: #a0812f; color: #c7a24a; }
.nt.off { opacity: 0.55; }
.cd-new { padding: 14px; border: 1px dashed var(--line-3); border-radius: var(--r-md); display: flex; flex-direction: column; gap: 8px; }
.cd-new pre { margin: 0; font-size: 15px; letter-spacing: 0.1em; white-space: pre-wrap; }
table.data tr.dim td { opacity: 0.5; }
table.data .code { letter-spacing: 0.08em; }
@media (max-width: 860px) { .admin-nav { position: static; height: auto; max-height: none; flex-direction: row; flex-wrap: wrap; } .admin-nav .brand { flex: 1 1 100%; } .admin-nav .nav-group { flex: 1 1 100%; margin: 8px 4px 0; } .admin-nav a { min-height: 36px; padding: 0 10px; font-size: 13px; } .nav-foot { margin-top: 8px; flex: 1 1 100%; } }

/* ---------- 공지 띠 (게임 화면 맨 위) ---------- */
.notice-bar { display: flex; flex-direction: column; gap: 4px; padding: 6px 12px; }
.notice-bar:empty { display: none; }
.notice { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--panel-2); font-size: 13px; line-height: 1.5; }
.notice .tag { flex: none; }
.notice p { margin: 0; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.notice button { flex: none; background: transparent; border: 0; color: var(--muted); padding: 4px; border-radius: var(--r-sm); }
.notice.lv-warn { border-color: rgba(179, 38, 47, 0.6); background: linear-gradient(90deg, rgba(179, 38, 47, 0.14), var(--panel-2)); }
.notice.lv-event { border-color: rgba(199, 162, 74, 0.5); background: linear-gradient(90deg, rgba(199, 162, 74, 0.12), var(--panel-2)); }

/* ---------- 문의·건의 (학생) ---------- */
.ticket-form { display: flex; flex-direction: column; gap: 10px; }
.ticket-form textarea { min-height: 96px; }
#ticket-modal .modal-body { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
#ticket-modal .modal-body > * { width: 100%; }
.my-tickets:empty { display: none; }
.my-tickets .card { display: flex; flex-direction: column; gap: 6px; }
.my-tickets .reply { margin: 0; padding: 10px 12px; border-left: 2px solid var(--line-3); background: var(--panel-3); border-radius: 0 var(--r-md) var(--r-md) 0; white-space: pre-wrap; font-size: 13px; line-height: 1.7; }
.my-tickets .q { margin: 0; white-space: pre-wrap; font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- 과제 · 학생 교우 */
.quest-list li { flex-wrap: wrap; }
.quest-list .q-title { flex: 1 1 auto; min-width: 0; }
.quest-list .q-count { color: var(--muted); font-size: 12px; }
.quest-list .q-reward { padding: 2px 8px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--muted); font-size: 11px; }
#social-bonds .person + .bond-hint, #social-bonds .note + .bond-hint { margin-top: 14px; }
#social-bonds .bond-hint { display: block; }
.bond-list { margin: 8px 0 0; padding: 0; list-style: none; }
.bond-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); }
.bond-list li + li { margin-top: 6px; }
.bond-list .who { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.bond-list li.gone { opacity: 0.55; }

/* ---------- '지금' 밖의 탭: 수업·탐사·걷는 중 카드는 한 줄로 접는다 ---------- */
.act-open { display: none; }
body.game.away .col-center .activity { padding: 14px 18px; gap: 10px; }
body.game.away .activity .act-open { display: inline-flex; flex: none; white-space: nowrap; }
body.game.away .activity .panel-head { align-items: center; gap: 4px 10px; }
body.game.away .activity .panel-head h2 { flex: 1 1 0; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
body.game.away .activity .panel-head .hint { order: 3; flex: 1 1 100%; }
body.game.away .activity #act-sub, body.game.away .activity #sneak, body.game.away .activity #act-buttons,
body.game.away .activity #trip-sub, body.game.away .activity #trip-buttons { display: none; }
body.game.away .activity .incidents:empty { display: none; }

/* ---------- 휴대폰: 칸마다 따로 스크롤하지 않고 화면 전체가 내려간다. 메뉴줄만 위에 붙는다 ---------- */
@media (max-width: 820px) {
  body.game { height: auto; min-height: 100dvh; overflow: visible; }
  body.game .layout { flex: none; }
  body.game .col-center { overflow: visible; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.game .menubar { position: sticky; top: 0; z-index: 20; }
  .note-dock { padding-bottom: env(safe-area-inset-bottom); }
}

/* ---------- 교우의 마음: 함께 겪은 일이 쌓이면 뜨는 선택지 ---------- */
.bond-prompt { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px dashed var(--accent); border-radius: var(--r-lg, 14px); background: var(--panel-2); }
.bond-prompt p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.feel-row { display: flex; flex-wrap: wrap; gap: 6px; }
.btn.feel.cold { color: var(--muted); }
.feel-tag.warm { color: var(--text); }
.feel-tag.cold { color: var(--accent); }
