/* 청담 - 웹 채팅 플랫폼 메인 스타일시트 */

/* ===== CSS Variables ===== */
:root {
    /* Colors */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #ec4899;
    --accent-color: #06b6d4;

    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;

    --bg-dark: #f8f9fa;
    --bg-darker: #ffffff;
    --bg-card: rgba(0, 0, 0, 0.03);
    --bg-glass: rgba(255, 255, 255, 0.9);

    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5a;
    --text-muted: #71717a;

    --border-color: rgba(0, 0, 0, 0.1);
    --border-light: rgba(0, 0, 0, 0.15);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    --gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #6366f1 100%);
    --gradient-dark: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Z-index */
    --z-dropdown: 100;
    --z-modal: 1000;
    --z-toast: 1100;
    --z-loading: 2000;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gradient-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* 채팅 페이지에서는 스크롤 방지 */
body.chat-active {
    overflow: hidden;
    height: 100vh;
    height: 100dvh; /* 모바일 동적 뷰포트 */
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-color);
}

/* ===== Utility Classes ===== */
.hidden {
    display: none !important;
}

.glass-effect {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Loading Screen ===== */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-loading);
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

#loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-container {
    text-align: center;
}

.loading-logo {
    max-width: 120px;
    height: auto;
    margin-bottom: var(--spacing-md);
}

.loading-subtext {
    color: #666;
    font-size: 0.9rem;
}

/* ===== Particles Background ===== */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

/* ===== App Container ===== */
#app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    z-index: 50;
    border-bottom: 1px solid var(--border-color);
    background: #ffffff;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    padding: 0 var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-container {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 24px;
    width: auto;
    object-fit: contain;
}

.main-nav {
    display: flex;
    gap: var(--spacing-sm);
}

.nav-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.nav-btn svg {
    width: 20px;
    height: 20px;
}

.user-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

#auth-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

#user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

#user-nickname {
    font-weight: 500;
    color: var(--text-primary);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-outline {
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-outline:hover:not(:disabled) {
    background: #f0f0f5;
    border-color: var(--primary-color);
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
}

.btn-icon:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1rem;
}

.btn-full {
    width: 100%;
}

.btn-3d {
    transform-style: preserve-3d;
    transition: all var(--transition-base);
}

.btn-3d:hover:not(:disabled) {
    transform: translateY(-2px) rotateX(5deg);
}

.pulse-glow {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.6); }
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-top: 64px;
}

.section-page {
    min-height: calc(100vh - 64px);
}

/* ===== Landing Section ===== */
#landing-section {
    padding: var(--spacing-2xl);
}

.landing-hero {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-2xl);
    align-items: center;
    min-height: calc(100vh - 200px);
}

.hero-content {
    z-index: 1;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-lg);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
}

.hero-buttons {
    display: flex;
    gap: var(--spacing-md);
}

.hero-visual {
    position: relative;
    height: 400px;
    perspective: 1000px;
}

.floating-cards {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.card-3d {
    position: absolute;
    padding: var(--spacing-lg);
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    animation: float 6s ease-in-out infinite;
}

.card-1 {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.card-2 {
    top: 40%;
    right: 10%;
    animation-delay: -2s;
}

.card-3 {
    bottom: 10%;
    left: 30%;
    animation-delay: -4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotateX(5deg) rotateY(-5deg); }
    50% { transform: translateY(-20px) rotateX(-5deg) rotateY(5deg); }
}

.chat-bubble {
    background: var(--gradient-primary);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-lg);
    color: white;
    font-weight: 500;
}

/* Features Section */
.features-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-2xl) 0;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: var(--spacing-2xl);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
}

.feature-card {
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: all var(--transition-base);
}

.card-3d-hover {
    transform-style: preserve-3d;
    transition: transform var(--transition-base);
}

.card-3d-hover:hover {
    transform: translateY(-10px) rotateX(5deg);
}

.feature-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto var(--spacing-md);
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-icon svg {
    width: 30px;
    height: 30px;
    color: white;
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-sm);
}

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

/* ===== Chat Section ===== */
#chat-section {
    height: calc(100vh - 64px);
    height: calc(100dvh - 64px); /* 모바일 동적 뷰포트 */
    overflow: hidden;
}

.chat-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* Server Sidebar */
.server-sidebar {
    width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-sm);
    gap: var(--spacing-sm);
    border-right: 1px solid var(--border-color);
    background: #f0f0f5;
}

.server-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    flex: 1;
    overflow-y: auto;
}

.server-list-banner {
    width: 48px;
    padding: 4px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    overflow: hidden;
}

.server-list-banner img {
    width: 48px !important;
    max-width: 48px !important;
    height: auto !important;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.server-item {
    width: 48px;
    height: 48px;
    background: #ffffff;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border: 2px solid transparent;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.server-lock-icon {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 0.6rem;
    background: #fff;
    border-radius: 50%;
    padding: 1px;
    line-height: 1;
}

/* 멘션 인디케이터 (읽지 않은 멘션) */
.mention-indicator {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    animation: mention-pulse 1.5s ease-in-out infinite;
}

@keyframes mention-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.server-item:hover {
    background: #e8e8f0;
    color: var(--text-primary);
    border-radius: var(--radius-md);
}

.server-item.active {
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-md);
}

.server-item.main-server {
    background: var(--gradient-secondary);
    color: white;
}

.server-profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

.server-item.active .server-profile-img,
.server-item:hover .server-profile-img {
    border-radius: var(--radius-md);
}

/* 서버 목록 구분선 (채팅방/링크 사이) */
.server-list-divider {
    width: 36px;
    height: 0;
    border-top: 2px dashed var(--border-color);
    margin: 8px auto;
}

/* 제휴 구분선 (텍스트 포함) */
.server-list-divider.affiliate-divider {
    width: 36px;
    height: auto;
    border-top: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 10px auto 6px;
}

.server-list-divider .divider-text {
    font-size: 9px;
    color: var(--text-secondary);
    white-space: nowrap;
    letter-spacing: -0.5px;
}

/* 링크 아이템 */
.server-item.link-item,
.server-item.affiliate-item {
    position: relative;
}

.server-item .link-icon,
.server-item .affiliate-icon {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 10px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    padding: 1px;
    line-height: 1;
}

/* 링크 액션 메뉴 */
.link-action-menu {
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 1000;
    min-width: 80px;
}

.link-action-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.link-action-item:hover {
    background: var(--bg-secondary);
}

.link-action-item.link-action-delete {
    color: #ef4444;
}

.link-action-item.link-action-delete:hover {
    background: #fef2f2;
}

/* 모바일 서버 목록 구분선 */
.mobile-server-list-divider {
    width: 100%;
    height: 0;
    border-top: 2px dashed var(--border-color);
    margin: 12px 0;
}

/* 모바일 제휴 구분선 (텍스트 포함) */
.mobile-server-list-divider.affiliate-divider {
    height: auto;
    border-top: none;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0 8px;
}

.mobile-server-list-divider .divider-text {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.btn-add-server {
    width: 48px;
    height: 48px;
    border: 2px dashed var(--border-light);
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    margin-top: auto;
}

.btn-add-server:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

/* Chat Main */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #ffffff;
    overflow: hidden;
}

.chat-header {
    height: 42px;
    min-height: 42px;
    padding: 0 var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: #ffffff;
    flex-shrink: 0;
    overflow: visible;
}

/* 채팅 헤더 내 버튼 - CSS 툴팁 비활성화 (JavaScript 동적 툴팁 사용) */
.chat-header [data-tooltip]::after {
    display: none;
}

