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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f9fafb;
    color: #1f2937;
    min-height: 100vh;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    color: #1f2937;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    text-decoration: none;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.nav-link.active {
    background: #f3f4f6;
    color: #1f2937;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
}

/* Main */
.main {
    flex: 1;
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* Score Section */
.score-section {
    text-align: center;
    padding: 40px 0;
}

.score-ring-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 24px;
}

.score-ring {
    width: 100%;
    height: 100%;
}

.score-avatar {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.score-display {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 8px;
}

.score-current {
    color: #1f2937;
}

.score-separator,
.score-total {
    color: #d1d5db;
}

.score-label {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.score-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
}

.learn-more {
    font-size: 14px;
    color: #6b7280;
    text-decoration: none;
}

.learn-more:hover {
    color: #6366f1;
}

.badges {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
}

.badge-icon {
    font-size: 16px;
}

/* Courses Section */
.courses-section {
    margin-top: 40px;
}

.section-header {
    text-align: center;
    margin-bottom: 24px;
}

.attention-indicator {
    font-size: 14px;
    color: #6b7280;
}

.course-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}

.course-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.course-card.locked {
    opacity: 0.6;
}

.course-card.completed {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.course-icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 12px;
    flex-shrink: 0;
}

.course-content {
    flex: 1;
}

.course-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.course-meta {
    font-size: 13px;
    color: #9ca3af;
    margin-bottom: 8px;
}

.course-description {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 12px;
}

.course-due {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
}

.course-locked-info {
    font-size: 13px;
    color: #9ca3af;
    font-style: italic;
}

.course-action {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.btn-start {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #1f2937;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-start:hover {
    background: #374151;
}

.points-badge {
    background: #22c55e;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 12px;
}

.completion-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #9ca3af;
}

.completion-avatars {
    display: flex;
}

.completion-avatars img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid white;
    margin-left: -8px;
}

.completion-avatars img:first-child {
    margin-left: 0;
}

.completed-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #22c55e;
    font-weight: 600;
}

.completed-badge .check {
    width: 24px;
    height: 24px;
    background: #22c55e;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.points-earned {
    color: #9ca3af;
    font-weight: 500;
}

/* Leaderboard */
.leaderboard-header {
    text-align: center;
    padding: 40px 0;
}

.trophy-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.leaderboard-header h1 {
    font-size: 32px;
    font-weight: 300;
    color: #d1d5db;
    margin-bottom: 8px;
}

.leaderboard-subtitle {
    font-size: 14px;
    color: #9ca3af;
}

.leaderboard-list {
    background: white;
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: 12px;
    transition: all 0.2s;
}

.leaderboard-item:hover {
    background: #f9fafb;
}

.leaderboard-item.current-user {
    background: #f3f4f6;
}

.rank {
    width: 32px;
    font-size: 18px;
    text-align: center;
    font-weight: 600;
    color: #6b7280;
}

.lb-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.lb-name {
    flex: 1;
    font-weight: 500;
}

.lb-score {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
}

.lb-score-icon {
    color: #f59e0b;
}

.lb-score .current {
    font-weight: 600;
}

.lb-score .total {
    color: #9ca3af;
}

.leaderboard-divider {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 16px;
    color: #d1d5db;
}

/* Course Chat View */
#course-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 1000;
    padding: 0;
    overflow: hidden;
}

#course-view.active {
    display: flex;
    flex-direction: column;
}

.close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 50%;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f3f4f6;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 70px 20px 220px 20px;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

.chat-messages-inner {
    max-width: 600px;
    margin: 0 auto;
}

.chat-message {
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

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

.chat-message.bot {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.bot-content {
    flex: 1;
}

.bot-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1f2937;
}

.bot-bubble {
    background: #f3f4f6;
    padding: 14px 18px;
    border-radius: 18px;
    border-top-left-radius: 4px;
    font-size: 15px;
    line-height: 1.5;
    max-width: 90%;
    display: inline-block;
}

.bot-bubble + .bot-bubble {
    margin-top: 8px;
    display: block;
}

.chat-message.user {
    display: flex;
    justify-content: flex-end;
}

.user-bubble {
    background: #1f2937;
    color: white;
    padding: 14px 18px;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    font-size: 15px;
    max-width: 80%;
}

.chat-image {
    max-width: 100%;
    border-radius: 12px;
    margin: 12px 0;
}

.chat-options {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    background: linear-gradient(to top, white 80%, transparent);
    padding-top: 40px;
}

.chat-options-inner {
    max-width: 600px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.option-btn {
    padding: 14px 20px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    max-width: 80%;
    text-align: right;
}

.option-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    background: #f3f4f6;
    border-radius: 18px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Course Complete */
.course-complete {
    text-align: center;
    padding: 40px;
    animation: fadeIn 0.5s ease;
}

.complete-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.complete-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.complete-subtitle {
    color: #6b7280;
    margin-bottom: 24px;
}

.complete-points {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #22c55e;
    color: white;
    border-radius: 100px;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.complete-total {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 4px;
}

.complete-progress {
    font-size: 14px;
    color: #9ca3af;
    margin-bottom: 24px;
}

.btn-back {
    padding: 14px 28px;
    background: #1f2937;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.btn-back:hover {
    background: #374151;
}

/* Break Modal */
.break-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.break-modal {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

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

.break-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.break-modal h2 {
    font-size: 24px;
    margin-bottom: 16px;
    color: #1f2937;
}

.break-modal p {
    font-size: 15px;
    color: #6b7280;
    margin-bottom: 8px;
    line-height: 1.5;
}

.break-remaining {
    color: #22c55e !important;
    font-weight: 600;
    margin-top: 16px !important;
}

.break-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.btn-break-later {
    padding: 14px 24px;
    background: #1f2937;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.btn-break-later:hover {
    background: #374151;
}

.btn-break-continue {
    padding: 14px 24px;
    background: white;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

.btn-break-continue:hover {
    background: #f9fafb;
}

/* Responsive */
@media (max-width: 640px) {
    .header {
        padding: 12px 16px;
    }

    .main {
        padding: 20px;
    }

    .course-card {
        flex-direction: column;
    }

    .course-action {
        align-items: flex-start;
        width: 100%;
    }

    .btn-start {
        width: 100%;
        justify-content: center;
    }

    .badges {
        flex-direction: column;
    }
}
