/* =============================================
   艾斯特拉 RPG · 世界的叙述者
   Classic JRPG Fantasy Theme
   ============================================= */

/* 基础重置与字体（字体由 HTML <link> 异步加载，避免阻塞渲染） */

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

:root {
    --bg-primary: #0a0e12;
    --bg-secondary: #111820;
    --bg-tertiary: #162028;
    --bg-card: #1a2530;
    --gold: #d4af37;
    --gold-dim: #9a7b2c;
    --gold-glow: rgba(212, 175, 55, 0.15);
    --gold-light: #e8c84a;
    --text-primary: #e8e4dc;
    --text-secondary: #b8b4ac;
    --text-muted: #8a9199;
    --text-dim: #5a6068;
    --hp-red: #c44c4c;
    --hp-red-dark: #8b2a2a;
    --hp-red-glow: rgba(196, 76, 76, 0.3);
    --mp-blue: #4c7cc4;
    --mp-blue-dark: #2a4a8b;
    --mp-blue-glow: rgba(76, 124, 196, 0.3);
    --xp-green: #4caf50;
    --xp-green-dark: #2e7d32;
    --border-color: #2a3540;
    --border-gold: rgba(212, 175, 55, 0.3);
    --shadow: rgba(0, 0, 0, 0.5);
    --danger: #e74c3c;
    --success: #2ecc71;
    --orange: #e67e22;
    --serif: 'Noto Serif SC', 'Source Han Serif SC', serif;
    --sans: 'Noto Sans SC', 'Source Han Sans SC', sans-serif;

    /* 间距尺度（4px 基线，留给后续逐步替换硬编码值） */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 20px;
    --s-6: 24px;
    --s-8: 32px;

    /* 字号尺度 */
    --fs-xs: 11px;
    --fs-sm: 12px;
    --fs-base: 13px;
    --fs-md: 14px;
    --fs-lg: 16px;
    --fs-xl: 20px;

    /* 视口高度：移动 Safari 底栏出现时 100vh 会被裁；100dvh 跟随可见视口 */
    --app-vh: 100vh;
    --app-vh: 100dvh;

    --header-h: 56px;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--sans);
    font-weight: 300;
    line-height: 1.6;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(212, 175, 55, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(74, 124, 196, 0.02) 0%, transparent 50%);
}

/* =============================================
   通用类
   ============================================= */
.hidden {
    display: none !important;
}

/* =============================================
   角色创建界面
   ============================================= */
.name-entry-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 50% 30%, rgba(212, 175, 55, 0.05) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 80%, rgba(74, 124, 196, 0.03) 0%, transparent 50%);
    z-index: 1000;
}

.name-entry-container {
    max-width: 480px;
    width: 90%;
    padding: 48px 40px;
    text-align: center;
}

.name-entry-title {
    margin-bottom: 32px;
}

.title-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.name-entry-title h1 {
    font-family: var(--serif);
    font-size: 36px;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 0 40px rgba(212, 175, 55, 0.2), 0 2px 4px rgba(0,0,0,0.5);
    letter-spacing: 4px;
}

.title-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 8px;
    font-family: var(--serif);
    letter-spacing: 2px;
}

.name-entry-divider {
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
    margin: 0 auto 32px;
}

.name-entry-form label {
    display: block;
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-family: var(--serif);
}

.name-entry-form input {
    width: 100%;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 18px;
    font-family: var(--serif);
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
    letter-spacing: 2px;
}

.name-entry-form input:focus {
    border-color: var(--gold-dim);
    background: rgba(212, 175, 55, 0.05);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.1);
}

.name-entry-form input::placeholder {
    color: var(--text-dim);
    font-size: 14px;
}

.start-btn {
    margin-top: 8px;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--gold-dim), var(--gold));
    color: var(--bg-primary);
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-family: var(--serif);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 3px;
    position: relative;
    overflow: hidden;
}

.start-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.3);
}

.start-btn:active:not(:disabled) {
    transform: translateY(0);
}

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

.name-entry-hint {
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.8;
}

/* =============================================
   主游戏界面
   ============================================= */
.game-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

.game-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, auto);
    align-items: center;
    gap: 12px 16px;
    padding: 10px 20px;
    background: linear-gradient(180deg, rgba(17, 24, 32, 0.98) 0%, rgba(17, 24, 32, 0.85) 100%);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    min-height: 60px;
    backdrop-filter: blur(8px);
}

.header-left {
    min-width: 0;
}

.header-center {
    justify-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.world-time-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(100, 149, 237, 0.08);
    border: 1px solid rgba(100, 149, 237, 0.35);
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-muted, #9aa8b8);
    font-family: var(--serif);
    max-width: min(420px, 50vw);
}

.world-time-pill span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.world-time-icon {
    flex-shrink: 0;
    font-size: 13px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: end;
}

.game-title {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-pill,
.header-location {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(212, 175, 55, 0.06);
    border: 1px solid var(--border-gold);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: var(--serif);
    max-width: min(360px, 42vw);
}

.location-pill span:last-child,
.header-location span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.location-icon {
    font-size: 15px;
    flex-shrink: 0;
}

.header-player-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    max-width: 180px;
}

.chip-avatar {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(212, 175, 55, 0.05));
    border-radius: 50%;
    font-size: 14px;
    flex-shrink: 0;
}

.chip-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.chip-name {
    font-family: var(--serif);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chip-user {
    font-size: 10px;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(var(--app-vh) - var(--header-h));
}

/* =============================================
   聊天区域
   ============================================= */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--s-5) var(--s-6);
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* 欢迎消息 */
.chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-family: var(--serif);
    line-height: 2;
}

.welcome-icon {
    font-size: 36px;
    margin-bottom: 16px;
    display: block;
}

