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

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
}

/* 登录/注册画面 */
.auth-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-width: 450px;
    margin: 0 auto;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 0.9em;
}

.auth-switch a {
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* 开始画面 */
.container {
    max-width: 500px;
    margin: auto;
    padding: 40px 20px;
}

h1 {
    color: white;
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.character-setup {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.setup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

h2 {
    color: #667eea;
    margin: 0;
    font-size: 1.8em;
}

.logout-link {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 0.9em;
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 5px;
    transition: all 0.3s;
}

.logout-link:hover {
    background: #ffe5e5;
    color: #c0392b;
}

.logout-link.hidden {
    display: none;
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: #555;
    font-size: 1.1em;
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.button-group {
    display: flex;
    gap: 10px;
}

.option-btn {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.option-btn:hover {
    background: #f5f5f5;
}

.option-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.primary-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 20px;
    box-sizing: border-box;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

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

/* 匹配画面 */
.match-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.player-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 30px;
}

.player-card h3 {
    margin-bottom: 10px;
    color: white;
}

.player-card p {
    font-size: 1.2em;
    font-weight: bold;
}

.avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid white;
    margin-bottom: 15px;
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.avatar-small {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #667eea;
    object-fit: cover;
    margin-right: 12px;
}

.player-info-container {
    display: flex;
    align-items: center;
}

.partner-info-container {
    display: flex;
    align-items: center;
}

.partner-info-container.hidden {
    display: none;
}

.match-options {
    margin-bottom: 30px;
}

.match-options button {
    width: 100%;
}

.matching-status {
    text-align: center;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 15px;
    margin-bottom: 30px;
}

.matching-status.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.matching-status p {
    font-size: 1.1em;
    color: #667eea;
    margin-bottom: 20px;
}

.matching-hint {
    font-size: 0.9em !important;
    color: #95a5a6 !important;
    margin-bottom: 15px !important;
    line-height: 1.5;
}

.pool-count {
    font-size: 1em !important;
    color: #27ae60 !important;
    font-weight: bold;
    margin: 10px 0 !important;
    padding: 10px;
    background: #e8f8f5;
    border-radius: 8px;
    border-left: 4px solid #27ae60;
}

.match-info {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 15px;
}

.match-info h4 {
    color: #667eea;
    margin-bottom: 15px;
}

.match-info ul {
    list-style: none;
    padding: 0;
}

.match-info li {
    padding: 8px 0;
    color: #555;
    font-size: 0.95em;
}

.match-examples {
    margin-top: 15px;
    padding: 15px;
    background: #fff3cd;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.match-examples p {
    margin: 5px 0;
    color: #856404;
    font-size: 0.9em;
}

.match-examples strong {
    color: #856404;
}

/* 游戏画面 */
.game-container {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 40px);
}

.header {
    padding: 20px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 1em;
    font-weight: bold;
    color: #667eea;
}

.partner-info {
    font-size: 0.9em;
    color: #c44569;
    display: block;
}

.user-points {
    font-size: 0.85em;
    color: #f39c12;
    font-weight: bold;
}

.user-points.hidden {
    display: none;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.secondary-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    box-sizing: border-box;
}

.secondary-btn:hover {
    background: #5568d3;
}

.secondary-btn.hidden {
    display: none;
}

/* 确保按钮在弹窗中大小一致 */
.modal-buttons .primary-btn,
.modal-buttons .secondary-btn {
    padding: 15px 20px !important;
    font-size: 16px !important;
    min-height: 50px;
    font-weight: bold;
}

#send-proposal-btn,
#cancel-proposal-btn,
#accept-proposal-btn,
#reject-proposal-btn,
#cancel-waiting-btn {
    padding: 15px 20px !important;
    font-size: 16px !important;
    min-height: 50px;
    width: 100%;
    box-sizing: border-box;
}

.scenario-box {
    margin: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.scenario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.scenario-box h3 {
    color: #c44569;
    margin: 0;
    font-size: 1.2em;
}

.scenario-box p {
    color: #555;
    font-size: 1.1em;
    line-height: 1.6;
}

.change-scenario-btn {
    padding: 8px 16px;
    background: rgba(196, 69, 105, 0.2);
    color: #c44569;
    border: 2px solid #c44569;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: all 0.3s;
}

.change-scenario-btn:hover {
    background: #c44569;
    color: white;
}

.change-scenario-btn.hidden {
    display: none;
}

/* 弹窗样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

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

.modal-content h3 {
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
}

.scenario-options {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.option-scenario-btn {
    flex: 1;
    padding: 12px;
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s;
}

.option-scenario-btn:hover {
    background: #667eea;
    color: white;
}

.option-scenario-btn.active {
    background: #667eea;
    color: white;
}

#custom-input-area {
    margin-bottom: 20px;
}

#custom-scenario-input {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
}

#custom-scenario-input:focus {
    outline: none;
    border-color: #667eea;
}

#scenario-preview {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.preview-label {
    color: #95a5a6;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.preview-scenario {
    color: #333;
    font-size: 1.05em;
    line-height: 1.6;
}

.proposal-from {
    color: #95a5a6;
    font-size: 0.95em;
    margin-bottom: 15px;
    text-align: center;
}

.proposed-scenario {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.proposed-scenario p {
    color: #555;
    font-size: 1.1em;
    line-height: 1.6;
    margin: 0;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons button {
    flex: 1;
    margin-top: 0 !important;
}

.waiting-animation {
    text-align: center;
    margin-bottom: 20px;
}

.waiting-animation p {
    color: #667eea;
    margin-top: 15px;
}

.spinner-small {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

/* 隐藏元素 */
#dom-interface.hidden,
#sub-interface.hidden,
#waiting-interface.hidden,
#custom-input-area.hidden {
    display: none !important;
}

/* 自定义弹窗样式 */
.custom-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-alert-overlay.show {
    opacity: 1;
}

.custom-alert-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.custom-alert-overlay.show .custom-alert-box {
    transform: scale(1);
}

.custom-alert-icon {
    margin-bottom: 20px;
}

.custom-confirm-title {
    color: #333;
    font-size: 1.5em;
    margin-bottom: 20px;
}

.custom-alert-message {
    color: #555;
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 30px;
    white-space: pre-line;
}

.custom-alert-btn {
    padding: 12px 40px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 120px;
}

.custom-alert-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.custom-alert-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.custom-alert-btn.secondary {
    background: #95a5a6;
    color: white;
}

.custom-alert-btn.secondary:hover {
    background: #7f8c8d;
}

.custom-alert-btn:not(.primary):not(.secondary) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.custom-alert-btn:not(.primary):not(.secondary):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.custom-confirm-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* 移动端优化 */
@media (max-width: 500px) {
    .custom-alert-box {
        padding: 30px 25px;
    }
    
    .custom-alert-message {
        font-size: 1em;
    }
    
    .custom-confirm-buttons {
        flex-direction: column;
    }
    
    .custom-alert-btn {
        width: 100%;
    }
}

/* 语音通话样式 */
.call-modal-content {
    text-align: center;
    max-width: 400px;
}

.call-status {
    margin-bottom: 30px;
}

.call-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
}

.call-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid #667eea;
    object-fit: cover;
}

