/* 40~50대 타겟: 큰 글씨, 높은 대비, 단순한 레이아웃 */
:root {
  --red: #d01c27;       /* 국민의힘 상징색 (살짝 어둡게 조정) */
  --red-soft: #fdecee;
  --blue: #004ea2;      /* 더불어민주당 */
  --blue-soft: #e8f0fa;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1c1e21;
  --muted: #65676b;
  --line: #dcdfe4;
  --vote-a: #1b7a5c;   /* 투표 선택지 A — 틸 그린 */
  --vote-a-soft: #e6f4ef;
  --vote-b: #b85c00;   /* 투표 선택지 B — 앰버 오렌지 */
  --vote-b-soft: #fdf0e6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 18px; }

body {
  font-family: "Pretendard", "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
}

.page-content {
  flex: 1;
  min-width: 0;
}

/* 좌우 광고 사이드바 — 1200px 이하 화면에서는 숨김 */
.sidebar {
  width: 320px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: none;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem;
  padding-top: 0.7rem;
}

@media (min-width: 1200px) {
  .sidebar { display: flex; }
}

.ad-slot {
  width: 300px;
  height: 250px;
  background: var(--card);
  border: 2px dashed var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.ad-slot small { font-size: 0.75rem; opacity: 0.7; }

.hidden { display: none !important; }
.screen { min-height: 100vh; }

/* ---------- 로그인 ---------- */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  background: var(--card);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.logo { font-size: 2rem; text-align: center; }

/* 로고: 두 정당 색이 서로 계속 뒤바뀌는 두 개의 원 */
.logo-dots { display: inline-flex; gap: 0.18em; vertical-align: -0.08em; }
.dot {
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  border-radius: 50%;
  animation: color-swap 10s ease-in-out infinite;
}
.dot.d2 { animation-delay: -5s; }

/* 멈춤 구간 없이 5초 내내 천천히 색이 흐르듯 전환 */
@keyframes color-swap {
  0%   { background: var(--red); }
  50%  { background: var(--blue); }
  100% { background: var(--red); }
}
.tagline { text-align: center; color: var(--muted); margin-bottom: 0.8rem; }

.field-label { font-weight: 700; font-size: 0.9rem; margin-top: 0.4rem; }

input[type="text"], input[type="password"] {
  font-size: 1.1rem;
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  width: 100%;
}
input:focus { outline: none; border-color: #555; }
/* PIN 입력창: 숫자를 점으로 마스킹하되 type=text 유지 (비밀번호 저장 팝업 방지) */
#pin { -webkit-text-security: disc; }

#party-select .field-label {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text);
  text-align: center;
  margin-bottom: 0.7rem;
  letter-spacing: -0.01em;
}

.party-buttons { display: flex; gap: 0.6rem; }

.party-btn {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.9rem 0.4rem;
  border-radius: 10px;
  border: 3px solid transparent;
  cursor: pointer;
  color: #fff;
}
.party-btn.ppp { background: var(--red); }
.party-btn.dpk { background: var(--blue); }
.party-btn.selected { border-color: #1c1e21; box-shadow: 0 0 0 3px rgba(0,0,0,0.15); }

.terms-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.terms-box summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  font-size: 0.88rem;
}
.terms-list {
  margin: 0.6rem 0 0 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  line-height: 1.4;
}
.terms-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.3rem 0;
}
.terms-check input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
  cursor: pointer;
}

.big-btn {
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.9rem;
  border: none;
  border-radius: 10px;
  background: #1c1e21;
  color: #fff;
  cursor: pointer;
  margin-top: 0.6rem;
}
.big-btn:hover { opacity: 0.9; }

.error-msg { color: #c0392b; font-size: 0.9rem; min-height: 1.4rem; text-align: center; }
.hint { color: var(--muted); font-size: 0.8rem; text-align: center; }
.contact-hint a { color: var(--muted); text-decoration: underline; }
.contact-hint a:hover { color: var(--text); }

.ad-area { text-align: center; padding: 0.5rem 0 1rem; }

/* ---------- 메인 ---------- */
#main-screen {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#main-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.85rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.header-left { display: flex; flex-direction: column; gap: 0.1rem; }

.visitor-stats { display: flex; flex-direction: column; gap: 0; }
.visitor-stats .stat-line { font-size: 0.72rem; color: var(--muted); line-height: 1.3; }
.visitor-stats b { font-weight: 700; color: var(--text); }

/* 사이드바 방문자 통계 — 로그인 여부 무관하게 항상 표시 */
.sidebar-visitor-stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 8.5rem;
  padding: 0.9rem 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.6rem;
}
.sidebar-visitor-stats .sv-total {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.4;
}
.sidebar-visitor-stats .sv-total b { font-weight: 700; color: var(--text); }
.sidebar-visitor-stats .sv-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 0.35rem;
  letter-spacing: 0.02em;
}
.sidebar-visitor-stats .sv-party {
  font-size: 1.44rem;
  font-weight: 900;
  line-height: 1.3;
}

