/* ============================================
   线上剧本杀平台 - 全局样式
   风格：参照快看漫画暗色主题
   配色：深蓝黑 + 暗红 + 琥珀金
   ============================================ */

/* === CSS 变量 === */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2333;
    --bg-card: #1a1f2e;
    --bg-card-hover: #222839;
    --bg-input: #0d1117;
    --bg-modal: #161b22;

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;

    --accent-red: #c9302c;
    --accent-red-hover: #d9534f;
    --accent-red-light: rgba(201, 48, 44, 0.15);
    --accent-gold: #d4a017;
    --accent-gold-light: rgba(212, 160, 23, 0.15);
    --accent-green: #28a745;
    --accent-green-light: rgba(40, 167, 69, 0.15);
    --accent-blue: #1a8cff;
    --accent-blue-light: rgba(26, 140, 255, 0.15);

    --border-color: #30363d;
    --border-light: #21262d;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --nav-height: 60px;
    --container-width: 1200px;

    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* === 重置与基础 === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-gold);
}

img {
    max-width: 100%;
    display: block;
}

ul, ol {
    list-style: none;
}

input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

/* === 滚动条 === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === 容器 === */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* === 按钮 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
}

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

.btn-primary {
    background: var(--accent-red);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-red-hover);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

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

.btn-outline:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.btn-gold {
    background: var(--accent-gold);
    color: #000;
}

.btn-gold:hover {
    background: #e6b422;
    color: #000;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

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

/* === 顶部导航栏 === */
.top-nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--nav-height);
}

.nav-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 24px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-red);
    flex-shrink: 0;
}

.nav-logo:hover {
    color: var(--accent-red);
}

.nav-logo i {
    font-size: 24px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

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

.nav-link.active {
    color: var(--accent-gold);
    background: var(--accent-gold-light);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.nav-search {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0 12px;
    transition: border-color 0.2s;
}

.nav-search:focus-within {
    border-color: var(--accent-red);
}

.nav-search input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px;
    font-size: 13px;
    width: 180px;
}

.nav-search input::placeholder {
    color: var(--text-muted);
}

.nav-search .search-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 13px;
}

.nav-search .search-btn:hover {
    color: var(--text-primary);
}

.nav-user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.nav-user-menu:hover {
    background: var(--bg-tertiary);
}

.nav-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-username {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.nav-user-role {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.role-admin {
    background: var(--accent-red-light);
    color: var(--accent-red);
}

.role-host {
    background: var(--accent-gold-light);
    color: var(--accent-gold);
}

.role-player {
    background: var(--accent-blue-light);
    color: var(--accent-blue);
}

.nav-user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px;
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.nav-user-menu.open .nav-user-dropdown {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
}

/* === 分类标签栏 === */
.category-bar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    padding: 12px 0;
    overflow-x: auto;
}

.category-list {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

.category-tag {
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    border: 1px solid transparent;
}

.category-tag:hover {
    color: var(--text-primary);
    border-color: var(--border-color);
}

.category-tag.active {
    background: var(--accent-red);
    color: #fff;
    border-color: var(--accent-red);
}

/* === 轮播图 === */
.banner-section {
    padding: 20px 0;
}

.banner-slider {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 2.5 / 1;
    background: var(--bg-card);
}

.banner-track {
    display: flex;
    transition: transform 0.5s ease;
    height: 100%;
}

.banner-slide {
    min-width: 100%;
    height: 100%;
    position: relative;
}

.banner-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 30px 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
}

.banner-overlay h2 {
    font-size: 22px;
    margin-bottom: 6px;
}

.banner-overlay p {
    font-size: 14px;
    color: var(--text-secondary);
}

.banner-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-btn:hover {
    background: rgba(0,0,0,0.7);
}

.banner-btn.prev { left: 12px; }
.banner-btn.next { right: 12px; }

.banner-dots {
    position: absolute;
    bottom: 12px;
    right: 20px;
    display: flex;
    gap: 6px;
}

.banner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: all 0.3s;
}

.banner-dot.active {
    background: var(--accent-gold);
    width: 20px;
    border-radius: 4px;
}

/* === 区域标题 === */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 20px 0 0;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--accent-red);
    border-radius: 2px;
}

.section-more {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.section-more:hover {
    color: var(--accent-gold);
}

/* === 剧本卡片网格 === */
.script-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    padding-bottom: 20px;
}

.script-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
    border: 1px solid transparent;
}

.script-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-color);
    box-shadow: var(--shadow-md);
}

.script-card-cover {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.script-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.script-card:hover .script-card-cover img {
    transform: scale(1.05);
}

.script-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--accent-red);
    color: #fff;
}

.script-card-info {
    padding: 10px 12px;
}

.script-card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.script-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.script-card-meta i {
    margin-right: 2px;
}

.script-card-rating {
    font-size: 12px;
    color: var(--accent-gold);
}

/* === 排行榜样式 === */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 20px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    transition: all 0.2s;
    cursor: pointer;
}