.chat-welcome p {
    font-size: 14px;
    margin-bottom: 8px;
}

.welcome-subtle {
    color: var(--text-dim);
    font-size: 13px !important;
    font-style: italic;
}

/* 消息气泡 */
.message {
    margin-bottom: 0;
    animation: messageFadeIn 0.4s ease-out;
    max-width: 85%;
}

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

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message.system {
    align-self: center;
    text-align: center;
    max-width: 90%;
}

.message-content {
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.8;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-family: var(--sans);
}

/* Markdown 叙事（助手 / 系统消息） */
.message-content.markdown-body {
    white-space: normal;
}

.message-content.markdown-body > *:first-child {
    margin-top: 0;
}

.message-content.markdown-body > *:last-child {
    margin-bottom: 0;
}

.message-content.markdown-body p {
    margin: 0 0 0.65em;
}

.message-content.markdown-body h1,
.message-content.markdown-body h2,
.message-content.markdown-body h3,
.message-content.markdown-body h4 {
    font-family: var(--serif, var(--sans));
    color: var(--gold-light);
    margin: 0.85em 0 0.45em;
    line-height: 1.35;
    font-weight: 600;
}

.message-content.markdown-body h1 { font-size: 1.25em; }
.message-content.markdown-body h2 { font-size: 1.12em; }
.message-content.markdown-body h3 { font-size: 1.05em; }

.message-content.markdown-body ul,
.message-content.markdown-body ol {
    margin: 0.4em 0 0.65em;
    padding-left: 1.35em;
}

.message-content.markdown-body li {
    margin: 0.2em 0;
}

.message-content.markdown-body blockquote {
    margin: 0.5em 0;
    padding: 0.35em 0.85em;
    border-left: 3px solid rgba(212, 175, 55, 0.45);
    color: var(--text-secondary, var(--text-primary));
    background: rgba(0, 0, 0, 0.15);
    border-radius: 0 6px 6px 0;
}

.message-content.markdown-body code {
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace;
    font-size: 0.9em;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.35);
    color: var(--gold-light);
}

.message-content.markdown-body pre {
    margin: 0.5em 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.message-content.markdown-body pre code {
    padding: 0;
    background: none;
    color: var(--text-primary);
}

.message-content.markdown-body a {
    color: var(--gold-light);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.message-content.markdown-body a:hover {
    color: #fff;
}

.message-content.markdown-body hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.75em 0;
}

.message-content.markdown-body strong {
    color: var(--gold-light);
    font-weight: 600;
}

.message-content.markdown-body em {
    color: var(--text-primary);
    font-style: italic;
}

.message-content.markdown-body table {
    border-collapse: collapse;
    margin: 0.5em 0;
    font-size: 0.92em;
}

.message-content.markdown-body th,
.message-content.markdown-body td {
    border: 1px solid var(--border-color);
    padding: 4px 8px;
}

.message-content.markdown-body th {
    background: rgba(212, 175, 55, 0.1);
}

.message.user .message-content {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), rgba(212, 175, 55, 0.06));
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-bottom-right-radius: 4px;
    color: var(--gold-light);
}

.message.assistant .message-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
    color: var(--text-primary);
}

.message.system .message-content {
    background: rgba(154, 123, 44, 0.08);
    border: 1px solid rgba(154, 123, 44, 0.15);
    border-radius: 8px;
    color: var(--gold-dim);
    font-size: 13px;
    display: inline-block;
    padding: 8px 16px;
}

.message-role {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 4px;
    font-family: var(--sans);
}

.message.user .message-role {
    text-align: right;
}

.message.assistant .message-role {
    text-align: left;
}

/* 加载指示器 */
.loading-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 24px;
    animation: messageFadeIn 0.3s ease-out;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--gold-dim);
    border-radius: 50%;
    animation: dotPulse 1.5s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.3s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes dotPulse {
    0%, 100% {
        transform: scale(0.6);
        opacity: 0.3;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-text {
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--serif);
    font-style: italic;
}

/* 聊天输入区域 */
.chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 24px 16px;
    background: linear-gradient(0deg, var(--bg-primary) 0%, transparent 100%);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-input-area textarea {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--sans);
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    line-height: 1.5;
    max-height: 120px;
}

.chat-input-area textarea:focus {
    border-color: var(--gold-dim);
    background: rgba(212, 175, 55, 0.03);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.05);
}

.chat-input-area textarea::placeholder {
    color: var(--text-dim);
}

.send-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gold-dim), var(--gold));
    border: none;
    border-radius: 10px;
    color: var(--bg-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.send-btn:active {
    transform: translateY(0);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

/* =============================================
   状态面板
   ============================================= */
.status-panel {
    width: 300px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 20px;
}

.status-panel::-webkit-scrollbar {
    width: 4px;
}

.status-panel::-webkit-scrollbar-track {
    background: transparent;
}

.status-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.panel-header h2 {
    font-family: var(--serif);
    font-size: 16px;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 2px;
    margin: 0;
}

.btn-icon-only {
    padding: 7px;
    min-width: 0;
}

.btn-icon-only:hover:not(:disabled) {
    color: var(--gold);
    border-color: var(--border-gold);
}

.player-basic {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 20px;
}

.player-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.level-badge {
    position: absolute;
    top: -6px;
    right: -20px;
    background: linear-gradient(135deg, var(--gold-dim), var(--gold));
    color: var(--bg-primary);
    font-size: 11px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 10px;
    font-family: var(--sans);
}

.avatar-symbol {
    font-size: 36px;
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.2));
}

.player-name-display {
    text-align: center;
}

.player-name-display span:first-child {
    display: block;
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.player-class {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--serif);
}

.stat-bar-container {
    margin-bottom: 12px;
}

.stat-bar-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-family: var(--sans);
}

