body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    /* 更生动的背景 */
    background: linear-gradient(to bottom right, #b2ebf2, #81c784); /* 示例渐变背景 */
    color: #333; /* 深灰色文字 */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh; /* 撑满视口高度 */
    overflow-y: auto; /* 如果内容溢出，允许滚动 */
}

.container {
    background-color: rgba(255, 255, 255, 0.95); /* 半透明白色背景 */
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); /* 更明显的阴影 */
    text-align: center;
    max-width: 600px; /* 限制最大宽度 */
    width: 100%;
    margin-bottom: 20px; /* 与footer留出空间 */
    position: relative; /* 为了内部屏幕的绝对定位 */
    overflow: hidden; /* 隐藏超出部分的屏幕 */
}

h1 {
    color: #4a148c; /* 紫色标题 */
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1); /* 标题阴影 */
}

/* 游戏屏幕基础样式和过渡 */
.game-screen {
    width: 100%;
    min-height: 400px; /* 确保屏幕有最小高度 */
    position: absolute; /* 绝对定位，用于切换过渡 */
    top: 0;
    left: 0;
    padding: 30px; /* 与 container 的 padding 保持一致 */
    box-sizing: border-box; /* 将 padding 计算在宽度内 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0; /* 默认隐藏 */
    visibility: hidden;
    transition: opacity 0.6s ease-in-out, visibility 0.6s ease-in-out; /* 过渡动画 */
}

.game-screen.active {
    opacity: 1; /* 当前激活的屏幕显示 */
    visibility: visible;
    position: static; /* 激活时取消绝对定位，占据空间 */
}

/* 调整容器高度，使其适应内容 */
.container {
     display: block; /* 取消flex布局，让内部元素决定高度 */
     min-height: 460px; /* 设置一个最小高度，防止内容过少时塌陷 */
}

#start-screen.active,
#game-screen.active,
#end-screen.active {
    position: static; /* 激活时占据空间 */
    display: flex; /* 重新应用 flex 布局 */
}


.game-screen p {
    font-size: 1.2em; /* 稍微放大文字 */
    margin-bottom: 20px;
    color: #555;
}

/* 按钮基础样式 */
button {
    padding: 12px 30px; /* 增大按钮点击区域和文字 */
    font-size: 1.2em; /* 增大按钮文字 */
    border: none;
    border-radius: 25px; /* 圆角按钮 */
    cursor: pointer;
    margin: 8px; /* 按钮之间间距 */
    transition: background-color 0.3s ease, transform 0.1s ease; /* 添加点击动画 */
    min-width: 150px; /* 最小宽度 */
    text-transform: uppercase; /* 按钮文字大写 */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* 按钮阴影 */
}

button:hover {
    opacity: 0.9;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: scale(0.98); /* 点击时缩小 */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}


/* 特定按钮颜色 */
.btn-green {
    background-color: #4CAF50; /* 绿色 */
    color: white;
}

.btn-red {
    background-color: #f44336; /* 红色 */
    color: white;
}

.btn-blue {
    background-color: #2196F3; /* 蓝色 */
    color: white;
}

.btn-gray {
     background-color: #b0b0b0; /* 灰色 */
     color: white;
}


/* 游戏页面样式 */
#game-screen #question-counter {
    font-size: 1.3em;
    margin-bottom: 25px;
    color: #666;
    font-weight: bold;
}

.stone-display {
    margin-bottom: 25px;
    flex-grow: 1; /* 让石头信息区域占据剩余空间 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* 垂直居中内容 */
    width: 100%; /* 宽度100% */
}

#stone-image {
    max-width: 90%; /* 图片不超过父容器宽度 */
    height: 250px; /* 固定图片高度 */
    object-fit: contain; /* 保持图片比例不失真 */
    border: 5px solid #eee; /* 图片边框 */
    border-radius: 8px;
    margin-bottom: 15px;
    background-color: #fff; /* 图片加载前或无图片时的背景 */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* 图片阴影 */
    transition: transform 0.5s ease, opacity 0.5s ease; /* 图片加载动画 */
}