/* 이전 투표 아코디언 토글 */
.prev-issues-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  margin: 0.8rem 0 0.2rem;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.prev-issues-toggle:hover { background: var(--bg); }
.prev-issues-toggle .toggle-arrow { font-size: 0.78rem; transition: transform 0.2s; }
.prev-issues-toggle.open .toggle-arrow { transform: rotate(180deg); }

/* 이전 투표 카드 — 흐리게 */
.issue-card-prev { opacity: 0.75; }
.issue-card-prev .vote-btn { cursor: default; }

/* 이전 투표 채팅버튼 비활성화 */
.issue-chat-btn:disabled {
  background: var(--line) !important;
  color: var(--muted) !important;
  cursor: not-allowed;
  opacity: 0.6;
}

.issue-card-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.2rem; }
.issue-prev-badge {
  font-size: 0.72rem; font-weight: 700;
  background: var(--line); color: var(--muted);
  border-radius: 6px; padding: 0.1rem 0.5rem;
}
.issue-prev-date { margin-left: auto; font-size: 0.82rem; color: var(--text); font-weight: 600; }
.logo-small { font-weight: 800; font-size: 1.15rem; }
#user-info { flex: 1; text-align: right; font-weight: 700; font-size: 1.15rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#logout-btn { font-size: 1rem; }
.nick-ppp { color: var(--red); }
.nick-dpk { color: var(--blue); }

.small-btn {
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.tabs { display: flex; background: var(--card); border-bottom: 2px solid var(--line); }
.tab {
  flex: 1;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.48rem 0.5rem;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: #1c1e21; }

.view { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ---------- 채팅 ---------- */
#room-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.42rem 0.8rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
}
.banner-action-btn {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 6px;
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
.banner-action-btn:hover { background: rgba(255,255,255,0.35); }
.banner-action-btn.peek-btn-dpk { background: var(--blue); border-color: var(--blue); }
.banner-action-btn.peek-btn-dpk:hover { filter: brightness(1.15); }
.banner-action-btn.peek-btn-ppp { background: var(--red); border-color: var(--red); }
.banner-action-btn.peek-btn-ppp:hover { filter: brightness(1.15); }
#room-banner.ppp { background: var(--red); }
#room-banner.dpk { background: var(--blue); }
/* 이슈 채팅방: 양당이 함께 들어오는 방이므로 두 색을 모두 표시 */
#room-banner.issue { background: linear-gradient(90deg, var(--blue), var(--red)); }
/* 엿보기 모드: 상대 당 색상에 반투명 줄무늬 오버레이 */
#room-banner.peek-ppp { background: repeating-linear-gradient(45deg, var(--red) 0, var(--red) 6px, #a01018 6px, #a01018 12px); }
#room-banner.peek-dpk { background: repeating-linear-gradient(45deg, var(--blue) 0, var(--blue) 6px, #003a7a 6px, #003a7a 12px); }

/* 엿보기 바 */
#peek-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0.8rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  gap: 0.5rem;
  flex-shrink: 0;
}
.return-btn-ppp {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  font-weight: 700;
}
.return-btn-dpk {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  font-weight: 700;
}

.peek-toggle-btn {
  font-size: 1.08rem;
  font-weight: 700;
  padding: 0.45rem 0.9rem;
  border: 2px dashed var(--muted);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  width: 100%;
  text-align: center;
}
.peek-toggle-btn:hover { background: var(--line); }
.peek-notice {
  font-size: 1.05rem;
  color: var(--muted);
  font-weight: 700;
  flex: 1;
}
#send-btn:disabled { opacity: 0.35; cursor: not-allowed; }
#chat-input[contenteditable=false] { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#scroll-btn {
  position: absolute;
  bottom: 4rem;
  right: 0.75rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--line);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#scroll-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

.msg { display: flex; flex-direction: column; max-width: 85%; }
.msg .meta { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.1rem; }
.msg .meta .nick { font-weight: 800; font-size: 0.9rem; }
.msg.ppp .meta .nick { color: var(--red); }
.msg.dpk .meta .nick { color: var(--blue); }
.msg .bubble {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.4rem 0.75rem;
  font-size: 0.95rem;
  word-break: break-word;
  width: fit-content;
}
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.mine.ppp .bubble { background: var(--red-soft); }
.msg.mine.dpk .bubble { background: var(--blue-soft); }

.msg.system { align-self: center; }
.msg.system .bubble {
  background: #fff4d6;
  border-color: #f0d48a;
  color: #7a5c00;
  font-size: 0.88rem;
}

.report-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0 0.3rem;
  color: rgba(192, 57, 43, 0.35);
  vertical-align: middle;
  line-height: 1;
  letter-spacing: -0.01em;
}
.report-btn:hover { color: rgba(192, 57, 43, 0.75); }
.report-btn:disabled { cursor: default; color: rgba(192, 57, 43, 0.55); }