.call-status h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.5em;
}

.call-status p {
    color: #95a5a6;
    font-size: 1.1em;
}

.incoming-text {
    color: #667eea !important;
    font-weight: bold;
}

.call-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.call-controls.hidden {
    display: none;
}

.call-control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: #95a5a6;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.call-control-btn:hover {
    background: #7f8c8d;
    transform: scale(1.05);
}

.call-control-btn.muted {
    background: #e74c3c;
}

.end-call-btn {
    width: 100%;
    padding: 15px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.end-call-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 75%;
    animation: messageSlide 0.3s ease;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.message-content {
    padding: 12px 16px;
    border-radius: 15px;
    word-wrap: break-word;
    max-width: 100%;
}

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

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

.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

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

.message.partner .message-content {
    background: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 5px;
}

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

.message.system .message-content {
    background: #e0e0e0;
    color: #666;
    font-size: 0.9em;
    text-align: center;
    padding: 8px 16px;
}

.message.voice .message-content {
    display: flex;
    align-items: center;
    padding: 10px 14px;
}

/* 媒体消息样式 */
.message.media .message-content {
    padding: 8px;
    background: transparent !important;
}

.message.user.media .message-content {
    background: transparent !important;
}

.message.partner.media .message-content {
    background: transparent !important;
}

.media-content {
    max-width: 100%;
}

.message-image {
    max-width: 250px;
    max-height: 250px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s;
    display: block;
    object-fit: cover;
}

.message-image:hover {
    transform: scale(1.02);
}

.message-video {
    max-width: 300px;
    max-height: 300px;
    border-radius: 10px;
    display: block;
    background: #000;
}

.voice-player {
    display: flex;
    align-items: center;
    gap: 10px;
}

.play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.play-btn:hover {
    background: rgba(255,255,255,0.5);
}

.message.partner .play-btn {
    background: rgba(0,0,0,0.1);
}

.message.partner .play-btn:hover {
    background: rgba(0,0,0,0.2);
}

.message.partner .play-btn svg {
    color: #333;
}

.voice-duration {
    font-size: 0.9em;
}

.input-area {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 2px solid #f0f0f0;
    background: white;
    border-radius: 0 0 20px 20px;
    position: sticky;
    bottom: 0;
}

#message-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    transition: border-color 0.3s;
}