.stat-bar-label span:first-child {
    font-weight: 500;
}

.stat-bar-label span:last-child {
    font-family: var(--sans);
    font-weight: 400;
}

.stat-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    position: relative;
}

.stat-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 2s infinite;
}

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

.hp-bar .stat-bar-fill {
    background: linear-gradient(90deg, var(--hp-red-dark), var(--hp-red));
    box-shadow: 0 0 8px var(--hp-red-glow);
}

.mp-bar .stat-bar-fill {
    background: linear-gradient(90deg, var(--mp-blue-dark), var(--mp-blue));
    box-shadow: 0 0 8px var(--mp-blue-glow);
}

.xp-bar .stat-bar-fill {
    background: linear-gradient(90deg, var(--xp-green-dark), var(--xp-green));
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

.stats-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: 16px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    font-size: 13px;
}

.stat-icon {
    font-size: 14px;
}

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

.stat-value {
    margin-left: auto;
    color: var(--text-secondary);
    font-weight: 500;
    font-family: var(--sans);
}

.resources {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    font-size: 13px;
}

.resource-icon {
    font-size: 14px;
}

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

.resource-value {
    margin-left: auto;
    color: var(--gold-dim);
    font-weight: 500;
    font-family: var(--sans);
}

/* 装备 */
.equip-section {
    margin-top: 4px;
}

.equip-header {
    font-family: var(--serif);
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.equip-slots {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.equip-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
}

.slot-icon {
    font-size: 14px;
}

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

/* 键盘提示 */
.kbd-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    padding: 2px 6px;
    margin-left: 6px;
    font-family: var(--sans);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.btn-inventory {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
}

.btn-inventory .btn-inventory-icon {
    font-size: 16px;
    line-height: 1;
}

.btn-inventory .kbd-hint {
    margin-left: 4px;
    opacity: 0.85;
}

.btn-commissions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    position: relative;
}

.commissions-badge {
    position: absolute;
    top: 2px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    color: var(--bg-primary, #1a1510);
    background: var(--text-muted);
    border-radius: 999px;
}

.commissions-badge--ready {
    background: var(--gold);
    color: #1a1510;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

/* 委托弹窗 */
.commissions-overlay {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(8px);
    animation: overlayFadeIn 0.25s ease-out;
}

.commissions-panel {
    width: 520px;
    max-width: 96vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-gold);
    border-radius: 14px;
    box-shadow: 0 0 48px rgba(212, 175, 55, 0.12), 0 24px 64px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    animation: messageFadeIn 0.28s ease-out;
}

.commissions-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.08), transparent);
}

.commissions-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.commissions-title-icon {
    font-size: 22px;
}

.commissions-panel-header h2 {
    font-family: var(--serif);
    font-size: 20px;
    color: var(--gold);
    margin: 0;
    letter-spacing: 2px;
}

.commissions-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.commissions-close-btn:hover {
    color: var(--gold);
    border-color: var(--border-gold);
    background: rgba(212, 175, 55, 0.08);
}

.commissions-panel-body {
    padding: 16px 18px 20px;
    overflow-y: auto;
    flex: 1;
}

.commissions-summary-line {
    font-family: var(--serif);
    font-size: 14px;
    color: var(--gold);
    margin: 0 0 8px;
}

.commissions-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 14px;
    line-height: 1.5;
}

.commissions-hint--top {
    margin-bottom: 16px;
}

.commissions-block-title {
    font-family: var(--serif);
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 10px;
    letter-spacing: 1px;
}

.commissions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.commissions-empty,
.commissions-preview-empty {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.6;
}

.commission-card {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.commission-card--ready {
    border-color: rgba(212, 175, 55, 0.45);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.08);
}

.commission-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.commission-card-head h3 {
    font-family: var(--serif);
    font-size: 15px;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.commission-diff {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.commission-reqs {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.commission-reqs li {
    display: grid;
    grid-template-columns: 1fr minmax(80px, 120px) 40px;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.commission-req-name {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.commission-req-bar-wrap {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.commission-req-bar {
    height: 100%;
    background: linear-gradient(90deg, #5a7a4a, #8fbc6a);
    border-radius: 3px;
    transition: width 0.2s ease;
}

.commission-req--done .commission-req-bar {
    background: linear-gradient(90deg, var(--gold), #e8d48a);
}

.commission-req-nums {
    text-align: right;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.commission-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.commission-instance-id {
    font-size: 11px;
    color: var(--text-muted);
    font-family: ui-monospace, monospace;
}

.commission-foot-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-commission-deliver {
    font-size: 12px;
    padding: 6px 12px;
}

.commissions-preview-block {
    margin-bottom: 16px;
}

.commissions-preview-title {
    font-family: var(--serif);
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 8px;
}

.commissions-preview-list {
    margin: 0 0 8px;
    padding-left: 18px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.commissions-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

/* 地图弹窗 */
.map-overlay {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(8px);
    animation: overlayFadeIn 0.25s ease-out;
}

.map-panel {
    width: min(1180px, 96vw);
    height: min(760px, 88vh);
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-gold);
    border-radius: 14px;
    box-shadow: 0 0 48px rgba(212, 175, 55, 0.12), 0 24px 64px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    animation: messageFadeIn 0.28s ease-out;
}

.map-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.08), transparent);
}

.map-title-wrap,
.map-panel-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.map-title-icon {
    font-size: 22px;
}

.map-panel-header h2 {
    font-family: var(--serif);
    font-size: 20px;
    color: var(--gold);
    margin: 0;
    letter-spacing: 2px;
}

.map-scale-label {
    font-size: 12px;
    color: var(--text-muted);
}

.map-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.map-close-btn:hover {
    color: var(--gold);
    border-color: var(--border-gold);
    background: rgba(212, 175, 55, 0.08);
}

.map-legend {
    padding: 10px 18px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
}

.map-stage {
    flex: 1;
    overflow: hidden;
    cursor: grab;
    background:
        radial-gradient(circle at 20% 20%, rgba(212, 175, 55, 0.07), transparent 28%),
        radial-gradient(circle at 80% 70%, rgba(76, 124, 196, 0.06), transparent 30%),
        var(--bg-primary);
    padding: 28px;
    touch-action: none;
}

.map-stage:active {
    cursor: grabbing;
}

.map-grid {
    transform-origin: 0 0;
    display: grid;
    gap: 6px;
    width: max-content;
    min-width: 100%;
    transition: transform 0.08s ease-out;
}

.map-cell {
    width: 96px;
    min-height: 62px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 4px;
    padding: 7px 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.35;
    user-select: none;
}

.map-cell-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: break-word;
    word-break: break-all;
}

.map-cell-coord {
    color: var(--text-dim);
    font-size: 10px;
    flex-shrink: 0;
}

.map-current {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.22);
    color: var(--gold-light);
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.35);
}

.map-neighbor:not(.map-current) {
    border-color: rgba(76, 124, 196, 0.75);
    background: rgba(76, 124, 196, 0.16);
    color: #cfe0ff;
}

/* 背包弹窗 */
.inventory-overlay {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(8px);
    animation: overlayFadeIn 0.25s ease-out;
}

.inventory-panel {
    width: 520px;
    max-width: 96vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-gold);
    border-radius: 14px;
    box-shadow: 0 0 48px rgba(212, 175, 55, 0.12), 0 24px 64px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    animation: messageFadeIn 0.28s ease-out;
}

.inventory-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.08), transparent);
}

