/* 공통 스타일 */
:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-color: #1e293b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --border-radius: 8px;
  --transition: all 0.3s ease;
  --bg-secondary: #f1f5f9;
  --input-bg: #ffffff;
}

[data-theme="dark"] {
  --primary-color: #6366f1;
  --primary-hover: #818cf8;
  --secondary-color: #94a3b8;
  --success-color: #34d399;
  --danger-color: #f87171;
  --warning-color: #fbbf24;
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-color: #e2e8f0;
  --border-color: #334155;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
  --bg-secondary: #1e293b;
  --input-bg: #1e293b;
}

[data-theme="dark"] body { background: var(--bg-color); color: var(--text-primary); }
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select {
  background: var(--input-bg); color: var(--text-primary); border-color: var(--border-color);
}
[data-theme="dark"] button { color: var(--text-primary); }
[data-theme="dark"] .header { background: #1e293b; border-bottom-color: var(--border-color); }
[data-theme="dark"] .modal-content { background: var(--card-bg); }
[data-theme="dark"] .announcement-row.pinned { background: #2d2006; }
[data-theme="dark"] .btn-social { background-color: var(--card-bg); }
[data-theme="dark"] .btn-google:hover { background-color: var(--bg-color); }
[data-theme="dark"] .btn-notif-reject:hover { background: #450a0a; border-color: #7f1d1d; }

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

/* 글로벌 슬림 스크롤바 */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #b0b8c4; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #8b95a5; }
::-webkit-scrollbar-button { display: none; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #475569; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #64748b; }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: #b0b8c4 transparent; }
  [data-theme="dark"] * { scrollbar-color: #475569 transparent; }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 상단 공지 배너 */
.top-notice-bar {
  background: linear-gradient(90deg, #4f46e5, #6366f1);
  text-align: center;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}
.top-notice-bar.visible {
  max-height: 3rem;
  padding: 0.4rem 0;
}
.top-notice-link {
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.top-notice-link:hover { opacity: 0.85; }
.top-notice-badge {
  background: rgba(255,255,255,0.2);
  padding: 1px 8px;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.top-notice-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.top-notice-visitors {
  position: absolute;
  right: 1rem;
  color: rgba(255,255,255,0.9);
  font-size: 0.78rem;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .top-notice-visitors { display: none; }
}

/* 헤더 */
.header {
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 0.4rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  text-decoration: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-img {
  height: 80px;
  width: auto;
  object-fit: contain;
}

.nav {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar { display: none; }

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-link:hover {
  color: var(--primary-color);
  background-color: var(--bg-color);
}

.nav-link.active {
  color: var(--primary-color);
  background-color: var(--bg-color);
}

.user-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle-btn {
  background: none; border: none; cursor: pointer; width: 44px; height: 44px;
  border-radius: 50%; color: var(--text-secondary); transition: var(--transition);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0;
}

#userSection {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.theme-toggle-btn:hover { background-color: var(--bg-color); color: var(--primary-color); }
.theme-toggle-btn .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-toggle-btn .theme-icon-light { display: none; }
[data-theme="dark"] .theme-toggle-btn .theme-icon-dark { display: flex; }

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
  flex-shrink: 0;
}

/* 게스트/무아바타 결정론 색 이니셜 서클 (user-badge.js userAvatarHtml) */
.user-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  user-select: none;
}

/* 유저 뱃지 (관리자/공식/게스트) — badge-verified(신고 상태)와는 별개 네임스페이스 */
/* 정렬 원리: inline 문맥은 vertical-align:middle, flex 컨테이너는 부모 align-items:center가
   자동 중앙정렬 → SVG라 position:top 보정 없이 두 문맥 모두 일관 정렬됨 */
.user-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85em;
  line-height: 1;
  vertical-align: middle;
  margin-left: 0.25em; /* 이름과의 간격 (inline 문맥) */
}

.user-badge-admin,
.user-badge-official {
  font-size: 0.9em;
}

/* 인라인 SVG 아이콘 — em 기준 크기 */
.user-badge-icon {
  width: 1em;
  height: 1em;
  display: block;
}

/* flex 컨테이너(자체 gap 보유)에선 뱃지 좌여백 불필요 — gap이 간격 담당 */
.room-host .user-badge {
  margin-left: 0;
}

.user-badge-guest {
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.user-points {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* 버튼 */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
  text-align: center;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background-color: #475569;
}

.btn-success {
  background-color: var(--success-color);
  color: white;
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-outline-primary {
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}
.btn-outline-primary:hover {
  background: var(--primary-color);
  color: white;
}

.btn-outline-danger {
  background: transparent;
  border: 1px solid var(--danger-color);
  color: var(--danger-color);
}
.btn-outline-danger:hover {
  background: var(--danger-color);
  color: white;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* 메인 컨텐츠 */
.main {
  padding: 2rem 0;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  min-height: calc(100vh - 200px);
}

/* 로딩 스피너 */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 모달 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  animation: fadeIn 0.3s;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
}

/* 소셜 로그인 버튼 */
.social-login-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.5rem 0;
}

.btn-social {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  background-color: white;
  color: var(--text-primary);
}

.btn-social img {
  width: 20px;
  height: 20px;
}

.btn-google:hover {
  background-color: #f8fafc;
}

.btn-naver {
  background-color: #03c75a;
  color: white;
  border-color: #03c75a;
}

.btn-naver:hover {
  background-color: #02b350;
}

/* 구분선 */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.divider span {
  padding: 0 1rem;
}

/* 게스트 로그인 */
.guest-login {
  background-color: var(--bg-color);
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-top: 0.5rem;
}

.guest-input-group {
  display: flex;
  gap: 0.5rem;
}

.guest-input-group input {
  flex: 1;
}

.guest-input-group button {
  white-space: nowrap;
}

/* 폼 */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

.text-input,
.select-input,
.textarea-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  transition: var(--transition);
}

.text-input[readonly] {
  background: var(--bg-color);
  opacity: 0.7;
  cursor: default;
}

.text-input:focus,
.select-input:focus,
.textarea-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.textarea-input {
  resize: vertical;
  font-family: inherit;
}

.pw-toggle-btn {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem;
  line-height: 1;
  opacity: 0.5;
}

.pw-toggle-btn:hover {
  opacity: 1;
}

/* 슬라이더 (range input) */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(79, 70, 229, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--primary-color);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(79, 70, 229, 0.3);
}
input[type="range"]::-moz-range-track {
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* 유틸리티 클래스 */
.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* 건의하기 버튼 (하단 고정) */
.suggestion-btn {
  position: fixed;
  bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  right: 2rem;
  padding: 1rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
  z-index: 50;
}

.suggestion-btn:hover {
  background-color: var(--primary-hover);
  transform: scale(1.05);
}

/* 스켈레톤 로딩 UI */
.skeleton {
  background: linear-gradient(90deg, var(--border-color) 25%, rgba(79, 70, 229, 0.08) 50%, var(--border-color) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius);
}

.skeleton-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.skeleton-thumbnail {
  height: 180px;
  background: linear-gradient(90deg, var(--border-color) 25%, rgba(79, 70, 229, 0.08) 50%, var(--border-color) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-text {
  height: 14px;
  margin: 0.5rem 1rem;
  border-radius: 4px;
}

.skeleton-text.short {
  width: 40%;
}

.skeleton-text.medium {
  width: 70%;
}

.skeleton-text.long {
  width: 90%;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 페이지 진입 애니메이션 */
.main {
  animation: pageEnter 0.4s ease-out;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 개선된 토스트 알림 */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--border-radius);
  color: white;
  font-weight: 500;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: toastSlideIn 0.3s ease-out;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}

.toast-item:hover {
  transform: scale(1.02);
}

.toast-item.removing {
  animation: toastSlideOut 0.3s ease-in forwards;
}

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* 404 에러 페이지 */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  text-align: center;
  padding: 2rem;
}

.error-code {
  font-size: 8rem;
  font-weight: 800;
  color: var(--primary-color);
  line-height: 1;
  opacity: 0.15;
}

.error-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0.5rem 0;
}

.error-desc {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

/* 빈 상태 표시 */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  margin-bottom: 1.5rem;
}

/* 알림 벨 */
.notification-bell {
  position: relative;
}

.bell-btn {
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}

.bell-btn:hover {
  background-color: var(--bg-color);
  color: var(--primary-color);
}

.bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  background: var(--danger-color);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.notification-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  border: 1px solid var(--border-color);
  z-index: 1000;
  overflow: hidden;
}

.notification-dropdown.open {
  display: block;
  animation: fadeSlideDown 0.2s ease-out;
}

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.notification-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.btn-read-all {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg-color);
  color: var(--text-secondary);
  cursor: pointer;
}
.btn-read-all:hover {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.notification-list {
  max-height: 300px;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item:hover {
  background-color: var(--bg-color);
}

.notification-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

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

.notification-text {
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.notification-actions {
  display: flex;
  gap: 6px;
}

.btn-notif-accept {
  padding: 3px 10px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-notif-accept:hover {
  background: var(--primary-hover);
}

.btn-notif-reject {
  padding: 3px 10px;
  background: var(--bg-color);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-notif-reject:hover {
  background: #fee2e2;
  color: var(--danger-color);
  border-color: #fca5a5;
}

.notification-accepted {
  text-align: center;
  color: var(--success-color);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px;
}

.notification-empty,
.notification-loading,
.notification-more {
  text-align: center;
  padding: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.notification-footer {
  border-top: 1px solid var(--border-color);
  padding: 10px 16px;
  text-align: center;
}

.notification-footer-link {
  font-size: 0.8rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.notification-footer-link:hover {
  text-decoration: underline;
}

.notification-item.read {
  opacity: 0.6;
}

.notification-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.notification-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* 버튼 비활성화 상태 */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* 포커스 가시성 개선 (접근성) */
.btn:focus-visible,
.nav-link:focus-visible,
.text-input:focus-visible,
.select-input:focus-visible,
.textarea-input:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* 스크롤 투 탑 버튼 */
.scroll-top-btn {
  position: fixed;
  bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  z-index: 49;
  display: none;
  align-items: center;
  justify-content: center;
}

.scroll-top-btn.visible {
  display: flex;
}

.scroll-top-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* ===== 장르 셀렉터 (GenreSelector 컴포넌트) ===== */
.genre-selector { width: 100%; }
.genre-major-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.genre-major-btn {
  padding: 0.35rem 0.85rem; border: 2px solid var(--border-color);
  border-radius: 20px; background: transparent; cursor: pointer;
  font-size: 0.85rem; color: var(--text-secondary);
  transition: var(--transition); white-space: nowrap;
}
.genre-major-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.genre-major-btn.expanded { border-color: var(--primary-color); color: var(--primary-color); }
.genre-major-btn.selected { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.genre-major-btn.orphan-indicator { font-style: italic; opacity: 0.8; }
.genre-sub-row {
  display: flex; gap: 0.35rem; overflow-x: auto; padding: 0.5rem 0;
  -webkit-overflow-scrolling: touch;
}
.genre-sub-chip {
  padding: 0.3rem 0.8rem; border: 1px solid var(--border-color);
  border-radius: 50px; background: var(--card-bg); cursor: pointer;
  font-size: 0.8rem; color: var(--text-secondary);
  transition: var(--transition); white-space: nowrap; flex-shrink: 0;
}
.genre-sub-chip:hover { border-color: var(--primary-color); color: var(--primary-color); }
.genre-sub-chip.selected { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.genre-sub-chip.expanded { border-color: var(--primary-color); color: var(--primary-color); }
.genre-minor-row {
  display: flex; gap: 0.3rem; overflow-x: auto; padding: 0.3rem 0 0.3rem 0.5rem;
  -webkit-overflow-scrolling: touch;
}
.genre-minor-chip {
  padding: 0.25rem 0.7rem; border: 1px solid var(--border-color);
  border-radius: 50px; background: var(--card-bg); cursor: pointer;
  font-size: 0.75rem; color: var(--text-secondary);
  transition: var(--transition); white-space: nowrap; flex-shrink: 0;
}
.genre-minor-chip:hover { border-color: var(--primary-color); color: var(--primary-color); }
.genre-minor-chip.selected { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.genre-selected-summary { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.4rem; padding: 0.25rem 0; }
.genre-selected-area { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border-color); }
.genre-selected-label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; margin-bottom: 0.3rem; }
.genre-selected-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.genre-chip-selected { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.2rem 0.55rem; background: var(--primary-color); color: #fff; border-radius: 20px; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.genre-chip-selected:hover { background: var(--primary-hover); }
.genre-chip-x { font-size: 0.85rem; opacity: 0.75; margin-left: 0.1rem; line-height: 1; }
.genre-chip-selected:hover .genre-chip-x { opacity: 1; }
.genre-chip-clear { display: inline-flex; align-items: center; padding: 0.2rem 0.55rem; background: transparent; color: var(--text-secondary); border: 1px dashed var(--border-color); border-radius: 20px; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: var(--transition); }
.genre-chip-clear:hover { color: var(--danger-color); border-color: var(--danger-color); }

/* ===== 저작권 경고 모달 ===== */
.copyright-warning { text-align: center; margin-bottom: 1rem; }
.copyright-icon { font-size: 2.5rem; color: #f59e0b; margin-bottom: 0.5rem; }
.copyright-warning > p { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.75rem; }
.copyright-list { text-align: left; list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.copyright-list li { font-size: 0.85rem; color: var(--text-primary); padding-left: 1.2rem; position: relative; line-height: 1.5; }
.copyright-list li::before { content: '\2022'; position: absolute; left: 0; color: var(--text-secondary); }
.copyright-agree-label { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.75rem; background: var(--bg-color); border-radius: 8px; margin: 1rem 0; cursor: pointer; font-size: 0.85rem; line-height: 1.4; }
.copyright-agree-label input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; }
.copyright-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

/* 시스템 알림 오버레이 (접속 시간 / 점검 공지) */
.system-notify-overlay {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10000;
  cursor: pointer;
  animation: slideDown 0.3s;
}

.system-notify-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: var(--card-bg, #fff);
  padding: 0.75rem 1.5rem;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  border-bottom: 2px solid var(--primary-color, #6c5ce7);
}

.system-notify-icon { font-size: 1.4rem; flex-shrink: 0; }
.system-notify-text { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
.system-notify-sub { font-size: 0.85rem; color: var(--text-secondary); }
.system-notify-content .system-notify-sub { margin-left: 0.5rem; }

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* 확인 모달 (confirm 대체) */
.confirm-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  animation: fadeIn 0.2s;
}

.confirm-modal-box {
  background: var(--card-bg);
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: slideIn 0.2s;
}

.confirm-modal-header {
  padding: 1.25rem 1.5rem 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.confirm-modal-body {
  padding: 0.5rem 1.5rem 1.25rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-line;
}

.confirm-modal-actions {
  display: flex;
  gap: 0.75rem;
  padding: 0 1.5rem 1.25rem;
  justify-content: flex-end;
}

/* ===== 공유 탭 컴포넌트 ===== */
.page-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.page-tab {
  padding: 0.75rem 1.5rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.page-tab:hover {
  color: var(--primary-color);
}

.page-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

@media (max-width: 768px) {
  .page-tab { padding: 0.6rem 1rem; font-size: 0.9rem; }
}

@media (max-width: 480px) {
  .page-tab { padding: 0.6rem 1rem; font-size: 0.85rem; }
}

/* ===== 공유 페이지네이션 컴포넌트 ===== */
.pagination-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.pagination-bar button {
  min-width: 36px;
  height: 36px;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-color);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.pagination-bar button:hover:not(:disabled) {
  background: var(--bg-color);
  border-color: var(--primary-color);
}

.pagination-bar button.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.pagination-bar button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-bar .page-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0.5rem;
}

/* ===== 쿠키 동의 배너 ===== */
.cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
  padding: 1rem 1.5rem;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.cookie-consent-banner.cookie-consent-hide {
  transform: translateY(100%);
  opacity: 0;
}

.cookie-consent-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.cookie-consent-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.cookie-consent-text a {
  color: var(--primary-color);
  text-decoration: underline;
}

.cookie-consent-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ===== 푸터 링크 ===== */
.site-footer {
  text-align: center;
  padding: 1.5rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  margin: 0 0.5rem;
}

.site-footer a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

/* ===== 유틸리티 클래스 ===== */
.search-type-select { min-width: 120px; max-width: 140px; }
.text-nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.text-danger { color: var(--danger-color); }
.text-secondary { color: var(--text-secondary); }
.resize-vertical { resize: vertical; }
.mb-0 { margin-bottom: 0; }
.skeleton-chip { height: 32px; border-radius: 16px; display: inline-block; }
.refresh-row { display: flex; justify-content: flex-end; margin-bottom: 0.5rem; }
.btn-xs { padding: 0.2rem 0.6rem; font-size: 0.8rem; background: var(--card-bg); border: 1px solid var(--border-color); cursor: pointer; }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.85rem; }
.form-actions-end { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1rem; }

/* ===== 모바일 반응형 스타일 ===== */

/* 태블릿 (768px 이하) */
@media (max-width: 768px) {
  .header-content {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .logo {
    font-size: 1.2rem;
  }

  .nav {
    order: 3;
    width: 100%;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }

  .nav-link {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }

  /* iOS 자동 줌 방지: 16px 미만 input은 아이폰에서 자동 확대됨 */
  input, select, textarea {
    font-size: 16px !important;
  }

  .top-notice-link {
    white-space: normal;
  }

  .notification-dropdown {
    position: fixed;
    top: auto;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
  }

  .suggestion-btn {
    bottom: 1rem;
    right: 1rem;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }

  .modal-content {
    width: 95%;
    max-height: 85vh;
  }

}

/* 모바일 (480px 이하) */
@media (max-width: 480px) {
  .top-notice-link { font-size: 0.78rem; }
  .top-notice-badge { font-size: 0.65rem; padding: 1px 6px; }

  body {
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .container {
    padding: 0 12px;
  }
  .header .container {
    overflow: visible;
  }

  .header {
    padding: 0.75rem 0;
  }

  .header-content {
    gap: 0.75rem;
  }

  .logo {
    font-size: 1.1rem;
  }

  .user-section {
    gap: 0.5rem;
  }

  .user-avatar {
    width: 32px;
    height: 32px;
  }

  .user-details {
    display: none;
  }

  .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }

  .nav {
    gap: 0.25rem;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
  }

  .suggestion-btn {
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    right: 0.75rem;
    padding: 0.6rem 0.85rem;
    font-size: 0.8rem;
  }

  .modal-content {
    width: 100%;
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    max-height: 100dvh;
    border-radius: 0;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-header h2 {
    font-size: 1.2rem;
  }

  .modal-body {
    padding: 1rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  }

  .social-login-buttons {
    gap: 0.75rem;
  }

  .btn-social {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
  }

}

/* 쿠키 동의 배너 반응형 */
@media (max-width: 768px) {
  .cookie-consent-inner {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }

  .cookie-consent-text {
    font-size: 0.85rem;
  }
}

/* 햄버거 메뉴 (추후 필요 시) */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-primary);
}

@media (max-width: 480px) {
  .menu-toggle {
    display: block;
  }

  .notification-dropdown {
    position: fixed;
    top: auto;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
  }
}

/* 헤더 설정 드롭다운 */
.header-settings-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 0.4rem;
  background: var(--card-bg); border: 1px solid var(--border-color);
  border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 0.6rem 0.8rem; width: 200px; z-index: 1000;
}

/* ===== 해시태그 자동완성 드롭다운 (공통) ===== */
.tag-ac-dropdown {
  position: absolute;
  left: 0; right: 0; top: 100%;
  z-index: 200;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  display: none;
}
.tag-ac-dropdown.active { display: block; }
.tag-ac-dropdown .tag-ac-row {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
}
.tag-ac-dropdown .tag-ac-row:hover { background: var(--hover-bg); }
.tag-ac-dropdown .tag-ac-row.selected {
  background: rgba(128,128,128,0.2);
}
.tag-ac-dropdown .tag-ac-row .tag-ac-cnt {
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.tag-ac-dropdown .tag-ac-header {
  padding: 0.35rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* AdSense: 자동 광고 사용 — 관리자 토글은 server.js에서 스크립트 삽입 제어 */

/* 사이트 푸터 */
.site-footer {
  padding: 2.5rem 1rem 6rem;
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}
.site-footer .footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.site-footer .discord-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  background: #5865f2;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s;
}
.site-footer .discord-cta:hover { background: #4752c4; }
.site-footer .discord-cta svg { flex-shrink: 0; }
.site-footer .footer-link {
  color: var(--text-secondary);
  text-decoration: none;
}
.site-footer .footer-link:hover { color: var(--text-primary); text-decoration: underline; }
.site-footer .footer-meta { font-size: 0.8rem; opacity: 0.8; }