/* 동적 툴팁 (body에 직접 렌더링) */
.dynamic-tooltip {
    position: fixed;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: #333;
    color: #ffffff;
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 99999;
    transform: translateX(-50%);
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.dynamic-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.chat-room-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.chat-room-info h2 {
    font-size: 1rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(99, 102, 241, 0.2);
}

.online-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chat-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

/* 채팅 헤더 사용자 프로필 */
.chat-user-profile {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding-right: var(--spacing-md);
    border-right: 1px solid var(--border-color);
    margin-right: var(--spacing-sm);
}

.chat-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chat-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-user-avatar span {
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

.chat-user-nickname {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.chat-user-nickname:hover {
    text-decoration: underline;
}

.chat-user-avatar {
    cursor: pointer;
}

.chat-user-avatar:hover {
    opacity: 0.85;
}

/* 채팅 모드에서 상단 헤더 숨기기 */
body.chat-mode .main-header {
    display: none !important;
}

body.chat-mode .main-content {
    margin-top: 0 !important;
}

body.chat-mode #chat-section {
    height: 100vh !important;
}

/* Chat Messages */
.chat-messages-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: var(--spacing-md);
    padding-bottom: var(--spacing-xs);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    background: #f8f9fa;
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation; /* 더블탭 줌 방지, 스크롤/핀치줌 허용 */
    overscroll-behavior: contain;
    /* Safari 성능 최적화 */
    will-change: scroll-position;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* PC/모바일 모두 메시지는 위에서 아래로 쌓임, scrollToBottom()으로 스크롤 위치 관리 */

/* 새 메시지 알림 팝업 */
.new-message-popup {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    z-index: 10;
    transition: all var(--transition-fast);
    animation: popupSlideUp 0.3s ease-out;
}

.new-message-popup:hover {
    background: var(--primary-dark);
    transform: translateX(-50%) scale(1.05);
}

.new-message-popup.hidden {
    display: none;
}

.new-message-arrow {
    font-size: 1rem;
    animation: bounceDown 1s infinite;
}

@keyframes popupSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

.welcome-message {
    text-align: center;
    padding: var(--spacing-xl);
    color: #666;
}

.message {
    display: flex;
    align-items: flex-start; /* 기본: 상단 정렬 */
    gap: var(--spacing-sm);
    padding: 0 var(--spacing-sm);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    max-width: 100%;
    /* 복사 시 한 줄 유지 */
    white-space: nowrap;
}

/* 이모티콘이 포함된 메시지: 세로 중앙 정렬 */
.message.has-emoticon {
    align-items: center;
}

.message:hover {
    background: #eef0f5;
}

.message:hover .message-relative-time,
.message:active .message-relative-time {
    opacity: 1;
}

.message-relative-time {
    font-size: calc(var(--chat-font-size, 14px) * 0.75);
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.15s ease;
    margin-left: auto;
    padding-left: 8px;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.message-avatar {
    /* 폰트 크기에 연동: 기본 14px -> 24px, 비율 약 1.7배 */
    width: calc(var(--chat-font-size, 14px) * 1.7);
    height: calc(var(--chat-font-size, 14px) * 1.7);
    min-width: 20px;
    min-height: 20px;
    max-width: 36px;
    max-height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: calc(var(--chat-font-size, 14px) * 0.5);
    flex-shrink: 0;
    overflow: hidden;
    color: #fff;
}

.message-avatar.has-image {
    background: transparent;
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.message-content {
    flex: 1;
    min-width: 0;
    line-height: 1.4;
    white-space: normal; /* 메시지 내용은 줄바꿈 허용 */
}

.message-author {
    font-weight: 600;
    color: #000000;
    cursor: pointer;
    display: inline;
    font-size: var(--chat-font-size, 14px);
}

.message-author:hover {
    text-decoration: underline;
}

.message-separator {
    color: var(--text-secondary);
    margin: 0 2px;
    display: inline;
    font-size: var(--chat-font-size, 14px);
}

.message-badge {
    /* 폰트 크기에 연동: 기본 14px * 0.5 = 7px */
    font-size: calc(var(--chat-font-size, 14px) * 0.5);
    padding: 1px 4px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    vertical-align: middle;
    position: relative;
    top: -1px;
    display: inline;
    margin-left: 6px;
    margin-right: 4px;
}

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

.badge-sub-admin {
    background: var(--warning-color);
    color: #000;
}

/* 채널별 관리자 뱃지 */
.badge-server-admin {
    background: #e74c3c;
    color: white;
}

.badge-server-sub-admin {
    background: #f39c12;
    color: #000;
}

/* 반짝임 애니메이션 - 금색 효과 */
@keyframes sparkle {
    0%, 100% {
        box-shadow: 0 0 3px #ffd700, 0 0 6px #ffd700;
    }
    50% {
        box-shadow: 0 0 8px #ffd700, 0 0 15px #ffd700, 0 0 20px #ffaa00;
    }
}

.badge-sparkle {
    animation: sparkle 2s ease-in-out infinite;
    border: 1px solid #ffd700;
}

.message-text {
    word-break: break-word;
    line-height: 1.4;
    color: #000000; /* 기본 채팅 색상: 검정색 */
    cursor: default;
    font-size: var(--chat-font-size, 14px);
    display: inline;
    white-space: pre-wrap; /* 메시지 내용은 줄바꿈 허용 */
}

.chat-link {
    color: var(--primary-color);
    text-decoration: underline;
}

.chat-link:hover {
    color: var(--primary-dark);
}

.message-whisper {
    background: rgba(236, 72, 153, 0.1);
    border-left: 3px solid var(--secondary-color);
}

.message-whisper .message-text {
    color: var(--secondary-color);
    font-style: italic;
}

.message-mention {
    background: rgba(99, 102, 241, 0.1);
}

/* 멘션 자동완성 팝업 */
.mention-popup {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 99999 !important;
    margin-bottom: 8px;
}

.mention-popup.hidden {
    display: none;
}

.mention-popup-header {
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.mention-popup-list {
    max-height: 160px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
    overscroll-behavior: contain;
}

.mention-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    background: transparent;
}

.mention-item:hover {
    background: #f0f0f5;
}

.mention-item.selected {
    background: #e8e8f0;
}

.mention-item-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    margin-right: 10px;
    flex-shrink: 0;
    overflow: hidden;
}

.mention-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mention-item-info {
    flex: 1;
    min-width: 0;
}

.mention-item-nickname {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 명령어 자동완성 팝업 */
.command-popup {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 280px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 99999 !important;
    margin-bottom: 8px;
}

.command-popup.hidden {
    display: none;
}

.command-popup-header {
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.command-popup-list {
    max-height: 240px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
    overscroll-behavior: contain;
}

.command-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

.command-item:hover {
    background: #f0f0f5;
}

.command-item.selected {
    background: #e8e8f0;
}

.command-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    min-width: 110px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.command-admin-badge {
    font-size: 0.65rem;
    font-weight: 500;
    color: #e53935;
    background: rgba(229, 57, 53, 0.1);
    padding: 2px 5px;
    border-radius: 3px;
}

.command-item-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 전송 중 메시지 (낙관적 업데이트) */
.message-pending {
    opacity: 0.7;
}

.message-pending .message-text {
    color: var(--text-secondary);
}

.message-system {
    justify-content: center;
    background: transparent;
}

.message-system .message-text,
.message-system .system-text {
    color: #888;
    font-size: 0.85rem;
    text-align: center;
}

/* 공지사항 스타일 */
.message-notice {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border: 1px solid #ffc107;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    margin: var(--spacing-sm) 0;
}

.message-notice .notice-content {
    color: #856404;
    font-weight: 500;
    font-size: 0.9rem;
    text-align: center;
    white-space: pre-wrap;
    word-break: break-word;
}

.mention-highlight {
    background: rgba(99, 102, 241, 0.3);
    padding: 0 4px;
    border-radius: var(--radius-sm);
    color: var(--primary-light);
}

/* Chat Input */
.chat-input-container {
    padding: var(--spacing-xs) var(--spacing-md);
    border-top: 1px solid var(--border-color);
    background: #ffffff;
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 4px; /* 간격 최소화 */
    position: relative;
}

/* 스타일 옵션 토글 버튼 (+/-) */
.btn-style-toggle {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    font-size: 1.2rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-style-toggle:hover {
    background: #f0f0f5;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-style-toggle.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.chat-input {
    flex: 1;
    padding: var(--spacing-sm);
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition-fast);
    min-height: 36px;
    max-height: 36px;
    resize: none;
}

.chat-input:focus {
    border-color: var(--primary-color);
}

.btn-send {
    width: 36px;
    height: 36px;
    padding: 0;
}

.btn-send svg {
    width: 18px;
    height: 18px;
}

.chat-input-info {
    display: none;
}

#mute-status {
    color: var(--danger-color);
}

/* Members Panel */
.members-panel {
    width: 240px;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.panel-header {
    height: 56px;
    padding: 0 var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 1rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-close-panel {
    width: 32px;
    height: 32px;
}

.members-list {
    flex: 1;
    padding: var(--spacing-md);
    overflow-y: auto;
}

.member-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 4px var(--spacing-xs);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    overflow: hidden;
}

/* 서버 구분선 (메인 서버에서 전체 서버 멤버 표시용) */
.member-server-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 4px 4px;
    margin-top: 4px;
}

.member-server-divider:first-child {
    margin-top: 0;
    padding-top: 4px;
}

.member-server-divider span {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.member-item:hover {
    background: #f0f0f5;
}

.member-avatar {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    position: relative;
}

.member-status {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: var(--success-color);
    border: 2px solid #ffffff;
    border-radius: var(--radius-full);
}

.member-status.offline {
    background: var(--text-muted);
}

/* 모바일 디바이스 아이콘 */
.member-device {
    position: absolute;
    bottom: -2px;
    right: -2px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    width: auto !important;
    height: auto !important;
}

.member-device.mobile {
    color: #4ade80;
}

.member-device svg {
    width: 12px;
    height: 12px;
}

.member-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 3px;
    overflow: hidden;
}

.member-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.member-name.muted {
    text-decoration: line-through;
    color: var(--text-muted);
}

.member-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.member-badge {
    font-size: 0.5rem;
    padding: 1px 3px;
    border-radius: 2px;
    margin-left: 2px;
    vertical-align: middle;
    font-weight: 600;
    flex-shrink: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
}

/* 멤버 목록 M/S 뱃지 스타일 */
.member-badge.badge-admin {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.member-badge.badge-sub-admin {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.member-badge.badge-server-admin {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.member-badge.badge-server-sub-admin {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
}

/* ===== Modals ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: var(--spacing-lg);
    animation: fadeIn var(--transition-fast);
}

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

.modal {
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius-xl);
    position: relative;
    animation: modalSlideIn var(--transition-base);
    background: #ffffff;
    box-shadow: var(--shadow-lg);
}

.modal-lg {
    max-width: 600px;
}

.modal-sm {
    max-width: 320px;
}

.modal-3d {
    transform-style: preserve-3d;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) rotateX(-5deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

.modal-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

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

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-content {
    padding: var(--spacing-xl);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    text-align: center;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-footer {
    margin-top: var(--spacing-lg);
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* 유저 정보 모달 - 반응형 디자인 */
#modal-userinfo .modal {
    max-width: 700px;
    width: 95%;
}

@media (max-width: 768px) {
    #modal-userinfo .modal {
        max-width: 100%;
        width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
        height: 100%;
        position: relative;
    }

    #modal-userinfo .modal-close {
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 1001;
        background: rgba(255, 255, 255, 0.9);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        pointer-events: auto;
        touch-action: manipulation;
        cursor: pointer;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }

    #modal-userinfo .modal-content {
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        padding-top: 50px;
    }
}

#modal-userinfo .modal-title {
    font-size: 1rem;
    margin-bottom: var(--spacing-sm);
}

.userinfo-content {
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-start;
}

.userinfo-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
}

.userinfo-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.userinfo-details {
    flex: 1;
    min-width: 0;
}

.userinfo-details .form-group {
    margin-bottom: var(--spacing-sm);
}

.userinfo-details .form-group label {
    font-size: 0.75rem;
    margin-bottom: 2px;
    color: var(--text-secondary);
}

.userinfo-details .form-group input,
.userinfo-details .form-group .form-control {
    padding: 6px 10px;
    font-size: 0.85rem;
    height: auto;
}

.userinfo-details .input-with-btn {
    gap: 4px;
}

.userinfo-details .input-with-btn .btn {
    padding: 5px 10px;
    font-size: 0.75rem;
}

.userinfo-details .admin-section {
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
    margin-top: var(--spacing-sm);
}

/* 칭호 입력 컴팩트 레이아웃 */
.userinfo-details .title-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.userinfo-details .title-row .form-control {
    flex: 1;
    min-width: 60px;
}

.userinfo-details .color-picker {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

.userinfo-details .sparkle-chk {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.userinfo-details .sparkle-chk input {
    width: auto;
    margin: 0;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.7rem;
}

/* 칭호 미리보기 */
#userinfo-title-preview {
    margin-left: 6px;
    vertical-align: middle;
}

#userinfo-title-preview:empty {
    display: none;
}

.input-with-btn {
    display: flex;
    gap: var(--spacing-sm);
}

.input-with-btn .form-control {
    flex: 1;
}

.input-with-btn .btn {
    white-space: nowrap;
}

.modal-actions {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-lg) var(--spacing-xl);
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-hint a {
    color: var(--primary-light);
}

.form-error {
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    border-radius: var(--radius-md);
    color: var(--danger-color);
    font-size: 0.85rem;
}

/* 서버 타입 선택기 */
.server-type-selector {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.server-type-selector .type-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: #f8f9fa;
}

.server-type-selector .type-option:hover {
    border-color: var(--primary-light);
    background: #fff;
}

.server-type-selector .type-option input[type="radio"] {
    width: auto;
    margin: 0;
    accent-color: var(--primary-color);
}

.server-type-selector .type-option:has(input:checked) {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.server-type-selector .type-label {
    font-weight: 500;
    color: var(--text-primary);
}

/* 링크 이미지 업로드 */
.link-image-upload {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-sm);
}

.link-image-preview {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    background: #f0f0f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.link-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.link-image-preview span {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    margin-top: var(--spacing-lg);
}

.login-options {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
    font-size: 0.85rem;
}

.login-options .checkbox-label {
    color: var(--text-secondary);
}

.login-options .checkbox-label input[type="checkbox"] {
    width: auto;
    margin-right: 4px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

/* ===== Settings ===== */
.settings-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-md);
}

.tab-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    background: #f0f0f5;
    color: var(--text-primary);
}

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

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
}

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

.setting-info h4 {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
}

.setting-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.nickname-change-info {
    font-size: 0.75rem;
    margin-top: 4px;
}

.setting-input {
    width: 150px;
    padding: var(--spacing-sm);
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
}

.setting-color {
    width: 50px;
    height: 36px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: transparent;
}

.setting-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 100px;
}

.setting-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Setting Divider */
.setting-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--spacing-md) 0;
}

/* Password Change Section */
.password-change-form {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-top: var(--spacing-sm);
}

.password-change-form .form-group {
    margin-bottom: var(--spacing-sm);
}

.password-change-form .form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.password-change-form .form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.9rem;
}

.password-change-btns {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.password-change-error {
    color: var(--danger-color);
    font-size: 0.8rem;
    margin-top: var(--spacing-sm);
    margin-bottom: 0;
}

.password-change-success {
    color: var(--success-color);
    font-size: 0.8rem;
    margin-top: var(--spacing-sm);
    margin-bottom: 0;
}

/* Font Size Controls */
.font-size-setting {
    border-bottom: none !important;
    padding-bottom: 0 !important;
}

.font-size-controls {
    padding: var(--spacing-sm) 0 var(--spacing-md);
}

.font-size-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.font-size-row:last-child {
    margin-bottom: 0;
}

.font-size-label {
    width: 60px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.font-size-slider-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex: 1;
}

.font-size-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e0e0e5;
    border-radius: 3px;
    outline: none;
}

.font-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.font-size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.font-size-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.font-size-value {
    width: 40px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #e0e0e5;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* Admin Section */
.admin-section {
    margin-bottom: var(--spacing-lg);
}

.admin-section h3 {
    font-size: 1rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
}

/* 관리 탭 아코디언 */
.admin-accordion {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    overflow: hidden;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-card);
    cursor: pointer;
    font-weight: 500;
    user-select: none;
    transition: background 0.2s;
}

.accordion-header:hover {
    background: var(--bg-hover);
}

.accordion-arrow {
    width: 18px;
    height: 18px;
    transition: transform 0.2s;
    color: var(--text-secondary);
}

.admin-accordion.open .accordion-arrow {
    transform: rotate(180deg);
}

.accordion-content {
    display: none;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.admin-accordion.open .accordion-content {
    display: block;
}

.accordion-content .setting-item {
    padding: var(--spacing-xs) 0;
    border-bottom: none;
}

.accordion-content .setting-item:last-child {
    padding-bottom: 0;
}

.admin-user-list {
    max-height: 200px;
    overflow-y: auto;
}

/* 칭호 관리 */
.title-form {
    background: var(--bg-card);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
}

.title-form .form-row {
    display: flex;
    gap: var(--spacing-md);
}

.title-form .form-row .form-group {
    flex: 1;
}

.title-form .form-group {
    margin-bottom: var(--spacing-sm);
}

.title-form .form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.title-form input[type="color"] {
    width: 100%;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.title-preview {
    padding: var(--spacing-sm);
    background: #fff;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.title-form .form-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.title-list {
    max-height: 150px;
    overflow-y: auto;
}

.title-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-xs);
}

.title-item-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.title-item-name {
    font-weight: 500;
}

.title-edit-btn {
    padding: 2px 8px;
    font-size: 0.75rem;
}

.title-item:hover {
    background: var(--bg-secondary);
}

/* ===== Context Menu ===== */
.context-menu {
    position: fixed;
    background: #ffffff;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    min-width: 160px;
    z-index: 3000; /* members-panel(2000)보다 높게 */
    box-shadow: var(--shadow-lg);
}

.context-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.context-item:hover {
    background: #f0f0f5;
}

.context-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.context-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--spacing-sm) 0;
}

/* Mute Options */
.mute-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.mute-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.9rem;
}

