/* =====================================================================
   SOMOIM 본부
   컨셉: 병단 문서함. 석벽색 바탕, 짙은 올리브 지휘부, 놋쇠 계급장.
   조사병단은 숲 녹색, 헌병단은 남색으로 구분.
   ===================================================================== */

:root {
  --wall: #dde1d8;
  --paper: #f4f6f0;
  --paper-2: #e8ebe2;
  --white: #fbfcf9;
  --ink: #1c2219;
  --muted: #5b6456;
  --line: #c3c9bc;
  --olive: #263022;
  --olive-2: #34402e;
  --olive-3: #4a5843;
  --on-olive: #e9ecdf;
  --on-olive-muted: #a9b29f;
  --mm: #1d5a44;
  --mm-soft: #d3e5da;
  --classic: #2a3d69;
  --classic-soft: #d8dfee;
  --brass: #b5872c;
  --brass-light: #d4a94e;
  --brass-soft: #f0e2c0;
  --brass-ink: #6a4d12;
  --danger: #a2382a;
  --ok: #2e6b3b;
  --radius: 6px;
  --font-display: 'Black Han Sans', 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-body: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --side-w: 232px;
  --tabbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
img { max-width: 100%; display: block; }
a { color: var(--classic); text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.875rem; margin-top: 6px; }
.boot { padding: 40px; color: var(--muted); }

/* ------------------------------------------------------------ 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--white); color: var(--ink);
  font-weight: 600; font-size: 0.95rem; text-decoration: none; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--paper-2); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--olive); border-color: var(--olive); color: var(--on-olive); }
.btn-primary:hover { background: var(--olive-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #8c2f23; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--paper-2); color: var(--ink); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 0.875rem; }
.btn-block { width: 100%; }
.btn-icon { display: inline-flex; }
.btn-icon svg { width: 18px; height: 18px; }
.btn-ghost-light { background: transparent; color: var(--on-olive); border-color: rgba(233, 236, 223, 0.35); }
.btn-ghost-light:hover { background: rgba(233, 236, 223, 0.1); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius);
  border: 0; background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover, .icon-btn.on { background: rgba(127, 140, 115, 0.18); }
.icon-btn-sm { width: 30px; height: 30px; }
.icon-btn-sm svg { width: 16px; height: 16px; }

/* ------------------------------------------------------------ 입력 */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; align-content: start; }
.field > label, legend { font-size: 0.875rem; font-weight: 600; }
input[type='text'], input[type='password'], input[type='number'], input[type='date'],
input[type='datetime-local'], select, textarea {
  width: 100%; min-height: 42px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--white);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brass); outline-offset: 0; border-color: var(--brass); }
.input-num { max-width: 110px; font-variant-numeric: tabular-nums; }
input[type='file'] { font-size: 0.9rem; }
input[type='range'] { width: 100%; accent-color: var(--brass); }
fieldset.checks { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0; display: grid; gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--olive); }
.check-inline { font-size: 0.9rem; color: var(--muted); }
.inline-field { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-start { display: flex; gap: 6px; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-2 { display: grid; grid-template-columns: 140px 1fr; gap: 12px; }
.section-gap { margin-bottom: 16px; }

/* 세그먼트 선택 */
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--olive); color: var(--on-olive); }
.seg-row { margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* 태그와 배지 */
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.div-mm.tag { background: var(--mm-soft); color: var(--mm); }
.div-classic.tag { background: var(--classic-soft); color: var(--classic); }
.div-all.tag { background: var(--brass-soft); color: var(--brass-ink); }
.div-event.tag { background: var(--paper-2); color: var(--ink); border: 1px solid var(--line); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.badge-ok { background: #d6e8d9; color: var(--ok); }
.badge-no { background: #f2dad5; color: var(--danger); }
.badge-wait { background: var(--brass-soft); color: var(--brass-ink); }

.rank-mark { display: inline-flex; color: var(--brass); flex: none; }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); display: grid; gap: 12px; justify-items: center; }

/* ------------------------------------------------------------ 데모 띠 */
.demo-bar {
  display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between;
  padding: 6px 16px; background: var(--brass-soft); color: var(--brass-ink); font-size: 0.82rem;
  border-bottom: 1px solid #dcc58e; position: relative; z-index: 20;
}
.demo-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.demo-actions button { border: 1px solid #c9ad6c; background: transparent; border-radius: 4px; padding: 2px 8px; cursor: pointer; font-size: 0.8rem; color: var(--brass-ink); }
.demo-actions button:hover { background: rgba(255, 255, 255, 0.5); }
.demo-hint { font-size: 0.85rem; background: var(--brass-soft); color: var(--brass-ink); padding: 8px 12px; border-radius: var(--radius); }

/* ------------------------------------------------------------ 소개 페이지 (외부인) */
.pub { min-height: 100vh; background: var(--wall); }
.pub-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px clamp(16px, 4vw, 48px); background: var(--olive); color: var(--on-olive);
}
.pub-mark { font-family: var(--font-display); font-size: 1.4rem; color: var(--on-olive); text-decoration: none; letter-spacing: 0.02em; }

.hero { background: var(--olive); color: var(--on-olive); }
.hero-inner { padding: clamp(24px, 5vw, 64px) clamp(16px, 4vw, 48px) clamp(28px, 5vw, 56px); max-width: 1200px; }
.hero-school { color: var(--on-olive-muted); font-weight: 500; }
.hero-mark {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(4.5rem, 17vw, 12rem); line-height: 0.9; letter-spacing: -0.01em;
  color: var(--brass-light); margin: 12px 0 20px;
}
.hero-lead { font-size: clamp(1.05rem, 2.2vw, 1.35rem); max-width: 34em; }

.regiments { display: grid; grid-template-columns: 1fr 1fr; }
.regiment { padding: clamp(24px, 4vw, 44px) clamp(16px, 4vw, 48px) clamp(28px, 4vw, 48px); color: #eef2ea; }
.regiment h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1; }
.regiment-what { font-weight: 700; margin: 10px 0 12px; opacity: 0.85; }
.regiment p:last-child { max-width: 30em; }
.regiment-mm { background: var(--mm); }
.regiment-classic { background: var(--classic); }

.pub-section {
  display: grid; grid-template-columns: minmax(0, 660px) minmax(0, 400px); gap: clamp(24px, 6vw, 96px);
  padding: clamp(40px, 6vw, 72px) clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
}
.pub-section h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.7rem, 3.4vw, 2.3rem); margin-bottom: 12px; }
.pub-lead { color: var(--muted); margin-bottom: 20px; }
.pub-history, .pub-join { grid-template-columns: minmax(0, 760px); }
.pub-join p { margin-bottom: 16px; max-width: 36em; }

