:root {
    /* Cyber/Neon Premium Dark Palette */
    --primary-color: #FFB6C1;
    /* Neon Cyan */
    --primary-hover: #FF8DA1;
    --secondary-color: #DDA0DD;
    /* Electric Purple */
    --secondary-hover: #C8A2C8;
    --danger-color: #E57373;
    --success-color: #98D8C8;
    --warning-color: #FFE082;

    /* Backgrounds */
    --bg-dark: #1A1520;
    /* Deep Void */
    --bg-medium: #251E2D;
    --bg-light: #332A3D;
    --bg-glass: rgba(45, 35, 50, 0.7);
    --bg-glass-light: rgba(55, 45, 60, 0.6);

    /* Text */
    --text-light: #F5E6D3;
    --text-dim: #C4B5C0;
    --text-dark: #1A1520;
    --text-muted: #8B7D8B;

    /* Borders & Effects */
    --border-color: rgba(255, 182, 193, 0.15);
    --border-highlight: rgba(255, 182, 193, 0.4);
    --shame-color: #FF69B4;
    /* Neon Pink */

    /* Shadows & Glows */
    --shadow-sm: 0 4px 12px rgba(26, 21, 32, 0.4);
    --shadow-lg: 0 20px 40px rgba(26, 21, 32, 0.6);
    --glow-primary: 0 0 20px rgba(255, 182, 193, 0.4);
    --glow-secondary: 0 0 20px rgba(221, 160, 221, 0.4);

    /* Animation timing */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: radial-gradient(circle at top right, #332A3D 0%, #1A1520 100%);
    background-attachment: fixed;
    color: var(--text-light);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 只在游戏画面禁用body滚动 */
body.game-active {
    overflow: hidden;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    overflow-y: auto;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
    /* 居中显示 */
    padding-top: 40px;
    padding-bottom: 40px;
    animation: fadeIn var(--transition-smooth);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.container {
    background: var(--bg-glass);
    border-radius: 20px;
    padding: 40px;
    max-width: 480px;
    /* 登录/注册常用尺寸调整 */
    width: 100%;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 182, 193, 0.1);
    margin: auto;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--border-highlight), transparent);
    opacity: 0.7;
}

.game-title {
    font-size: 3em;
    text-align: center;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #FFB6C1 0%, #DDA0DD 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(255, 182, 193, 0.2);
    font-weight: 800;
    letter-spacing: -1.5px;
}

.game-subtitle {
    text-align: center;
    margin-bottom: 40px;
    color: var(--text-dim);
    font-size: 1.05em;
    font-weight: 400;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.btn {
    padding: 14px 28px;
    border: 1px solid transparent;
    border-radius: 14px;
    font-size: 1em;
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 600;
    margin-top: 15px;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 1;
}

/* 针对特定独立页面的主表单/菜单恢复按钮的占满全宽和居中（修复侧栏样式更新导致的溢出问题副作用） */
.auth-form .btn,
.admin-login-container .btn,
#start-screen .container>.btn,
.modal-content>.btn {
    width: 100%;
}

/* 按钮涟漪效果 */
.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    z-index: -1;
    transition: transform 0.6s ease;
}

.btn:hover::after {
    transform: translateX(100%);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #FF8DA1);
    color: var(--text-dark);
    box-shadow: 0 4px 15px rgba(255, 182, 193, 0.2);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 182, 193, 0.4);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 182, 193, 0.05);
    color: var(--text-light);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 182, 193, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #F5E6D3;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #FFE082;
    border: 1px solid rgba(245, 158, 11, 0.3);
    backdrop-filter: blur(10px);
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.25);
    border-color: rgba(245, 158, 11, 0.5);
    color: #fcd34d;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    backdrop-filter: blur(10px);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

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

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
    width: auto;
    margin: 0 5px;
}

.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dim);
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-glass-light);
    color: var(--text-light);
    font-size: 1em;
    transition: all var(--transition-base);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(255, 182, 193, 0.15), inset 0 0 10px rgba(255, 182, 193, 0.05);
    background: rgba(55, 45, 60, 0.8);
}

.form-group small {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.85em;
}

.role-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.role-card {
    background: rgba(255, 182, 193, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 25px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-smooth);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.role-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px transparent;
    transition: box-shadow var(--transition-base);
}

.role-card:hover {
    background: rgba(255, 182, 193, 0.06);
    transform: translateY(-4px);
}