.mute-custom-section {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.mute-custom-input {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.mute-custom-input input {
    flex: 1;
    padding: var(--spacing-sm);
}

.mute-btn-permanent {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    padding: var(--spacing-md) var(--spacing-lg);
    background: #ffffff;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    box-shadow: var(--shadow-md);
    animation: toastSlideIn var(--transition-base);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

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

.toast.toast-out {
    animation: toastSlideOut var(--transition-base);
}

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

.toast-success { border-left: 3px solid var(--success-color); }
.toast-error { border-left: 3px solid var(--danger-color); }
.toast-warning { border-left: 3px solid var(--warning-color); }
.toast-info { border-left: 3px solid var(--info-color); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f0f0f5;
}

::-webkit-scrollbar-thumb {
    background: #c0c0c5;
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a0a5;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .landing-hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-visual {
        display: none;
    }

    .hero-buttons {
        justify-content: center;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .members-panel {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 10;
        background: #ffffff;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 var(--spacing-md);
    }

    /* 헤더 버튼 모바일 최적화 */
    #auth-buttons {
        display: flex;
        flex-direction: row;
        gap: var(--spacing-xs);
    }

    #auth-buttons .btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.85rem;
        min-height: 40px;
    }

    /* 시작하기 버튼 크게 */
    .hero-buttons {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: center;
    }

    .hero-buttons .btn {
        width: 100%;
        max-width: 300px;
        padding: var(--spacing-lg) var(--spacing-xl);
        font-size: 1.1rem;
        min-height: 56px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

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

    .server-sidebar {
        width: 60px;
    }

    .server-item {
        width: 40px;
        height: 40px;
    }

    .btn-add-server {
        width: 40px;
        height: 40px;
    }

    .chat-header {
        padding: 0 var(--spacing-md);
    }

    .chat-messages {
        padding: var(--spacing-md);
    }

    .chat-input-container {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .modal {
        margin: var(--spacing-md);
    }

    .modal-content {
        padding: var(--spacing-lg);
    }

    /* 사용자 정보 영역 */
    #user-info {
        gap: var(--spacing-sm);
    }

    #user-nickname {
        display: none;
    }

    .nav-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    /* 시작하기 버튼 더 크게 */
    .hero-buttons .btn {
        padding: var(--spacing-lg) var(--spacing-xl);
        font-size: 1.2rem;
        min-height: 60px;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .settings-tabs {
        flex-wrap: wrap;
    }

    .mute-options {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 헤더 버튼 더 최적화 */
    #auth-buttons .btn {
        padding: var(--spacing-sm) var(--spacing-sm);
        font-size: 0.8rem;
        min-height: 44px;
        border-radius: var(--radius-lg);
    }

    /* 로고 크기 조정 */
    .logo-text {
        font-size: 1.4rem;
    }
}

/* ===== Tooltip ===== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: #333;
    color: #ffffff;
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    pointer-events: none;
    z-index: 9999;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    top: calc(100% + 5px);
}

/* 서버 아이템 툴팁은 JavaScript 동적 툴팁 사용 (overflow 문제 해결) */
.server-item[data-tooltip]::after {
    display: none;
}

/* ===== 채팅 스타일 바 ===== */
.chat-style-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 4px var(--spacing-sm);
    border-bottom: none;
    background: #f8f9fa;
    border-radius: var(--radius-sm);
    margin-right: var(--spacing-xs);
}

.chat-style-bar.hidden {
    display: none;
}

/* 굵기 토글 버튼 (B) */
.chat-style-bar .style-btn-bold {
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: Georgia, serif;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chat-style-bar .style-btn-bold:hover {
    background: #f0f0f5;
    border-color: var(--primary-color);
}

.chat-style-bar .style-btn-bold.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.chat-style-bar .style-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.chat-style-bar .style-item label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.chat-style-bar .style-select {
    padding: 2px 6px;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
}

.chat-style-bar .style-color {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* ===== Profile Image Upload ===== */
.profile-image-setting {
    flex-direction: column;
    gap: var(--spacing-md);
}

.profile-image-upload {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.profile-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    border: 3px solid var(--border-color);
}

.profile-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-upload-btns {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.85rem;
}

/* ===== Records List (기보 목록) ===== */
.records-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.record-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
}

.record-item:hover {
    background: var(--bg-glass);
    transform: translateX(4px);
}

.record-item-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.record-item-players {
    font-weight: 600;
    color: var(--text-primary);
}

.record-item-meta {
    display: flex;
    gap: var(--spacing-md);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.record-item-winner {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--success-color);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
}

.record-item-winner.pending {
    background: var(--warning-color);
}

/* ===== Record Detail (기보 상세) ===== */
.record-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.record-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.record-players {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.record-winner {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--success-color);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.record-winner-actions {
    margin-top: var(--spacing-md);
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
}

.record-chat-log {
    max-height: 350px;
    overflow-y: auto;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.record-message {
    display: flex;
    gap: var(--spacing-sm);
    font-size: 0.9rem;
}

.record-message-time {
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.record-message-author {
    font-weight: 600;
    flex-shrink: 0;
}

.record-message-text {
    word-break: break-word;
}

/* ===== Rankings List (전적 랭킹) ===== */
.rankings-list {
    max-height: 450px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.ranking-position {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.ranking-position.gold {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #fff;
}

.ranking-position.silver {
    background: linear-gradient(135deg, #C0C0C0, #A9A9A9);
    color: #fff;
}

.ranking-position.bronze {
    background: linear-gradient(135deg, #CD7F32, #8B4513);
    color: #fff;
}

.ranking-position.normal {
    background: var(--bg-glass);
    color: var(--text-secondary);
}

.ranking-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    flex-shrink: 0;
}

.ranking-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ranking-info {
    flex: 1;
    min-width: 0;
}

.ranking-nickname {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-stats {
    display: flex;
    gap: var(--spacing-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ranking-stat {
    display: flex;
    gap: var(--spacing-xs);
}

.ranking-stat.wins {
    color: var(--success-color);
}

.ranking-stat.losses {
    color: var(--danger-color);
}

.ranking-winrate {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-md);
    flex-wrap: wrap;
}

.pagination .btn {
    min-width: 36px;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.9rem;
}

.pagination .btn.active {
    background: var(--primary-color);
    color: #fff;
}

/* ===== Loading Text ===== */
.loading-text {
    text-align: center;
    color: var(--text-muted);
    padding: var(--spacing-xl);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: var(--spacing-xl);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    opacity: 0.5;
    margin-bottom: var(--spacing-md);
}

/* ===== Auth Code Section (회원가입/찾기 인증) ===== */
.auth-code-section {
    text-align: center;
    padding: var(--spacing-lg) 0;
}

.auth-instruction {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
}

.auth-link {
    color: var(--primary) !important;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-link:hover {
    color: var(--primary-light) !important;
    text-decoration: underline;
    opacity: 0.8;
}

.auth-code-display {
    margin: var(--spacing-lg) 0;
}

.auth-code-display .code-text {
    font-family: 'Courier New', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--primary-color);
    background: var(--bg-card);
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-lg);
    display: inline-block;
    border: 2px dashed var(--primary-light);
    user-select: all;
}

.auth-timer {
    margin: var(--spacing-md) 0;
    color: var(--warning-color);
    font-size: 1.1rem;
    font-weight: 600;
}

.auth-timer.expired {
    color: var(--danger-color);
}

#auth-timer-text,
#find-timer-text {
    font-family: monospace;
    font-size: 1.2rem;
}

.auth-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin: var(--spacing-md) 0;
    color: var(--text-secondary);
}

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

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

.auth-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: var(--spacing-md);
}

.auth-hint strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Auth Verified Badge */
.auth-verified-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success-color);
    border-radius: var(--radius-md);
    color: var(--success-color);
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
}

.auth-verified-badge svg {
    width: 24px;
    height: 24px;
}

/* Find Account Tabs */
.find-type-tabs {
    display: flex;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-sm);
}

.find-type-tabs .tab-btn {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.find-type-tabs .tab-btn:hover {
    color: var(--primary-color);
}

.find-type-tabs .tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Find Result Box */
.find-result-box {
    text-align: center;
    padding: var(--spacing-lg);
}

.find-result-box p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.masked-id {
    font-family: monospace;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    padding: var(--spacing-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    letter-spacing: 0.1em;
}

.revealed-id {
    font-family: monospace;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--success-color);
    padding: var(--spacing-lg);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success-color);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-md);
}

/* Already Registered Alert */
.already-registered-alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    text-align: center;
}

.already-registered-alert p {
    color: var(--danger-color);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.already-registered-alert .existing-id {
    font-family: monospace;
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-top: var(--spacing-sm);
}

/* ===== 전체화면 모달 ===== */
.modal-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.fullscreen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.fullscreen-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: white;
}

.fullscreen-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-close-fullscreen {
    padding: 5px 10px;
    font-size: 0.8rem;
    background: rgba(255,255,255,0.2) !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    color: white !important;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.btn-close-fullscreen svg {
    width: 14px;
    height: 14px;
}

.btn-close-fullscreen:hover {
    background: rgba(255,255,255,0.3) !important;
}

.fullscreen-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
}

/* 검색 박스 */
.records-search-box {
    display: flex;
    gap: 6px;
}

.search-input-lg {
    width: 180px;
    padding: 5px 10px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 0.8rem;
}

.search-input-lg::placeholder {
    color: rgba(255,255,255,0.7);
}

.search-input-lg:focus {
    outline: none;
    border-color: white;
    background: rgba(255,255,255,0.25);
}

.records-search-box .btn {
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* 유저 배너 */
.records-user-header {
    margin-bottom: var(--spacing-md);
}

.records-user-banner {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.user-avatar-xl {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    overflow: hidden;
}

.user-avatar-xl img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-profile-info h3 {
    margin: 0 0 var(--spacing-xs) 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-stats-row {
    display: flex;
    gap: var(--spacing-sm);
}

.stat-box {
    text-align: center;
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.stat-box .stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
}

.stat-box .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-box.wins .stat-value { color: var(--success-color); }
.stat-box.losses .stat-value { color: var(--danger-color); }
.stat-box.winrate .stat-value { color: var(--primary-color); }

.user-banner-actions {
    margin-left: auto;
    display: flex;
    gap: var(--spacing-xs);
}

/* 기보 테이블 */
.records-table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.records-table {
    width: 100%;
    border-collapse: collapse;
}

.records-table thead {
    background: #f1f5f9;
}

.records-table th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid #e2e8f0;
}

.records-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    font-size: 0.8rem;
    color: #334155;
}

.records-table tbody tr:last-child td {
    border-bottom: none;
}

.records-table .record-row {
    cursor: pointer;
    transition: background 0.1s ease;
}

.records-table .record-row:hover {
    background: #f8fafc;
}

.col-id { width: 45px; font-weight: 600; color: #6366f1; }
.col-players { width: auto; }
.col-result { width: 100px; }
.col-server { width: 90px; color: #64748b; font-size: 0.75rem; }
.col-date { width: 120px; color: #94a3b8; font-size: 0.75rem; }
.col-action { width: 60px; text-align: center; }

/* 플레이어 셀 */
.players-cell {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.player-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.player-info:hover {
    background: rgba(99, 102, 241, 0.1);
}

.player-info.winner {
    background: rgba(16, 185, 129, 0.15);
}

.player-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
    overflow: hidden;
}

.player-avatar-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-name {
    font-weight: 600;
    font-size: 1rem;
}

.vs-badge {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-tertiary);
    padding: 4px 8px;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
}

/* 결과 배지 */
.result-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
}

.result-badge.win {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
}

.result-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
}

.result-badge.draw {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

.result-badge.friendly {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

/* 랭크전/친선전 탭 */
.records-tabs {
    display: flex;
    gap: 3px;
    margin-bottom: 12px;
    padding: 3px;
    background: #e2e8f0;
    border-radius: 6px;
    width: fit-content;
}

.records-tab-btn {
    padding: 5px 12px;
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.records-tab-btn:hover {
    color: #334155;
    background: white;
}

.records-tab-btn.active {
    background: #6366f1;
    color: white;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}

/* 배틀 타입 배지 */
.col-type { width: 70px; text-align: center; }

.battle-type-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
}

.battle-type-badge.type-ranked {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.battle-type-badge.type-friendly {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.battle-type-badge.type-tournament {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

/* 페이지네이션 */
.pagination-lg {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xl);
    padding: var(--spacing-lg);
}

.pagination-info {
    margin-right: var(--spacing-lg);
    color: var(--text-secondary);
    font-weight: 500;
}

.pagination-ellipsis {
    padding: var(--spacing-sm);
    color: var(--text-secondary);
}

/* 기보 상세 - 대전 정보 */
.record-detail-layout {
    max-width: 100%;
    margin: 0 auto;
}

.record-match-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xl);
    padding: var(--spacing-xl);
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: var(--spacing-lg);
}

.match-vs {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-tertiary);
}

.match-player-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 150px;
}

.match-player-card:hover {
    background: rgba(99, 102, 241, 0.1);
}

.match-player-card.winner {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--success-color);
}

.match-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

.match-name {
    font-size: 1.2rem;
    font-weight: 700;
}

.match-winner-badge {
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--success-color);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
}

.record-meta {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.meta-item {
    padding: var(--spacing-sm) var(--spacing-md);
    background: white;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.meta-item.winner {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    font-weight: 600;
}

.meta-item.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.meta-item.draw {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
    font-weight: 600;
}

/* 채팅 로그 */
.record-chat-container {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
}

.record-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 8px;
}

.record-chat-container h3 {
    margin: 0;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.record-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.record-chat-mode-tabs {
    display: flex;
    gap: 4px;
    background: #e5e7eb;
    border-radius: var(--radius-md);
    padding: 3px;
}

#btn-copy-record-chat {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 0.8rem;
}

#btn-copy-record-chat svg {
    flex-shrink: 0;
}

.record-chat-mode-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.record-chat-mode-btn:hover {
    color: var(--text-primary);
}

.record-chat-mode-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 일반 모드: 아바타 숨김 */
.record-chat-log[data-mode="simple"] .record-message-avatar,
.record-chat-log[data-mode="simple"] .record-message-avatar-img {
    display: none;
}

.record-chat-log {
    max-height: 60vh;
    overflow-y: auto;
    padding: var(--spacing-sm);
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* 기보 메시지 (채팅방과 동일한 한 줄 스타일) */
.record-message {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-xs);
    padding: 2px var(--spacing-sm);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.record-message:hover {
    background: #eef0f5;
}

.record-message-avatar {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.7rem;
    flex-shrink: 0;
    background: var(--gradient-primary);
    align-self: center;
}

.record-message-avatar.has-image {
    background: transparent;
}

.record-message-avatar-img {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    object-fit: cover;
}

.record-message-author {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    flex-shrink: 0;
}

.record-message-badge {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    flex-shrink: 0;
}

.record-message-badge.badge-admin {
    background: var(--gradient-primary);
    color: white;
}

.record-message-badge.badge-sub-admin {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.record-message-badge.custom-title {
    font-weight: 500;
}

.record-message-badge.badge-sparkle {
    animation: sparkle 2s ease-in-out infinite;
    border: 1px solid #ffd700;
}

.record-message-colon {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.record-message-text {
    word-break: break-word;
    line-height: 1.5;
    font-size: 0.9rem;
}

/* 기보 댓글 섹션 */
.record-comments-container {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.record-comments-container h3 {
    margin: 0 0 var(--spacing-md) 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.comment-count {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* 댓글 입력 폼 */
.comment-form {
    margin-bottom: var(--spacing-lg);
}

.comment-input-wrapper {
    display: flex;
    gap: var(--spacing-sm);
    align-items: flex-start;
}

.comment-input {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    resize: none;
    font-family: inherit;
    font-size: 0.95rem;
    min-height: 60px;
    background: var(--surface-color);
    transition: border-color var(--transition-fast);
}

.comment-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-comment-submit {
    padding: var(--spacing-sm) var(--spacing-lg);
    height: fit-content;
}

.comment-reply-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--primary-color);
}

.btn-cancel-reply {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 8px;
    font-size: 0.8rem;
}

.btn-cancel-reply:hover {
    color: var(--danger-color);
}

/* 댓글 목록 */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.comment-item {
    padding: var(--spacing-md);
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.comment-item.reply {
    margin-left: var(--spacing-xl);
    background: rgba(99, 102, 241, 0.03);
    border-left: 3px solid var(--primary-color);
}

.comment-main {
    display: flex;
    gap: var(--spacing-sm);
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
    background: var(--gradient-primary);
}

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

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.comment-author {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-content {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
    word-break: break-word;
    white-space: pre-wrap;
}

.comment-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xs);
}

.btn-comment-reply,
.btn-comment-delete {
    background: none;
    border: none;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-comment-reply {
    color: var(--primary-color);
}

.btn-comment-reply:hover {
    background: rgba(99, 102, 241, 0.1);
}

.btn-comment-delete {
    color: var(--text-muted);
}

.btn-comment-delete:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.comment-replies {
    margin-top: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.comment-replies .comment-item {
    margin-left: 0;
}

/* 댓글 반응형 */
@media (max-width: 768px) {
    .comment-item.reply {
        margin-left: var(--spacing-md);
    }

    .comment-input-wrapper {
        flex-direction: column;
    }

    .btn-comment-submit {
        width: 100%;
    }
}

/* 랭킹 그리드 */
.rankings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: all 0.15s ease;
}

.ranking-item:hover {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.ranking-position {
    font-size: 1rem;
    font-weight: 700;
    min-width: 28px;
    text-align: center;
    color: #64748b;
}

.ranking-position.gold { color: #f59e0b; }
.ranking-position.silver { color: #9ca3af; }
.ranking-position.bronze { color: #d97706; }

.ranking-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    overflow: hidden;
}

.ranking-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ranking-info {
    flex: 1;
    min-width: 0;
}

.ranking-nickname {
    font-weight: 600;
    font-size: 0.85rem;
    color: #334155;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-stats {
    display: flex;
    gap: 6px;
    font-size: 0.75rem;
}

.ranking-stat.wins { color: #10b981; }
.ranking-stat.losses { color: #ef4444; }

.ranking-winrate {
    font-size: 0.9rem;
    font-weight: 700;
    color: #6366f1;
}

/* 유저 상세 전적 */
.user-stats-container {
    max-width: 900px;
    margin: 0 auto;
}

.user-stats-profile {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    padding: var(--spacing-xl);
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: var(--spacing-xl);
}

.profile-avatar-xl {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.profile-avatar-xl img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-main h2 {
    margin: 0 0 var(--spacing-md) 0;
    font-size: 1.8rem;
}

.profile-stats-grid {
    display: flex;
    gap: var(--spacing-lg);
}

.profile-stat {
    text-align: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    background: #f8fafc;
    border-radius: var(--radius-lg);
}

.profile-stat .stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
}

.profile-stat .stat-number.wins { color: var(--success-color); }
.profile-stat .stat-number.losses { color: var(--danger-color); }
.profile-stat .stat-number.winrate { color: var(--primary-color); }

.profile-stat .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.streak-badge {
    display: inline-block;
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-lg);
    font-weight: 700;
}

.streak-badge.win {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.streak-badge.loss {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.user-stats-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: var(--spacing-xl);
}

.user-stats-section h3 {
    margin: 0 0 var(--spacing-lg) 0;
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid #f1f5f9;
}

/* 상대 전적 그리드 */
.opponents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.opponent-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: #f8fafc;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.opponent-card:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.opponent-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    overflow: hidden;
}

.opponent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.opponent-info {
    flex: 1;
}

.opponent-name {
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
}

.opponent-record {
    font-size: 0.85rem;
}

.opponent-record .wins { color: var(--success-color); }
.opponent-record .losses { color: var(--danger-color); }
.opponent-record .total { color: var(--text-tertiary); }

.opponent-winrate {
    font-size: 0.9rem;
    font-weight: 700;
}

.opponent-winrate.positive { color: var(--success-color); }
.opponent-winrate.negative { color: var(--danger-color); }

/* 최근 경기 */
.recent-games-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.recent-game-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: #f8fafc;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-left: 4px solid transparent;
}

.recent-game-item:hover {
    background: #f1f5f9;
}

.recent-game-item.win {
    border-left-color: var(--success-color);
}

.recent-game-item.loss {
    border-left-color: var(--danger-color);
}

.game-result {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.game-result.win {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.game-result.loss {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.game-result.pending {
    background: #e2e8f0;
    color: var(--text-tertiary);
}

.game-opponent {
    flex: 1;
    font-weight: 500;
}

.game-server, .game-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== 모바일 접속자 패널 개선 ===== */
@media (max-width: 1024px) {
    /* 멤버 패널이 열렸을 때 채팅 영역 축소 */
    .chat-main {
        transition: margin-right 0.2s ease-out;
    }

    .chat-main.members-open {
        margin-right: 180px !important;
    }

    .members-panel {
        position: fixed !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        left: auto !important;
        width: 180px !important;
        max-width: 60vw !important;
        z-index: 1001 !important; /* 헤더/입력창보다 높게 */
        background: #ffffff !important;
        border-left: 1px solid var(--border-color) !important;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15) !important;
        animation: slideInRight 0.2s ease-out;
    }

    .members-panel.hidden {
        display: none !important;
    }

    /* PC와 동일한 헤더 스타일 */
    .members-panel .panel-header {
        height: 50px !important;
        padding: 0 var(--spacing-md) !important;
        background: #ffffff !important;
        border-bottom: 1px solid var(--border-color) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .members-panel .panel-header h3 {
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        background: var(--gradient-primary) !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        background-clip: text !important;
    }

    .members-panel .btn-close-panel {
        width: 32px !important;
        height: 32px !important;
        background: transparent !important;
        border-radius: var(--radius-sm) !important;
        color: var(--text-secondary) !important;
    }

    .members-panel .btn-close-panel:hover {
        background: #f0f0f5 !important;
    }

    /* PC와 동일한 멤버 리스트 스타일 */
    .members-panel .members-list {
        padding: var(--spacing-sm) !important;
        height: calc(100% - 50px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* PC와 동일한 멤버 아이템 스타일 - 간격 좁게 */
    .members-panel .member-item {
        display: flex !important;
        align-items: center !important;
        gap: var(--spacing-xs) !important;
        padding: 4px var(--spacing-xs) !important;
        margin-bottom: 0 !important;
        background: transparent !important;
        border-radius: var(--radius-sm) !important;
        cursor: pointer !important;
    }

    .members-panel .member-item:active {
        background: #f0f0f5 !important;
    }

    .members-panel .member-avatar {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.7rem !important;
    }

    .members-panel .member-name {
        font-size: 0.85rem !important;
    }

    .members-panel .member-badge {
        font-size: 0.6rem !important;
        padding: 1px 4px !important;
    }

    /* 전체화면 모달 모바일 */
    .modal-fullscreen {
        z-index: 1001; /* 모달 오버레이보다 높게 */
    }

    .fullscreen-header {
        flex-direction: column;
        gap: var(--spacing-md);
        padding: var(--spacing-md);
        padding-top: max(var(--spacing-md), env(safe-area-inset-top));
    }

    .fullscreen-header-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
    }

    .records-search-box {
        width: 100%;
    }

    .search-input-lg {
        width: 100%;
        flex: 1;
    }

    .fullscreen-content {
        padding: var(--spacing-md);
    }

    .records-table th,
    .records-table td {
        padding: var(--spacing-sm);
        font-size: 0.85rem;
    }

    .records-table .col-server, .records-table .col-date {
        display: none;
    }

    .records-user-banner {
        flex-direction: column;
        text-align: center;
    }

    .user-banner-actions {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }

    .user-stats-row {
        justify-content: center;
    }

    .user-stats-profile {
        flex-direction: column;
        text-align: center;
    }

    .profile-stats-grid {
        justify-content: center;
        flex-wrap: wrap;
    }
}

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

/* ===== 모바일 채팅 인터페이스 최적화 ===== */

/* 모바일 기기 감지 */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari 전용 */
    body {
        -webkit-overflow-scrolling: touch;
    }
}

/* 모바일에서 채팅 섹션 전체 레이아웃 */
@media (max-width: 768px) {
    /* 기본 설정 */
    html, body {
        height: 100%;
        height: 100dvh;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    #app-container {
        height: 100%;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    /* 헤더 */
    .main-header {
        height: 52px;
        flex-shrink: 0;
        position: relative;
        z-index: 100;
    }

    .main-content {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        margin-top: 0; /* 데스크탑 margin-top 무시 */
    }

    /* 채팅 섹션 */
    #chat-section {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    .chat-layout {
        flex: 1;
        display: flex;
        flex-direction: row;
        min-height: 0;
        overflow: hidden;
    }

    /* 서버 사이드바 모바일 */
    .server-sidebar {
        width: 52px;
        padding: var(--spacing-xs);
        flex-shrink: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .server-item {
        width: 36px;
        height: 36px;
        font-size: 0.75rem;
    }

    .btn-add-server {
        width: 36px;
        height: 36px;
    }

    /* 채팅 메인 영역 - 핵심 */
    .chat-main {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    /* 채팅 헤더 */
    .chat-header {
        height: 48px;
        min-height: 48px;
        flex-shrink: 0;
        padding: 0 var(--spacing-sm);
    }

    .chat-room-info h2 {
        font-size: 0.95rem;
    }

    .online-count {
        font-size: 0.7rem;
    }

    .chat-actions {
        gap: 2px;
    }

    /* 채팅 헤더 사용자 프로필 - 모바일 */
    .chat-user-profile {
        padding-right: var(--spacing-sm);
        margin-right: var(--spacing-xs);
    }

    .chat-user-avatar {
        width: 26px;
        height: 26px;
    }

    .chat-user-avatar span {
        font-size: 0.75rem;
    }

    .chat-user-nickname {
        display: none; /* 모바일에서 닉네임 숨기기 */
    }

    .chat-actions .btn-icon {
        width: 32px;
        height: 32px;
    }

    .chat-actions .btn-icon svg {
        width: 16px;
        height: 16px;
    }

    /* 채팅 메시지 영역 - 스크롤 가능한 핵심 영역 */
    .chat-messages {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: var(--spacing-sm);
        overscroll-behavior: contain;
    }

    /* 메시지 스타일 모바일 최적화 */
    .message {
        padding: var(--spacing-xs) var(--spacing-sm);
        gap: var(--spacing-xs);
        align-items: flex-start; /* 아바타를 상단에 정렬 */
    }

    /* 모바일: 이모티콘이 포함된 메시지는 세로 중앙 정렬 */
    .message.has-emoticon {
        align-items: center;
    }

    .message-avatar {
        /* 폰트 크기에 연동 */
        width: calc(var(--chat-font-size, 14px) * 1.5);
        height: calc(var(--chat-font-size, 14px) * 1.5);
        min-width: 18px;
        min-height: 18px;
        max-width: 32px;
        max-height: 32px;
        font-size: calc(var(--chat-font-size, 14px) * 0.5);
        margin-top: 2px; /* 닉네임과 수직 정렬 */
    }

    .message-author {
        font-size: var(--chat-font-size, 0.85rem);
    }

    .message-text {
        font-size: var(--chat-font-size, 0.9rem);
        line-height: 1.4;
    }

    .message-badge {
        font-size: calc(var(--chat-font-size, 0.85rem) * 0.7);
        padding: 1px 4px;
    }

    /* 채팅 입력 영역 - 하단 */
    .chat-input-container {
        flex-shrink: 0;
        padding: var(--spacing-sm);
        padding-bottom: calc(var(--spacing-sm) + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid var(--border-color);
        background: #ffffff;
        /* 키보드 위에 자연스럽게 위치 */
        position: relative;
        z-index: 10;
    }

    .chat-input-wrapper {
        gap: var(--spacing-xs);
        display: flex;
        align-items: center;
    }

    .chat-input {
        flex: 1;
        padding: 0 var(--spacing-md);
        font-size: max(16px, var(--chat-font-size, 16px)) !important; /* iOS zoom 방지 + 폰트 크기 연동 */
        border-radius: var(--radius-full);
        min-height: 42px;
        height: 42px;
        max-height: 42px;
        line-height: 42px;
        resize: none;
        border: 1px solid var(--border-color);
        outline: none;
    }

    .chat-input:focus {
        border-color: var(--primary-color);
    }

    .btn-send {
        width: 42px;
        height: 42px;
        min-width: 42px;
        border-radius: var(--radius-full);
    }

    .btn-send svg {
        width: 18px;
        height: 18px;
    }

    .chat-input-info {
        display: none; /* 모바일에서 글자수 카운터 숨김 */
    }

    /* 환영 메시지 */
    .welcome-message {
        padding: var(--spacing-md);
    }

    .welcome-message p {
        font-size: 0.9rem;
    }
}


/* 아주 작은 화면 (SE 등) */
@media (max-width: 375px) {
    .server-sidebar {
        width: 44px;
    }

    .server-item {
        width: 32px;
        height: 32px;
        font-size: 0.7rem;
    }

    .btn-add-server {
        width: 32px;
        height: 32px;
    }

    .chat-header {
        height: 44px;
        min-height: 44px;
    }

    .chat-room-info h2 {
        font-size: 0.85rem;
    }

    .chat-actions .btn-icon {
        width: 28px;
        height: 28px;
    }

    .message-avatar {
        /* 폰트 크기에 연동 */
        width: calc(var(--chat-font-size, 14px) * 1.5);
        height: calc(var(--chat-font-size, 14px) * 1.5);
        min-width: 18px;
        min-height: 18px;
        max-width: 28px;
        max-height: 28px;
        font-size: calc(var(--chat-font-size, 14px) * 0.5);
    }

    .message-author {
        font-size: var(--chat-font-size, 0.8rem);
    }

    .message-text {
        font-size: var(--chat-font-size, 0.85rem);
    }

    .chat-input {
        min-height: 38px;
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: max(16px, var(--chat-font-size, 16px));
    }

    .btn-send {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }

    /* 아주 작은 화면 공지사항 스타일 */
    .announcement-message {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        padding: 0.375rem !important;
        margin: 0.375rem auto !important;
    }
}

/* 가로 모드 모바일 */
@media (max-height: 500px) and (orientation: landscape) {
    .main-header {
        height: 40px;
    }

    .main-content {
        margin-top: 40px;
    }

    #chat-section {
        height: calc(100% - 40px);
    }

    .chat-header {
        height: 36px;
        min-height: 36px;
    }

    .chat-messages {
        padding: var(--spacing-xs);
        touch-action: manipulation; /* 더블탭 줌 방지 */
        overscroll-behavior: contain;
    }

    .message {
        padding: 4px;
        touch-action: manipulation; /* 메시지에서도 더블탭 줌 방지 */
    }

    /* 모바일: 이모티콘이 포함된 메시지는 세로 중앙 정렬 */
    .message.has-emoticon {
        align-items: center;
    }

    .message-avatar {
        /* 폰트 크기에 연동 */
        width: calc(var(--chat-font-size, 14px) * 1.3);
        height: calc(var(--chat-font-size, 14px) * 1.3);
        min-width: 16px;
        min-height: 16px;
        max-width: 24px;
        max-height: 24px;
    }

    .chat-input-container {
        padding: var(--spacing-xs);
    }

    .chat-input {
        min-height: 32px;
        padding: 6px 12px;
        font-size: max(16px, var(--chat-font-size, 16px));
    }

    .btn-send {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    /* 가로 모드 공지사항 스타일 */
    .announcement-message {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        padding: 0.5rem !important;
        margin: 0.5rem auto !important;
    }
}

/* 태블릿 세로 모드 */
@media (min-width: 768px) and (max-width: 1024px) {
    .server-sidebar {
        width: 60px;
    }

    .chat-input {
        font-size: max(16px, var(--chat-font-size, 16px)); /* iPad에서도 zoom 방지 + 폰트 크기 연동 */
    }

    /* 멤버 패널이 열렸을 때 채팅 영역 축소 */
    .chat-main {
        transition: margin-right 0.2s ease-out;
    }

    .chat-main.members-open {
        margin-right: 200px !important;
    }

    /* 태블릿 멤버 패널 - 모바일과 동일하게 */
    .members-panel {
        position: fixed !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        left: auto !important;
        width: 200px !important;
        max-width: 70vw !important;
        z-index: 100 !important;
        background: #ffffff !important;
        border-left: 1px solid var(--border-color) !important;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15) !important;
        animation: slideInRight 0.2s ease-out;
    }

    .members-panel.hidden {
        display: none !important;
    }

    .members-panel .panel-header {
        height: 50px !important;
        padding: 0 var(--spacing-md) !important;
        background: #ffffff !important;
        border-bottom: 1px solid var(--border-color) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .members-panel .panel-header h3 {
        font-size: 1rem !important;
        font-weight: 700 !important;
        background: var(--gradient-primary) !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        background-clip: text !important;
    }

    .members-panel .btn-close-panel {
        width: 32px !important;
        height: 32px !important;
        background: transparent !important;
        border-radius: var(--radius-sm) !important;
        color: var(--text-secondary) !important;
    }

    .members-panel .btn-close-panel:hover {
        background: #f0f0f5 !important;
    }

    .members-panel .members-list {
        padding: var(--spacing-sm) !important;
        height: calc(100% - 50px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .members-panel .member-item {
        display: flex !important;
        align-items: center !important;
        gap: var(--spacing-xs) !important;
        padding: 4px var(--spacing-xs) !important;
        margin-bottom: 0 !important;
        background: transparent !important;
        border-radius: var(--radius-sm) !important;
        cursor: pointer !important;
    }

    .members-panel .member-item:active,
    .members-panel .member-item:hover {
        background: #f0f0f5 !important;
    }

    .members-panel .member-avatar {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.7rem !important;
    }

    .members-panel .member-name {
        font-size: 0.85rem !important;
    }

    .members-panel .member-badge {
        font-size: 0.6rem !important;
        padding: 1px 4px !important;
    }
}

/* 모바일 터치 피드백 */
@media (hover: none) and (pointer: coarse) {
    .message:hover {
        background: transparent;
    }

    .message:active {
        background: #eef0f5;
    }

    .server-item:hover {
        background: #ffffff;
    }

    .server-item:active {
        background: #e8e8f0;
    }

    .btn:active {
        transform: scale(0.98);
    }

    /* 터치 가능 영역 확대 */
    .message-author {
        padding: 4px 0;
    }
}

/* ===== 광장 시스템 ===== */

/* 모달 xl 사이즈 */
.modal-xl {
    max-width: 1280px;
    width: 98%;
}

/* 광장 모달 */
.plaza-modal-content {
    padding: 0;
}

.plaza-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-sm) var(--spacing-md);
    gap: var(--spacing-sm);
}

.plaza-tabs .tab-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    background: none;
    cursor: pointer;
    border-radius: var(--radius-md);
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.plaza-tabs .tab-btn:hover {
    background: var(--bg-card);
}

.plaza-tabs .tab-btn.active {
    background: var(--gradient-primary);
    color: white;
}

.plaza-tab-panel {
    display: none;
    padding: var(--spacing-md);
}

.plaza-tab-panel.active {
    display: block;
}

/* 광장 컨테이너 */
.plaza-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

#plaza-canvas {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    max-width: 100%;
    height: auto;
    background: #90c96e;
}

.plaza-chat-input {
    display: flex;
    gap: var(--spacing-sm);
    width: 100%;
    max-width: 600px;
}

.plaza-chat-input input {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 14px;
    outline: none;
}

.plaza-chat-input input:focus {
    border-color: var(--primary-color);
}

/* 채팅 모드 활성화 스타일 */
.plaza-chat-input.chat-active {
    background: rgba(99, 102, 241, 0.1);
    padding: var(--spacing-sm);
    border-radius: var(--radius-lg);
    border: 2px solid var(--primary-color);
    animation: pulse-border 1s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: var(--primary-color); }
    50% { border-color: var(--primary-light); }
}

.plaza-chat-input.chat-active input {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.plaza-controls {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* 아바타 에디터 */
.avatar-editor {
    display: flex;
    gap: var(--spacing-xl);
    flex-wrap: wrap;
}

.avatar-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    min-width: 150px;
}

#avatar-preview {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #f0f0f0;
}

.avatar-options {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    min-width: 300px;
}

.avatar-option-group {
    background: var(--bg-card);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
}

.avatar-option-group h4 {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.option-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
}

.avatar-option {
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all var(--transition-fast);
}

.avatar-option:hover {
    border-color: var(--primary-color);
}

.avatar-option.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

/* 피부색 및 색상 옵션 */
.skin-option,
.hair-color-option,
.top-color-option,
.bottom-color-option {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.2);
}

.skin-option.selected,
.hair-color-option.selected,
.top-color-option.selected,
.bottom-color-option.selected {
    box-shadow: 0 0 0 3px var(--primary-color);
    background: inherit !important;
}

/* 스크롤 가능한 옵션 버튼 */
.option-buttons.scrollable {
    max-height: 120px;
    overflow-y: auto;
    flex-wrap: wrap;
    padding: var(--spacing-xs);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

/* 이미지 그리드 (상의/하의 미리보기) */
.option-buttons.image-grid {
    max-height: 200px;
    gap: var(--spacing-sm);
}

.avatar-option.image-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-xs);
    min-width: 80px;
    background: var(--bg-card);
}

.avatar-option.image-btn img {
    border-radius: var(--radius-sm);
    background: #eee;
}

.avatar-option.image-btn span {
    font-size: 0.7rem;
    margin-top: 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
}

.avatar-option.image-btn.selected {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

/* 아바타 탭 네비게이션 */
.avatar-tabs {
    display: flex;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
}

.avatar-tab {
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.avatar-tab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.avatar-tab.active {
    background: var(--gradient-primary);
    color: white;
}

.avatar-tab-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* 색상 버튼 스타일 */
.color-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.color-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.2);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.color-btn:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
}

.color-btn.selected {
    box-shadow: 0 0 0 3px var(--primary-color);
    transform: scale(1.1);
}

.color-picker {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.color-picker input[type="color"] {
    width: 40px;
    height: 30px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px;
}

/* 모바일 광장 */
@media (max-width: 768px) {
    .modal-xl {
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        margin: 0;
    }

    .plaza-container {
        padding: var(--spacing-sm);
    }

    #plaza-canvas {
        max-width: 100%;
        max-height: 60vh;
        height: auto;
    }

    .avatar-editor {
        flex-direction: column;
    }

    .avatar-preview-container {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
    }

    .avatar-options {
        min-width: 100%;
    }

    .option-buttons {
        justify-content: center;
    }
}

/* ===== 모바일 UI 개선 ===== */
@media (max-width: 768px) {
    /* 모바일에서 상단 메인 헤더 숨기기 */
    .main-header {
        display: none !important;
    }

    .main-content {
        margin-top: 0 !important;
        padding: 0 !important;
    }

    /* 전체 채팅 섹션 */
    #chat-section {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
    }

    .chat-layout {
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    /* 서버 사이드바 숨기기 */
    .server-sidebar {
        display: none !important;
    }

    /* 채팅 메인 영역 */
    .chat-main {
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    /* 채팅 헤더 - 화면 상단 고정 */
    .chat-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 50px !important;
        min-height: 50px !important;
        padding: 8px !important;
        background: #ffffff !important;
        border-bottom: 1px solid var(--border-color) !important;
        z-index: 1000 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        box-sizing: border-box !important;
    }

    /* 입력창 - 화면 하단 고정 */
    .chat-input-container {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        padding: 4px 8px !important;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
        background: #ffffff !important;
        border-top: 1px solid var(--border-color) !important;
        z-index: 1000 !important;
        box-sizing: border-box !important;
        overflow: visible !important; /* 멘션 팝업이 보이도록 */
    }

    /* 모바일 멘션 팝업 - 최상위에 표시 */
    .mention-popup {
        position: fixed !important;
        bottom: 60px !important;
        left: 8px !important;
        right: 8px !important;
        z-index: 99999 !important;
        max-height: 200px !important;
        overflow: hidden !important;
        flex-direction: column !important;
        background: #ffffff !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important;
    }

    /* 모바일에서도 hidden 클래스 적용 */
    .mention-popup.hidden {
        display: none !important;
    }

    .mention-popup:not(.hidden) {
        display: flex !important;
    }

    .mention-popup-header {
        flex: 0 0 auto !important;
        padding: 8px 12px !important;
    }

    .mention-popup-list {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        max-height: 150px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }

    .mention-item {
        min-height: 44px !important;
    }

    /* 모바일 명령어 팝업 - 최상위에 표시 */
    .command-popup {
        position: fixed !important;
        bottom: 60px !important;
        left: 8px !important;
        right: 8px !important;
        z-index: 99999 !important;
        max-height: 280px !important;
        overflow: hidden !important;
        flex-direction: column !important;
        background: #ffffff !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important;
    }

    .command-popup.hidden {
        display: none !important;
    }

    .command-popup:not(.hidden) {
        display: flex !important;
    }

    .command-popup-header {
        flex: 0 0 auto !important;
        padding: 8px 12px !important;
    }

    .command-popup-list {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        max-height: 220px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }

    .command-item {
        min-height: 44px !important;
        padding: 10px 12px !important;
    }

    .command-item-name {
        min-width: 80px !important;
        font-size: 0.85rem !important;
    }

    .command-item-desc {
        font-size: 0.75rem !important;
        flex: 1 !important;
    }

    .command-admin-badge {
        font-size: 0.6rem !important;
        padding: 1px 4px !important;
    }

    /* 메시지 영역 - 헤더와 입력창 사이 공간 */
    .chat-messages-wrapper {
        position: fixed !important;
        top: 50px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 56px !important; /* 입력창(36px) + 토글버튼(8px) + 패딩(12px) */
        overflow: hidden !important;
        background: #f8f9fa !important;
    }

    .chat-messages {
        width: 100% !important;
        height: 100% !important;
        padding: 4px !important;
        padding-bottom: 0 !important;
        gap: 0 !important;
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important; /* 기본: 위에서부터 쌓임 (PC와 동일) */
        touch-action: manipulation !important; /* 더블탭 줌 방지 */
        overscroll-behavior: contain !important;
    }

    /* 모바일 전용: JS에서 mobile-layout 클래스 추가 시 아래에서부터 쌓임 */
    .chat-messages.mobile-layout {
        flex-direction: column-reverse !important;
    }

    /* column-reverse로 인해 뒤집힌 메시지 순서를 wrapper로 다시 정상화 */
    .chat-messages.mobile-layout .messages-inner-wrapper {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    /* 모바일에서 접속자 패널 열렸을 때 채팅 영역 축소 */
    .chat-main.members-open .chat-messages-wrapper {
        right: 120px !important;
    }

    .chat-main.members-open .chat-header {
        right: 120px !important;
    }

    /* 접속자 패널 열렸을 때 서버이름/온라인 텍스트만 숨김 */
    .chat-main.members-open .chat-room-info {
        display: none !important;
    }

    .chat-main.members-open .chat-input-container {
        right: 120px !important;
    }

    /* 모바일 접속자 패널 컴팩트 스타일 */
    .members-panel {
        width: 120px !important;
    }

    .members-panel .panel-header {
        padding: 6px 8px !important;
    }

    .members-panel .panel-header h3 {
        font-size: 0.7rem !important;
    }

    .members-panel .panel-header .btn-icon {
        width: 20px !important;
        height: 20px !important;
    }

    .members-panel .member-item {
        padding: 4px 6px !important;
        gap: 4px !important;
    }

    .members-panel .member-avatar {
        width: 20px !important;
        height: 20px !important;
        min-width: 20px !important;
        font-size: 0.55rem !important;
    }

    .members-panel .member-avatar img {
        width: 20px !important;
        height: 20px !important;
    }

    .members-panel .member-info {
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .members-panel .member-name {
        font-size: 0.65rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .members-panel .member-badges {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 2px !important;
    }

    .members-panel .member-badge {
        font-size: 0.5rem !important;
        padding: 0 3px !important;
        max-width: 50px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .members-panel .role-badge {
        font-size: 0.5rem !important;
        padding: 0 3px !important;
    }

    /* 모바일에서 스타일 토글 버튼 */
    .btn-style-toggle {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        font-size: 1rem !important;
        flex-shrink: 0;
    }

    /* 모바일에서 스타일바 (컴팩트하게) */
    .chat-style-bar {
        display: flex;
        padding: 2px 6px !important;
        gap: 6px !important;
        border-bottom: none !important;
        flex-shrink: 0 !important;
        overflow: hidden !important;
        max-width: calc(100% - 90px) !important; /* 토글버튼 + 입력창 + 전송버튼 여유 */
    }

    /* hidden 클래스가 있으면 숨김 (토글 작동) */
    .chat-style-bar.hidden {
        display: none !important;
    }

    .chat-style-bar .style-btn-bold {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.75rem !important;
    }

    .chat-style-bar .style-item {
        gap: 4px !important;
    }

    .chat-style-bar .style-item label {
        font-size: 0.65rem !important;
    }

    .chat-style-bar .style-color {
        width: 20px !important;
        height: 20px !important;
    }

    .chat-style-bar .style-select {
        padding: 2px 4px !important;
        font-size: 0.65rem !important;
    }

    .chat-input-info {
        display: none !important;
    }

    /* 입력창 래퍼 */
    .chat-input-wrapper {
        display: flex !important;
        gap: 6px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: visible !important; /* 멘션 팝업이 보이도록 */
    }

    .chat-input {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        min-height: 36px !important;
        height: 36px !important;
        max-height: 36px !important;
        line-height: 36px !important;
        font-size: max(16px, var(--chat-font-size, 16px)) !important;
        padding: 0 10px !important;
        box-sizing: border-box !important;
    }

    .btn-send {
        flex: 0 0 36px !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
    }

    .message {
        padding: 1px 4px !important;
        gap: 4px !important;
        margin: 0 !important;
        align-items: flex-start !important;
    }

    /* 모바일: 이모티콘이 포함된 메시지는 세로 중앙 정렬 */
    .message.has-emoticon {
        align-items: center !important;
    }

    .message-avatar {
        /* 폰트 크기에 연동 */
        width: calc(var(--chat-font-size, 14px) * 1.3) !important;
        height: calc(var(--chat-font-size, 14px) * 1.3) !important;
        min-width: 16px !important;
        min-height: 16px !important;
        max-width: 24px !important;
        max-height: 24px !important;
        font-size: calc(var(--chat-font-size, 14px) * 0.45) !important;
        margin-top: 2px !important;
    }

    .message-content {
        font-size: var(--chat-font-size, 0.85rem) !important;
        gap: 2px !important;
    }

    .message-author {
        font-size: var(--chat-font-size, 0.8rem) !important;
    }

    .message-text {
        font-size: var(--chat-font-size, 0.85rem) !important;
        line-height: 1.2 !important;
    }

    .message-time {
        font-size: calc(var(--chat-font-size, 0.85rem) * 0.7) !important;
    }

    .message-badge {
        font-size: calc(var(--chat-font-size, 0.85rem) * 0.6) !important;
        padding: 1px 2px !important;
    }

    /* 시스템 메시지 */
    .system-message {
        padding: 2px 8px !important;
        font-size: var(--chat-font-size, 0.75rem) !important;
        margin: 1px 0 !important;
    }

    /* 공지사항 메시지 - .message 스타일 완전 덮어쓰기 */
    .announcement-message {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0.5rem !important;
        margin: 0.5rem auto !important;
        gap: 0.375rem !important;
        max-width: 95% !important;
        width: fit-content !important;
    }

    /* 헤더 내 채팅방 선택 버튼 표시 */
    .btn-mobile-servers {
        display: flex !important;
    }

    /* 채팅 입력 높이 조정 */
    .chat-input {
        min-height: 32px !important;
        height: 32px !important;
        max-height: 32px !important;
        line-height: 32px !important;
        font-size: max(16px, var(--chat-font-size, 16px)) !important; /* iOS 확대 방지 + 폰트 크기 연동 */
        padding: 0 10px !important;
    }
}

/* 모바일 채팅방 선택 버튼 (헤더 내) */
.btn-mobile-servers {
    display: none;
}

/* 모바일 키보드 열렸을 때 대응 */
@media (max-width: 768px) {
    /* visualViewport API로 JS에서 처리할 클래스 */
    .keyboard-open #chat-section {
        /* JS에서 동적으로 높이 조정 */
    }

    .keyboard-open .chat-input-container {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 100 !important;
    }
}

/* 모바일 서버 목록 팝업 */
.mobile-server-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.5);
}

.mobile-server-popup.active {
    display: block;
}

.mobile-server-popup-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    max-height: 70vh;
    background: #ffffff;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideDown 0.2s ease-out;
}

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

.mobile-server-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    background: #f8f9fa;
}

.mobile-server-popup-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mobile-server-popup-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.mobile-server-popup-close:active {
    background: rgba(0, 0, 0, 0.1);
}

.mobile-server-list {
    max-height: calc(70vh - 60px);
    overflow-y: auto;
    padding: var(--spacing-sm);
}

.mobile-server-list-banner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-xs);
}

.mobile-server-list-banner img {
    max-width: 120px;
    height: auto;
    object-fit: contain;
}

.mobile-server-list-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.mobile-server-list-item:active {
    background: #f0f0f5;
}

.mobile-server-list-item.active {
    background: rgba(99, 102, 241, 0.1);
}

.mobile-server-list-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}

.mobile-server-list-icon.main-server {
    background: var(--gradient-secondary);
}

.mobile-server-list-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-server-list-info {
    flex: 1;
    min-width: 0;
}

.mobile-server-list-name {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-server-list-count {
    display: none; /* 모바일에서 접속자수 숨김 */
}

.mobile-server-list-item.active .mobile-server-list-name {
    color: var(--primary-color);
    font-weight: 600;
}

/* 모바일 멘션 배지 */
.mobile-mention-badge {
    display: inline-block;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 4px;
    animation: mention-pulse 1.5s ease-in-out infinite;
}

/* 모바일 서버 추가 버튼 */
.mobile-server-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: var(--spacing-md);
    margin-top: var(--spacing-sm);
    background: #f8f9fa;
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.mobile-server-add-btn:active {
    background: #e8e8f0;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ===== 로그인 기록 스타일 ===== */
.login-history-container {
    max-height: 250px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #fff;
    margin-top: var(--spacing-sm);
}

.login-history-loading,
.login-history-empty {
    padding: var(--spacing-lg);
    text-align: center;
    color: var(--text-secondary);
}

/* 로그인 기록 테이블 */
.login-history-table {
    width: 100%;
    min-width: 550px;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.login-history-table th,
.login-history-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.login-history-table th {
    background: #f1f5f9;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 1;
}

.login-history-table tbody tr:hover {
    background: #f8fafc;
}

.login-history-table tbody tr.current-session {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(99, 102, 241, 0.03));
}

.login-history-table tbody tr.current-session:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.06));
}

.login-history-badge {
    display: inline-block;
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 8px;
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
    margin-left: 4px;
    vertical-align: middle;
}

.login-history-table .col-date { color: #334155; }
.login-history-table .col-device { color: #16a34a; }
.login-history-table .col-model { color: #7c3aed; font-weight: 500; }
.login-history-table .col-browser { color: #2563eb; }
.login-history-table .col-ip { color: #d97706; font-family: monospace; font-size: 0.72rem; }

/* 모바일에서 로그인 기록 */
@media (max-width: 768px) {
    .login-history-container {
        max-height: 200px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .login-history-table {
        font-size: 0.68rem;
        min-width: 500px; /* 최소 너비 지정으로 가로 스크롤 활성화 */
    }

    .login-history-table th,
    .login-history-table td {
        padding: 5px 6px;
        white-space: nowrap;
    }

    .login-history-table .col-date {
        min-width: 85px;
    }

    .login-history-table .col-ip {
        font-size: 0.65rem;
    }
}

/* ===== 닉네임 변경 기록 스타일 ===== */
.nickname-history-container {
    max-height: 150px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #f8f9fa;
    border-radius: var(--radius-md);
}

.nickname-history-loading,
.nickname-history-empty {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--text-secondary);
}

.nickname-history-table {
    width: 100%;
    min-width: 320px;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.nickname-history-table th,
.nickname-history-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.nickname-history-table th {
    background: #e2e8f0;
    font-weight: 600;
    color: #334155;
    position: sticky;
    top: 0;
    z-index: 1;
}

.nickname-history-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.nickname-history-table .col-date { color: #334155; white-space: nowrap; }
.nickname-history-table .col-old { color: #dc2626; }
.nickname-history-table .col-new { color: #16a34a; font-weight: 500; }

/* 모바일에서 닉네임 변경 기록 */
@media (max-width: 768px) {
    .nickname-history-container {
        max-height: 120px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nickname-history-table {
        font-size: 0.72rem;
        min-width: 350px; /* 최소 너비 지정으로 가로 스크롤 활성화 */
    }

    .nickname-history-table th,
    .nickname-history-table td {
        padding: 6px 8px;
        white-space: nowrap;
    }

    .nickname-history-table .col-date {
        min-width: 110px;
    }
}

/* ===== 현재 접속 기기 스타일 ===== */
.active-sessions-container {
    margin-top: var(--spacing-sm);
}

.active-sessions-loading,
.active-sessions-empty {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--text-secondary);
    background: #f8f9fa;
    border-radius: var(--radius-md);
}

.active-session-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
}

.active-session-item:last-child {
    margin-bottom: 0;
}

.active-session-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #22c55e;
    border-radius: 50%;
    color: #fff;
    flex-shrink: 0;
}

.active-session-icon svg {
    width: 20px;
    height: 20px;
}

.active-session-info {
    flex: 1;
    min-width: 0;
}

.active-session-device {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.active-session-details {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.active-session-details span {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

.active-session-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 10px;
    background: #22c55e;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .active-session-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    .active-session-icon {
        width: 32px;
        height: 32px;
    }

    .active-session-icon svg {
        width: 16px;
        height: 16px;
    }
}


/* =====================================================
   공지사항 스타일
   ===================================================== */

/* 채팅창 내 공지사항 메시지 */
.announcement-message {
    /* .message 클래스의 기본 스타일 덮어쓰기 */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: 1px solid rgba(99, 102, 241, 0.3) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.5rem 0.75rem !important;
    margin: 0.5rem auto !important;
    gap: 0.375rem !important;
    backdrop-filter: blur(4px);
    max-width: 95% !important;
    width: fit-content !important;
    min-width: 200px;
    white-space: normal !important;
}

.announcement-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    width: fit-content;
    align-self: center;
}

.announcement-badge::before {
    content: '📢';
    font-size: 0.75rem;
}

.announcement-message .announcement-body {
    line-height: 1.5;
    word-break: break-word;
    color: var(--text-primary);
    text-align: center !important;
    width: 100%;
}

/* 모든 자식 요소 가운데 정렬 및 배경 투명 강제 */
.announcement-message .announcement-body * {
    text-align: center !important;
    background: transparent !important;
    background-color: transparent !important;
}

.announcement-message .announcement-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 0.375rem auto !important;
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.announcement-message .announcement-body video,
.announcement-message .announcement-body iframe {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 0.375rem auto !important;
    display: block !important;
}

.announcement-message .announcement-body a {
    color: #6366f1 !important;
    text-decoration: underline !important;
}

/* 공지사항 편집기 모달 */
.announcement-modal {
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.announcement-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.announcement-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.announcement-header .btn-close {
    color: white;
    opacity: 0.8;
}

.announcement-header .btn-close:hover {
    opacity: 1;
}


/* 공지사항 편집기 모달 */
.announcement-editor-modal {
    width: 95%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.announcement-editor-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.announcement-editor-modal .modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.announcement-editor-modal .modal-header .btn-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background var(--transition-fast);
    line-height: 1;
}

.announcement-editor-modal .modal-header .btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.announcement-editor-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0;
}

.announcement-editor-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 0.75rem;
    overflow: hidden;
}

/* 에디터 툴바 */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding-right: 0.5rem;
    border-right: 1px solid #ddd;
}

.toolbar-group:last-child {
    border-right: none;
    padding-right: 0;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
}

.toolbar-btn:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.toolbar-btn:active,
.toolbar-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.toolbar-select {
    height: 32px;
    padding: 0 0.5rem;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    background: white;
    font-size: 0.8rem;
    cursor: pointer;
    max-width: 80px;
}

.toolbar-color {
    width: 32px;
    height: 32px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: white;
}

/* 편집 영역 */
.editor-content {
    flex: 1;
    min-height: 300px;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    background: white;
    overflow-y: auto;
    line-height: 1.7;
    text-align: center;
}

.editor-content:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.editor-content:empty::before {
    content: attr(placeholder);
    color: #aaa;
    pointer-events: none;
}

.editor-content img {
    max-width: 100%;
    height: auto;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    transition: border-color var(--transition-fast);
}

.editor-content img:hover {
    border-color: var(--primary-color);
}

.editor-content img.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* 이미지/동영상 리사이즈 래퍼 */
.resizable-wrapper {
    display: inline-block;
    position: relative;
    margin: 4px;
}

.resizable-wrapper.selected {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.resizable-wrapper img,
.resizable-wrapper video,
.resizable-wrapper iframe {
    display: block;
    max-width: 100%;
}

/* 리사이즈 핸들 */
.resize-handle {
    position: absolute;
    background: var(--primary-color);
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    z-index: 10;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.resizable-wrapper.selected .resize-handle,
.resizable-wrapper:hover .resize-handle {
    opacity: 1;
}

/* 모서리 핸들 */
.resize-handle-corner {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.resize-handle-nw { top: -6px; left: -6px; cursor: nw-resize; }
.resize-handle-ne { top: -6px; right: -6px; cursor: ne-resize; }
.resize-handle-sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.resize-handle-se { bottom: -6px; right: -6px; cursor: se-resize; }

/* 옆면 핸들 */
.resize-handle-edge {
    background: var(--primary-color);
}

.resize-handle-n,
.resize-handle-s {
    height: 6px;
    left: 20%;
    right: 20%;
    border-radius: 3px;
    cursor: ns-resize;
}

.resize-handle-n { top: -4px; }
.resize-handle-s { bottom: -4px; }

.resize-handle-e,
.resize-handle-w {
    width: 6px;
    top: 20%;
    bottom: 20%;
    border-radius: 3px;
    cursor: ew-resize;
}

.resize-handle-e { right: -4px; }
.resize-handle-w { left: -4px; }

/* 편집기 옵션 */
.editor-options {
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: var(--radius-sm);
}

.editor-options .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.editor-options .checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 이미지 크기 조절 팝업 */
.image-resize-popup {
    position: fixed;
    z-index: 10001;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 1rem;
}

.image-resize-popup.hidden {
    display: none;
}

.resize-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.resize-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.resize-controls input[type="number"] {
    width: 70px;
    padding: 0.25rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
}

.resize-controls input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.resize-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* 설정에 공지사항 편집 버튼 */
.btn-edit-announcement {
    width: 100%;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.btn-edit-announcement:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .announcement-modal {
        width: 95%;
        max-height: 85vh;
    }

    .announcement-header {
        padding: 0.875rem 1rem;
    }

    .announcement-body {
        padding: 1rem;
    }

    /* 모바일 공지사항 강제 가운데 정렬 - .message 스타일 완전 덮어쓰기 */
    .announcement-message {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0.5rem !important;
        margin: 0.5rem auto !important;
        gap: 0.375rem !important;
        max-width: 95% !important;
        width: fit-content !important;
    }

    .announcement-message .announcement-body {
        text-align: center !important;
        width: 100%;
    }

    .announcement-message .announcement-body * {
        text-align: center !important;
    }

    .announcement-message .announcement-body img {
        margin-left: auto !important;
        margin-right: auto !important;
        display: block !important;
    }

    .announcement-editor-modal {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .announcement-editor-body {
        padding: 0.75rem;
    }

    .editor-toolbar {
        padding: 0.375rem;
        gap: 0.375rem;
    }

    .toolbar-group {
        padding-right: 0.375rem;
    }

    .toolbar-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .toolbar-select {
        height: 28px;
        font-size: 0.75rem;
        max-width: 65px;
        padding: 0 0.25rem;
    }

    .toolbar-color {
        width: 28px;
        height: 28px;
    }

    .editor-content {
        min-height: 200px;
        padding: 0.75rem;
        font-size: 14px;
    }

    .image-resize-popup {
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 90%;
        max-width: 280px;
    }
}

/* =====================================================
   이모티콘 스타일
   ===================================================== */

/* 이모티콘 버튼 */
.btn-emoticon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
}

.btn-emoticon svg {
    width: 20px;
    height: 20px;
    transition: all var(--transition-fast);
}

.btn-emoticon:hover {
    background: rgba(236, 72, 153, 0.1);
    color: var(--secondary-color);
}

.btn-emoticon:active {
    transform: scale(0.95);
}

/* 이모티콘 팝업 */
.emoticon-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-height: 360px;
    background: var(--glass-bg, #ffffff);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.emoticon-popup.hidden {
    display: none;
}

.emoticon-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.05);
}

.btn-emoticon-upload {
    width: 24px;
    height: 24px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-emoticon-upload:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* 이모티콘 탭 */
.emoticon-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.emoticon-tabs::-webkit-scrollbar {
    display: none;
}

.emoticon-tab {
    flex-shrink: 0;
    padding: 0.25rem 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    white-space: nowrap;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emoticon-tab:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

.emoticon-tab.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.emoticon-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.375rem;
    max-height: 280px;
}

.emoticon-popup-body::-webkit-scrollbar {
    width: 6px;
}

.emoticon-popup-body::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 3px;
}

/* 이모티콘 아이템 */
.emoticon-item {
    position: relative;
    aspect-ratio: 1;
    width: 56px;
    height: 56px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.02);
}

.emoticon-item:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.emoticon-item img {
    max-width: 48px;
    max-height: 48px;
    object-fit: contain;
}

/* 이모티콘 삭제 버튼 (관리자용) */
.emoticon-delete-btn {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 12px;
    height: 12px;
    border: none;
    background: rgba(239, 68, 68, 0.95);
    color: white;
    font-size: 9px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    z-index: 10;
    transition: all var(--transition-fast);
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.emoticon-delete-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}

.emoticon-item:hover .emoticon-delete-btn {
    display: flex;
}

/* 이모티콘 빈 상태 */
.emoticon-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.emoticon-empty-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* 채팅 메시지 내 이모티콘 */
.chat-emoticon {
    display: inline-block;
    vertical-align: middle; /* 텍스트와 중앙 정렬 */
    /* 폰트 크기에 연동 - 5배 크기 (Safari 호환성을 위해 명시적 크기 설정) */
    height: calc(var(--chat-font-size, 14px) * 5);
    width: calc(var(--chat-font-size, 14px) * 5);
    max-width: calc(var(--chat-font-size, 14px) * 8);
    max-height: calc(var(--chat-font-size, 14px) * 5);
    object-fit: contain;
    margin: 0 2px;
    /* Safari에서 이미지 크기 고정을 위한 추가 속성 */
    flex-shrink: 0;
}

/* 입력창 내 이모티콘 */
.chat-input .input-emoticon {
    display: inline-block;
    vertical-align: middle;
    height: 20px;
    width: auto;
    max-width: 28px;
    object-fit: contain;
    margin: 0 1px;
    border-radius: 2px;
}

/* 이모티콘 미리보기 영역 */
.emoticon-preview {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
    flex-shrink: 0;
}

.emoticon-preview.has-emoticons {
    display: flex;
}

.emoticon-preview .preview-item {
    position: relative;
    cursor: pointer;
    border-radius: 4px;
    padding: 2px;
    transition: background 0.15s;
}

.emoticon-preview .preview-item:hover {
    background: rgba(0, 0, 0, 0.1);
}

.emoticon-preview .preview-item img {
    display: block;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* contenteditable placeholder */
.chat-input[contenteditable]:empty:before {
    content: attr(data-placeholder);
    color: var(--text-secondary);
    pointer-events: none;
}

/* contenteditable 기본 스타일 */
.chat-input[contenteditable] {
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 36px;
    height: 36px;
    line-height: 36px;
    outline: none;
    padding: 0 12px;
    font-size: var(--chat-font-size, 14px);
    -webkit-user-select: text;
    user-select: text;
    -webkit-tap-highlight-color: transparent;
}

/* 입력창 이모티콘 세로 정렬 */
.chat-input[contenteditable] .input-emoticon {
    vertical-align: middle;
}

/* 모바일 이모티콘 스타일 */
@media (max-width: 768px) {
    .btn-emoticon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 1.1rem;
    }

    .emoticon-popup {
        position: fixed;
        bottom: 60px;
        right: 8px;
        left: 8px;
        width: auto;
        max-height: 220px;
    }

    .emoticon-popup-body {
        grid-template-columns: repeat(7, 1fr);
        gap: 0.25rem;
        max-height: 160px;
    }

    .emoticon-item {
        width: 32px;
        height: 32px;
        min-height: auto;
    }

    .emoticon-item img {
        max-width: 28px;
        max-height: 28px;
    }
}

/* ===== 관리 탭 개선 UI ===== */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.admin-card {
    background: linear-gradient(135deg, var(--bg-glass) 0%, rgba(255, 255, 255, 0.7) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.admin-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.admin-card-icon {
    font-size: 2rem;
    margin-bottom: var(--spacing-xs);
}

.admin-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.admin-card-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* 관리 서브섹션 */
.admin-subsection {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.admin-subsection h5 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-xs);
    border-bottom: 2px solid var(--primary-color);
}

.admin-subsection h5 .btn-xs {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

/* 칭호 할당 폼 */
.title-assign-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.title-assign-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--spacing-sm);
    align-items: center;
}

.title-assign-row label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.title-assign-row .form-select,
.title-assign-row .form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: white;
}

.title-color-row {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.title-color-row input[type="color"] {
    width: 40px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px;
}

.title-color-row .color-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* 체크박스 인라인 */
.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.checkbox-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 프리셋 리스트 */
.preset-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    min-height: 40px;
    padding: var(--spacing-xs);
}

.preset-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 2px solid transparent;
}

.preset-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}

.preset-item.selected {
    border-color: var(--text-primary);
}

.preset-item .preset-actions {
    display: flex;
    gap: 2px;
    margin-left: 4px;
}

.preset-item .preset-action-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.2);
    color: inherit;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.preset-item .preset-action-btn:hover {
    background: rgba(0,0,0,0.4);
}

/* 프리셋 빈 상태 */
.preset-empty {
    width: 100%;
    text-align: center;
    padding: var(--spacing-md);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* 칭호 보유자 리스트 */
.title-holders-list {
    max-height: 200px;
    overflow-y: auto;
}

.title-holder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

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

.title-holder-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.title-holder-name {
    font-weight: 500;
    color: var(--text-primary);
}

.title-holder-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}

/* 광고 관리 */
.ads-settings-row {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.ads-settings-row label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ads-settings-row input[type="number"] {
    width: 70px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
}

.ads-add-form {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.ads-add-form textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    resize: none;
    font-size: 0.9rem;
    min-height: 60px;
}

/* 광고 목록 */
.ads-list {
    max-height: 250px;
    overflow-y: auto;
}

.ads-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-xs);
    background: white;
}

.ads-item.inactive {
    opacity: 0.5;
    background: var(--bg-card);
}

.ads-item-content {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-right: var(--spacing-sm);
    word-break: break-word;
}

.ads-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* 버튼 크기 변형 */
.btn-xs {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.btn-icon-xs {
    width: 26px;
    height: 26px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-icon-xs:hover {
    background: var(--bg-card);
}

.btn-icon-xs.btn-danger:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

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

.btn-icon-xs.btn-success:hover {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

/* 부관리자 목록 */
.sub-admin-list {
    max-height: 200px;
    overflow-y: auto;
}

.sub-admin-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}

.sub-admin-item:hover {
    background: var(--bg-card);
}

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

.sub-admin-name {
    font-weight: 500;
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.empty-state-icon {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
    opacity: 0.5;
}

/* 반짝이 효과 */
@keyframes sparkle-animation {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.sparkle-badge {
    position: relative;
    overflow: visible;
}

.sparkle-badge::before,
.sparkle-badge::after {
    content: '✦';
    position: absolute;
    font-size: 0.6em;
    animation: sparkle-animation 1s infinite;
}

.sparkle-badge::before {
    top: -2px;
    left: -6px;
}

.sparkle-badge::after {
    bottom: -2px;
    right: -6px;
    animation-delay: 0.5s;
}

/* 칭호 미리보기 */
.title-preview {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
    margin: var(--spacing-sm) 0;
}

/* 서버 관리 그리드 개선 */
.admin-grid-server {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.admin-card-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: var(--spacing-xs);
    min-height: 130px;
}

.admin-card-center h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.admin-card-center p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.admin-card-center .profile-preview {
    width: 50px;
    height: 50px;
    margin-bottom: var(--spacing-xs);
}

/* 검색 입력 */
.search-input-wrapper {
    margin-bottom: var(--spacing-sm);
}

.search-input-wrapper .form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

/* 칭호 폼 개선 */
.title-assign-form-new {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.title-form-row {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: var(--spacing-sm);
    align-items: center;
}

.title-form-row label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.title-form-row .form-select,
.title-form-row .form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.title-color-picker {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    flex-wrap: wrap;
}

.title-color-picker .color-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.title-color-picker .color-item span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.title-color-picker input[type="color"] {
    width: 36px;
    height: 30px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px;
}

.sparkle-check {
    margin-left: 0;
}

.title-sparkle-settings {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    align-items: center;
}

.sparkle-options {
    display: none;
    gap: var(--spacing-sm);
    align-items: center;
}

.sparkle-options.show {
    display: flex;
}

.form-select-sm {
    padding: 4px 8px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
}

/* 동적 반짝이 효과 - CSS 변수 사용 */
.badge-sparkle-dynamic {
    --sparkle-color: #ffd700;
    --sparkle-weight: 2;
    animation: sparkle-dynamic 2s ease-in-out infinite;
    border-width: calc(var(--sparkle-weight) * 1px);
    border-style: solid;
    border-color: var(--sparkle-color);
}

@keyframes sparkle-dynamic {
    0%, 100% {
        box-shadow: 0 0 calc(var(--sparkle-weight) * 2px) var(--sparkle-color),
                    0 0 calc(var(--sparkle-weight) * 4px) var(--sparkle-color);
    }
    50% {
        box-shadow: 0 0 calc(var(--sparkle-weight) * 4px) var(--sparkle-color),
                    0 0 calc(var(--sparkle-weight) * 8px) var(--sparkle-color);
    }
}

.title-preview-row .title-preview-box {
    padding: var(--spacing-sm);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    min-height: 44px;
    display: flex;
    align-items: center;
}

.title-preview-badge {
    display: inline-block;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
}

/* ===== 유저 정보 모달 커스텀 칭호 폼 ===== */
.userinfo-title-form {
    background: #f8fafc;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.userinfo-title-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.userinfo-title-label {
    min-width: 55px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.userinfo-title-row .form-control,
.userinfo-title-row .form-select-sm {
    flex: 1;
}

.userinfo-title-colors {
    display: flex;
    gap: var(--spacing-md);
    flex: 1;
}

.userinfo-title-colors .color-item,
.userinfo-title-sparkle .color-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.userinfo-title-colors .color-item span,
.userinfo-title-sparkle .color-item span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.userinfo-title-colors input[type="color"],
.userinfo-title-sparkle input[type="color"] {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.userinfo-title-sparkle {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
    flex-wrap: wrap;
}

.userinfo-title-sparkle .sparkle-check {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}

.userinfo-title-sparkle .sparkle-options {
    display: flex;
    gap: var(--spacing-md);
}

.userinfo-title-preview-row {
    margin-top: var(--spacing-xs);
    padding-top: var(--spacing-sm);
    border-top: 1px dashed #e2e8f0;
}

.userinfo-title-preview-box {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm);
    min-height: 44px;
}

.userinfo-title-preview-box .title-preview-badge {
    padding: 6px 14px;
    font-size: 0.9rem;
}

.userinfo-title-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    margin-top: var(--spacing-xs);
    padding-top: var(--spacing-sm);
    border-top: 1px solid #e2e8f0;
}

/* 모바일에서 유저 정보 칭호 폼 */
@media (max-width: 480px) {
    .userinfo-title-row {
        flex-wrap: wrap;
    }

    .userinfo-title-label {
        min-width: 100%;
        margin-bottom: 4px;
    }

    .userinfo-title-colors,
    .userinfo-title-sparkle {
        width: 100%;
    }

    .userinfo-title-sparkle .sparkle-options {
        width: 100%;
        margin-top: var(--spacing-xs);
    }
}

.title-form-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
}

/* 광고 추가 폼 개선 */
.ads-global-settings {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.ads-add-form-new {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.ads-add-form-new textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    resize: vertical;
    font-size: 0.9rem;
    min-height: 80px;
}

.ads-add-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm);
}

.ads-interval-input {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ads-interval-input label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ads-interval-input input {
    width: 60px;
    padding: 6px 8px;
    text-align: center;
}

.ads-interval-input span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* 광고 아이템 개선 */
.ads-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-sm);
    background: white;
}

.ads-item.inactive {
    opacity: 0.6;
    background: var(--bg-card);
}

.ads-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ads-item-status {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 500;
}

.ads-item-status.active {
    background: var(--success-color);
    color: white;
}

.ads-item-status.inactive {
    background: var(--bg-card);
    color: var(--text-muted);
}

.ads-item-interval {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ads-item-target {
    font-size: 0.75rem;
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.ads-server-select {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ads-server-select label {
    font-size: 0.85rem;
    white-space: nowrap;
}

.ads-server-select select {
    min-width: 120px;
    flex: 1;
}

.ads-item-message {
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.ads-item-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    padding-top: var(--spacing-xs);
    border-top: 1px solid var(--border-color);
}

/* 광고 수정 모달 */
.ad-edit-modal {
    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: var(--z-modal);
}

.ad-edit-modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.ad-edit-modal h4 {
    margin-bottom: var(--spacing-md);
    font-size: 1rem;
}

.ad-edit-modal textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    resize: vertical;
    margin-bottom: var(--spacing-sm);
}

.ad-edit-modal-options {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.ad-edit-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .admin-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .admin-grid-server {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-card {
        padding: var(--spacing-sm);
    }

    .admin-card-center {
        min-height: 110px;
    }

    .admin-card-icon {
        font-size: 1.5rem;
    }

    .admin-card-value {
        font-size: 1.2rem;
    }

    .title-form-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .title-color-picker {
        flex-wrap: wrap;
    }

    .ads-add-options {
        flex-direction: column;
        align-items: stretch;
    }

    .ads-interval-input {
        justify-content: space-between;
    }
}

/* =====================================================
   이미지 업로드 및 뷰어 스타일
   ===================================================== */

/* 이미지 업로드 버튼 */
.btn-image-upload {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
}

.btn-image-upload svg {
    width: 20px;
    height: 20px;
    transition: all var(--transition-fast);
}

.btn-image-upload:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.btn-image-upload:active {
    transform: scale(0.95);
}

/* 이미지 업로드 중 상태 */
.btn-image-upload.uploading {
    pointer-events: none;
    opacity: 0.6;
}

/* 업로드된 이미지 링크 */
.image-link {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.image-link:hover {
    color: var(--primary-dark);
}

/* 이미지 뷰어 오버레이 */
.image-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    animation: fadeIn 0.2s ease;
}

.image-viewer-overlay.hidden {
    display: none;
}

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

.image-viewer-container {
    position: relative;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 50px; /* X 버튼 공간 확보 */
}

.image-viewer-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 10;
    backdrop-filter: blur(4px);
}

.image-viewer-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.image-viewer-img {
    max-width: 95vw;
    max-height: calc(90vh - 80px);
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.image-viewer-info {
    margin-top: var(--spacing-md);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    text-align: center;
}

/* 모바일 이미지 뷰어 */
@media (max-width: 768px) {
    .btn-image-upload {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 1rem;
    }

    .image-viewer-close {
        top: 10px;
        right: 10px;
        position: fixed;
    }

    .image-viewer-img {
        max-width: 100vw;
        max-height: 80vh;
        border-radius: 0;
    }
}

/* ===== 채널 관리자 관리 ===== */
.admin-section-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.channel-admin-form {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.channel-admin-form .form-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.channel-admin-form .form-row label {
    min-width: 80px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.channel-admin-form .form-select {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-darker);
    font-size: 0.875rem;
}

.channel-admin-form .form-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
}

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

.channel-admin-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-xs);
}

.channel-admin-item:hover {
    background: var(--bg-glass);
}

.channel-admin-item .admin-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.channel-admin-item .admin-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    overflow: hidden;
}

.channel-admin-item .admin-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.channel-admin-item .admin-details {
    display: flex;
    flex-direction: column;
}

.channel-admin-item .admin-nickname {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.channel-admin-item .admin-role-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-weight: 500;
}

.channel-admin-item .admin-role-badge.role-admin {
    background: var(--gradient-primary);
    color: white;
}

.channel-admin-item .admin-role-badge.role-sub-admin {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-color);
}

.channel-admin-item .admin-appointed {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.channel-admin-item .btn-remove-admin {
    background: transparent;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
    opacity: 0.6;
    transition: all var(--transition-fast);
}

.channel-admin-item .btn-remove-admin:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

/* 성능 최적화: 파티클 시스템 및 불필요한 애니메이션 비활성화 (PC/모바일 공통) */
#particles-container,
.geometric-shape {
    display: none !important;
}

/* 3D 큐브 애니메이션 비활성화 (PC/모바일 공통) */
.cube {
    animation: none !important;
}

/* 모바일 추가 최적화 */
@media (max-width: 768px) {
    .cube {
        display: none !important;
    }
}

/* ===== 기보/랭킹 컴팩트 UI ===== */

/* 채팅방 스타일 헤더 */
.records-chat-header {
    height: 42px;
    min-height: 42px;
    padding: 0 var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(139, 92, 246, 0.95));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.records-header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.records-chat-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.records-chat-header .btn.btn-icon {
    background: transparent;
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.records-chat-header .btn.btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
}

.records-chat-header .btn.btn-icon svg {
    width: 20px;
    height: 20px;
}

/* 헤더 내 검색 박스 - 2개 입력창 */
.records-header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 320px;
    margin: 0 12px;
}

.records-header-search .search-input-nick {
    flex: 1;
    min-width: 0;
    padding: 5px 10px;
    border: none;
    outline: none;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    text-align: center;
}

.records-header-search .search-input-nick::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.records-header-search .search-input-nick:focus {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

.records-header-search .search-vs {
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

/* 컴팩트 콘텐츠 영역 */
.records-content-compact {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f8fafc;
}

/* 탭 컴팩트 */
.records-tabs-compact {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    padding: 4px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.records-tabs-compact .records-tab-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: fit-content;
}

.records-tabs-compact .records-tab-btn:hover {
    color: #334155;
    background: rgba(255, 255, 255, 0.5);
}

.records-tabs-compact .records-tab-btn.active {
    background: #6366f1;
    color: white;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

/* 기보 카드 리스트 */
.records-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.record-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: all 0.2s ease;
}

.record-card:hover {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    transform: translateY(-1px);
}

.record-card:active {
    transform: scale(0.98);
}

.record-card-type {
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 6px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.record-card-type.ranked {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.record-card-type.friendly {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

.record-card-type.tournament {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.record-card-players {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.record-card-player {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 45%;
}

.record-card-player.winner .player-name {
    color: #10b981;
    font-weight: 600;
}

.record-card-player .player-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}

.record-card-player .player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.record-card-player .player-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.record-card-vs {
    font-size: 0.75rem;
    font-weight: 800;
    color: #94a3b8;
    flex-shrink: 0;
    padding: 0 4px;
}

.record-card-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.record-card-result {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.record-card-result.win {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.record-card-result.lose {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.record-card-result.draw {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
}

.record-card-result.pending {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.record-card-date {
    font-size: 0.7rem;
    color: #94a3b8;
}

/* 페이지네이션 컴팩트 */
.pagination-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
    padding: 8px;
}

.pagination-compact .page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: none;
    background: white;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-compact .page-btn:hover {
    background: #f1f5f9;
    color: #334155;
}

.pagination-compact .page-btn.active {
    background: #6366f1;
    color: white;
}

.pagination-compact .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 기보 상세 - 대전 정보 컴팩트 */
.record-match-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 12px;
}

.match-player-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    transition: background 0.2s;
}

.match-player-compact:hover {
    background: rgba(99, 102, 241, 0.08);
}

.match-player-compact.winner {
    background: rgba(16, 185, 129, 0.08);
}

.match-player-compact .player-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    overflow: hidden;
}

.match-player-compact .player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.match-player-compact .player-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.match-player-compact.winner .player-name {
    color: #10b981;
}

.match-player-compact .winner-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    background: #10b981;
    color: white;
    border-radius: 10px;
}

.match-vs-compact {
    font-size: 1rem;
    font-weight: 800;
    color: #cbd5e1;
    flex-shrink: 0;
}

/* 기보 메타 정보 컴팩트 */
.record-meta-compact {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.record-meta-compact .meta-tag {
    padding: 4px 10px;
    background: white;
    border-radius: 20px;
    font-size: 0.75rem;
    color: #64748b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.record-meta-compact .meta-tag.winner {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    font-weight: 600;
}

.record-meta-compact .meta-tag.pending {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.record-meta-compact .meta-tag.draw {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
    font-weight: 600;
}

/* 승패 결정 버튼 컴팩트 */
.record-winner-actions-compact {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.record-winner-actions-compact .btn {
    padding: 6px 16px;
    font-size: 0.8rem;
}

/* 채팅 로그 컨테이너 컴팩트 */
.record-chat-container-compact {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    margin-bottom: 12px;
}

.record-chat-header-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.record-chat-header-compact .chat-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

.record-chat-header-compact .chat-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.record-chat-header-compact .btn-mode {
    padding: 4px 10px;
    border: none;
    background: #e2e8f0;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.record-chat-header-compact .btn-mode:hover {
    background: #cbd5e1;
}

.record-chat-header-compact .btn-mode.active {
    background: #6366f1;
    color: white;
}

.btn-icon-sm {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon-sm:hover {
    background: #e2e8f0;
    color: #334155;
}

/* 댓글 섹션 컴팩트 */
.record-comments-compact {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.comments-header-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

.comments-header-compact .comment-count {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 8px;
    background: #e2e8f0;
    color: #64748b;
    border-radius: 10px;
}

.comment-form-compact {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
}

.comment-form-compact .comment-input-row {
    display: flex;
    gap: 8px;
}

.comment-form-compact .comment-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    resize: none;
    min-height: 36px;
    max-height: 100px;
}

.comment-form-compact .comment-input:focus {
    outline: none;
    border-color: #6366f1;
}

.comment-form-compact .comment-reply-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    padding: 6px 10px;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #64748b;
}

.comment-form-compact .btn-cancel-reply {
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 0.75rem;
    cursor: pointer;
}

/* 랭킹 그리드 컴팩트 (이미 있는 스타일 보완) */
@media (max-width: 768px) {
    .rankings-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .ranking-item {
        padding: 10px;
    }
}

/* 유저 전적 상세 모바일 최적화 */
@media (max-width: 768px) {
    .user-stats-container {
        max-width: 100%;
    }

    .user-stats-profile {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 16px;
    }

    .profile-avatar-xl {
        width: 72px;
        height: 72px;
        font-size: 1.8rem;
    }

    .profile-main h2 {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }

    .profile-stats-grid {
        justify-content: center;
    }

    .stats-breakdown,
    .opponents-list,
    .recent-games {
        padding: 12px;
    }

    .stats-breakdown h3,
    .opponents-list h3,
    .recent-games h3 {
        font-size: 0.9rem;
        margin-bottom: 12px;
    }
}