.ranking-item:hover {
    background: var(--bg-card-hover);
}

.ranking-number {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.ranking-number.top1 { background: var(--accent-gold); color: #000; }
.ranking-number.top2 { background: #a0a0a0; color: #000; }
.ranking-number.top3 { background: #cd7f32; color: #000; }

.ranking-cover {
    width: 50px;
    height: 66px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

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

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

.ranking-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* === 表单样式 === */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--accent-red);
}

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

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

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-error {
    font-size: 12px;
    color: var(--accent-red);
    margin-top: 4px;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    accent-color: var(--accent-red);
}

/* === 认证页面 === */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo i {
    font-size: 40px;
    color: var(--accent-red);
    margin-bottom: 12px;
}

.auth-logo h1 {
    font-size: 24px;
    font-weight: 700;
}

.auth-logo p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent-gold);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
}

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

/* === 页脚 === */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    margin-top: 40px;
}

.footer-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.footer-links a {
    font-size: 13px;
    color: var(--text-muted);
}

.footer-links a:hover {
    color: var(--text-primary);
}

.footer-copyright {
    font-size: 12px;
    color: var(--text-muted);
}

/* === 模态框 === */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* === Toast 提示 === */
.toast-message {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    max-width: 400px;
    text-align: center;
}

.toast-message.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-info {
    background: var(--accent-blue);
    color: #fff;
}

.toast-success {
    background: var(--accent-green);
    color: #fff;
}

.toast-error {
    background: var(--accent-red);
    color: #fff;
}

.toast-warning {
    background: var(--accent-gold);
    color: #000;
}

/* === 空状态 === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
}

/* === 加载状态 === */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading-spinner::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* === 标签 === */
.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.tag-red { background: var(--accent-red-light); color: var(--accent-red); }
.tag-gold { background: var(--accent-gold-light); color: var(--accent-gold); }
.tag-green { background: var(--accent-green-light); color: var(--accent-green); }
.tag-blue { background: var(--accent-blue-light); color: var(--accent-blue); }

/* === 游戏页面样式 === */
.game-container {
    display: flex;
    height: calc(100vh - var(--nav-height));
    overflow: hidden;
}

.game-sidebar-left {
    width: 220px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.game-sidebar-right {
    width: 300px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.game-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.game-header-title {
    font-size: 16px;
    font-weight: 600;
}

.game-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.game-status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.game-status-waiting { background: var(--accent-gold-light); color: var(--accent-gold); }
.game-status-playing { background: var(--accent-green-light); color: var(--accent-green); }
.game-status-finished { background: var(--text-muted); color: var(--bg-primary); }

/* 游戏标签页 */
.game-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.game-tab {
    padding: 12px 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

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

.game-tab.active {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
}

.game-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* 玩家列表 */
.player-list {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.player-item:hover {
    background: var(--bg-tertiary);
}

.player-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

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

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

.player-name {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-role {
    font-size: 11px;
    color: var(--text-muted);
}

.player-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.player-ready { background: var(--accent-green-light); color: var(--accent-green); }
.player-not-ready { background: var(--bg-tertiary); color: var(--text-muted); }
.player-host { background: var(--accent-gold-light); color: var(--accent-gold); }

/* 聊天区域 */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.chat-msg-self {
    align-self: flex-end;
    background: var(--accent-red);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg-other {
    align-self: flex-start;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-msg-system {
    align-self: center;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    padding: 4px 12px;
}

.chat-msg-name {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--accent-gold);
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 13px;
}

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

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-red);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.chat-send-btn:hover {
    background: var(--accent-red-hover);
}

/* 游戏底部操作栏 */
.game-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* 剧本阅读器 */
.script-viewer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.script-page-image {
    max-width: 100%;
    max-height: calc(100vh - 240px);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.script-page-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.script-page-indicator {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 线索卡 */
.clue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.clue-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.clue-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-2px);
}

.clue-card-image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.clue-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.clue-card-name {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
}

.clue-card-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
}

/* 投票区域 */
.vote-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.vote-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.vote-card:hover {
    border-color: var(--accent-red);
    background: var(--bg-card-hover);
}

.vote-card.selected {
    border-color: var(--accent-red);
    background: var(--accent-red-light);
}

.vote-card-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin: 0 auto 8px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

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

.vote-card-name {
    font-size: 14px;
    font-weight: 500;
}

.vote-card-votes {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* === 房间卡片 === */
.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.room-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: all 0.2s;
    cursor: pointer;
}

.room-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.room-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.room-card-title {
    font-size: 16px;
    font-weight: 600;
}

.room-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.room-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

/* === 剧本详情页 === */
.detail-container {
    padding: 24px 0;
}

.detail-header {
    display: flex;
    gap: 24px;
    margin-bottom: 30px;
}

.detail-cover {
    width: 240px;
    height: 320px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
}

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

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

.detail-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.detail-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.detail-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-meta-item i {
    color: var(--accent-gold);
}

.detail-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 20px;
}

.detail-actions {
    display: flex;
    gap: 12px;
}

/* 角色卡片 */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.character-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
}

.character-card:hover {
    border-color: var(--accent-gold);
}

.character-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 10px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

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

.character-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.character-desc {
    font-size: 12px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 评论区域 */
.comment-section {
    margin-top: 30px;
}

.comment-input-box {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.comment-input-box textarea {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
}

.comment-input-box textarea:focus {
    border-color: var(--accent-red);
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

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

.comment-body {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-username {
    font-size: 13px;
    font-weight: 500;
}

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

.comment-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.comment-rating {
    font-size: 12px;
    color: var(--accent-gold);
    margin-top: 4px;
}

/* === 上传页面 === */
.upload-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
}

.upload-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.upload-dropzone:hover {
    border-color: var(--accent-red);
    color: var(--text-secondary);
}

.upload-dropzone i {
    font-size: 32px;
    margin-bottom: 8px;
}

.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.upload-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-tertiary);
}

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

.upload-preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    border: none;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === 管理后台 === */
.admin-layout {
    display: flex;
    min-height: calc(100vh - var(--nav-height));
}

.admin-sidebar {
    width: 200px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    flex-shrink: 0;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s;
    cursor: pointer;
}

.admin-nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.admin-nav-item.active {
    color: var(--accent-gold);
    background: var(--accent-gold-light);
    border-right: 3px solid var(--accent-gold);
}

.admin-nav-item i {
    width: 20px;
    text-align: center;
}

.admin-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.stat-card-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
}

.stat-card-value.text-red { color: var(--accent-red); }
.stat-card-value.text-gold { color: var(--accent-gold); }
.stat-card-value.text-green { color: var(--accent-green); }
.stat-card-value.text-blue { color: var(--accent-blue); }

/* 数据表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
}

.data-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
}

.data-table tr:hover td {
    background: var(--bg-card-hover);
}

.data-table .actions {
    display: flex;
    gap: 8px;
}

/* === 图片预览模态框 === */
.image-preview-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.image-preview-overlay.active {
    display: flex;
}

.image-preview-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
}

/* === 角色详情卡片（游戏内） === */
.character-detail-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    max-width: 500px;
    margin: 0 auto;
}