.role-card:hover::after {
    box-shadow: inset 0 0 0 1px rgba(255, 182, 193, 0.4);
}

.role-card.selected {
    background: rgba(255, 182, 193, 0.08);
    border-color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(255, 182, 193, 0.2);
}

.role-card.selected::after {
    box-shadow: inset 0 0 0 2px var(--primary-color);
}

.role-card h3 {
    margin-bottom: 10px;
    color: var(--text-dim);
    font-size: 1.25em;
    transition: color var(--transition-base);
}

.role-card.selected h3 {
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(255, 182, 193, 0.5);
}

.role-card p {
    color: var(--text-muted);
    font-size: 0.9em;
    transition: color var(--transition-base);
}

.role-card.selected p {
    color: var(--text-light);
}

/* 遊戲畫面 */
#game-screen.active {
    display: flex;
    flex-direction: column;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    align-items: stretch;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
}

.status-bar {
    background: var(--bg-glass);
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(26, 21, 32, 0.4);
    height: 80px;
    flex: 0 0 80px;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.player-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.player-name {
    font-size: 1.4em;
    font-weight: 800;
    background: linear-gradient(90deg, #F5E6D3 0%, #E8D5C4 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 15px rgba(255, 182, 193, 0.25);
    letter-spacing: 0.5px;
}

.player-role {
    background: rgba(221, 160, 221, 0.15);
    color: var(--secondary-color);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    border: 1px solid rgba(221, 160, 221, 0.4);
    font-weight: 700;
    text-shadow: 0 0 10px rgba(221, 160, 221, 0.4);
    box-shadow: inset 0 0 10px rgba(221, 160, 221, 0.1);
}

.stats {
    flex: 1;
    max-width: 300px;
    margin: 0 20px;
}

.game-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.auto-save-indicator {
    font-size: 0.85em;
    color: var(--success-color);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(152, 216, 200, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(152, 216, 200, 0.2);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.auto-save-indicator.saving {
    color: var(--primary-color);
    background: rgba(255, 182, 193, 0.1);
    border-color: rgba(255, 182, 193, 0.3);
    animation: neonPulse 1.5s infinite alternate;
}

@keyframes neonPulse {
    from {
        box-shadow: 0 0 5px rgba(255, 182, 193, 0.1), inset 0 0 5px rgba(255, 182, 193, 0.1);
    }

    to {
        box-shadow: 0 0 15px rgba(255, 182, 193, 0.4), inset 0 0 10px rgba(255, 182, 193, 0.2);
    }
}

.stat {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-label {
    min-width: 60px;
    font-size: 0.9em;
    color: var(--text-dim);
    font-weight: 600;
    letter-spacing: 1px;
}

.stat-bar {
    flex: 1;
    height: 12px;
    background: rgba(255, 182, 193, 0.05);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 182, 193, 0.1);
    box-shadow: inset 0 2px 4px rgba(26, 21, 32, 0.4);
}

.stat-fill {
    height: 100%;
    transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    border-radius: 6px;
    position: relative;
}

.stat-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(200%);
    }
}

.shame-fill {
    background: linear-gradient(90deg, #DDA0DD, var(--shame-color));
    box-shadow: 0 0 10px var(--shame-color);
}

.stat-value {
    min-width: 35px;
    text-align: right;
    font-weight: 800;
    color: var(--text-light);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}

.game-content {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    gap: 0;
    overflow: hidden;
    height: calc(100vh - 70px);
    position: relative;
}

.sidebar,
.sidebar-right {
    background: var(--bg-glass-light);
    padding: 24px;
    overflow-y: scroll !important;
    overflow-x: hidden;
    border-right: 1px solid var(--border-color);
    height: 100%;
    -webkit-overflow-scrolling: touch;
    z-index: 5;
    position: relative;
    pointer-events: auto;
    backdrop-filter: blur(15px);
}

.sidebar-right {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

/* 隐藏侧边栏滚动条但保留滚动效果 */
.sidebar::-webkit-scrollbar,
.sidebar-right::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.sidebar-right::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.sidebar-right::-webkit-scrollbar-thumb {
    background: rgba(255, 182, 193, 0.1);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.sidebar-right::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.location-panel,
.npc-panel {
    margin-bottom: 35px;
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.location-panel h3,
.npc-panel h3,
.npc-detail h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
    border-bottom: 1px solid rgba(255, 182, 193, 0.2);
    padding-bottom: 10px;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 182, 193, 0.3);
}

.current-location {
    background: linear-gradient(135deg, rgba(55, 45, 60, 0.8), rgba(45, 35, 50, 0.9));
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 700;
    border: 1px solid rgba(255, 182, 193, 0.15);
    box-shadow: 0 8px 16px rgba(26, 21, 32, 0.4), inset 0 1px 0 rgba(255, 182, 193, 0.05);
    color: var(--primary-color);
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.current-location::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 182, 193, 0.5), transparent);
}

.npc-item {
    background: rgba(255, 182, 193, 0.02);
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid rgba(255, 182, 193, 0.05);
    position: relative;
    z-index: 10;
    pointer-events: auto;
    margin-bottom: 4px;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    gap: 8px;
}

.npc-item:hover {
    background: rgba(255, 182, 193, 0.06);
    border-color: rgba(255, 182, 193, 0.1);
    transform: translateX(3px);
}

.npc-item.active {
    border-color: var(--secondary-color);
    background: rgba(221, 160, 221, 0.1);
    box-shadow: 0 2px 8px rgba(221, 160, 221, 0.15), inset 0 0 0 1px var(--secondary-color);
}

.npc-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(221, 160, 221, 0.3);
    flex-shrink: 0;
    background: rgba(15, 23, 42, 0.8);
}

/* Force list avatars to stay small regardless of other rules */
.npc-item .npc-avatar {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    margin-bottom: 0 !important;
}

.npc-avatar-fallback {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    color: var(--text-light);
    border: 1.5px solid rgba(221, 160, 221, 0.3);
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(221, 160, 221, 0.2), rgba(152, 216, 200, 0.2));
}