#message-input:focus {
    outline: none;
    border-color: #667eea;
}

.icon-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: #667eea;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.icon-btn:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.icon-btn:active {
    transform: scale(0.95);
}

.icon-btn.recording {
    background: #e74c3c;
    animation: recordPulse 1s infinite;
}

@keyframes recordPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }
}

.recording-indicator {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #e74c3c;
    color: white;
    padding: 15px 25px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        bottom: 50px;
        opacity: 0;
    }
    to {
        bottom: 100px;
        opacity: 1;
    }
}

.recording-indicator.hidden {
    display: none;
}

.pulse {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }

    h2 {
        font-size: 1.4em;
    }

    .character-setup, .auth-container, .match-container {
        padding: 25px;
    }

    .setup-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .logout-link {
        align-self: flex-end;
    }

    .game-container {
        margin: 0;
        border-radius: 0;
        height: 100vh;
    }

    .header {
        padding: 12px;
        flex-wrap: wrap;
    }

    .player-info-container, .partner-info-container {
        font-size: 0.85em;
    }

    .avatar-small {
        width: 35px;
        height: 35px;
        margin-right: 8px;
    }

    .avatar-large {
        width: 80px;
        height: 80px;
    }

    .header-buttons {
        flex-wrap: wrap;
        width: 100%;
        margin-top: 10px;
    }

    .header-buttons button {
        flex: 1;
        min-width: 80px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .scenario-box {
        margin: 15px;
        padding: 15px;
    }

    .scenario-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .scenario-box h3 {
        font-size: 1em;
    }

    .scenario-box p {
        font-size: 0.95em;
    }

    .change-scenario-btn {
        width: 100%;
        font-size: 0.85em;
    }

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

    .match-options {
        margin-bottom: 20px;
        flex-direction: column;
    }

    .scenario-options {
        flex-direction: column;
    }

    .option-scenario-btn {
        padding: 10px;
        font-size: 0.9em;
    }

    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-buttons .primary-btn,
    .modal-buttons .secondary-btn {
        padding: 12px !important;
        font-size: 14px !important;
        min-height: 45px;
    }
    
    #send-proposal-btn,
    #cancel-proposal-btn,
    #accept-proposal-btn,
    #reject-proposal-btn,
    #cancel-waiting-btn {
        padding: 12px !important;
        font-size: 14px !important;
        min-height: 45px;
    }

    .call-avatar {
        width: 100px;
        height: 100px;
    }

    .call-status h3 {
        font-size: 1.3em;
    }

    .call-status p {
        font-size: 1em;
    }

    .end-call-btn {
        padding: 12px;
        font-size: 14px;
    }

    .proposed-scenario {
        padding: 15px;
    }

    #custom-scenario-input {
        min-height: 80px;
        font-size: 0.9em;
    }

    .chat-container {
        padding: 12px;
    }

    .message {
        max-width: 85%;
        gap: 6px;
    }

    .message-content {
        padding: 10px 12px;
        font-size: 0.9em;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
    }

    .message-image {
        max-width: 200px;
        max-height: 200px;
    }

    .message-video {
        max-width: 100%;
        max-height: 200px;
    }

    .input-area {
        padding: 12px;
    }

    #message-input {
        font-size: 14px;
        padding: 10px 12px;
    }

    .icon-btn {
        width: 40px;
        height: 40px;
    }

    .icon-btn svg {
        width: 20px;
        height: 20px;
    }

    .button-group {
        flex-direction: column;
    }

    .option-btn {
        width: 100%;
    }

    .match-options {
        flex-direction: column;
    }

    .player-card {
        padding: 15px;
    }

    .match-info {
        padding: 15px;
    }

    .match-info li {
        font-size: 0.85em;
    }
}

