body {
    background: #2c2c2c;
    color: white;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 1200px; /* 设置固定宽度，与电脑端一致 */
    margin: 0 auto; /* 居中显示 */
    padding: 0;
    font-family: Arial, sans-serif;
    overflow-x: auto; /* 在较小屏幕上允许水平滚动 */
}

.main-button {
    font-size: 28px;
    width: 100px;
    height: 100px;
    border: none;
    background: linear-gradient(145deg, #ff0000, #cc0000);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0px 4px 10px rgba(255, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

.main-button:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.options {
    position: fixed;
    left: calc(50% + 60px);
    top: calc(50% - 10px);
    color: white;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 1000;
}

.card-container {
    display: none;
    position: relative;
    width: 1200px; /* 设置固定宽度，与电脑端一致 */
    height: 450px;
    margin-top: -100px;
}

.card {
    position: absolute;
    width: 100px;
    height: 160px;
    background: url('images/card-back.jpg') no-repeat center/cover;
    border-radius: 10px;
    transform-origin: center bottom;
    cursor: pointer;
    opacity: 0;
    transition: transform 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.card:hover {
    transform-origin: center bottom;
    transition: transform 0.2s ease-out;
    filter: brightness(1.2);
}

.drawn-card-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    width: 100%;
    position: relative;
    margin-top: -40px;
    z-index: 1001;
    padding: 0 10px;
    box-sizing: border-box;
}

.drawn-card-wrapper {
    text-align: center;
    position: relative;
    animation: cardAppear 0.5s ease-out forwards;
}

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

.drawn-card {
    width: 120px;
    height: 192px;
    background: url('images/card-back.jpg') no-repeat center/cover;
    border-radius: 10px;
    transition: transform 0.5s ease-in-out;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6);
}

.drawn-card.reversed {
    transform: rotate(180deg);
}

.drawn-card:hover {
    filter: brightness(1.2);
    transform: translateY(-5px);
}

.drawn-card.reversed:hover {
    filter: brightness(1.2);
    transform: translateY(-5px) rotate(180deg);
}

.card-name {
    margin-top: 5px;
    font-size: 16px;
    font-weight: bold;
    color: white;
}

.tooltip {
    position: absolute;
    background: rgba(118, 112, 112, 0.9);
    color: white;
    padding: 8px;
    border-radius: 6px;
    display: none;
    min-width: 140px;
    max-width: 500px;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    white-space: normal;
    font-size: 13px;
    line-height: 1.4;
    z-index: 1500;
    box-sizing: border-box;
    border: 2px solid rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.chat-container {
    position: fixed;
    top: 620px;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 1000px; /* 设置固定宽度，与电脑端一致 */
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 10px;
    opacity: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
    box-sizing: border-box;
}

.chat-input {
    width: 85%;
    padding: 10px;
    font-size: 16px;
    border-radius: 5px;
    border: none;
    color: #ccc;
    background: #444;
}

.ask-button {
    padding: 8px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.ai-response {
    height: auto; 
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    line-height: 1.6;
    margin-top: 10px;
    word-wrap: break-word; /* 允许长单词换行 */
    overflow-wrap: break-word; /* 兼容性更好的换行方式 */
    max-height: none;
    overflow: hidden; /* 隐藏滚动条，防止出现横向滚动 */
    white-space: normal; /* 让文本正常换行 */
    width: 100%; 
    box-sizing: border-box;
}

.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.loading-dots {
    display: inline-block;
}

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

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

.limit-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 0, 0, 0.8);
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 16px;
    display: none;
    z-index: 2000;
}

@keyframes drawFromDeck {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: translate(-20%, 20%) rotate(10deg);
        opacity: 1;
    }
    100% {
        transform: translate(-300%, 100%) rotate(0deg);
        opacity: 0;
    }
}

@keyframes flipCard {
    0% {
        transform: rotateY(0deg);
    }
    49% {
        transform: rotateY(90deg);
    }
    51% {
        transform: rotateY(270deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}
