* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --tertiary: #f093fb;
    --dark: #0f0f2e;
    --light: #f8f9ff;
    --accent: #ffd89b;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--dark) 0%, #1a0033 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 별 배경 애니메이션 */
.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    opacity: 0.7;
}

.star.small { width: 1px; height: 1px; opacity: 0.4; }
.star.medium { width: 2px; height: 2px; opacity: 0.6; }
.star.large { width: 3px; height: 3px; opacity: 0.8; }

/* 컨테이너 */
.container {
    position: relative;
    z-index: 10;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* 헤더 */
header {
    text-align: center;
    padding: 40px 20px 20px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--tertiary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: 2px;
}

header h1 .logo-icon {
    -webkit-text-fill-color: unset;
    background: none;
    margin-right: 5px;
}

header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    font-weight: 300;
}

/* 메인 콘텐츠 */
.content {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
}

/* 카드 스타일 */
.card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    padding: 50px 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.6s ease-out;
    width: 100%;
    box-sizing: border-box;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card h2 {
    font-size: 2rem;
    color: var(--dark);
    margin-bottom: 20px;
}

.card p {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* 타일 그리드 (메인 페이지) */
.tests-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 40px 20px;
}

.test-tile {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.test-tile:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 50px rgba(102, 126, 234, 0.4);
}

.test-thumbnail {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
}

.test-info {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.test-info h3 {
    font-size: 1.3rem;
    color: var(--dark);
    margin-bottom: 10px;
}

.test-info p {
    color: #999;
    font-size: 0.95rem;
    margin-bottom: 15px;
    flex: 1;
}

.test-info .btn {
    align-self: flex-start;
}

/* 버튼 스타일 */
.btn {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-lg {
    padding: 15px 50px;
    font-size: 1.1rem;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent), #ffb347);
    color: var(--dark);
}

.btn-secondary:hover {
    box-shadow: 0 10px 25px rgba(255, 216, 155, 0.4);
}

/* 진행률 바 */
.progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 30px 0;
    box-sizing: border-box;
    display: block;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.3s ease;
}

/* 문항 화면 */
.question-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    padding: 50px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.6s ease-out;
    width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
    flex: 0 0 auto;
}

#question-container {
    width: 100%;
    box-sizing: border-box;
    display: block;
}

#question-container > * {
    width: 100%;
    box-sizing: border-box;
}

#question-container .progress-bar {
    width: 100%;
    box-sizing: border-box;
}

#question-container .options {
    width: 100%;
    box-sizing: border-box;
}

.question-number {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 20px;
    font-size: 0.95rem;
    letter-spacing: 1px;
    width: 100%;
    box-sizing: border-box;
    display: block;
}

.question-text {
    font-size: 1.5rem;
    color: white;
    margin-bottom: 40px;
    line-height: 1.6;
    width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: block;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
}

.option {
    padding: 20px 25px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.05rem;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: block;
}

.option:hover {
    background: #e8f0ff;
    border-color: var(--primary);
}

.option.selected {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-color: var(--secondary);
}

/* 로딩 화면 */
.loading-container {
    text-align: center;
    padding: 60px 40px;
}

.loading-title {
    font-size: 1.8rem;
    color: #000;
    margin-bottom: 40px;
}

.orbit {
    width: 100px;
    height: 100px;
    margin: 30px auto;
    position: relative;
}

.planet {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    position: absolute;
    background: linear-gradient(135deg, var(--tertiary), var(--primary));
    top: 50%;
    left: 50%;
    margin: -15px 0 0 -15px;
    animation: spin 4s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg) translateX(40px) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(40px) rotate(-360deg); }
}

.loading-text {
    color: #000;
    margin-top: 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* 결과 화면 */
.result-badge {
    width: 150px;
    height: 150px;
    margin: 0 auto 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: white;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

.result-title {
    font-size: 2rem;
    color: var(--dark);
    margin: 20px 0;
}

.result-description {
    color: #666;
    margin: 20px 0 30px;
    line-height: 1.8;
    font-size: 1.05rem;
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

.result-actions .btn {
    flex: 1;
    min-width: 200px;
}

/* 태블릿 이상 (768px 이상) */
@media (min-width: 768px) {
    .tests-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card {
        max-width: 500px;
        margin: 0 auto;
    }
    
    .question-card {
        max-width: 600px;
        margin: 0 auto;
        width: 600px;
        flex: 0 0 600px;
    }
}

/* 데스크톱 (1024px 이상) */
@media (min-width: 1024px) {
    .tests-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .container {
        max-width: 900px;
    }
    
    .card {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .question-card {
        max-width: 800px;
        margin: 0 auto;
        width: 800px;
        flex: 0 0 800px;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .card {
        padding: 40px 25px;
    }
    
    .content {
        width: 100%;
        max-width: 100%;
    }

    .container {
        padding: 10px;
        width: 100%;
        max-width: 100%;
    }

    .question-card {
        padding: 30px 20px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .question-text {
        font-size: 1.2rem;
    }

    .btn-lg {
        padding: 12px 30px;
        font-size: 1rem;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-actions .btn {
        min-width: 100%;
    }
}