.banner-input-row {
  display: flex;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  background: var(--card);
  border-top: 1px solid var(--line);
}
.banner-input-row input {
  flex: 1;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
}
.banner-use-btn { position: relative; }

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  background: var(--card);
  border-top: 1px solid var(--line);
  position: relative;
}
#chat-input {
  flex: 1;
  font-size: 1.1rem;
  padding: 0.55rem 0.9rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  min-height: 2.7rem;
  max-height: 5rem;
  overflow-y: auto;
  outline: none;
  line-height: 1.5;
  background: var(--bg);
  word-break: break-word;
  cursor: text;
}
#chat-input:focus { border-color: #555; }
#chat-input:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}
#chat-input span[data-code] { display: inline; vertical-align: middle; }
#chat-input span[data-code] img { height: 1.5em; width: auto; vertical-align: middle; border-radius: 4px; background: #fff; }
.big-btn.send { margin-top: 0; padding: 0.7rem 1.2rem; white-space: nowrap; }

/* ---------- 투표 ---------- */
#vote-view { overflow-y: auto; }
#issues { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.75rem; zoom: 0.9; }

.issue-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
}
.issue-category {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg);
  border-radius: 6px;
  padding: 0.1rem 0.5rem;
  margin-bottom: 0.35rem;
}
.issue-title { font-size: 1.18rem; font-weight: 800; margin-bottom: 0.7rem; }

.vote-buttons { display: flex; gap: 0.5rem; margin-bottom: 0.7rem; }
.vote-btn {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.7rem 0.4rem;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  background: var(--bg);
}
.vote-btn.a,
.vote-btn.b { color: var(--text); border-color: var(--line); }
.vote-btn.chosen { background: var(--vc); border-color: var(--vc); color: #fff; }
.vote-btn:not(.chosen):hover { border-color: var(--muted); }

.gauge {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--line);
  margin-bottom: 0.3rem;
}
/* 게이지 바 색상은 app.js에서 inline style로 설정 */

.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  font-weight: 700;
}
/* 게이지 라벨 색상은 app.js에서 inline style로 설정 (짝수/홀수날 적색·청색 전환) */

.party-breakdown { margin-top: 0.5rem; }
.bd-split {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.92rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.bd-split > span { white-space: normal; word-break: keep-all; overflow-wrap: break-word; }
.bd-ppp { color: var(--red); font-weight: 700; }
.bd-dpk { color: var(--blue); font-weight: 700; }
.bd-total { color: var(--muted); font-weight: 400; }

.issue-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.55rem;
  align-items: stretch;
}

.issue-chat-btn {
  flex: 1;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.6rem;
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
}
.issue-chat-btn:hover { opacity: 0.92; }

.issue-share-btn {
  flex-shrink: 0;
  padding: 0.6rem 0.75rem;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.issue-share-btn:hover { background: var(--bg); color: var(--text); }

/* 로그인 후엔 사용자 위젯이 스페이서 역할을 대신하므로 placeholder 숨김 */
#sidebar-user-stats:not(.hidden) + .sidebar-stats-placeholder { display: none; }

/* 우측 사이드바 스페이서 — 좌측 방문자통계 높이만큼 여백 확보 */
.sidebar-stats-placeholder {
  width: 100%;
  padding: 0.9rem 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.6rem;
  visibility: hidden;
  min-height: 8.5rem;
}

/* 우측 사이드바 — 사용자 정보 위젯 (좌측 방문자통계와 동일 스타일) */
.sidebar-user-stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 8.5rem;
  padding: 0.9rem 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.6rem;
}
.sidebar-user-stats .sv-total { font-size: 1rem; color: var(--muted); font-weight: 500; line-height: 1.4; }
.sidebar-user-stats .sv-total b { font-weight: 700; color: var(--text); }
.sidebar-user-stats .sv-party { font-size: 1.44rem; font-weight: 900; line-height: 1.3; }