/* 超小屏幕 */
@media (max-width: 400px) {
    h1 {
        font-size: 1.5em;
    }

    .character-setup, .auth-container, .match-container {
        padding: 20px;
    }

    .message {
        max-width: 92%;
    }

    .message-content {
        font-size: 0.85em;
    }

    .avatar-large {
        width: 70px;
        height: 70px;
    }

    .message-avatar {
        width: 30px;
        height: 30px;
    }

    .message-image {
        max-width: 180px;
        max-height: 180px;
    }

    .message-video {
        max-width: 100%;
        max-height: 180px;
    }

    .player-info span, .partner-info {
        font-size: 0.9em;
    }

    .user-points {
        font-size: 0.75em;
    }

    .recording-indicator {
        bottom: 80px;
        padding: 12px 20px;
        font-size: 0.9em;
    }
}

/* 横屏优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .game-container {
        height: 100vh;
    }

    .header {
        padding: 10px;
    }

    .scenario-box {
        margin: 10px;
        padding: 10px;
    }

    .chat-container {
        padding: 10px;
    }

    .input-area {
        padding: 10px;
    }
}

/* 图片预览模态框 */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    cursor: zoom-out;
}

.image-preview-modal.hidden {
    display: none;
}

.image-preview-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    cursor: default;
    animation: imageZoomIn 0.3s ease-out;
}

@keyframes imageZoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 关闭按钮 - 左上角 */
.close-image-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    color: white;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.close-image-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
    transform: rotate(90deg);
}

.close-image-btn:active {
    transform: rotate(90deg) scale(0.95);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .close-image-btn {
        top: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
        font-size: 28px;
    }
    
    .image-preview-modal img {
        max-width: 95%;
        max-height: 95%;
    }
}

/* 游戏引导弹窗 */
.guide-modal-content {
    max-width: 500px;
    padding: 30px;
}

.guide-modal-content h3 {
    color: #667eea;
    font-size: 1.5em;
    margin-bottom: 20px;
    text-align: center;
}

.guide-content {
    margin-bottom: 25px;
}

.guide-text {
    font-size: 1.1em;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.guide-step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.step-number {
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
}

.guide-step p {
    margin: 0;
    color: #555;
    line-height: 1.6;
}

.guide-step strong {
    color: #667eea;
    font-weight: bold;
}

.guide-arrow {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    animation: pulse 2s infinite;
}

.guide-arrow p {
    margin: 0;
    color: white;
    font-weight: bold;
    font-size: 1.1em;
}

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

#guide-ok-btn {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
}

@media (max-width: 768px) {
    .guide-modal-content {
        padding: 20px;
    }
    
    .guide-modal-content h3 {
        font-size: 1.3em;
    }
    
    .guide-step {
        padding: 12px;
    }
    
    .step-number {
        width: 25px;
        height: 25px;
        font-size: 0.9em;
        margin-right: 10px;
    }
}

