* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    color: #333;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.container {
    max-width: 850px;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-top: 20px;
}

header {
    text-align: center;
    margin-bottom: 25px;
    position: relative;
}

h1 {
    color: #1a2a6c;
    margin-bottom: 10px;
    font-size: 2.5rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}

.subtitle {
    color: #b21f1f;
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    background: linear-gradient(to right, #1a2a6c, #b21f1f);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.score, .progress {
    font-size: 1.3rem;
    font-weight: bold;
}

.current-substance {
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    text-align: center;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 3px dashed #1a2a6c;
}

.substance-name {
    font-size: 2.5rem;
    font-weight: bold;
    color: #1a2a6c;
    margin-bottom: 10px;
}

.substance-formula {
    font-size: 1.8rem;
    color: #b21f1f;
    font-style: italic;
}

.options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.option-btn {
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.electrolyte {
    background-color: #4caf50;
    color: white;
}

.strong-electrolyte {
    background-color: #2196f3;
    color: white;
}

.non-electrolyte {
    background-color: #ff9800;
    color: white;
}

.neither {
    background-color: #9c27b0;
    color: white;
}

.option-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.option-btn:active {
    transform: translateY(1px);
}

.feedback {
    background-color: #e3f2fd;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    display: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.feedback.correct {
    background-color: #e8f5e9;
    border-left: 5px solid #4caf50;
}

.feedback.incorrect {
    background-color: #ffebee;
    border-left: 5px solid #f44336;
}

.feedback-title {
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.feedback-explanation {
    font-size: 1.1rem;
    line-height: 1.5;
}

.next-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background: linear-gradient(to right, #1a2a6c, #b21f1f);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    margin-top: 20px;
}

.next-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

.next-btn:active {
    transform: translateY(1px);
}

.rules {
    background-color: #f5f5f5;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.rules h2 {
    color: #1a2a6c;
    margin-bottom: 10px;
}

.rules p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.rules ul {
    margin-left: 20px;
    margin-bottom: 10px;
}

.rules li {
    margin-bottom: 5px;
}

@media (max-width: 768px) {
    .options {
        grid-template-columns: 1fr;
    }
    
    .substance-name {
        font-size: 2rem;
    }
    
    .substance-formula {
        font-size: 1.5rem;
    }
}

.highlight {
    color: #b21f1f;
    font-weight: bold;
}

.key-point {
    color: #1a2a6c;
    font-weight: bold;
}

/* QR码样式 */
.qr-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 10;
}

.qr-icon:hover {
    transform: scale(1.1);
    background-color: white;
}

.qr-icon svg {
    width: 30px;
    height: 30px;
    fill: #1a2a6c;
}

.qr-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.qr-content {
    background-color: white;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    max-width: 300px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.qr-title {
    color: #1a2a6c;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.qr-code {
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    overflow: hidden;
}

.qr-code img {
    max-width: 100%;
    max-height: 100%;
}

.qr-description {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.close-btn {
    background: linear-gradient(to right, #1a2a6c, #b21f1f);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 模态框容器 */
.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none; /* 默认隐藏 */
    justify-content: center;
    align-items: center;
    z-index: 1000; /* 确保它在最上层 */
}

/* 模态框内容 */
.qr-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    max-width: 90%;
    width: 300px;
}

/* QR Code 容器 */
.qr-code {
    width: 180px;
    height: 180px;
    margin: 15px auto;
    border: 1px solid #ddd;
    padding: 10px;
}

/* QR 图标 (浮动在页面上) */
.qr-icon {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    padding: 5px;
    background-color: #007bff;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.qr-icon svg {
    fill: white;
    width: 100%;
    height: 100%;
}

.qr-title {
    margin-top: 0;
    color: #333;
}

.qr-description {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 15px;
}

.close-btn {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

.close-btn:hover {
    background-color: #d32f2f;
}

/* 确保生成的 canvas/table 在容器内居中 */
.qr-code > #qrcode-display {
    display: inline-block; /* qrcode.js 生成的元素是 block，这里让它居中 */
}