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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #e4e4e7;
    min-height: 100vh;
    padding: 2rem 1rem;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 1.5rem;
}

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

.header-content i {
    font-size: 2.5rem;
    color: #60a5fa;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: #9ca3af;
    font-size: 1.1rem;
}

/* Help Button */
.help-button-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.help-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.help-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

/* Welcome Modal - Separate styles */
.welcome-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.welcome-modal-box {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 1rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

.welcome-modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #374151;
}

.welcome-modal-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    color: #fbbf24;
}

.welcome-modal-body {
    padding: 2rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
}

.modal.hidden {
    display: none;
}

/* Welcome Modal Specific */
.welcome-modal-content {
    max-width: 600px;
}

.warning-content {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.warning-icon {
    flex-shrink: 0;
}

.warning-icon i {
    font-size: 3rem;
    color: #fbbf24;
}

.warning-text h3 {
    color: #60a5fa;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.warning-text p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.warning-text ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.warning-text li {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.warning-text li i {
    color: #60a5fa;
    font-size: 0.75rem;
}

.drive-link {
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid #60a5fa;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.drive-link i {
    color: #60a5fa;
}

.drive-link a {
    color: #60a5fa;
    text-decoration: underline;
    font-weight: 600;
}

.drive-link a:hover {
    color: #93c5fd;
}

.note-text {
    background: rgba(251, 191, 36, 0.1);
    border-left: 4px solid #fbbf24;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.note-text i {
    color: #fbbf24;
    margin-top: 0.25rem;
    flex-shrink: 0;
}

.understand-btn {
    width: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.understand-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.understand-btn:active {
    transform: translateY(0);
}

.modal-content {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 1rem;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #374151;
    position: sticky;
    top: 0;
    background: #1f2937;
    z-index: 10;
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    color: #a78bfa;
}

.close-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #f87171;
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.grade-table-img {
    width: 100%;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
    border: 2px solid #374151;
}

.explanation {
    color: #d1d5db;
}

.explanation h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.3rem;
    color: #60a5fa;
    margin-bottom: 1.5rem;
}

.calc-section {
    background: rgba(55, 65, 81, 0.3);
    border-left: 4px solid #60a5fa;
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.calc-section.total {
    border-left-color: #34d399;
    background: rgba(52, 211, 153, 0.1);
}

.calc-section h4 {
    color: #fbbf24;
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calc-section ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.calc-section li {
    margin-bottom: 0.5rem;
    color: #d1d5db;
}

.text-green {
    color: #34d399;
}

.text-blue {
    color: #60a5fa;
}

.text-yellow {
    color: #fbbf24;
}

.formula {
    background: #111827;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1rem;
    font-family: 'Courier New', monospace;
    color: #34d399;
    font-size: 0.95rem;
    line-height: 1.8;
}

/* Section Title */
.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.section-title i {
    color: #a78bfa;
}

/* Grading System */
.grading-system {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.grade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
}

.grade-card {
    background: rgba(55, 65, 81, 0.5);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
}

.grade-percent {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.grade-percent.blue { color: #60a5fa; }
.grade-percent.green { color: #34d399; }
.grade-percent.yellow { color: #fbbf24; }
.grade-percent.purple { color: #a78bfa; }
.grade-percent.orange { color: #fb923c; }

.grade-label {
    color: #9ca3af;
    font-size: 0.9rem;
}

/* Input Section */
.input-section {
    margin-bottom: 2rem;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.input-card {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.input-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.input-label.blue { color: #60a5fa; }
.input-label.yellow { color: #fbbf24; }

textarea {
    width: 100%;
    height: 250px;
    background: #111827;
    border: 1px solid #4b5563;
    border-radius: 0.5rem;
    padding: 1rem;
    color: #e4e4e7;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    resize: vertical;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

textarea::placeholder {
    color: #6b7280;
}

.input-hint {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #6b7280;
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    margin-bottom: 2rem;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.calculate-btn:active {
    transform: translateY(0);
}

/* Results */
.results {
    animation: fadeIn 0.5s ease;
}

.results.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-section {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border: 1px solid #374151;
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Status Cards */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.status-card {
    background: rgba(55, 65, 81, 0.5);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
}

.status-label {
    color: #9ca3af;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.status-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.status-value.blue { color: #60a5fa; }
.status-value.yellow { color: #fbbf24; }
.status-value.green { color: #34d399; }

.status-percent {
    color: #6b7280;
    font-size: 0.85rem;
}

/* Required Scores */
.required-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.required-card {
    background: rgba(55, 65, 81, 0.5);
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.required-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.required-info i {
    font-size: 1.5rem;
}

.required-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.required-subtitle {
    color: #9ca3af;
    font-size: 0.9rem;
}

.required-score {
    font-size: 2rem;
    font-weight: 700;
}

.score-green {
    color: #34d399;
}

.score-yellow {
    color: #fbbf24;
}

.score-orange {
    color: #fb923c;
}

.score-red {
    color: #f87171;
}

.icon-green {
    color: #34d399;
}

.icon-yellow {
    color: #fbbf24;
}

.icon-orange {
    color: #fb923c;
}

.icon-red {
    color: #f87171;
}

/* Info Note */
.info-note {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid #2563eb;
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.info-note i {
    color: #60a5fa;
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.note-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.info-note p {
    font-size: 0.9rem;
    color: #d1d5db;
}

/* Error Message */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.error-message.hidden {
    display: none;
}

.error-message i {
    color: #f87171;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.error-message p {
    color: #fca5a5;
    font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .header-content i {
        font-size: 2rem;
    }

    .input-grid {
        grid-template-columns: 1fr;
    }

    .grade-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .status-grid {
        grid-template-columns: 1fr;
    }

    .required-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .required-score {
        align-self: flex-end;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .modal-header {
        padding: 1rem 1.5rem;
    }

    .welcome-modal-body {
        padding: 1.5rem;
    }

    .welcome-modal-header {
        padding: 1rem 1.5rem;
    }

    .warning-content {
        flex-direction: column;
    }

    .warning-icon i {
        font-size: 2.5rem;
    }
}