.inventory-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inventory-title-icon {
    font-size: 22px;
}

.inventory-panel-header h2 {
    font-family: var(--serif);
    font-size: 20px;
    color: var(--gold);
    margin: 0;
    letter-spacing: 2px;
}

.inventory-kbd {
    margin-left: 0;
}

.inventory-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.inventory-close-btn:hover {
    color: var(--gold);
    border-color: var(--border-gold);
    background: rgba(212, 175, 55, 0.08);
}

.inventory-panel-body {
    padding: 16px 18px 20px;
    overflow-y: auto;
    flex: 1;
}

.inventory-block-title {
    font-family: var(--serif);
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 10px;
    letter-spacing: 1px;
}

.inventory-equip-block {
    margin-bottom: 18px;
}

.inventory-equip-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.inventory-equip-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-height: 72px;
}

.inventory-equip-cell .cell-icon {
    font-size: 18px;
}

.inventory-equip-cell .cell-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.inventory-equip-cell .cell-value {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.35;
    word-break: break-word;
}

.inventory-hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0 0 12px;
    opacity: 0.9;
}

.inventory-groups {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.inventory-group-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--gold-dim);
    letter-spacing: 1px;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
}

.inventory-group-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.inventory-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    transition: border-color 0.15s, background 0.15s;
}

.inventory-item:hover {
    border-color: rgba(212, 175, 55, 0.35);
    background: rgba(212, 175, 55, 0.04);
}

.inventory-item-name {
    color: var(--text-primary);
}

.inventory-item-qty {
    flex-shrink: 0;
    color: var(--gold-dim);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.inventory-empty {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 24px 12px;
    margin: 0;
}

.inventory-buffs-block {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.inventory-buff-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.inventory-buff-list li {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 10px;
    background: rgba(155, 89, 182, 0.08);
    border: 1px solid rgba(155, 89, 182, 0.2);
    border-radius: 6px;
}

/* LLM 设置弹窗 */
.settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 650;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(8px);
    animation: overlayFadeIn 0.25s ease-out;
}

.settings-panel {
    width: 480px;
    max-width: 96vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-gold);
    border-radius: 14px;
    box-shadow: 0 0 48px rgba(212, 175, 55, 0.12), 0 24px 64px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    animation: messageFadeIn 0.28s ease-out;
}

.settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.08), transparent);
}

.settings-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-title-icon {
    font-size: 22px;
}

.settings-panel-header h2 {
    font-family: var(--serif);
    font-size: 20px;
    color: var(--gold);
    margin: 0;
    letter-spacing: 2px;
}

.settings-panel-body {
    padding: 18px 20px 22px;
    overflow-y: auto;
    flex: 1;
}

.settings-intro {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0 0 14px;
}

.settings-source {
    font-size: 12px;
    color: var(--gold-dim);
    margin: 0 0 14px;
    padding: 8px 10px;
    background: rgba(212, 175, 55, 0.06);
    border-radius: 6px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.settings-field {
    margin-bottom: 16px;
}

.settings-field label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.settings-field input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.settings-field input:focus {
    border-color: var(--border-gold);
}

.settings-model-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.settings-model-combo {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.settings-model-combo input {
    flex: 1;
    min-width: 0;
    padding-right: 40px;
}

.settings-model-picker-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: calc(100% - 8px);
    min-height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(212, 175, 55, 0.12);
    color: var(--gold);
    font-size: 11px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.settings-model-picker-btn:hover:not(:disabled) {
    background: rgba(212, 175, 55, 0.22);
}

.settings-model-picker-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.settings-model-picker-btn.is-open {
    background: rgba(212, 175, 55, 0.28);
}

.settings-model-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 20;
    margin: 0;
    padding: 4px 0;
    max-height: 220px;
    overflow-y: auto;
    list-style: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-gold);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.settings-model-dropdown li {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settings-model-dropdown li:hover,
.settings-model-dropdown li.is-active {
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold);
}

.settings-fetch-models-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 10px 12px;
    font-size: 12px;
}