.character-detail-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent-gold);
    margin-bottom: 16px;
    box-shadow: 0 0 20px rgba(212, 160, 23, 0.3);
}

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

.character-detail-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--accent-gold);
}

.character-detail-desc {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.8;
    max-width: 400px;
}

/* === 游戏结束公告 === */
.game-end-announcement {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.game-end-icon {
    font-size: 64px;
    color: var(--accent-gold);
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

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

.game-end-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.game-end-result {
    font-size: 20px;
    font-weight: 600;
    color: var(--accent-gold);
    padding: 12px 32px;
    background: var(--accent-gold-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--accent-gold);
    margin-bottom: 12px;
}

.game-end-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

/* === 投票禁用状态 === */
.vote-card.vote-disabled {
    cursor: default;
    opacity: 0.7;
}

.vote-card.vote-disabled:hover {
    border-color: var(--border-color);
    background: var(--bg-card);
    transform: none;
}

/* === 主持人操作区域 === */
.player-host-actions {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 8px;
}

.player-host-actions .player-kick-btn {
    flex-shrink: 0;
    font-size: 11px;
    padding: 4px 8px;
    color: var(--accent-red);
}

.player-host-actions .player-kick-btn:hover {
    background: var(--accent-red-light);
    color: var(--accent-red);
}

/* === 剧本页面标题 === */
.script-page-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* === 响应式 === */
@media (max-width: 768px) {
    .nav-container {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        gap: 12px;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        order: 3;
    }

    .nav-links.show {
        display: flex;
    }

    .nav-link {
        padding: 10px 16px;
    }

    .nav-right {
        order: 2;
        margin-left: auto;
    }

    .nav-search input {
        width: 120px;
    }

    .mobile-menu-btn {
        display: block;
    }

    .script-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

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

    .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .detail-cover {
        width: 200px;
        height: 267px;
    }

    .detail-meta {
        justify-content: center;
    }

    .detail-actions {
        justify-content: center;
    }

    .game-container {
        flex-direction: column;
    }

    .game-sidebar-left,
    .game-sidebar-right {
        width: 100%;
        max-height: 200px;
    }

    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        padding: 10px 0;
        display: flex;
        overflow-x: auto;
    }

    .admin-nav-item {
        white-space: nowrap;
        padding: 8px 16px;
        border-right: none;
    }

    .admin-nav-item.active {
        border-right: none;
        border-bottom: 3px solid var(--accent-gold);
    }

    .banner-slider {
        aspect-ratio: 16 / 9;
    }
}

@media (max-width: 480px) {
    .script-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .nav-search {
        display: none;
    }

    .auth-card {
        padding: 24px;
    }
}
