/* 模态框基礎 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #fff;
    opacity: 0.7;
    transition: opacity 0.3s;
    z-index: 10;
}

.close-btn:hover {
    opacity: 1;
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 30px;
    border-radius: 20px 20px 0 0;
}

.atom-model {
    width: 150px;
    height: 170px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.atom-svg {
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.3));
}

.shell-info {
    margin-top: 5px;
    font-size: 0.75rem;
    color: #a0a0a0;
    text-align: center;
}

.shell-label {
    color: #00d4ff;
}

.electron {
    animation: electronPulse 1s ease-in-out infinite;
}

@keyframes electronPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.nucleus {
    animation: nucleusPulse 2s ease-in-out infinite;
}

@keyframes nucleusPulse {

    0%,
    100% {
        filter: url(#glow) brightness(1);
    }

    50% {
        filter: url(#glow) brightness(1.3);
    }
}

.element-symbol-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    margin-top: 10px;
}

.element-info-header {
    flex: 1;
}

.element-info-header h2 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.element-info-header p {
    color: #a0a0a0;
    font-style: italic;
}

/* 发音按钮 */
.speak-btn {
    background: rgba(0, 212, 255, 0.2);
    border: 2px solid #00d4ff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #00d4ff;
    padding: 0;
}

.speak-btn:hover {
    background: rgba(0, 212, 255, 0.4);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.speak-btn:active {
    transform: scale(0.95);
}

.speak-btn.speaking {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.7);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(0, 212, 255, 0);
    }
}

/* Modal Body */
.modal-body {
    padding: 0 30px 30px;
}

.modal-flex {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.modal-media {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
}

.photos-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 10px;
}

.photo-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.photo-card img {
    width: 100%;
    height: auto;
    display: block;
}

.photo-caption {
    padding: 8px 10px;
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    text-align: center;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.info-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
}

.info-label {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 5px;
}

.info-value {
    font-size: 1.1rem;
    color: #fff;
    font-weight: 500;
}

.info-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.info-section h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #00d4ff;
}

.info-section p {
    color: #ccc;
    line-height: 1.6;
}

/* 考試模態框 */
#examConfigModal {
    pointer-events: none;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

#examConfigModal .exam-modal {
    pointer-events: auto;
    position: fixed;
    right: 20px;
    top: 20px;
    width: 360px;
    max-width: 90vw;
    max-height: 70vh;
}

.exam-modal .exam-hint {
    color: #a0a0a0;
}

.exam-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

.exam-form .form-group {
    margin-bottom: 12px;
}

.input-with-action {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-with-action input {
    flex: 1;
}

.field-action-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.exam-form label {
    display: block;
    font-size: 0.9rem;
    color: #ccc;
    margin-bottom: 6px;
}

.exam-form input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    outline: none;
}

.exam-form input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
}

.exam-result {
    text-align: center;
    margin-top: 10px;
    font-weight: 600;
}

.exam-result.ok {
    color: #1dd1a1;
}

.exam-result.err {
    color: #ee5a24;
}