.npc-item-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.npc-name {
    font-weight: 600;
    margin-bottom: 1px;
    color: var(--text-light);
    letter-spacing: 0.2px;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.npc-affection {
    font-size: 0.7em;
    color: var(--secondary-color);
    font-weight: 500;
    white-space: nowrap;
}

.main-area {
    display: flex;
    flex-direction: column;
    background: var(--bg-medium);
    height: 100%;
    overflow: hidden;
    position: relative;
    z-index: 0;
    box-shadow: inset 0 0 30px rgba(26, 21, 32, 0.4);
}

.chat-container {
    flex: 1;
    padding: 24px;
    overflow-y: scroll;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    scroll-behavior: smooth;
}

/* 隐藏对话区滚动条 */
.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(255, 182, 193, 0.1);
    border-radius: 3px;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
}

.welcome-message h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.message {
    margin-bottom: 24px;
    padding: 16px 20px;
    border-radius: 18px;
    max-width: 85%;
    animation: slideIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    line-height: 1.7;
    position: relative;
    box-shadow: 0 4px 15px rgba(26, 21, 32, 0.2);
    font-size: 1.05em;
    letter-spacing: 0.3px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 流式输出样式 */
.message.streaming .message-content {
    position: relative;
}

.message.streaming .message-content::after {
    content: '▊';
    animation: blink 1s infinite;
    margin-left: 2px;
    color: var(--primary-color);
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

.typing-indicator {
    color: #8B7D8B;
    font-style: italic;
}

/* 思考过程样式 */
.thinking-process {
    background: rgba(152, 216, 200, 0.15);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    border-left: 4px solid #98D8C8;
    overflow: hidden;
    transition: opacity 0.5s, max-height 0.5s;
    max-height: 300px;
    overflow-y: auto;
}

.thinking-process::before {
    content: '💭 AI思考过程';
    display: block;
    color: #98D8C8;
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.thinking-content {
    color: #C4B5C0;
    font-size: 0.85em;
    font-style: italic;
    line-height: 1.5;
}

.message.system {
    background: rgba(255, 182, 193, 0.03);
    border: 1px solid var(--border-color);
    margin: 30px auto;
    max-width: 90%;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.9em;
    backdrop-filter: blur(5px);
}

.message.ai {
    background: rgba(221, 160, 221, 0.05);
    /* 微弱的紫色光晕 */
    border-bottom-left-radius: 4px;
    margin-right: auto;
    border: 1px solid rgba(221, 160, 221, 0.15);
    color: var(--text-light);
    box-shadow: 0 4px 15px rgba(26, 21, 32, 0.2), inset 0 0 20px rgba(221, 160, 221, 0.05);
}

.message.ai .message-header {
    color: var(--secondary-color);
    text-shadow: 0 0 8px rgba(221, 160, 221, 0.5);
}

.message.player {
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.08), rgba(255, 141, 161, 0.03));
    border-bottom-right-radius: 4px;
    margin-left: auto;
    border: 1px solid rgba(255, 182, 193, 0.15);
    color: var(--text-light);
    box-shadow: 0 4px 15px rgba(26, 21, 32, 0.2), inset 0 0 20px rgba(255, 182, 193, 0.02);
}

.message.player .message-header {
    color: var(--primary-color);
    text-shadow: 0 0 8px rgba(255, 182, 193, 0.5);
}

.message-header {
    font-weight: 800;
    margin-bottom: 8px;
    font-size: 0.9em;
    letter-spacing: 1px;
    opacity: 0.95;
    text-transform: uppercase;
}

.options-container {
    padding: 24px 30px;
    border-top: 1px solid rgba(255, 182, 193, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    max-height: 240px;
    overflow-y: auto;
    flex: 0 0 auto;
    background: rgba(26, 21, 32, 0.8);
    position: relative;
    z-index: 10;
    backdrop-filter: blur(30px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -10px 30px rgba(26, 21, 32, 0.4);
}

.options-container.collapsed {
    max-height: 0;
    padding: 0;
    border-top: none;
    overflow: hidden;
    opacity: 0;
}

.options-toggle-btn {
    position: absolute;
    right: 20px;
    top: -45px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.options-toggle-btn:hover {
    background: var(--primary-color);
    color: #F5E6D3;
}

.options-toggle-btn.collapsed svg {
    transform: rotate(180deg);
}

.option-btn {
    flex: 1;
    min-width: 220px;
    padding: 16px 24px;
    background: rgba(255, 182, 193, 0.03);
    border: 1px solid rgba(255, 182, 193, 0.1);
    border-radius: 12px;
    color: var(--text-light);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: left;
    font-size: 0.95em;
    line-height: 1.6;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.option-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent, rgba(255, 182, 193, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.option-btn:hover {
    background: rgba(255, 182, 193, 0.15);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(26, 21, 32, 0.4);
}

.option-btn:hover::after {
    transform: translateX(100%);
}

.option-btn.平常 {
    border-color: rgba(255, 182, 193, 0.4);
    background: rgba(255, 182, 193, 0.05);
}

.option-btn.平常:hover {
    border-color: var(--primary-color);
    background: rgba(255, 182, 193, 0.15);
    box-shadow: 0 0 15px rgba(255, 182, 193, 0.2);
}

.option-btn.激进 {
    border-color: rgba(229, 115, 115, 0.4);
    background: rgba(229, 115, 115, 0.05);
}

.option-btn.激进:hover {
    border-color: var(--danger-color);
    background: rgba(229, 115, 115, 0.15);
    box-shadow: 0 0 15px rgba(229, 115, 115, 0.2);
}

.option-btn.调皮 {
    border-color: rgba(221, 160, 221, 0.4);
    background: rgba(221, 160, 221, 0.05);
}

.option-btn.调皮:hover {
    border-color: var(--secondary-color);
    background: rgba(221, 160, 221, 0.15);
    box-shadow: 0 0 15px rgba(221, 160, 221, 0.2);
}

.loading-options {
    text-align: center;
    padding: 20px;
    color: #8B7D8B;
    font-style: italic;
}

.loading-options small {
    display: block;
    margin-top: 8px;
    font-size: 0.85em;
    color: #8B7D8B;
}

/* 选项槽位 */
.option-slot {
    flex: 1;
    min-width: 200px;
    margin-bottom: 10px;
}

.option-generating {
    padding: 15px 20px;
    background: rgba(255, 182, 193, 0.05);
    border: 1px solid rgba(255, 182, 193, 0.3);
    border-radius: 12px;
    text-align: center;
    color: var(--primary-color);
    font-weight: 700;
    box-shadow: inset 0 0 10px rgba(255, 182, 193, 0.1);
    letter-spacing: 1px;
}

.option-pending {
    padding: 15px 20px;
    background: rgba(255, 182, 193, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    text-align: center;
    color: var(--text-dim);
    font-style: italic;
    letter-spacing: 1px;
}

/* 选项流式生成中的样式 */
.option-streaming {
    opacity: 0.9;
    pointer-events: none;
    animation: optionPulse 1s infinite;
}

@keyframes optionPulse {

    0%,
    100% {
        opacity: 0.9;
    }

    50% {
        opacity: 1;
    }
}

/* 右侧滑入动画 */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(50px);
    }
}

/* 新手引导（指向右侧菜单按钮） */
.newbie-guide {
    position: fixed;
    right: 90px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1002;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: guideFloat 2s infinite;
}

@keyframes guideFloat {

    0%,
    100% {
        transform: translateY(-50%) translateX(0);
        right: 90px;
    }

    50% {
        transform: translateY(-50%) translateX(-5px);
        right: 95px;
    }
}

.guide-arrow {
    font-size: 2.5em;
    color: var(--primary-color);
    text-shadow: 0 0 20px rgba(152, 216, 200, 0.8);
    animation: arrowBlink 1.5s infinite;
    line-height: 1;
    margin-left: 5px;
}

@keyframes arrowBlink {

    0%,
    100% {
        opacity: 1;
        transform: translateX(0);
    }

    50% {
        opacity: 0.7;
        transform: translateX(5px);
    }
}

.guide-text {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    padding: 12px 18px;
    border-radius: 10px;
    color: #F5E6D3;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.5);
    animation: guidePulse 1.5s infinite;
    white-space: nowrap;
    font-size: 0.95em;
}

@keyframes guidePulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(99, 102, 241, 0.5);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(99, 102, 241, 0.7);
    }
}

.guide-text small {
    display: block;
    margin-top: 3px;
    font-weight: normal;
    font-size: 0.8em;
    opacity: 0.95;
}

/* 首次NPC选择样式优化 */
.first-npc-modal-bg {
    background: transparent !important;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 80px;
}

.first-npc-modal {
    max-width: 420px;
    width: 420px;
    box-shadow: 0 10px 40px rgba(26, 21, 32, 0.4);
    animation: slideInRight 0.5s ease-out;
    position: relative;
}

.loading-dots::after {
    content: '...';
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {

    0%,
    20% {
        content: '.';
    }

    40% {
        content: '..';
    }

    60%,
    100% {
        content: '...';
    }
}

.punishment-warning {
    text-align: center;
    padding: 20px;
    color: #f87171;
    font-weight: bold;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    border: 2px solid rgba(239, 68, 68, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.02);
    }
}

.btn.disabled,
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn.disabled:hover,
.btn:disabled:hover {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    transform: none !important;
}

.input-area {
    padding: 15px 20px;
    border-top: 2px solid var(--border-color);
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
    background: rgba(30, 27, 75, 0.95);
    position: relative;
    z-index: 0;
    align-items: flex-start;
}

.input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.input-area textarea {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: rgba(30, 27, 75, 0.5);
    color: var(--text-light);
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
}

.input-area textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(30, 27, 75, 0.7);
}

.input-area input {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: rgba(30, 27, 75, 0.5);
    color: var(--text-light);
    font-size: 1em;
}

.btn-send {
    width: 100%;
    padding: 10px 20px;
    margin: 0;
}

.btn-generate-options {
    padding: 10px 16px;
    font-size: 0.9em;
    width: auto;
    white-space: nowrap;
    min-width: 120px;
    margin: 0;
    background: rgba(139, 92, 246, 0.3);
    border: 2px solid var(--secondary-color);
    color: var(--text-light);
}

.btn-generate-options:hover:not(:disabled) {
    background: rgba(139, 92, 246, 0.5);
    border-color: var(--primary-color);
}

.btn-generate-options:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.npc-detail {
    background: rgba(76, 29, 149, 0.3);
    padding: 20px;
    border-radius: 12px;
    position: relative;
    /* 确保不脱离文档流 */
    z-index: 1;
}

.npc-detail .placeholder {
    color: #8B7D8B;
    text-align: center;
    padding: 20px;
}

.npc-detail-content {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.npc-detail-content .npc-avatar,
.npc-card .npc-avatar {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4em;
}

.npc-info-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 182, 193, 0.1);
}

.npc-info-label {
    font-size: 0.9em;
    color: #8B7D8B;
    margin-bottom: 5px;
}

.npc-info-value {
    font-weight: bold;
}

.affection-bar {
    height: 10px;
    background: rgba(26, 21, 32, 0.3);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 5px;
}

.affection-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFE082, #FFE082);
    border-radius: 5px;
    transition: width 0.5s ease-in-out;
}