.earn { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.earn li { display: grid; grid-template-columns: 9.5em 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.earn strong { font-weight: 700; }
.earn span { color: var(--muted); }

.ladder { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 0; border-left: 2px solid var(--olive); }
.ladder li { display: flex; align-items: center; gap: 14px; padding: 10px 0 10px 16px; font-weight: 700; font-size: 1.1rem; }
.ladder-mark { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: var(--olive); color: var(--brass-light); border-radius: var(--radius); }

.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-width: 760px; }
.history li { display: grid; grid-template-columns: 4em 8em 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.history-when { color: var(--muted); font-variant-numeric: tabular-nums; }

.pub-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 24px clamp(16px, 4vw, 48px) 40px; color: var(--muted); font-size: 0.9rem; }

/* ------------------------------------------------------------ 로그인·가입 */
.auth-wrap { min-height: calc(100vh - 40px); display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 10px; padding: 32px 28px; display: grid; gap: 16px;
}
.auth-card h1 { font-size: 1.5rem; }
.auth-mark { font-family: var(--font-display); font-size: 1.3rem; color: var(--olive); text-decoration: none; }

/* ------------------------------------------------------------ 본부 틀 */
.shell {
  display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh;
  background: linear-gradient(to right, var(--olive) var(--side-w), transparent var(--side-w));
}
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--olive); color: var(--on-olive);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.side-mark { font-family: var(--font-display); font-size: 1.6rem; color: var(--brass-light); text-decoration: none; padding: 4px 10px 20px; }
.side-nav { display: grid; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius);
  color: var(--on-olive-muted); text-decoration: none; font-weight: 600;
}
.nav-link:hover { background: var(--olive-2); color: var(--on-olive); }
.nav-link.on { background: var(--olive-2); color: var(--on-olive); box-shadow: inset 3px 0 0 var(--brass-light); }
.nav-icon { display: inline-flex; }
.side-me {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 6px 4px 10px; border-top: 1px solid var(--olive-3);
}
.side-me > div { display: grid; line-height: 1.3; flex: 1; min-width: 0; }
.side-me strong { font-size: 0.95rem; }
.side-me span { color: var(--on-olive-muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; }
.side-me .rank-mark { color: var(--brass-light); }

.main { min-width: 0; }
body.is-demo .side { height: calc(100vh - 40px); }
.topbar { display: none; }
.page { max-width: 1040px; padding: 32px clamp(16px, 3vw, 40px) 64px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.9rem, 3.5vw, 2.4rem); }
.page-desc { color: var(--muted); margin-top: 6px; max-width: 44em; }
.page-actions { display: flex; gap: 8px; }
.tabbar { display: none; }
.fatal { padding: 48px 24px; display: grid; gap: 12px; justify-items: start; max-width: 560px; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel h2 { margin-bottom: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.panel-head a { font-size: 0.9rem; font-weight: 600; }

/* ------------------------------------------------------------ 본부 홈: 병적 카드 */
.dossier {
  display: grid; grid-template-columns: auto 1fr auto; gap: 16px 28px; align-items: center;
  background: var(--olive); color: var(--on-olive); border-radius: 10px;
  padding: clamp(18px, 3vw, 30px) clamp(20px, 3.5vw, 36px); margin-bottom: 16px;
  background-image: radial-gradient(ellipse 140px 26px at 90px calc(100% - 22px), rgba(0, 0, 0, 0.22), transparent 70%);
}
.dossier-avatar { display: block; width: 132px; margin: -6px 0 -10px; transition: transform 0.15s; }
.dossier-avatar:hover { transform: translateY(-3px); }
.dossier-avatar svg { display: block; width: 100%; height: auto; }
.dossier-name { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.2rem, 5vw, 3.2rem); line-height: 1; }
.dossier-tags { margin: 12px 0 16px; }
.dossier-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dossier-power { display: grid; justify-items: end; align-content: center; text-align: right; }
.power-num {
  font-family: var(--font-display); font-weight: 400; color: var(--brass-light);
  font-size: clamp(3.4rem, 8vw, 5.2rem); line-height: 0.9; font-variant-numeric: tabular-nums;
}
.power-num-sm { font-size: 2.2rem; color: var(--brass); }
.power-unit { font-weight: 700; margin-top: 4px; }
.power-pos { color: var(--on-olive-muted); font-size: 0.9rem; text-decoration: none; }
.power-pos:hover { color: var(--on-olive); text-decoration: underline; }
.dossier .tag { background: rgba(255, 255, 255, 0.12); color: var(--on-olive); }
.dossier .title-badge { background: var(--brass-light); color: var(--olive); }
.btn-gold { background: var(--brass-light); border-color: var(--brass-light); color: var(--olive); }
.btn-gold:hover { background: #e2b960; }

.notice-strip {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 12px 16px;
  background: var(--brass-soft); color: var(--brass-ink); border: 1px solid #dcc58e; border-radius: var(--radius);
  font-weight: 700; text-decoration: none;
}
.notice-strip:hover { background: #f4e6c6; }

.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel-cert { grid-column: 1 / -1; display: grid; gap: 12px; justify-items: start; }
.panel-cert .panel-head { width: 100%; margin-bottom: 0; }

.mini-events { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mini-events li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.mini-events li > div { display: grid; line-height: 1.35; min-width: 0; }
.date-chip { display: grid; justify-items: center; width: 52px; padding: 4px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); line-height: 1.1; }
.date-chip b { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; }
.date-chip small { color: var(--muted); font-size: 0.72rem; }

/* 내역 목록 */
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li {
  display: grid; grid-template-columns: 3.2em 4.5em 1fr auto auto; gap: 10px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem;
}
.ledger li:last-child { border-bottom: 0; }
.ledger-compact li { grid-template-columns: 3.2em 4.5em 1fr auto; }
.admin-give .ledger li { grid-template-columns: 3.2em 4em 4.5em 1fr auto auto; }
.ledger-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.ledger-cat { font-weight: 600; }
.ledger-who { font-weight: 600; }
.ledger-note { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-amt { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ok); text-align: right; min-width: 3em; }
.ledger-amt.neg { color: var(--danger); }

/* ------------------------------------------------------------ 전투력 순위 */
.roster { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.roster-row + .roster-row { border-top: 1px solid var(--line); }
.roster-btn {
  width: 100%; display: grid; grid-template-columns: 2.2em 28px minmax(8em, 1fr) auto 140px 4.2em; gap: 14px; align-items: center;
  padding: 12px 18px; border: 0; background: transparent; text-align: left; cursor: pointer;
}
.roster-btn:hover { background: var(--paper-2); }
.roster-row.is-me .roster-btn { background: var(--brass-soft); }
.roster-pos { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.roster-name { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.roster-rank { color: var(--muted); font-size: 0.875rem; }
.me-flag { display: inline-block; margin-left: 6px; font-size: 0.72rem; background: var(--olive); color: var(--on-olive); border-radius: 3px; padding: 0 5px; vertical-align: 2px; }
.roster-tags { justify-content: flex-end; }
.roster-bar { height: 6px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.roster-bar span { display: block; height: 100%; background: var(--olive-3); border-radius: 999px; }
.roster-power { font-family: var(--font-display); font-size: 1.35rem; text-align: right; font-variant-numeric: tabular-nums; }
.roster-row:nth-child(-n+3) .roster-power { color: var(--brass); }

.history-sum { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

/* ------------------------------------------------------------ 일정 */
.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.event {
  display: grid; grid-template-columns: 76px 1fr; background: var(--paper);
  border: 1px solid var(--line); border-left: 5px solid var(--brass); border-radius: var(--radius); overflow: hidden;
}
.event.div-mm { border-left-color: var(--mm); }
.event.div-classic { border-left-color: var(--classic); }
.event-date { display: grid; justify-items: center; align-content: center; padding: 12px 4px; background: var(--paper-2); line-height: 1.1; }
.event-date b { font-family: var(--font-display); font-weight: 400; font-size: 2rem; }
.event-date span { font-size: 0.8rem; color: var(--muted); }
.event-body { padding: 14px 18px; display: grid; gap: 4px; }
.event-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.event-meta { display: flex; gap: 14px; color: var(--muted); font-size: 0.92rem; flex-wrap: wrap; }
.event-place { display: inline-flex; align-items: center; gap: 4px; }
.mini-icon svg { width: 15px; height: 15px; vertical-align: -2px; }
.event-note { font-size: 0.92rem; }
.event-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.events-past .event { opacity: 0.85; }
.past { margin-top: 20px; display: grid; gap: 10px; justify-items: start; }
.past .events { width: 100%; }

.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 2px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); max-height: 46vh; overflow-y: auto; }

/* 일정 투표 */
.section-title { font-size: 1.05rem; margin: 8px 0 12px; color: var(--muted); font-weight: 700; }
.polls { display: grid; gap: 12px; margin-bottom: 28px; }
.poll { background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--brass); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 8px; }
.poll.div-mm { border-top-color: var(--mm); }
.poll.div-classic { border-top-color: var(--classic); }
.poll-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.poll-del { margin-left: auto; }
.poll-help { font-size: 0.88rem; color: var(--muted); }
.poll-options { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.poll-option { display: grid; grid-template-columns: minmax(210px, auto) 1fr auto; gap: 12px; align-items: center; padding: 6px; border-radius: var(--radius); }
.poll-option.is-best { background: var(--brass-soft); }
.poll-pick {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 42px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--white); cursor: pointer; text-align: left;
}
.poll-pick:hover { border-color: var(--olive-3); }
.poll-check { width: 22px; height: 22px; border-radius: 4px; border: 1.5px solid var(--line); display: inline-grid; place-items: center; color: transparent; flex: none; }
.poll-check svg { width: 16px; height: 16px; }
.poll-pick.on { border-color: var(--olive); background: var(--olive); color: var(--on-olive); }
.poll-pick.on .poll-check { border-color: var(--brass-light); background: var(--brass-light); color: var(--olive); }
.poll-when b { font-weight: 700; }
.poll-tally { display: grid; grid-template-columns: minmax(60px, 160px) auto 1fr; gap: 10px; align-items: center; min-width: 0; }
.poll-bar { height: 8px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.poll-bar span { display: block; height: 100%; background: var(--olive-3); border-radius: 999px; }
.is-best .poll-bar span { background: var(--brass); }
.poll-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.poll-names { font-size: 0.85rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poll-missing { font-size: 0.85rem; }
.time-rows { display: grid; gap: 6px; }
.time-row { display: flex; gap: 6px; align-items: center; }
.field-label { font-size: 0.875rem; font-weight: 600; }

/* ------------------------------------------------------------ 개인연습 인증 */
.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.cert { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.cert.is-mine { border-color: var(--brass); }
.cert-photo { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; background: var(--paper-2); cursor: zoom-in; }
.cert-photo img { width: 100%; height: 100%; object-fit: cover; }
.cert-body { padding: 12px 14px 14px; display: grid; gap: 4px; }
.cert-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cert-meta, .cert-games { font-size: 0.9rem; color: var(--muted); }
.cert-reason { font-size: 0.85rem; color: var(--danger); }
.cert-with { font-size: 0.88rem; }
.checklist-short { max-height: 200px; border: 0; padding: 0; background: transparent; }
.cert-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.upload-preview { border: 1px dashed var(--line); border-radius: var(--radius); min-height: 120px; display: grid; place-items: center; overflow: hidden; background: var(--white); }
.upload-preview img { max-height: 220px; width: auto; }
.zoom-img { width: 100%; max-height: 70vh; object-fit: contain; background: var(--ink); border-radius: var(--radius); margin-bottom: 10px; }

/* ------------------------------------------------------------ 머더미스터리 평가표 */
.stars { position: relative; display: inline-block; font-size: 0.95rem; line-height: 1; letter-spacing: 1px; white-space: nowrap; }
.stars-bg { color: var(--line); }
.stars-fg { position: absolute; left: 0; top: 0; overflow: hidden; color: var(--brass); }
.stars-lg { font-size: 1.4rem; }

.mm-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.search { position: relative; display: flex; align-items: center; flex: 1 1 220px; max-width: 320px; }
.search-icon { position: absolute; left: 11px; display: inline-flex; color: var(--muted); pointer-events: none; }
.search-input { width: 100%; min-height: 40px; padding: 8px 12px 8px 36px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.search-input:focus { outline: 2px solid var(--brass); outline-offset: 0; border-color: var(--brass); }

.scen-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.scen-card {
  width: 100%; height: 100%; display: flex; flex-direction: column; padding: 0; text-align: left; cursor: pointer;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.scen-card:hover { border-color: var(--olive-3); }
.scen-card:hover .scen-poster img { transform: scale(1.03); }
.scen-poster { position: relative; aspect-ratio: 3 / 4; background: var(--olive); overflow: hidden; }
.scen-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s; }
.poster-blank {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 2.6rem; color: var(--brass-light); letter-spacing: 0.02em;
}
.tier-badge {
  position: absolute; top: 8px; left: 8px; width: 32px; height: 32px; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 1.15rem; border-radius: 5px; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); color: var(--ink);
}
.tier-none .tier-label { background: var(--paper-2); color: var(--muted); font-family: var(--font-body); font-size: 0.85rem; font-weight: 700; }
.scen-card-body { padding: 10px 12px 12px; display: grid; gap: 3px; }
.scen-card-title { line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.scen-card-players { font-size: 0.82rem; }
.scen-card-rate { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 0.85rem; }
.scen-card-rate b { font-family: var(--font-display); font-weight: 400; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.scen-card-mine { font-size: 0.8rem; font-weight: 700; color: var(--mm); }
.scen-card-mine.none { color: var(--muted); font-weight: 500; }

.tier-rule { margin-bottom: 14px; max-width: 52em; }
.tier-board { display: grid; gap: 8px; }
.tier-row { display: grid; grid-template-columns: 76px 1fr; min-height: 128px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tier-label { display: grid; place-items: center; font-family: var(--font-display); font-size: 2.4rem; text-align: center; padding: 6px; color: var(--ink); }
.tier-items { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px; align-items: flex-start; }
.tier-empty { align-self: center; font-size: 0.9rem; }
.tier-item { width: 86px; display: grid; gap: 3px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.tier-thumb { position: relative; width: 86px; aspect-ratio: 3 / 4; border-radius: 4px; overflow: hidden; background: var(--olive); }
.tier-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tier-thumb .poster-blank { font-size: 1.4rem; }
.tier-item:hover .tier-thumb { outline: 2px solid var(--brass); outline-offset: 1px; }
.tier-item-title { font-size: 0.8rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tier-item small { color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }

.scen-head-poster { position: relative; width: 150px; aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; background: var(--olive); }
.scen-head-poster img { width: 100%; height: 100%; object-fit: cover; }
.poster-field { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: start; }
.poster-preview { width: 96px; aspect-ratio: 3 / 4; border: 1px dashed var(--line); border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; background: var(--white); font-size: 0.8rem; }
.poster-preview img { width: 100%; height: 100%; object-fit: cover; }

.scen-head { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.scen-avg { display: grid; justify-items: start; gap: 4px; }
.scen-avg b { font-family: var(--font-display); font-weight: 400; font-size: 3rem; line-height: 1; }
.scen-info { display: grid; gap: 6px; }
.my-rating { display: grid; gap: 12px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.my-score { display: flex; align-items: center; gap: 12px; }
.my-score-num { font-family: var(--font-display); font-size: 2.2rem; line-height: 1; min-width: 2.2em; }
.ratings-head { margin-bottom: 8px; }
.ratings { list-style: none; margin: 0; padding: 0; }
.ratings li { display: grid; grid-template-columns: 4.5em 2.2em auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.rating-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.rating-comment { color: var(--muted); min-width: 0; }

/* ------------------------------------------------------------ 커뮤니티 */
.cat-notice.tag { background: var(--olive); color: var(--on-olive); }
.cat-free.tag { background: var(--paper-2); color: var(--ink); border: 1px solid var(--line); }
.cat-meetup.tag { background: var(--brass-soft); color: var(--brass-ink); }
.posts { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.posts li + li { border-top: 1px solid var(--line); }
.posts li.is-pinned { background: var(--white); }
.post-row {
  width: 100%; display: grid; grid-template-columns: 3.4em 1fr 5em 4.2em; gap: 14px; align-items: center;
  padding: 13px 18px; border: 0; background: transparent; text-align: left; cursor: pointer;
}
.post-row:hover { background: var(--paper-2); }
.post-row .tag { justify-self: start; }
.post-title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-count { margin-left: 8px; color: var(--mm); font-weight: 700; font-size: 0.85rem; }
.post-meta { color: var(--muted); font-size: 0.88rem; white-space: nowrap; }
.post-when { text-align: right; font-variant-numeric: tabular-nums; }
.post-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.post-actions { margin-left: auto; display: flex; gap: 4px; }
.post-body { white-space: pre-wrap; padding: 14px 0 18px; border-bottom: 1px solid var(--line); line-height: 1.75; }
.comments-title { margin-top: 4px; }
.comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.comments li { padding: 10px 0; border-bottom: 1px solid var(--paper-2); }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.comment-head .icon-btn { margin-left: auto; }
.comment-body { white-space: pre-wrap; margin-top: 2px; }
.comments-empty { border-bottom: 0 !important; }
.comment-form { display: flex; gap: 8px; }

/* ------------------------------------------------------------ 운영 */
.admin-give { display: grid; gap: 16px; }
.picker-head > div { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.admin-members { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.admin-members li { display: grid; grid-template-columns: 28px minmax(9em, 1.2fr) minmax(7em, 1fr) 8em auto; gap: 12px; align-items: center; padding: 12px 16px; }
.admin-members li + li { border-top: 1px solid var(--line); }
.admin-members li.is-off { opacity: 0.55; }
.admin-members .tags { justify-content: flex-end; }
.am-name { display: grid; line-height: 1.35; }
.am-name .muted { font-size: 0.85rem; }
.am-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.invite-row { display: flex; gap: 8px; margin: 12px 0 4px; }
.invite-url { font-size: 0.85rem; }
.settings { display: grid; gap: 16px; }
.rank-rows { display: grid; gap: 8px; margin: 12px 0 16px; }
.rank-row { display: grid; grid-template-columns: 3.5em minmax(6em, 10em) auto 110px auto auto; gap: 10px; align-items: center; }
.rank-step { color: var(--muted); font-size: 0.85rem; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin: 12px 0 16px; }

/* ------------------------------------------------------------ 캐릭터 공통 */
.px-avatar, .px-avatar image { image-rendering: pixelated; image-rendering: crisp-edges; }
.px-avatar { image-rendering: pixelated; }
.avatar-head {
  display: inline-flex; flex: none; border-radius: 50%; overflow: hidden;
  background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line);
}
.avatar-head svg { width: 100%; height: 100%; }
.side-me .avatar-head { background: var(--olive-2); box-shadow: inset 0 0 0 1px var(--olive-3); }
.title-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; background: var(--brass-soft); color: var(--brass-ink); white-space: nowrap; }
.roster-name .title-badge { font-size: 0.72rem; }
.history-nums { display: flex; gap: 18px; flex: 1; }
.history-nums span { display: grid; line-height: 1.2; }
.history-nums small { color: var(--muted); font-size: 0.78rem; }
.history-nums b { font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; }
.chip {
  display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--white); color: var(--ink); font-size: 0.88rem; font-weight: 600; cursor: pointer; text-decoration: none;
}
.chip:hover { border-color: var(--olive-3); }
.chip.on { background: var(--olive); border-color: var(--olive); color: var(--on-olive); }
.chip-link { border-style: dashed; color: var(--muted); }
.sample-avatars { display: flex; align-items: flex-end; gap: 4px; margin: 4px 0 18px; }
.sample-avatars span { display: block; width: 84px; }
.sample-avatars svg { width: 100%; height: auto; display: block; }

/* ------------------------------------------------------------ 캐릭터 꾸미기 */
.look { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.look-stage {
  position: sticky; top: 24px; display: grid; gap: 14px; justify-items: center;
  background: var(--olive); border-radius: 10px; padding: 24px 20px 20px;
  background-image: radial-gradient(ellipse 110px 22px at 50% 78%, rgba(0, 0, 0, 0.25), transparent 70%);
}
.look-preview { width: 150px; }
.look-preview svg { display: block; width: 100%; height: auto; }
.look-stage .btn-quiet { color: var(--on-olive-muted); }
.look-stage .btn-quiet:hover { background: var(--olive-2); color: var(--on-olive); }
.look-options { display: grid; gap: 14px; }
.opt { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); margin: 0; padding: 12px 16px 14px; }
.opt legend { padding: 0 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--white); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--olive), 0 0 0 4px var(--brass-light); }
.face-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.face-pick { width: 58px; height: 58px; padding: 2px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--white); cursor: pointer; display: grid; place-items: center; }
.face-pick svg { width: 52px; height: 52px; }
.face-pick:hover { border-color: var(--olive-3); }
.face-pick.on { border-color: var(--olive); box-shadow: 0 0 0 2px var(--brass-light); }
.costume-row { display: grid; grid-template-columns: 3em 1fr; gap: 10px; align-items: center; padding: 6px 0; }
.costume-row + .costume-row { border-top: 1px dashed var(--line); }
.costume-slot { font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.costume-picks { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------ 집 */
.room-stage { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--paper-2); user-select: none; }
.room-stage > svg { display: block; width: 100%; height: auto; }
.room-item { cursor: grab; outline: none; }
.room-item:active { cursor: grabbing; }
.room-item:focus-visible rect:first-child { stroke: var(--brass); stroke-width: 2; }
.room-owner { margin: -8px 0 14px; }
.room-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 16px; }
.room-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 32px; }
.room-tray { display: grid; gap: 12px; }
.surface-row { display: grid; grid-template-columns: 3em 1fr; gap: 10px; align-items: center; }
.surface-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.surface { width: 76px; height: 42px; padding: 0; border-radius: 5px; border: 1px solid var(--line); overflow: hidden; cursor: pointer; background: var(--white); }
.surface svg { width: 100%; height: 100%; display: block; }
.surface.on { border-color: var(--olive); box-shadow: 0 0 0 2px var(--brass-light); }
.tray-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.tray-item {
  display: grid; justify-items: center; gap: 4px; padding: 10px 8px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
}
.tray-item:hover:not(:disabled) { border-color: var(--olive-3); }
.tray-item:disabled { opacity: 0.5; cursor: default; }
.tray-art { display: grid; place-items: center; width: 100%; height: 64px; }
.tray-art svg { max-width: 92px; max-height: 64px; }
.tray-name { font-size: 0.85rem; font-weight: 700; }
.tray-left { font-size: 0.75rem; }

/* ------------------------------------------------------------ 상점 */
.wallet { display: grid; justify-items: end; line-height: 1.1; padding: 8px 14px; border-radius: var(--radius); background: var(--olive); color: var(--on-olive); }
.wallet small { color: var(--on-olive-muted); font-size: 0.78rem; }
.wallet b { font-family: var(--font-display); font-weight: 400; font-size: 1.7rem; color: var(--brass-light); }
.shop-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.shop-card { height: 100%; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.shop-card.is-owned { background: var(--paper-2); }
.shop-art { height: 150px; display: grid; place-items: center; padding: 12px; background: linear-gradient(var(--white), var(--paper-2)); border-bottom: 1px solid var(--line); }
.shop-art svg { max-width: 100%; max-height: 126px; width: auto; height: auto; }
.shop-art.is-avatar { align-items: end; padding-bottom: 0; }
.shop-art.is-avatar svg { height: 138px; max-height: none; }
.shop-body { padding: 10px 12px 12px; display: grid; gap: 6px; flex: 1; align-content: start; }
.shop-body .btn { margin-top: auto; }
.shop-price { color: var(--muted); font-size: 0.88rem; }
.shop-price b { font-family: var(--font-display); font-weight: 400; font-size: 1.25rem; color: var(--brass); }
.shop-have { font-size: 0.8rem; }
.buy-preview { display: grid; place-items: center; height: 180px; border-radius: var(--radius); background: linear-gradient(var(--white), var(--paper-2)); border: 1px solid var(--line); }
.buy-preview svg { max-height: 160px; max-width: 90%; width: auto; height: auto; }
.buy-preview.is-avatar svg { height: 170px; }
.shop-admin { list-style: none; margin: 8px 0 0; padding: 0; }
.shop-admin li { display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.shop-admin li:last-child { border-bottom: 0; }
.shop-admin-name { display: grid; line-height: 1.3; }
.shop-admin-name .muted { font-size: 0.8rem; }

/* ------------------------------------------------------------ 광장 */
.village-col { min-width: 0; }
.village {
  position: relative; height: min(64vh, 580px); min-height: 360px; border: 4px solid #2b2131; border-radius: 8px;
  overflow: hidden; background: #7cb36a; touch-action: none; outline: none;
}
.village:focus-visible { box-shadow: 0 0 0 3px var(--brass-light); }
.village-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; cursor: pointer; }
.village-help { position: absolute; left: 10px; top: 10px; padding: 4px 9px; border-radius: 4px; background: rgba(43, 33, 49, 0.75); color: #fff; font-size: 12px; pointer-events: none; }
.village-card {
  position: absolute; z-index: 5; transform: translate(-50%, -100%); min-width: 200px; max-width: 260px; display: grid; gap: 6px;
  padding: 12px 12px 10px; background: var(--paper); border: 3px solid #2b2131; border-radius: 6px; box-shadow: 4px 4px 0 rgba(43, 33, 49, 0.3);
}
.village-card[hidden] { display: none; }
.village-card strong { font-size: 1rem; padding-right: 26px; }
.village-card .muted { font-size: 0.85rem; }
.page.page-wide { max-width: 1320px; }
.plaza-head { display: flex; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.plaza-head h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.9rem, 3.5vw, 2.4rem); }
.plaza-head .muted { flex: 1 1 320px; font-size: 0.92rem; }
.plaza-status { font-size: 0.82rem; font-weight: 700; color: var(--mm); background: var(--mm-soft); padding: 2px 10px; border-radius: 999px; }
.plaza-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.plaza-scroll { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.plaza { position: relative; aspect-ratio: 5 / 3; min-width: 640px; overflow: hidden; cursor: crosshair; background: #e3dccb; }
.plaza-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.plaza-layer { position: absolute; inset: 0; pointer-events: none; }
.hotspot { position: absolute; border-radius: 10px; cursor: pointer; z-index: 5; }
.hotspot:hover, .hotspot:focus-visible { outline: 3px dashed var(--brass-light); outline-offset: -3px; background: rgba(255, 248, 220, 0.18); }
.actor {
  position: absolute; width: 6.4%; transform: translate(-50%, -96%); padding: 0; border: 0; background: none;
  pointer-events: auto; cursor: pointer; transition-property: left, top; transition-timing-function: linear;
  display: grid; justify-items: center;
}
.actor-figure { display: block; width: 100%; }
.actor-figure svg { display: block; width: 100%; height: auto; }
.actor.face-left .actor-figure svg { transform: scaleX(-1); }
.actor.walking .actor-figure { animation: actor-bob 0.32s ease-in-out infinite; }
@keyframes actor-bob { 50% { transform: translateY(-4%); } }
.actor.is-away .actor-figure { opacity: 0.6; filter: saturate(0.55); }
.actor-name {
  display: inline-flex; align-items: center; gap: 4px; margin-top: -4%; padding: 1px 8px; border-radius: 999px;
  background: rgba(244, 246, 240, 0.92); color: var(--ink); font-size: clamp(10px, 1.05vw, 13px); font-weight: 700; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}
.actor.is-away .actor-name { color: var(--muted); background: rgba(244, 246, 240, 0.7); }
.actor.is-me .actor-name { background: var(--olive); color: var(--brass-light); }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #3fae64; box-shadow: 0 0 0 2px rgba(63, 174, 100, 0.25); }
.online-dot[hidden] { display: none; }
.bubble {
  position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -6px); width: max-content; max-width: 190px;
  padding: 6px 10px; border-radius: 12px; background: #fff; color: var(--ink); border: 1.5px solid var(--olive);
  font-size: clamp(11px, 1.1vw, 13.5px); font-weight: 600; line-height: 1.35; text-align: center; white-space: normal; word-break: keep-all;
  animation: bubble-in 0.18s ease-out;
}
.bubble::after {
  content: ''; position: absolute; left: 50%; top: 100%; width: 10px; height: 10px; background: #fff;
  border-right: 1.5px solid var(--olive); border-bottom: 1.5px solid var(--olive); transform: translate(-50%, -5px) rotate(45deg);
}
.bubble[hidden] { display: none; }
@keyframes bubble-in { from { opacity: 0; transform: translate(-50%, 2px); } }
.actor-card {
  position: absolute; z-index: 2000; transform: translate(-50%, -100%); width: 240px; display: grid; gap: 6px;
  padding: 14px 14px 12px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(28, 34, 25, 0.22); cursor: default;
}
.actor-card[hidden] { display: none; }
.actor-card strong { font-size: 1.05rem; padding-right: 26px; }
.actor-card .muted { font-size: 0.85rem; }
.card-close { position: absolute; top: 6px; right: 6px; }
.plaza-chat { display: grid; grid-template-rows: auto 1fr auto; gap: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px; height: 100%; max-height: 560px; min-height: 320px; }
.plaza-chat h2 { font-size: 1rem; }
.chat-log { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; align-content: start; gap: 6px; }
.chat-log li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline; font-size: 0.9rem; }
.chat-log strong { white-space: nowrap; }
.chat-body { min-width: 0; overflow-wrap: anywhere; }
.chat-log time { font-size: 0.75rem; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { min-width: 0; }

.event-month { font-size: 0.75rem; }

/* ------------------------------------------------------------ 모달·알림 */
.modal {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  border: 0; border-radius: 10px; padding: 0; background: var(--paper); color: var(--ink);
}
.modal-wide { width: min(760px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(28, 34, 25, 0.55); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 16px 0 22px; }
.modal-head h2 { font-size: 1.15rem; }
.modal-body { padding: 14px 22px 22px; display: grid; gap: 12px; }
.confirm-text { font-size: 1rem; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px);
  background: var(--olive); color: var(--on-olive); padding: 10px 18px; border-radius: var(--radius);
  font-weight: 600; font-size: 0.95rem; opacity: 0; pointer-events: none; z-index: 100;
  transition: opacity 0.18s, transform 0.18s; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast[data-kind='error'] { background: var(--danger); color: #fff; }

/* ------------------------------------------------------------ 좁은 화면 */
@media (max-width: 900px) {
  .shell { display: block; background: none; }
  .side { display: none; }
  .topbar {
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 10; padding: 6px 8px 6px 16px;
    background: var(--olive); color: var(--on-olive);
  }
  .topbar-mark { font-family: var(--font-display); font-size: 1.3rem; color: var(--brass-light); text-decoration: none; }
  .topbar-actions { display: flex; }
  .page { padding: 20px 16px calc(var(--tabbar-h) + 32px); }
  .tabbar {
    display: grid; grid-template-columns: repeat(6, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--olive); border-top: 1px solid var(--olive-3);
  }
  .tabbar .nav-link { flex-direction: column; justify-content: center; gap: 2px; padding: 6px 0; font-size: 0.72rem; border-radius: 0; }
  .tabbar .nav-link.on { box-shadow: inset 0 3px 0 var(--brass-light); }
  #toast { bottom: calc(var(--tabbar-h) + 16px); }
}

@media (max-width: 720px) {
  .regiments { grid-template-columns: 1fr; }
  .pub-section { grid-template-columns: 1fr; }
  .earn li { grid-template-columns: 1fr; gap: 2px; }
  .history li { grid-template-columns: 3.5em 1fr; }
  .history li > span:last-child { grid-column: 2; }

  .home-grid { grid-template-columns: 1fr; }

  .roster-btn { grid-template-columns: 1.6em 24px 1fr auto; gap: 10px; padding: 12px 14px; }
  .roster-tags, .roster-bar { display: none; }

  .scen-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .search { max-width: none; flex-basis: 100%; }
  .tier-row { grid-template-columns: 52px 1fr; }
  .tier-label { font-size: 1.8rem; }
  .tier-items { gap: 10px; padding: 10px; }
  .tier-item, .tier-thumb { width: 72px; }
  .scen-head-poster { width: 120px; }
  .scen-head { grid-template-columns: 1fr; gap: 12px; }
  .ratings li { grid-template-columns: 4.5em 2.2em 1fr; }
  .ratings li .stars, .ratings li > .muted { display: none; }

  .admin-members li { grid-template-columns: 24px 1fr auto; }
  .admin-members .tags { grid-column: 2; justify-content: flex-start; }
  .admin-members .am-account { grid-column: 3; grid-row: 1; justify-self: end; }
  .admin-members .am-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .ledger li, .admin-give .ledger li { grid-template-columns: 3em 1fr auto auto; }
  .ledger-compact li { grid-template-columns: 3em 1fr auto; }
  .ledger li .ledger-note { grid-column: 2; grid-row: 2; }
  .admin-give .ledger li .ledger-cat { display: none; }
  .row-2 { grid-template-columns: 1fr; }
  .rank-row { grid-template-columns: 1fr 90px auto; }
  .rank-row .rank-step, .rank-row > .muted { display: none; }
  .event { grid-template-columns: 64px 1fr; }
  .poll-option { grid-template-columns: 1fr auto; }
  .poll-tally { grid-column: 1 / -1; grid-row: 2; grid-template-columns: 90px auto 1fr; }
  .post-row { grid-template-columns: auto 1fr; gap: 4px 10px; padding: 12px 14px; }
  .post-row .post-meta:not(.post-when) { grid-column: 2; grid-row: 2; }
  .post-when { grid-column: 2; grid-row: 2; justify-self: end; }
}

@media (max-width: 900px) {
  .plaza-wrap { grid-template-columns: 1fr; }
  .village { height: 58vh; min-height: 320px; }
  .plaza-chat { max-height: 320px; min-height: 0; height: auto; }
  .chat-log { max-height: 180px; }
  .look { grid-template-columns: 1fr; }
  .look-stage { position: static; }
}
@media (max-width: 720px) {
  .dossier { grid-template-columns: auto 1fr; }
  .dossier-avatar { width: 96px; grid-row: span 2; }
  .dossier-power { grid-column: 2; justify-items: start; text-align: left; }
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .shop-art { height: 128px; }
  .shop-art.is-avatar svg { height: 120px; }
  .shop-admin li { grid-template-columns: 1fr auto; }
  .surface-row, .costume-row { grid-template-columns: 1fr; gap: 6px; }
  .tray-items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sample-avatars span { width: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  #toast, .scen-poster img, .actor, .dossier-avatar { transition: none !important; }
  .actor.walking .actor-figure, .bubble { animation: none; }
  .scen-card:hover .scen-poster img { transform: none; }
}

/* ------------------------------------------------------------ 캐릭터: 방향 보기·AI */
.look-turns { display: flex; gap: 10px; justify-content: center; }
.look-turn { margin: 0; display: grid; justify-items: center; gap: 2px; }
.look-turn span { display: block; width: 44px; }
.look-turn svg { display: block; width: 100%; height: auto; }
.look-turn figcaption { font-size: 0.72rem; color: var(--on-olive-muted); }
.look-badge {
  justify-self: center; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 10px; border-radius: 999px; background: var(--brass-light); color: var(--ink);
}
.ai-card { display: grid; gap: 10px; }
.ai-card > p { margin: 0; }
.ai-form { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; }
.ai-inputs { display: grid; gap: 10px; }
.ai-inputs .field { margin: 0; }
.ai-thumb { width: 96px; height: 96px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--white); }
.ai-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ai-quota { margin: 0; font-size: 0.85rem; }
.ai-result { display: grid; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--olive); }
.ai-result-views { display: flex; gap: 18px; justify-content: center; align-items: end; }
.ai-result-views span { display: block; width: 96px; }
.ai-result-views svg { display: block; width: 100%; height: auto; }
@media (max-width: 560px) {
  .ai-form { grid-template-columns: 1fr; }
  .ai-thumb { width: 72px; height: 72px; }
}
.village-zoom {
  position: absolute; right: 10px; top: 10px; z-index: 4; padding: 5px 10px; border-radius: 4px; cursor: pointer;
  border: 2px solid #2b2131; background: #f4ecd8; color: #2b2131; font: 12px 'Galmuri11', var(--font, sans-serif); box-shadow: 2px 2px 0 rgba(43, 33, 49, 0.35);
}
.village-zoom:hover { background: #fff7e2; }
.app-version { margin: 32px 0 4px; text-align: center; font-size: 0.72rem; color: var(--muted); opacity: 0.8; }
.boot-fail { max-width: 420px; margin: 12vh auto; padding: 28px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); display: grid; gap: 12px; }
.boot-fail h1 { margin: 0; font-size: 1.3rem; }
.boot-fail p { margin: 0; color: var(--muted); }
.boot-fail button { justify-self: start; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--olive); background: var(--olive); color: #fff; font: inherit; cursor: pointer; }
.boot-fail pre { margin: 0; white-space: pre-wrap; font-size: 0.75rem; color: var(--muted); }

/* ------------------------------------------------------------ 평가표: 분류·0.1점·메모 */
.scen-card-cat { font-size: 0.74rem; color: var(--muted); letter-spacing: 0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scen-cat { margin: 0; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.my-score-input { font-family: var(--font-display); font-size: 1.6rem; width: 4.2em; padding: 4px 8px; text-align: center; }
.my-rating textarea { width: 100%; resize: vertical; min-height: 4.5em; }
.ratings li { align-items: start; }
.rating-comment { white-space: pre-line; line-height: 1.5; }
.ratings li { grid-template-columns: 4.5em 2.8em auto 1fr auto; }
.rating-score { white-space: nowrap; }
@media (max-width: 720px) { .ratings li { grid-template-columns: 4.5em 2.8em 1fr; } }
.chat-log:empty::before { content: '최근 3시간 대화만 보여요. 3시간이 지나면 지워져요.'; color: var(--muted); font-size: 0.85rem; }

/* ------------------------------------------------------------ 외부 공개 평가표 */
.pub-links { display: flex; align-items: center; gap: 14px; }
.pub-link { color: var(--on-olive); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.pub-link:hover { text-decoration: underline; }
.pub-board { max-width: 1240px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 48px) 56px; }
.regiment-link { display: inline-block; margin-top: 10px; font-weight: 700; color: inherit; }
.ratings-anon li { grid-template-columns: 3.4em 2.8em auto 1fr; }
@media (max-width: 720px) { .ratings-anon li { grid-template-columns: 3.4em 2.8em 1fr; } }
.ai-status { margin: 0; font-size: 0.88rem; color: var(--olive); font-weight: 600; }
/* 긴 시나리오 이름도 잘리지 않게 전부 보여줌 */
.scen-card-title { display: block; -webkit-line-clamp: unset; overflow: visible; word-break: keep-all; overflow-wrap: anywhere; }
.tier-item-title { display: block; -webkit-line-clamp: unset; overflow: visible; word-break: keep-all; overflow-wrap: anywhere; }
.scen-note { margin: 4px 0 0; white-space: pre-line; line-height: 1.6; color: var(--ink); max-height: 16em; overflow-y: auto; }
.scen-note { max-height: none; overflow: visible; }
.scen-note.is-clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.scen-note-wrap { display: grid; justify-items: start; gap: 2px; }
.note-toggle { border: 0; background: none; padding: 2px 0; color: var(--olive); font-weight: 700; font-size: 0.88rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.note-toggle[hidden] { display: none; }