/* 카운트다운 */
.vote-countdown {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0.5rem 0 0.2rem;
  letter-spacing: 0.02em;
}

/* 기존 계정 로그인 (접이식) */
.legacy-login-box {
  margin-top: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
}
.legacy-login-box summary { cursor: pointer; font-weight: 700; color: var(--text); font-size: 1rem; }
.legacy-form { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.7rem; }
.legacy-form input { padding: 0.6rem 0.9rem; border: 2px solid var(--line); border-radius: 8px; font-size: 1rem; }
.legacy-party-row { display: flex; gap: 0.5rem; }
.legacy-party-btn { flex: 1; padding: 0.65rem; border: none; border-radius: 8px; font-size: 1rem; font-weight: 700; color: #fff; cursor: pointer; }
.legacy-party-btn.ppp { background: var(--red); }
.legacy-party-btn.dpk { background: var(--blue); }
.remember-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; color: var(--muted); cursor: pointer; }
.remember-row input[type="checkbox"] { width: 1.1rem; height: 1.1rem; cursor: pointer; accent-color: var(--blue); }

/* 프로필 모달 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: var(--card);
  border-radius: 16px;
  padding: 1.5rem 1.2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.modal-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 0.4rem; }
.modal-desc { font-size: 0.82rem; color: var(--muted); margin-bottom: 0.9rem; line-height: 1.5; }
.modal-card .field-label { display: block; font-size: 0.88rem; font-weight: 700; color: var(--muted); margin-bottom: 0.3rem; }
.modal-card input { width: 100%; padding: 0.6rem 0.8rem; border: 2px solid var(--line); border-radius: 8px; font-size: 0.95rem; }
.modal-actions { display: flex; gap: 0.6rem; margin-top: 1rem; }
.modal-cancel-btn { flex: 1; padding: 0.6rem; background: var(--bg); border: 1.5px solid var(--line); border-radius: 8px; font-size: 0.95rem; font-weight: 700; cursor: pointer; }
.modal-save-btn { flex: 2; padding: 0.6rem; background: var(--blue); color: #fff; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 700; cursor: pointer; }
.modal-save-btn:hover { opacity: 0.9; }

/* 헤더 프로필 버튼 */
.profile-btn { color: var(--muted); background: var(--bg); border: 1.5px solid var(--line); margin-right: 0.3rem; }
.profile-btn:hover { color: var(--text); }

/* 사이드바 발자국 + 스토어 버튼 행 */
.sv-party-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.sv-party-row .sv-points { font-size: 1.3rem; font-weight: 900; line-height: 1.3; }
.store-btn {
  font-size: 0.78rem; font-weight: 800;
  padding: 0.2rem 0.55rem;
  background: linear-gradient(135deg, var(--red), var(--blue));
  color: #fff; border: none; border-radius: 20px;
  cursor: pointer; white-space: nowrap;
}
.store-btn:hover { opacity: 0.88; }
.claim-btn {
  width: 100%; margin-top: 0.4rem;
  font-size: 0.9rem; font-weight: 800;
  padding: 0.45rem 0;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff; border: none; border-radius: 20px;
  cursor: pointer;
}
.claim-btn:hover { opacity: 0.88; }
.claim-btn:disabled { opacity: 0.5; cursor: default; }
.claim-btn-maxed {
  background: var(--line) !important;
  color: var(--muted) !important;
  font-weight: 700;
}