.no-affection-hint {
    margin-top: 5px;
    font-size: 0.85em;
    color: #8B7D8B;
    font-style: italic;
}

.npc-affection-display {
    transition: color 0.3s;
}

.npc-item .affection-value {
    transition: all 0.3s;
    display: inline-block;
}

/* 模態框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 21, 32, 0.85);
    /* 更深的遮罩 */
    backdrop-filter: blur(10px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
    animation: fadeIn var(--transition-base);
}

.modal-content {
    background: rgba(45, 35, 50, 0.85);
    padding: 40px;
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid rgba(255, 182, 193, 0.2);
    box-shadow: 0 0 30px rgba(26, 21, 32, 0.6), inset 0 0 20px rgba(255, 182, 193, 0.05);
    backdrop-filter: blur(20px);
    box-sizing: border-box;
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 30px;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 182, 193, 0.3);
}

.location-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.location-card {
    background: rgba(255, 182, 193, 0.03);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 182, 193, 0.1);
    cursor: pointer;
    transition: all var(--transition-smooth);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.location-card::after {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 0 1px transparent;
    transition: box-shadow var(--transition-base);
    border-radius: inherit;
}

.location-card:hover {
    background: rgba(255, 182, 193, 0.05);
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(26, 21, 32, 0.4);
}