.settings-unsaved {
    font-size: 12px;
    color: #e8c547;
    margin: 0 0 12px;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(232, 197, 71, 0.08);
    border: 1px solid rgba(232, 197, 71, 0.25);
}

.settings-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.45;
    opacity: 0.85;
}

/* ── Streaming toggle in settings ── */
.settings-toggle-field {
    border-top: 1px solid var(--border-muted);
    padding-top: 18px;
    margin-top: 18px;
}

.settings-field .settings-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 0;
    letter-spacing: 0;
}

.settings-field .settings-toggle-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.settings-field .settings-toggle-track {
    flex-shrink: 0;
    width: 44px;
    height: 24px;
    background: var(--surface-raised);
    border: 1px solid var(--border-muted);
    border-radius: 12px;
    position: relative;
    transition: background 0.2s, border-color 0.2s;
}

.settings-field .settings-toggle-label input:checked + .settings-toggle-track {
    background: var(--accent, #4f8);
    border-color: var(--accent, #4f8);
}

.settings-field .settings-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.settings-field .settings-toggle-label input:checked + .settings-toggle-track .settings-toggle-thumb {
    transform: translateX(20px);
}

.settings-field .settings-toggle-text {
    font-weight: 500;
    color: var(--text-primary);
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.settings-actions .btn {
    flex: 1;
    min-width: 120px;
}

.settings-save-btn {
    flex: 1 1 100%;
    margin-top: 4px;
    padding: 12px 16px;
    font-size: 14px;
}

.settings-status {
    margin: 14px 0 0;
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 8px;
}

.settings-status.ok {
    color: #7dcea0;
    background: rgba(39, 174, 96, 0.12);
    border: 1px solid rgba(39, 174, 96, 0.3);
}

.settings-status.err {
    color: #e8a0a0;
    background: rgba(192, 57, 43, 0.12);
    border: 1px solid rgba(192, 57, 43, 0.3);
}

.btn-settings .btn-inventory-icon {
    font-size: 16px;
}

/* =============================================
   战斗覆盖层
   ============================================= */
.battle-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayFadeIn 0.3s ease-out;
}

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

.battle-container {
    width: 650px;
    max-width: 95vw;
    max-height: 90vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-gold);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 0 60px rgba(212, 175, 55, 0.1);
    display: flex;
    flex-direction: column;
}

.battle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--s-4) var(--s-6);
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.08), transparent);
    border-bottom: 1px solid var(--border-gold);
}

.battle-header h2 {
    font-family: var(--serif);
    font-size: 20px;
    color: var(--gold);
    letter-spacing: 2px;
}

.battle-round {
    font-family: var(--serif);
    font-size: 14px;
    color: var(--text-muted);
}

.battle-content {
    padding: var(--s-5) var(--s-6);
    overflow-y: auto;
    max-height: calc(90vh - 60px);
}

/* 敌人卡片 */
.battle-enemy-area {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.enemy-card {
    text-align: center;
    padding: var(--s-5) var(--s-8);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    min-width: 280px;
}

.enemy-sprite {
    font-size: 52px;
    margin-bottom: 8px;
    display: block;
    animation: enemyFloat 2s ease-in-out infinite;
}

@keyframes enemyFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-6px) scale(1.05); }
}

.enemy-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.enemy-name {
    font-family: var(--serif);
    font-size: 20px;
    font-weight: 600;
    color: var(--danger);
    text-shadow: 0 0 20px rgba(231, 76, 60, 0.3);
}

.enemy-level {
    font-size: 13px;
    color: var(--text-muted);
    padding: 2px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.enemy-hp-bar {
    height: 10px;
}

.enemy-hp-bar .stat-bar-fill {
    background: linear-gradient(90deg, #6b2020, var(--hp-red));
    box-shadow: 0 0 12px var(--hp-red-glow);
}

/* 敌人属性预览 */
.enemy-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.enemy-stat strong {
    color: var(--text-secondary);
    margin-left: 3px;
}

/* 战斗日志 */
.battle-log {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    height: 160px;
    overflow-y: auto;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.8;
}

.battle-log::-webkit-scrollbar {
    width: 4px;
}

.battle-log::-webkit-scrollbar-track {
    background: transparent;
}

.battle-log::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.battle-log-entry {
    padding: 2px 0;
    animation: logFadeIn 0.3s ease-out;
}

@keyframes logFadeIn {
    from { opacity: 0; transform: translateX(-5px); }
    to { opacity: 1; transform: translateX(0); }
}

.battle-log-entry.damage {
    color: var(--orange);
}

.battle-log-entry.heal {
    color: var(--success);
}

.battle-log-entry.system {
    color: var(--gold-dim);
}

.battle-log-entry.info {
    color: var(--text-muted);
}

.battle-log-entry.special {
    color: #a855f7;
}

/* 玩家战斗状态 */
.battle-player-status {
    margin-bottom: 12px;
}

.battle-player-name {
    font-family: var(--serif);
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.battle-player-bars .stat-bar-container {
    margin-bottom: 8px;
}

.battle-player-bars .stat-bar-label {
    font-size: 11px;
}

/* 状态效果 */
.battle-effects {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    min-height: 24px;
}

.battle-effect {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 4px;
    font-size: 12px;
    color: #a855f7;
}

.battle-effect.debuff {
    background: rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.2);
    color: var(--danger);
}

/* 战斗按钮 */
.battle-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    justify-content: center;
}

.battle-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--serif);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
    flex: 1;
    max-width: 140px;
}

.battle-btn.attack {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
    border-color: rgba(231, 76, 60, 0.3);
}

.battle-btn.attack:hover {
    background: rgba(231, 76, 60, 0.2);
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.2);
    transform: translateY(-1px);
}

.battle-btn.defend {
    background: rgba(76, 124, 196, 0.1);
    color: var(--mp-blue);
    border-color: rgba(76, 124, 196, 0.3);
}

