/* 游戏 App 基础样式 */
#app-game-container {
    height: 100%;
    width: 100%;
    background: #f4f5f7;
    position: relative;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
}

.game-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    padding-top: calc(24px + var(--top-safe-area, 0px) + env(safe-area-inset-top, 0px)) !important;
    height: calc(74px + var(--top-safe-area, 0px) + env(safe-area-inset-top, 0px)) !important;
    min-height: calc(74px + var(--top-safe-area, 0px) + env(safe-area-inset-top, 0px)) !important;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    box-sizing: border-box;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.game-header .back-btn {
    position: absolute;
    left: 15px;
    bottom: 10px;
    font-size: 18px;
    cursor: pointer;
    color: #333;
    padding: 10px;
    margin-left: -10px;
}

.game-header .title {
    font-size: 16px;
    font-weight: 600;
    color: #000;
    margin-top: calc(24px + var(--top-safe-area, 0px) + env(safe-area-inset-top, 0px));
    transform: translateY(-50%);
}

.game-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    -webkit-overflow-scrolling: touch;
}

/* 游戏列表项 */
.game-list-item {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(0,0,0,0.02);
}

.game-list-item:active {
    transform: scale(0.98);
}

.game-list-item-title {
    font-size: 16px;
    font-weight: bold;
    color: #222;
    margin-bottom: 6px;
}

.game-list-item-desc {
    font-size: 12px;
    color: #888;
    line-height: 1.4;
}

/* 配置表单 */
.game-config-section {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.game-config-title {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.game-config-input {
    width: 100%;
    border: 1px solid #eee;
    background: #fafafa;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.game-config-input:focus {
    border-color: #07c160;
    background: #fff;
}

textarea.game-config-input {
    resize: none;
    height: 80px;
    line-height: 1.5;
}

/* 参与者选择 */
.game-participants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.game-participant {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    position: relative;
}

.game-participant-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.game-participant.selected .game-participant-avatar {
    border-color: #07c160;
    transform: scale(1.05);
}

.game-participant-name {
    font-size: 11px;
    color: #666;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.game-participant-check {
    position: absolute;
    bottom: 20px;
    right: 0;
    width: 16px;
    height: 16px;
    background: #07c160;
    border-radius: 50%;
    border: 1.5px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s;
}

.game-participant.selected .game-participant-check {
    opacity: 1;
    transform: scale(1);
}

/* 按钮 */
.game-start-btn {
    background: linear-gradient(135deg, #07c160, #10ad5b);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 14px 0;
    font-size: 16px;
    font-weight: bold;
    width: calc(100% - 30px);
    margin: 10px 15px 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.game-start-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 6px rgba(7, 193, 96, 0.2);
}

.game-start-btn:disabled {
    background: #ccc;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* 文游界面 (Text UI) */
.text-game-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #111;
    color: #eee;
    font-family: 'Songti SC', 'SimSun', serif; /* 文游常用沉浸感字体 */
}

.text-game-header {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    padding-top: calc(24px + var(--top-safe-area, 0px) + env(safe-area-inset-top, 0px)) !important;
    height: calc(74px + var(--top-safe-area, 0px) + env(safe-area-inset-top, 0px)) !important;
    min-height: calc(74px + var(--top-safe-area, 0px) + env(safe-area-inset-top, 0px)) !important;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    box-sizing: border-box;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.text-game-header .title {
    font-size: 16px;
    color: #ddd;
    letter-spacing: 2px;
    margin-top: calc(24px + var(--top-safe-area, 0px) + env(safe-area-inset-top, 0px));
    transform: translateY(-50%);
}

.text-game-header .back-btn {
    color: #aaa;
    position: absolute;
    left: 15px;
    bottom: 10px;
}

.text-game-display {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-size: 16px;
    line-height: 1.8;
    letter-spacing: 1px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
}

.text-paragraph {
    margin-bottom: 16px;
    animation: fadeInRow 0.5s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

.text-paragraph.user {
    color: #8ab4f8;
    text-align: right;
    font-style: italic;
    opacity: 0.9;
}

.text-paragraph.system {
    color: #e8eaed;
}

.text-paragraph.error {
    color: #f28b82;
    font-size: 14px;
    text-align: center;
}

.text-game-input-area {
    padding: 12px 15px;
    background: #1a1a1a;
    border-top: 1px solid #333;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.text-game-input {
    flex: 1;
    background: #2a2a2a;
    border: 1px solid #444;
    color: #fff;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.text-game-input:focus {
    border-color: #666;
}

.text-game-send {
    background: transparent;
    border: none;
    color: #8ab4f8;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.text-game-send:active {
    background: rgba(138, 180, 248, 0.1);
}

.text-game-send:disabled {
    color: #555;
    cursor: not-allowed;
}

/* 文本加载动画 */
.text-typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 10px 0;
    opacity: 0.7;
}

.text-typing-dot {
    width: 6px;
    height: 6px;
    background: #aaa;
    border-radius: 50%;
    animation: textTypingFade 1.4s infinite ease-in-out both;
}

.text-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.text-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes textTypingFade {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.2); }
}

@keyframes fadeInRow {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