.location-card:hover::after {
    box-shadow: inset 0 0 0 1px rgba(255, 182, 193, 0.4);
}

.location-card h4 {
    color: var(--text-light);
    margin-bottom: 10px;
    transition: color var(--transition-base);
}

.location-card:hover h4 {
    color: var(--primary-color);
}

.location-card p {
    font-size: 0.9em;
    color: var(--text-muted);
}

/* NPC资料网格 */
.npc-profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
    overflow: visible;
    width: 100%;
}

.npc-profile-card {
    background: rgba(255, 182, 193, 0.03);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 182, 193, 0.1);
    transition: all var(--transition-smooth);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.npc-profile-card:hover {
    border-color: var(--secondary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(26, 21, 32, 0.4), inset 0 0 15px rgba(221, 160, 221, 0.1);
    background: rgba(221, 160, 221, 0.05);
}

.npc-profile-card.selectable {
    cursor: pointer;
}

.npc-profile-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    margin: 0 auto 15px;
    font-weight: bold;
    box-shadow: 0 0 15px rgba(221, 160, 221, 0.5);
    border: 2px solid rgba(255, 182, 193, 0.1);
}

.npc-profile-info {
    text-align: center;
}

.npc-profile-name {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.npc-profile-detail {
    font-size: 0.85em;
    color: #c7d2fe;
    margin: 6px 0;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 182, 193, 0.1);
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.npc-profile-detail:last-child {
    border-bottom: none;
}

.npc-profile-detail strong {
    color: #a5b4fc;
    margin-right: 5px;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .npc-profiles-grid {
        grid-template-columns: 1fr;
    }

    .npc-profile-card {
        padding: 15px;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }

    /* 移动端：首次NPC选择居中 */
    .first-npc-modal-bg {
        padding-right: 0 !important;
        justify-content: center !important;
    }

    .first-npc-modal {
        max-width: 90% !important;
        width: 90% !important;
    }

    /* 移动端：引导提示调整 */
    .newbie-guide {
        right: 80px;
        top: 50%;
        transform: translateY(-50%);
        flex-direction: row;
    }

    @keyframes guideFloat {

        0%,
        100% {
            transform: translateY(-50%) translateX(0);
            right: 80px;
        }

        50% {
            transform: translateY(-50%) translateX(-5px);
            right: 85px;
        }
    }

    .guide-arrow {
        font-size: 2em;
    }

    .guide-text {
        font-size: 0.85em;
        padding: 10px 15px;
    }
}

/* 載入動畫 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

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

/* 滾動條美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 182, 193, 0.1);
    border-radius: 4px;
    border: 2px solid var(--bg-dark);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 182, 193, 0.4);
}

/* 移动端菜单按钮（改为右侧中心） */
.mobile-menu-btn {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border: 3px solid rgba(255, 255, 255, 0.2);
    color: #F5E6D3;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    z-index: 1001;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    pointer-events: auto;
}

.mobile-menu-btn:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.7);
}