.battle-btn.defend:hover {
    background: rgba(76, 124, 196, 0.2);
    box-shadow: 0 0 15px rgba(76, 124, 196, 0.2);
    transform: translateY(-1px);
}

.battle-btn.fireball {
    background: rgba(230, 126, 34, 0.1);
    color: var(--orange);
    border-color: rgba(230, 126, 34, 0.3);
}

.battle-btn.fireball:hover {
    background: rgba(230, 126, 34, 0.2);
    box-shadow: 0 0 15px rgba(230, 126, 34, 0.2);
    transform: translateY(-1px);
}

.battle-btn.skill {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
    border-color: rgba(168, 85, 247, 0.3);
}

.battle-btn.skill:hover {
    background: rgba(168, 85, 247, 0.2);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
    transform: translateY(-1px);
}

.battle-btn.flee {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    border-color: var(--border-color);
}

.battle-btn.flee:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.battle-btn.item {
    background: rgba(76, 180, 120, 0.12);
    color: #7dcea0;
    border-color: rgba(76, 180, 120, 0.35);
}

.battle-btn.item:hover {
    background: rgba(76, 180, 120, 0.22);
    transform: translateY(-1px);
}

.battle-picker-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
}

.battle-picker-overlay.hidden {
    display: none;
}

.battle-picker-panel {
    width: min(92%, 360px);
    max-height: 70%;
    overflow: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

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

.battle-picker-header h3 {
    font-family: var(--serif);
    font-size: 18px;
    color: var(--gold-light);
}

.battle-picker-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
}

.battle-picker-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.battle-picker-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 12px 14px;
    text-align: left;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.battle-picker-btn:hover:not(:disabled) {
    background: var(--gold-glow);
    border-color: var(--gold-dim);
}

.battle-picker-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.battle-picker-btn .picker-title {
    font-weight: 600;
}

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

.battle-picker-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 16px 8px;
    font-size: 14px;
}

.battle-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.battle-btn:active:not(:disabled) {
    transform: scale(0.95);
}

/* 键盘快捷键提示 */
.battle-kbd {
    display: inline-block;
    font-family: var(--sans);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    padding: 1px 5px;
    margin-left: 6px;
    vertical-align: middle;
    line-height: 1.4;
}

/* 敌人受击闪烁 */
@keyframes enemyHitFlash {
    0% { filter: brightness(1); }
    30% { filter: brightness(2.5) saturate(0.3); }
    100% { filter: brightness(1); }
}

.enemy-sprite.enemy-hit {
    animation: enemyHitFlash 0.35s ease-out;
}

/* 战斗结果 */
.battle-result {
    text-align: center;
    padding: 24px;
    animation: messageFadeIn 0.5s ease-out;
}

.battle-result.victory h3 {
    font-family: var(--serif);
    font-size: 24px;
    color: var(--gold);
    text-shadow: 0 0 30px rgba(212, 175, 55, 0.3);
    margin-bottom: 8px;
}

.battle-result.defeat h3 {
    font-family: var(--serif);
    font-size: 24px;
    color: var(--danger);
    text-shadow: 0 0 30px rgba(231, 76, 60, 0.3);
    margin-bottom: 8px;
}

.battle-result p {
    color: var(--text-muted);
    font-size: 14px;
}

.battle-result .close-overlay-btn {
    margin-top: 16px;
    padding: 10px 28px;
    font-size: 14px;
    letter-spacing: 1px;
}

/* =============================================
   Toast 提示
   ============================================= */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    animation: messageFadeIn 0.3s ease-out;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--sans);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
    border-left: 3px solid var(--gold-dim);
}

.toast.toast-error {
    border-left-color: var(--danger);
    color: #ffb4ab;
}

.toast.toast-success {
    border-left-color: var(--success);
    color: #a8e6b0;
}

/* =============================================
   响应式设计
   ============================================= */
@media (max-width: 768px) {
    .game-header {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "title actions"
            "location location";
        padding: 10px 14px;
        gap: 8px;
    }

    .header-left {
        grid-area: title;
    }

    .header-center {
        grid-area: location;
        justify-self: stretch;
    }

    .header-actions {
        grid-area: actions;
    }

    .location-pill,
    .world-time-pill {
        max-width: 100%;
        width: 100%;
        justify-content: center;
    }

    .header-player-chip {
        display: none;
    }

    .btn-logout .btn-label {
        display: none;
    }

    .btn-logout {
        padding: 8px 10px;
    }

    .game-main {
        flex-direction: column-reverse;
    }

    .status-panel {
        width: 100%;
        max-height: 38vh;
        border-left: none;
        border-bottom: 1px solid var(--border-color);
        padding: 12px 16px;
        overflow-y: auto;
    }

    .panel-header h2 {
        font-size: 14px;
        padding-bottom: 8px;
        margin-bottom: 10px;
    }

    .player-basic {
        flex-direction: row;
        margin-bottom: 12px;
        gap: 12px;
    }

    .avatar-symbol {
        font-size: 28px;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .resources {
        grid-template-columns: repeat(4, 1fr);
    }

    .equip-slots {
        flex-direction: row;
    }

    .equip-slot {
        flex: 1;
    }

    .chat-messages {
        padding: 12px 16px;
    }

    .chat-input-area {
        padding: 8px 16px 12px;
    }

    .battle-actions {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: var(--s-1);
    }

    .battle-btn {
        min-width: 0;
        padding: 8px 6px;
        font-size: var(--fs-sm);
    }

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

    .name-entry-container {
        padding: 32px 24px;
    }

    .name-entry-title h1 {
        font-size: 28px;
    }

    .battle-container {
        max-height: 95vh;
    }

    .battle-content {
        padding: 16px;
    }

    .enemy-card {
        min-width: auto;
        padding: 16px 20px;
    }

    .battle-log {
        height: 120px;
    }
}

@media (max-width: 480px) {
    .game-header {
        padding: 8px 12px;
        min-height: 52px;
    }

    .game-title {
        font-size: 14px;
        letter-spacing: 1px;
    }

    /* ≤480 时头部按钮全部隐藏文字，只剩图标，避免拥挤 */
    .header-actions .btn-label,
    .header-actions .kbd-hint {
        display: none;
    }

    .header-actions .btn-inventory,
    .header-actions .btn-commissions,
    .header-actions .btn-settings,
    .header-actions .btn-logout {
        padding: 8px 10px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .btn-block {
        width: 100%;
    }

    .status-panel {
        max-height: 32vh;
    }

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

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

    .stat-item, .resource-item {
        font-size: 11px;
        padding: 4px 8px;
    }

    .name-entry-title h1 {
        font-size: 24px;
    }

    .battle-btn {
        min-width: 0;
        padding: 6px 4px;
        font-size: var(--fs-xs);
    }
}

/* 尊重用户「减少动效」偏好（系统级辅助功能开关） */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    .title-icon {
        animation: none !important;
    }
}

/* =============================================
   登录/注册表单
   ============================================= */
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: var(--serif);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

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

.auth-form {
    text-align: left;
    margin-bottom: 16px;
}

.auth-field {
    margin-bottom: 16px;
}

.auth-field label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-family: var(--serif);
}

