/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    animation: fadeInDown 1s ease;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.tagline {
    font-size: 1.5rem;
    opacity: 0.9;
}

/* 屏幕容器 */
.screen {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    text-align: center;
    animation: fadeIn 0.8s ease;
}

.hidden {
    display: none;
}

/* 首页按钮 */
.cta-button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.cta-button:active {
    transform: translateY(-1px);
}

.cta-button.secondary {
    background: linear-gradient(45deg, #ff9a9e, #fecfef);
}

.cta-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.cta-button:focus:not(:active)::after {
    animation: ripple 1s ease;
}

/* 测试界面 */
.progress-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.progress-bar {
    flex: 1;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    margin-right: 20px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 6px;
    width: 5%;
    transition: width 0.5s ease;
}

#question-text {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: #333;
    animation: slideInLeft 0.5s ease;
}

.options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.option {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.option:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.option.selected {
    border-color: #667eea;
    background: #eef2ff;
    transform: translateY(-3px);
}

.option.selected::before {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 15px;
    color: #667eea;
    font-size: 1.5rem;
    font-weight: bold;
}

.option-letter {
    display: inline-block;
    width: 30px;
    height: 30px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    margin-right: 10px;
    font-weight: bold;
    transition: transform 0.2s ease;
}

.option:hover .option-letter {
    transform: scale(1.1);
}

.nav-button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    border-radius: 25px;
    cursor: pointer;
    margin: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-button:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.nav-button:active {
    transform: translateY(0);
}

.nav-button:disabled {
    background: #e9ecef;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 结果界面 */
#result-screen h2 {
    margin-bottom: 30px;
    font-size: 2rem;
    color: #333;
    animation: fadeInUp 0.8s ease;
}

#personality-type {
    color: #667eea;
    font-weight: bold;
    font-size: 2.5rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

#town-container {
    margin: 40px 0;
    min-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

/* SVG小镇样式 */
.town-svg {
    width: 100%;
    height: 500px;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    background: #e0f7fa;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.town-svg:hover {
    transform: scale(1.02);
}

.building {
    cursor: pointer;
    transition: all 0.3s ease;
    transform-origin: center;
}

.building:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.2));
    z-index: 10;
}

.building:hover rect {
    stroke-width: 3;
    stroke: #ff6b6b;
}

.tooltip {
    position: fixed;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 15px;
    border-radius: 10px;
    font-size: 14px;
    max-width: 250px;
    z-index: 1000;
    pointer-events: none;
    backdrop-filter: blur(5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transform: translate(-50%, -100%);
    margin-top: -10px;
    animation: fadeIn 0.2s ease;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0,0,0,0.9) transparent transparent transparent;
}

.tooltip strong {
    display: block;
    margin-bottom: 5px;
    color: #ffeb3b;
    font-size: 16px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .tagline {
        font-size: 1.2rem;
    }
    
    .screen {
        padding: 20px;
    }
    
    .options {
        grid-template-columns: 1fr;
    }
    
    .actions {
        flex-direction: column;
        align-items: center;
    }
    
    .cta-button {
        width: 100%;
        margin-bottom: 10px;
    }
    
    #question-text {
        font-size: 1.2rem;
    }
    
    .town-svg {
        height: 400px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .screen {
        padding: 15px;
    }
    
    #question-text {
        font-size: 1.1rem;
    }
    
    .option {
        padding: 15px;
    }
    
    .town-svg {
        height: 300px;
    }
}

/* 动画关键帧 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes ripple {
    0% {
        transform: scale(1, 1);
        opacity: 1;
    }
    100% {
        transform: scale(100, 100);
        opacity: 0;
    }
}