/* =========================================
   Gemini UI Mobile Styles
   ========================================= */

/* 默认隐藏移动端头部 */
.mobile-header {
    display: none;
}

/* 桌面端显示状态栏 */
.desktop-only {
    display: flex;
}

/* 移动端样式覆盖 */
@media (max-width: 768px) {

    /* 隐藏桌面端元素 */
    .desktop-only {
        display: none !important;
    }

    .mobile-menu-btn {
        display: none !important;
    }

    /* 全局背景调整 - 极客深色网络 */
    body {
        background: radial-gradient(circle at top right, #332A3D 0%, #1A1520 100%) !important;
        color: var(--text-light) !important;
    }

    /* 移动端头部 */
    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: rgba(45, 35, 50, 0.85);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(255, 182, 193, 0.15);
        box-shadow: 0 4px 15px rgba(26, 21, 32, 0.4);
    }

    .header-title {
        font-size: 1.25em;
        color: var(--primary-color);
        font-weight: 700;
        letter-spacing: 1px;
        text-shadow: 0 0 10px rgba(255, 182, 193, 0.4);
    }

    .icon-btn {
        background: rgba(255, 182, 193, 0.05);
        border: 1px solid rgba(255, 182, 193, 0.1);
        padding: 8px;
        cursor: pointer;
        color: var(--text-light);
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: all var(--transition-base);
    }

    .icon-btn:active {
        background: rgba(255, 182, 193, 0.2);
        border-color: var(--primary-color);
        transform: scale(0.95);
    }

    .header-profile {
        cursor: pointer;
    }

    .profile-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        border: 2px solid transparent;
        background: linear-gradient(#1A1520, #1A1520) padding-box,
            linear-gradient(135deg, var(--primary-color), var(--secondary-color)) border-box;
        box-shadow: 0 0 10px rgba(255, 182, 193, 0.3);
    }

    /* 主内容区调整 */
    .game-content {
        display: block;
        height: 100vh;
        padding-top: 60px;
        padding-bottom: 80px;
    }

    .main-area {
        background: transparent !important;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    /* 欢迎页样式 */
    .gemini-welcome {
        padding: 20px;
        margin-top: 40px;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
    }

    .greeting-text {
        font-size: 3em;
        font-weight: 700;
        line-height: 1.2;
        color: var(--text-light);
        margin-bottom: 10px;
        letter-spacing: -1px;
        text-shadow: 0 0 20px rgba(26, 21, 32, 0.4);
    }

    .player-name-large {
        display: block;
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        background-clip: text;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        font-weight: 800;
        text-shadow: 0 0 30px rgba(255, 182, 193, 0.4);
    }

    .sub-greeting {
        font-size: 2em;
        color: var(--text-dim);
        margin-bottom: 40px;
        font-weight: 500;
        letter-spacing: -1px;
    }

    /* 建议芯片样式 */
    .suggestion-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 10px;
    }

    .chip {
        background: rgba(255, 182, 193, 0.05);
        border: 1px solid rgba(255, 182, 193, 0.1);
        border-radius: 12px;
        padding: 12px 20px;
        font-size: 0.95em;
        color: var(--text-light);
        display: flex;
        align-items: center;
        gap: 8px;
        cursor: pointer;
        box-shadow: 0 4px 10px rgba(26, 21, 32, 0.2);
        transition: all var(--transition-base);
        white-space: nowrap;
        flex: 0 0 auto;
        backdrop-filter: blur(10px);
    }

    .chip:active {
        background: rgba(255, 182, 193, 0.15);
        border-color: var(--primary-color);
        transform: scale(0.98);
    }

    /* 聊天容器调整 */
    .chat-container {
        padding: 15px;
        padding-bottom: 100px; /* ⭐ 增加底部内边距，避免被输入框遮挡 */
        background: transparent;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 底部输入区 (悬浮样式) */
    .input-area-wrapper {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 10px 15px 20px 15px;
        background: rgba(45, 35, 50, 0.85);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 50;
        border-top: 1px solid rgba(255, 182, 193, 0.15);
        max-width: 100vw; /* ⭐ 限制最大宽度 */
        box-sizing: border-box; /* ⭐ 包含内边距在宽度内 */
    }

    /* ⭐ 快捷操作按钮 */
    .quick-actions {
        display: flex;
        gap: 8px;
        margin-bottom: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
    }

    .quick-action-btn {
        background: rgba(255, 182, 193, 0.05);
        border: 1px solid rgba(255, 182, 193, 0.1);
        border-radius: 20px;
        padding: 6px 12px;
        font-size: 0.85em;
        color: var(--text-light);
        cursor: pointer;
        white-space: nowrap;
        transition: all 0.3s ease;
        backdrop-filter: blur(10px);
    }

    .quick-action-btn:active {
        background: rgba(255, 182, 193, 0.15);
        border-color: var(--primary-color);
        transform: scale(0.95);
    }

    .input-area.gemini-style {
        background: rgba(255, 182, 193, 0.05);
        border-radius: 30px;
        padding: 8px 15px;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        box-shadow: 0 4px 15px rgba(26, 21, 32, 0.3);
        border: 1px solid rgba(255, 182, 193, 0.2);
        transition: all var(--transition-base);
        max-width: 100%; /* ⭐ 限制最大宽度 */
        box-sizing: border-box; /* ⭐ 包含内边距在宽度内 */
    }

    .input-area.gemini-style:focus-within {
        border-color: var(--primary-color);
        box-shadow: 0 0 15px rgba(255, 182, 193, 0.2);
        background: rgba(255, 182, 193, 0.15);
    }

    .input-area.gemini-style textarea {
        flex: 1;
        background: transparent;
        border: none;
        color: var(--text-light);
        font-size: 1.05em;
        padding: 8px 0;
        resize: none;
        max-height: 100px;
        line-height: 1.5;
    }

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

    .input-area.gemini-style .send-btn {
        color: var(--primary-color);
        transition: all var(--transition-base);
    }

    .input-area.gemini-style .send-btn:disabled {
        color: var(--text-muted);
        cursor: default;
    }

    /* 生成选项按钮 (输入框内) */
    #generate-options-btn {
        color: var(--secondary-color);
        transition: all 0.3s ease;
    }

    #generate-options-btn:hover {
        background: rgba(221, 160, 221, 0.15);
        border-radius: 50%;
    }

    #generate-options-btn svg {
        stroke: var(--secondary-color);
    }

    #generate-options-btn:hover svg {
        stroke: #C77DFF;
        filter: drop-shadow(0 0 5px rgba(221, 160, 221, 0.5));
    }

    /* 侧边栏调整 */
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100%;
        background: rgba(45, 35, 50, 0.95) !important;
        backdrop-filter: blur(20px) !important;
        border-right: 1px solid rgba(255, 182, 193, 0.2) !important;
        z-index: 200;
        transition: left 0.3s ease;
        box-shadow: 2px 0 20px rgba(26, 21, 32, 0.6);
        padding-top: 60px;
        display: block;
    }

    .sidebar h3 {
        color: var(--primary-color) !important;
        border-bottom: 1px solid rgba(255, 182, 193, 0.2) !important;
        letter-spacing: 1px;
    }

    /* 侧边栏内容样式覆盖 */
    .current-location {
        background: rgba(255, 182, 193, 0.05) !important;
        color: var(--primary-color) !important;
        border: 1px solid rgba(255, 182, 193, 0.2) !important;
        box-shadow: inset 0 0 10px rgba(255, 182, 193, 0.05) !important;
    }

    .npc-item {
        background: rgba(255, 182, 193, 0.02) !important;
        color: var(--text-light) !important;
        border: 1px solid rgba(255, 182, 193, 0.05) !important;
        box-shadow: 0 4px 10px rgba(26, 21, 32, 0.2) !important;
        margin-bottom: 8px;
    }

    .npc-item:hover {
        background: rgba(255, 182, 193, 0.06) !important;
        border-color: rgba(255, 182, 193, 0.1) !important;
    }

    .npc-name {
        color: var(--text-light) !important;
        font-weight: 600;
    }

    .npc-status {
        color: var(--text-dim) !important;
    }

    /* Modal Overrides */
    .modal-content {
        background: rgba(45, 35, 50, 0.95) !important;
        color: var(--text-light) !important;
        border: 1px solid rgba(255, 182, 193, 0.2) !important;
        box-shadow: 0 4px 30px rgba(26, 21, 32, 0.6) !important;
        backdrop-filter: blur(20px) !important;
    }

    .modal-content h2 {
        color: var(--primary-color) !important;
        text-shadow: 0 0 10px rgba(255, 182, 193, 0.3) !important;
    }

    .location-card {
        background: rgba(255, 182, 193, 0.03) !important;
        border: 1px solid rgba(255, 182, 193, 0.1) !important;
        color: var(--text-light) !important;
        box-shadow: none !important;
    }

    .location-card:hover {
        background: rgba(255, 182, 193, 0.05) !important;
        border-color: rgba(255, 182, 193, 0.4) !important;
        transform: translateY(-2px) !important;
    }

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

    .location-card p {
        color: var(--text-muted) !important;
    }

    /* NPC Profile Card in Modal */
    .npc-profile-card {
        background: rgba(255, 182, 193, 0.03) !important;
        border: 1px solid rgba(255, 182, 193, 0.1) !important;
        color: var(--text-light) !important;
        box-shadow: none !important;
    }

    .npc-profile-card:hover {
        border-color: var(--secondary-color) !important;
        box-shadow: 0 4px 15px rgba(221, 160, 221, 0.2) !important;
        transform: translateY(-2px) !important;
    }

    .npc-profile-name {
        color: var(--primary-color) !important;
    }

    .npc-profile-detail {
        color: var(--text-dim) !important;
        border-bottom-color: rgba(255, 182, 193, 0.1) !important;
    }

    .npc-profile-detail strong {
        color: var(--text-light) !important;
    }

    /* NPC Detail View */
    .npc-detail {
        background: rgba(255, 182, 193, 0.02) !important;
        color: var(--text-light) !important;
        border: 1px solid rgba(255, 182, 193, 0.1);
        border-radius: 12px;
    }

    .npc-info-label {
        color: var(--text-dim) !important;
    }

    .close-modal:hover {
        color: var(--danger-color) !important;
    }

    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(26, 21, 32, 0.4);
        z-index: 150;
        display: none;
    }

    /* 遮罩层 */
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(26, 21, 32, 0.4);
        z-index: 150;
        display: none;
    }

    .option-generating {
        background: rgba(255, 182, 193, 0.05) !important;
        border: 1px solid rgba(255, 182, 193, 0.3) !important;
        color: var(--primary-color) !important;
    }

    /* 选项按钮覆盖样式 */
    .option-btn {
        background: rgba(255, 182, 193, 0.03) !important;
        color: var(--text-light) !important;
        border: 1px solid rgba(255, 182, 193, 0.1) !important;
        box-shadow: 0 4px 10px rgba(26, 21, 32, 0.2) !important;
        border-radius: 12px !important;
        padding: 12px 16px !important;
        margin-bottom: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        white-space: normal !important;
        height: auto !important;
        backdrop-filter: blur(10px);
    }

    .option-btn:hover {
        background: rgba(255, 182, 193, 0.15) !important;
        box-shadow: 0 4px 15px rgba(26, 21, 32, 0.4) !important;
    }

    /* 不同类型选项的颜色微调 */
    .option-btn.平常 {
        border-left: 4px solid var(--primary-color) !important;
    }

    .option-btn.激进 {
        border-left: 4px solid var(--danger-color) !important;
    }

    .option-btn.调皮 {
        border-left: 4px solid var(--secondary-color) !important;
    }

    .option-text {
        color: var(--text-light) !important;
        font-size: 0.95em !important;
    }

    .option-type {
        background: rgba(255, 182, 193, 0.1) !important;
        color: var(--text-dim) !important;
        font-size: 0.8em !important;
        padding: 2px 8px !important;
        border-radius: 4px !important;
    }

    /* 选项容器调整 */
    .options-container {
        background: transparent !important;
        backdrop-filter: none !important;
        border: none !important;
        padding: 10px 15px;
        margin-bottom: 100px; /* ⭐ 增加底部边距，避免被输入框遮挡 */
        max-height: none !important;
        overflow: visible !important;
        display: flex;
        flex-direction: column;
        gap: 10px;
        transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
        opacity: 1;
        transform: translateY(0);
    }

    /* 收起状态 */
    .options-container.collapsed {
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        opacity: 0;
        overflow: hidden !important;
        transform: translateY(20px);
        pointer-events: none;
    }

    /* 选项切换按钮 */
    .options-toggle-btn {
        position: absolute;
        right: 10px;
        top: -40px;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: rgba(45, 35, 50, 0.9);
        border: 1px solid rgba(255, 182, 193, 0.3);
        color: var(--primary-color);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 60;
        box-shadow: 0 4px 10px rgba(26, 21, 32, 0.4);
        transition: all 0.3s ease;
    }

    .options-toggle-btn:hover {
        background: rgba(255, 182, 193, 0.1);
        transform: scale(1.1);
    }

    /* 收起时的按钮状态 - 箭头翻转 */
    .options-toggle-btn.collapsed svg {
        transform: rotate(180deg);
    }

    /* 按钮内的SVG动画 */
    .options-toggle-btn svg {
        transition: transform 0.3s ease;
    }

    .loading-options {
        color: var(--text-dim) !important;
    }

    .loading-options small {
        color: var(--text-muted) !important;
    }

    /* 隐藏旧的输入区 */
    .input-area:not(.gemini-style) {
        display: none;
    }

    /* 消息样式覆盖 */
    .message.player {
        color: var(--text-light) !important;
        background: linear-gradient(135deg, rgba(255, 182, 193, 0.15), rgba(255, 141, 161, 0.05)) !important;
        border: 1px solid rgba(255, 182, 193, 0.2) !important;
        box-shadow: 0 4px 10px rgba(26, 21, 32, 0.2) !important;
    }

    .message.ai {
        color: var(--text-light) !important;
        background: rgba(221, 160, 221, 0.08) !important;
        border: 1px solid rgba(221, 160, 221, 0.2) !important;
        box-shadow: 0 4px 10px rgba(26, 21, 32, 0.2) !important;
    }

    .message-header {
        color: var(--text-dim) !important;
    }
}