.auth-field input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--sans);
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.auth-field input:focus {
    border-color: var(--gold-dim);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.1);
}

.auth-field input::placeholder {
    color: var(--text-dim);
}

.auth-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
    font-family: var(--sans);
    animation: messageFadeIn 0.3s ease-out;
}

/* =============================================
   通用按钮
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: all 0.22s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
}

.btn-icon {
    flex-shrink: 0;
}

.btn-label {
    letter-spacing: 0.5px;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.12);
}

.btn-logout:hover:not(:disabled) {
    color: var(--danger);
    border-color: rgba(231, 76, 60, 0.35);
    background: rgba(231, 76, 60, 0.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: linear-gradient(135deg, #a93226, var(--danger));
    border-color: rgba(231, 76, 60, 0.5);
    color: #fff;
    font-family: var(--serif);
    font-weight: 600;
    letter-spacing: 1px;
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.35);
}

.btn-block {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
}

/* 确认弹窗 */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    animation: overlayFadeIn 0.25s ease-out;
}

.modal-card {
    width: 100%;
    max-width: 380px;
    padding: 28px 24px 22px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-gold);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: messageFadeIn 0.3s ease-out;
}

.modal-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.modal-title {
    font-family: var(--serif);
    font-size: 20px;
    color: var(--gold);
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.modal-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 22px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* =============================================
   战斗邀请卡
   ============================================= */
.message.battle-entry {
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

.battle-invite-card {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08), rgba(231, 76, 60, 0.08));
    border: 1px solid var(--border-gold);
    border-radius: 12px;
    padding: 16px 24px;
    text-align: center;
    min-width: 240px;
    animation: messageFadeIn 0.4s ease-out;
}

.battle-invite-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.battle-invite-icon {
    font-size: 24px;
    animation: pulse 1.5s ease-in-out infinite;
}

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

.battle-invite-title {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 2px;
}

.battle-invite-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 14px;
}

.battle-invite-enemy {
    font-family: var(--serif);
    font-size: 16px;
    font-weight: 600;
    color: var(--danger);
}

.battle-invite-level {
    font-size: 13px;
    color: var(--text-muted);
    padding: 2px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.battle-invite-btn {
    padding: 10px 36px;
    background: linear-gradient(135deg, var(--danger), #c0392b);
    border: none;
    border-radius: 8px;
    color: white;
    font-family: var(--serif);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.2);
}

.battle-invite-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 25px rgba(231, 76, 60, 0.4);
}

.battle-invite-btn:active {
    transform: translateY(0);
}

/* =============================================
   叙事选项按钮
   ============================================= */
.message.narrative-choices-entry {
    display: flex;
    justify-content: flex-start;
    padding: 4px 0 12px;
}

.narrative-choices-card {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.06), rgba(52, 152, 219, 0.06));
    border: 1px solid var(--border-gold);
    border-radius: 10px;
    padding: 12px 14px;
    max-width: 100%;
    animation: messageFadeIn 0.35s ease-out;
}

.narrative-choices-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.narrative-choices-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.narrative-choice-btn {
    padding: 8px 14px;
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid var(--border-gold);
    border-radius: 8px;
    color: var(--gold);
    font-family: var(--serif);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    line-height: 1.35;
    max-width: 100%;
}

.narrative-choice-btn:hover:not(:disabled) {
    background: rgba(212, 175, 55, 0.22);
    transform: translateY(-1px);
    box-shadow: 0 2px 12px rgba(212, 175, 55, 0.15);
}

.narrative-choice-btn:active:not(:disabled) {
    transform: translateY(0);
}

.narrative-choice-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.narrative-choices-disabled .narrative-choice-btn {
    opacity: 0.45;
}

/* =============================================
   PvP 覆盖层
   ============================================= */
.pvp-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    animation: overlayFadeIn 0.25s ease-out;
}

.pvp-container {
    width: 700px;
    max-width: 95vw;
    max-height: 90vh;
    background: linear-gradient(135deg, #1c1626 0%, #2d2040 100%);
    border: 2px solid var(--border-gold);
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: messageFadeIn 0.35s ease-out;
}

.pvp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-gold);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), transparent);
}

.pvp-header h2 {
    margin: 0;
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 2px;
}