/* 스토어 모달 */
.store-modal-card { width: 500px; max-width: 96vw; max-height: 82vh; display: flex; flex-direction: column; }
.store-modal-header { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.store-points { font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.store-points b { color: var(--text); }
.store-grid {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  overflow-y: auto;
  padding: 0.2rem 0.1rem;
  flex: 1;
}
.store-card {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.4rem;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  background: var(--card);
  transition: border-color 0.15s;
}
.store-card.owned { border-color: #1a7f37; background: #f0fff4; }
.store-card-img { width: 56px; height: 56px; object-fit: contain; border-radius: 8px; }
.store-card-emoji { font-size: 2.6rem; line-height: 1; }
.store-card-name { font-size: 0.82rem; font-weight: 700; }
.store-card-price { font-size: 0.78rem; color: var(--muted); }
.store-buy-btn {
  font-size: 0.8rem; font-weight: 700;
  padding: 0.3rem 0.7rem;
  border: none; border-radius: 20px; cursor: pointer;
  background: linear-gradient(135deg, var(--red), var(--blue));
  color: #fff;
}
.store-buy-btn:disabled { background: var(--line); color: var(--muted); cursor: default; }
.store-owned-badge {
  font-size: 0.78rem; font-weight: 700;
  padding: 0.25rem 0.6rem;
  background: #1a7f37; color: #fff; border-radius: 20px;
}
.store-empty { grid-column: 1/-1; text-align: center; color: var(--muted); padding: 2rem; font-size: 0.9rem; }

/* 스토어 섹션 구분 */
.store-section { width: 100%; }
.store-section-title { font-size: 0.88rem; font-weight: 800; color: var(--muted); letter-spacing: 0.03em; margin-bottom: 0.6rem; }
.store-emo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
@media (max-width: 400px) { .store-emo-grid { grid-template-columns: repeat(2, 1fr); } }

/* 특수 아이템 카드 */
.store-action-card {
  display: flex; align-items: center; gap: 0.8rem;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
}
.store-action-img { width: 52px; height: 52px; object-fit: contain; flex-shrink: 0; border-radius: 8px; }
.store-action-info { flex: 1; min-width: 0; }
.store-action-name { font-size: 0.92rem; font-weight: 800; }
.store-action-desc { font-size: 0.78rem; color: var(--muted); margin: 0.15rem 0 0.3rem; }

/* 먹물 오버레이 */
#chat-body {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#ink-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ink-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  mix-blend-mode: multiply;
}
.ink-badge {
  position: relative;
  z-index: 51;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border-radius: 20px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex; align-items: center; gap: 0.6rem;
  pointer-events: none;
}
.ink-who { opacity: 0.85; }
.ink-countdown { font-size: 1rem; font-weight: 900; }

/* 똥 공격 */
@keyframes poop-fall {
  0% { transform: translateY(-80px) rotate(-10deg); opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateY(100vh) rotate(20deg); opacity: 0; }
}
.poop-fall {
  position: absolute;
  top: 0;
  z-index: 55;
  pointer-events: none;
  animation: poop-fall 2.2s ease-in forwards;
}
.poop-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 56;
  background: rgba(100,50,0,0.82);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  pointer-events: none;
}

/* 현수막 */
.banner-display {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(135deg, #7c3aed, #db2777);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 0 0 8px 8px;
  text-align: center;
  letter-spacing: 0.3px;
}
.banner-icon { font-size: 1.1rem; }


/* 스토어 특수아이템 이모지 */
.store-action-emoji {
  font-size: 2.5rem;
  flex-shrink: 0;
  width: 56px;
  text-align: center;
}
.store-count-badge {
  background: var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: 4px;
  vertical-align: middle;
}

/* 이모티콘 픽커 */
.emo-picker-btn {
  flex-shrink: 0;
  width: 2.4rem;
  align-self: stretch;
  background: var(--bg); border: 1.5px solid var(--line);
  border-radius: 8px; font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.emo-picker-btn:hover { background: var(--line); }
.emo-picker {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0.5rem;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.3rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 100;
  max-width: 240px;
  max-height: 200px;
  overflow-y: auto;
}
.emo-picker-item {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; cursor: pointer; font-size: 1.5rem;
  border: none; background: transparent;
}
.emo-picker-item:hover { background: var(--bg); }
.emo-picker-item img { max-width: 32px; max-height: 32px; width: auto; height: auto; object-fit: contain; }
.emo-picker-empty { grid-column: 1/-1; font-size: 0.8rem; color: var(--muted); text-align: center; padding: 0.5rem; }

/* 채팅 버블 내 이모티콘 */
.chat-emo { max-width: 64px; max-height: 64px; width: auto; height: auto; object-fit: contain; vertical-align: middle; border-radius: 4px; }
.chat-emo-photo { max-width: 84px; max-height: 84px; width: auto; height: auto; display: block; border-radius: 8px; margin: 4px 0; }
.chat-emo-emoji { font-size: 1.5rem; vertical-align: middle; }

/* 광고 배너 — LIVE 깜빡이는 점 */
@keyframes ad-live-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.1; transform: scale(0.8); }
}
.ad-live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ff3b30;
  animation: ad-live-blink 1.1s ease-in-out infinite;
  vertical-align: middle;
  margin-right: 5px;
  box-shadow: 0 0 6px #ff3b30, 0 0 14px rgba(255,59,48,0.45);
}

/* 모바일: 헤더 정당명 숨김 */
@media (max-width: 480px) {
  .user-party { display: none; }
  #user-info { font-size: 1rem; }
}
