* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.input-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.input-header h2 {
    font-size: 1.3rem;
    color: #333;
    font-weight: 600;
}

.char-count {
    font-size: 0.9rem;
    color: #666;
    background: #f5f5f5;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

textarea {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 1rem;
    resize: vertical;
    transition: all 0.3s ease;
    font-family: inherit;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.analyze-btn {
    flex: 1.2;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    line-height: 1.2;
    min-height: 48px;
    white-space: nowrap;
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.analyze-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.load-example-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    color: #495057;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1.2;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.load-example-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.clear-text-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    background: #fff5f5;
    color: #e74c3c;
    border: 2px solid #e74c3c;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1.2;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.clear-text-btn:hover {
    background: #e74c3c;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.3);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.info-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.info-section h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 600;
}

.info-section p {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.result-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.result-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #333;
    font-weight: 600;
}

.result-card {
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.result-header {
    padding: 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
}

.result-verdict {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.verdict-text {
    font-size: 1.3rem;
    font-weight: 700;
}

.verdict-text.level-0 {
    color: #27ae60;
}

.verdict-text.level-1 {
    color: #f39c12;
}

.verdict-text.level-2 {
    color: #3498db;
}

.verdict-text.level-3 {
    color: #e74c3c;
}

.verdict-text.level-4 {
    color: #8e44ad;
}

.confidence-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
}

.confidence-badge.low {
    background: #fff3cd;
    color: #856404;
}

.confidence-badge.medium {
    background: #d1ecf1;
    color: #0c5460;
}

.confidence-badge.high {
    background: #d4edda;
    color: #155724;
}

.result-details {
    padding: 1.5rem;
}

.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 600;
}

.reasoning-content {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    line-height: 1.6;
    color: #555;
}

.levels-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.level-item {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.level-item.identified {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.level-item.grayed-out {
    opacity: 0.5;
    background: #f8f9fa;
}

.level-header {
    padding: 1rem;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
}

.level-header:hover {
    background: #f8f9fa;
}

.level-item.grayed-out .level-header:hover {
    background: #f1f3f4;
}

.level-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.level-number {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.level-item.grayed-out .level-number {
    background: #adb5bd;
}

.level-name {
    font-weight: 600;
    color: #333;
}

.level-item.grayed-out .level-name {
    color: #6c757d;
}

.identified-badge {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.toggle-icon {
    color: #6c757d;
    font-size: 0.9rem;
    transition: transform 0.3s ease;
    font-weight: bold;
}

.level-content {
    padding: 0 1rem;
    border-top: 1px solid #e1e5e9;
    background: white;
    display: none;
}

.level-item.identified .level-content {
    display: block;
    border-top-color: #667eea;
}

.level-content > div {
    margin: 0.75rem 0;
    line-height: 1.5;
    color: #555;
}

.level-content > div:last-child {
    margin-bottom: 0.75rem;
}

.level-content strong {
    color: #333;
    font-weight: 600;
}

.level-description,
.level-characteristics,
.level-purpose,
.level-keywords,
.level-example {
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .level-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .level-header {
        padding: 0.75rem;
    }
    
    .level-content {
        padding: 0 0.75rem;
    }
    
    .level-content > div {
        font-size: 0.85rem;
        margin: 0.5rem 0;
    }
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.detail-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
}

.detail-item h4 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.detail-item p {
    color: #333;
    font-size: 1rem;
}

.analyze-again-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.analyze-again-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.3);
}

.footer {
    text-align: center;
    color: rgba(255,255,255,0.8);
    margin-top: auto;
    padding-top: 2rem;
}

.footer p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.footer-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: rgba(255,255,255,0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.2);
}

.footer-link:hover {
    color: white;
    background: rgba(255,255,255,0.2);
    transform: translateY(-1px);
    text-decoration: none;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .input-section,
    .result-section {
        padding: 1.5rem;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .result-verdict {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .load-example-btn,
    .clear-text-btn,
    .analyze-btn {
        width: 100%;
        flex: none;
    }
}

.progress-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.progress-container {
    text-align: center;
}

.progress-text {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 1rem;
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e1e5e9;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
    display: block;
    min-width: 0%;
}

.progress-countdown {
    font-size: 1rem;
    color: #666;
    font-weight: 500;
}

.progress-countdown #countdownText {
    color: #667eea;
    font-weight: 700;
    font-size: 1.2rem;
}