.pvp-status {
    padding: 10px 16px;
    margin: 0;
    font-size: 14px;
    text-align: center;
    border-bottom: 1px solid var(--border-gold);
    animation: statusSlideIn 0.3s ease-out;
}

.pvp-status.info {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.pvp-status.success {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.pvp-status.error {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

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

.pvp-panel {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* =============================================
   PvP 匹配选项
   ============================================= */
.pvp-intro {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.pvp-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pvp-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px;
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pvp-option-btn:hover {
    transform: translateY(-2px);
    border-color: var(--gold);
    box-shadow: 0 6px 25px rgba(212, 175, 55, 0.2);
}

.pvp-option-icon {
    font-size: 32px;
}

.pvp-option-title {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
}

.pvp-option-desc {
    font-size: 12px;
    opacity: 0.8;
}

.pvp-join-group {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.pvp-join-input-wrap {
    flex: 1;
}

.pvp-join-input-wrap input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    text-align: center;
    letter-spacing: 4px;
    transition: all 0.2s ease;
}

.pvp-join-input-wrap input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.pvp-join-input-wrap input::placeholder {
    color: var(--text-muted);
    letter-spacing: normal;
}

/* =============================================
   PvP 等待面板
   ============================================= */
.pvp-waiting-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 20px;
    text-align: center;
}

.pvp-waiting-icon {
    font-size: 64px;
    animation: rotate 2s linear infinite;
}

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

.pvp-waiting-content h3 {
    font-family: var(--serif);
    font-size: 20px;
    color: var(--gold);
    margin: 0;
}

.pvp-waiting-hint {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 0 12px;
}

/* =============================================
   PvP 房间面板
   ============================================= */
.pvp-room-info {
    text-align: center;
    margin-bottom: 24px;
}

.pvp-room-info h3 {
    font-family: var(--serif);
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 10px;
    letter-spacing: 1px;
}

.pvp-room-id-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.pvp-room-id {
    font-family: 'Courier New', monospace;
    font-size: 28px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 8px;
    padding: 12px 24px;
    background: rgba(212, 175, 55, 0.1);
    border: 2px solid var(--border-gold);
    border-radius: 10px;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

.pvp-opponent-info {
    font-size: 15px;
    color: var(--text-primary);
    margin: 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px dashed var(--border-color);
}

.pvp-room-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* =============================================
   PvP 战斗面板
   ============================================= */
.pvp-battle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.pvp-round {
    font-family: var(--serif);
    font-size: 14px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.pvp-turn-indicator {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
}

.pvp-turn-indicator.my-turn {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.2), rgba(46, 204, 113, 0.1));
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.4);
    animation: pulse 1.5s ease-in-out infinite;
}

.pvp-turn-indicator.opponent-turn {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.2), rgba(231, 76, 60, 0.1));
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.4);
}

.pvp-player-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.pvp-player-card.enemy {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(192, 57, 43, 0.05));
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.pvp-player-card.ally {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1), rgba(41, 128, 185, 0.05));
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.pvp-player-avatar {
    font-size: 42px;
    flex-shrink: 0;
}

.pvp-player-info {
    flex-shrink: 0;
}

.pvp-player-name {
    font-family: var(--serif);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.pvp-player-level {
    font-size: 12px;
    color: var(--text-muted);
}

.pvp-hp-container,
.pvp-mp-container {
    flex: 1;
    min-width: 0;
}

.pvp-stats-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.pvp-battle-log {
    height: 120px;
    overflow-y: auto;
    padding: 12px;
    margin: 12px 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    line-height: 1.6;
}

.pvp-battle-log::-webkit-scrollbar {
    width: 4px;
}

.pvp-battle-log::-webkit-scrollbar-track {
    background: transparent;
}

.pvp-battle-log::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.pvp-battle-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 8px;
}

.pvp-battle-btn {
    padding: 14px 8px;
}

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

.pvp-battle-result {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    text-align: center;
    animation: overlayFadeIn 0.4s ease-out;
    z-index: 10;
}

.pvp-battle-result.victory {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.15), rgba(0, 0, 0, 0.9));
}

.pvp-battle-result.defeat {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.15), rgba(0, 0, 0, 0.9));
}

.pvp-battle-result h3 {
    font-family: var(--serif);
    font-size: 36px;
    margin: 0;
    letter-spacing: 3px;
}

.pvp-battle-result.victory h3 {
    color: #2ecc71;
}

.pvp-battle-result.defeat h3 {
    color: #e74c3c;
}

.pvp-battle-result p {
    font-size: 15px;
    color: var(--text-muted);
    margin: 0;
}

/* =============================================
   响应式设计
   ============================================= */
@media (max-width: 768px) {
    .pvp-container {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .pvp-panel {
        padding: 16px;
    }

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

    .pvp-player-card {
        flex-wrap: wrap;
        gap: 12px;
    }

    .pvp-stats-container {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .pvp-header {
        padding: 14px 16px;
    }

    .pvp-header h2 {
        font-size: 18px;
    }

    .pvp-option-btn {
        padding: 16px;
    }

    .pvp-option-icon {
        font-size: 28px;
    }

    .pvp-option-title {
        font-size: 16px;
    }

    .pvp-join-group {
        flex-direction: column;
    }

    .pvp-battle-actions {
        grid-template-columns: 1fr;
    }
}

/* ── Message Undo / Retract ────────────────────────────────────────── */

.msg-undo-btn-wrapper {
    position: absolute;
    right: 4px;
    top: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.message.user {
    position: relative;
}

.message.user:hover .msg-undo-btn-wrapper {
    opacity: 1;
}

.msg-undo-btn {
    background: none;
    border: 1px solid var(--text-dim);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    padding: 2px 8px;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    line-height: 1.6;
}

.msg-undo-btn:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.msg-undo-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