#stone-image.loading {
    opacity: 0.5; /* 加载时半透明 */
    transform: scale(0.95); /* 加载时稍微缩小 */
}


#stone-name {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    font-size: 1.8em; /* 放大名字 */
}

#stone-description {
     font-size: 1.1em; /* 放大描述 */
     color: #555;
     font-style: italic;
}


.answer-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 20px; /* 增大按钮之间的间距 */
    flex-wrap: wrap; /* 按钮多时换行 */
    width: 100%;
}

.answer-buttons button {
    flex-grow: 1; /* 按钮可以增长填充空间 */
    max-width: 200px; /* 最大宽度限制 */
}


/* 挑战结束提示样式 */
#challenge-end-prompt {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px dashed #ccc;
    width: 100%;
}

#challenge-end-prompt p {
    font-size: 1.1em;
    margin-bottom: 15px;
}

#challenge-end-prompt button {
     margin-top: 10px;
     min-width: 100px;
}

/* 结束页面样式 (更喜庆) */
#end-screen {
    background: linear-gradient(to bottom, #ffcc80, #ffab91); /* 暖色渐变背景 */
    color: #4e342e; /* 深棕色文字 */
}

#end-screen h2 {
    color: #d32f2f; /* 红色标题 */
    margin-bottom: 15px;
    font-size: 2em; /* 放大标题 */
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.congratulations-icon {
    font-size: 4em; /* 放大图标 */
    margin-bottom: 15px;
    animation: pulse 1.5s infinite; /* 添加跳动动画 */
}

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

#end-message {
    font-size: 1.3em;
    color: #3e2723; /* 深棕色文字 */
    margin-bottom: 20px;
    font-weight: bold;
}

#known-count-display {
    font-size: 1.5em;
    color: #bf360c; /* 更亮的颜色 */
    font-weight: bold;
}

.end-buttons {
    margin-top: 25px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    width: 100%;
}

.end-buttons button {
    flex-grow: 1;
    max-width: 200px;
}


/* 二维码弹窗叠加层样式 */
.modal-overlay {
    position: fixed; /* 固定位置 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* 半透明黑色背景 */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* 确保在最上层 */
    visibility: hidden; /* 默认隐藏 */
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease; /* 过渡动画 */
}

.modal-overlay.visible {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    width: 300px; /* 弹窗固定宽度 */
    transform: scale(0.9); /* 默认稍微缩小 */
    transition: transform 0.3s ease; /* 弹窗弹出动画 */
}

.modal-overlay.visible .modal-content {
     transform: scale(1); /* 显示时恢复正常大小 */
}


.modal-content h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.5em;
}

#qrcode-image {
    max-width: 100%;
    height: auto;
    margin: 15px 0;
    border: 1px solid #eee;
    background-color: #fff;
}

.modal-content p {
    font-size: 1em;
    color: #666;
    margin-bottom: 20px;
}

#btn-close-modal {
    margin-top: 15px;
    min-width: 100px;
}


/* 底部样式 */
footer {
    margin-top: 20px; /* 增加顶部间距 */
    width: 100%;
    text-align: center;
    padding: 15px 0;
    font-size: 0.9em;
    color: #666; /* 深灰色 */
}

/* 响应式调整 */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 20px;
    }

    button {
        padding: 10px 20px;
        font-size: 1.1em;
        min-width: 120px;
    }

    #stone-image {
        height: 200px;
    }

    #stone-name {
         font-size: 1.5em;
    }

    #end-screen h2 {
        font-size: 1.8em;
    }

    .congratulations-icon {
        font-size: 3em;
    }

    #end-message {
        font-size: 1.1em;
    }

    .answer-buttons, .end-buttons {
        gap: 10px;
    }
}