.mobile-menu-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.menu-icon {
    display: block;
    line-height: 1;
}

/* 移动端遮罩层 - 完全禁用 */
.mobile-overlay {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* 即使有active类也不显示（桌面端） */
@media (min-width: 769px) {

    .mobile-overlay,
    .mobile-overlay.active {
        display: none !important;
        pointer-events: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
}

/* 移动端才显示遮罩层 */
@media (max-width: 768px) {
    .mobile-overlay.active {
        display: block !important;
        pointer-events: auto !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(26, 21, 32, 0.4);
        z-index: 997;
    }
}

/* 響應式設計 */
@media (max-width: 1200px) {
    .game-content {
        grid-template-columns: 200px 1fr;
    }

    .sidebar-right {
        display: none !important;
    }
}

@media (max-width: 768px) {

    /* 显示移动端菜单按钮 */
    .mobile-menu-btn {
        display: flex;
    }

    #game-screen.active {
        height: 100vh;
        height: -webkit-fill-available;
    }

    .game-content {
        grid-template-columns: 1fr;
    }

    /* 侧边栏默认隐藏，通过类控制显示 */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        height: 100vh;
        z-index: 998;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(26, 21, 32, 0.4);
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
        pointer-events: auto;
    }

    .sidebar.mobile-active {
        left: 0;
        z-index: 999;
    }

    .status-bar {
        flex-wrap: wrap;
        padding: 10px 15px;
    }

    .player-info {
        width: 100%;
        justify-content: space-between;
        margin-bottom: 8px;
    }

    .stats {
        width: 100%;
        max-width: none;
        margin: 0;
    }

    .game-controls {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 8px;
    }

    .auto-save-indicator {
        font-size: 0.85em;
    }

    /* 优化选项按钮 */
    .options-container {
        flex-direction: column;
        max-height: 180px;
    }

    .option-btn {
        min-width: 100%;
        margin-bottom: 8px;
    }

    /* 优化输入区 */
    .input-area {
        flex-direction: column;
    }

    .input-wrapper {
        width: 100%;
    }

    .input-area textarea {
        width: 100%;
        margin-bottom: 8px;
    }

    .input-area input {
        width: 100%;
        margin-bottom: 8px;
    }

    .input-area .btn-send {
        width: 100%;
    }

    .input-area .btn-generate-options {
        width: 100%;
        min-width: auto;
    }

    /* 优化聊天容器 */
    .chat-container {
        padding: 15px;
    }

    .message {
        max-width: 90%;
        font-size: 0.95em;
    }

    /* 优化NPC列表 */
    .npc-item {
        padding: 10px;
        z-index: 100;
    }

    .sidebar {
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* 优化地点卡片 */
    .location-grid {
        grid-template-columns: 1fr;
    }

    .location-card {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px;
    }

    .game-title {
        font-size: 2em;
    }

    .role-selection {
        grid-template-columns: 1fr;
    }

    .status-bar {
        font-size: 0.9em;
    }

    .mobile-menu-btn {
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .mobile-menu-btn:hover {
        transform: translateY(-50%) scale(1.05);
    }

    .mobile-menu-btn:active {
        transform: translateY(-50%) scale(0.95);
    }

    .chat-container {
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .main-area {
        overflow: hidden !important;
    }
}


/* 移动端状态悬浮窗 */
.mobile-status-float {
    display: none;
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: 0 0 12px 12px;
    border: 1px solid var(--border-color);
    border-top: none;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

.mobile-status-float.collapsed .mobile-status-content {
    max-height: 0;
    padding: 0 15px;
    overflow: hidden;
}

.mobile-status-float.collapsed .mobile-status-toggle svg {
    transform: rotate(180deg);
}

.mobile-status-toggle {
    padding: 8px;
    text-align: center;
    cursor: pointer;
    color: var(--text-dim);
    transition: var(--transition-fast);
}

.mobile-status-toggle:active {
    background: rgba(255, 182, 193, 0.05);
}

.mobile-status-toggle svg {
    transition: var(--transition-base);
}

.mobile-status-content {
    max-height: 200px;
    padding: 10px 15px 15px;
    transition: all var(--transition-base);
    overflow: hidden;
}

.mobile-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.mobile-stat:last-child {
    border-bottom: none;
}

.mobile-stat-label {
    font-size: 13px;
    color: var(--text-dim);
}

.mobile-stat-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
}

@media (max-width: 768px) {
    .mobile-status-float {
        display: block;
    }
}
