:root {
    --primary: #2b4eff;
    --primary-dark: #1a3ad6;
    --accent-green: #3cb878;
    --accent-yellow: #f5a623;
    --bg: #f5f6fa;
    --text: #1c1c28;
    --card-radius: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
.site-header { background: var(--primary); padding: 16px 24px; }
.site-header__inner { max-width: 900px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.site-title { color: #fff; font-weight: 700; font-size: 20px; flex: 1; }
.logout-link { color: #fff; text-decoration: none; font-size: 14px; opacity: 0.85; }
.logout-link:hover { opacity: 1; }
.site-main { max-width: 900px; margin: 32px auto; padding: 0 16px; }

.login-card { max-width: 360px; margin: 60px auto; background: #fff; border: 2px solid var(--primary); border-radius: var(--card-radius); padding: 32px; }
.login-card h1 { font-size: 22px; margin-bottom: 24px; }
.login-card label { display: block; margin-top: 12px; margin-bottom: 4px; font-size: 14px; font-weight: 600; }
.login-card input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid #ccc; font-size: 15px; }
.login-card button { margin-top: 20px; width: 100%; padding: 12px; background: var(--primary); color: #fff; border: none; border-radius: 20px; font-size: 16px; font-weight: 600; cursor: pointer; }
.login-card button:hover { background: var(--primary-dark); }
.login-card .error { color: #d33; font-size: 14px; }

.dashboard h1 { font-size: 28px; margin-bottom: 20px; color: var(--primary); }

.exam-dashboard { display: flex; align-items: center; gap: 40px; background: #fff; border-radius: var(--card-radius); padding: 28px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); flex-wrap: wrap; }
.tasks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 14px; flex: 1; min-width: 280px; }
.task-box { aspect-ratio: 1.6; border-radius: 10px; background: #fff; border: 2px solid; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 15px; color: #1c1c28; }
.task-box--not_started { border-color: #c4c4d0; color: #999; }
.task-box--started { border-color: #f5d76e; }
.task-box--partial { border-color: #a8e6c1; }
.task-box--confident { border-color: var(--accent-green); }
.task-box--recall { border-color: #9b59b6; }
.task-box--problem { border-color: #eb5757; }
.task-box--perfect { background: var(--accent-green); border-color: var(--accent-green); color: #fff; }

.stats-breakdown { margin-top: 28px; background: #fff; border-radius: var(--card-radius); padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.stats-breakdown h2 { font-size: 18px; margin-top: 0; margin-bottom: 16px; color: var(--primary); }
.stats-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats-table th { text-align: left; padding: 8px 4px; border-bottom: 2px solid #eee; color: #777; font-weight: 600; }
.stats-table td { padding: 8px 4px; border-bottom: 1px solid #f0f0f0; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot--not_started { background: #c4c4d0; }
.dot--started { background: #f5d76e; }
.dot--partial { background: #a8e6c1; }
.dot--confident { background: var(--accent-green); }
.dot--recall { background: #9b59b6; }
.dot--problem { background: #eb5757; }
.dot--perfect { background: var(--accent-green); }
.percent-value { font-size: 72px; font-weight: 800; color: var(--primary); line-height: 1; }
.percent-label { font-size: 16px; font-weight: 600; color: #555; margin-top: 4px; }

.messages-block { margin-top: 28px; background: #fff; border-radius: var(--card-radius); padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.messages-block h2 { font-size: 18px; margin-top: 0; margin-bottom: 16px; color: var(--primary); }
.messages-history { display: flex; flex-direction: column; gap: 12px; max-height: 360px; overflow-y: auto; margin-bottom: 16px; }
.messages-empty { color: #888; font-size: 14px; }
.message { max-width: 75%; padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.message--student { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 2px; }
.message--tutor { align-self: flex-start; background: #f0f1f6; color: var(--text); border-bottom-left-radius: 2px; }
.message__meta { font-size: 11px; opacity: 0.7; margin-bottom: 4px; }
.message-form { display: flex; gap: 10px; }
.message-form textarea { flex: 1; min-height: 60px; padding: 10px 12px; border-radius: 10px; border: 1px solid #ccc; font-family: inherit; font-size: 14px; resize: vertical; }
.message-form button { padding: 0 22px; background: var(--primary); color: #fff; border: none; border-radius: 20px; font-weight: 600; cursor: pointer; }
.message-form button:hover { background: var(--primary-dark); }

.task-wrapper { position: relative; aspect-ratio: 1.6; }
.task-wrapper .task-box { width: 100%; height: 100%; }
.task-popups {
    display: none;
    position: absolute;
    top: 110%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    flex-direction: column;
    gap: 10px;
}
.task-wrapper:hover .task-popups { display: flex; }
.task-popup {
    width: 640px;
    background: #fff;
    border: 1px solid #e0e0e8;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    text-align: left;
}
.task-popup img { width: 100%; border-radius: 8px; margin-bottom: 8px; display: block; }
.task-popup p { margin: 0; font-size: 17px; line-height: 1.6; color: #333; }
.task-popup--comment { border: 1px solid var(--accent-green); background: #f3fbf6; }
.task-popup__label { font-size: 12px; font-weight: 700; color: var(--accent-green); text-transform: uppercase; margin-bottom: 6px; }

.history-block { margin-top: 28px; background: #fff; border-radius: var(--card-radius); padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.history-block h2, .history-block h3 { color: var(--primary); margin-top: 0; }
.history-block h3 { font-size: 15px; margin-top: 20px; margin-bottom: 10px; }
.score-chart { margin: 10px 0; }
.history-feed { list-style: none; padding: 0; margin: 0; font-size: 14px; color: #444; }
.history-feed li { padding: 6px 0; border-bottom: 1px solid #f0f0f0; }
.history-feed li:last-child { border-bottom: none; }

@media (max-width: 640px) {
    .site-main { padding: 0 10px; margin: 16px auto; }
    .site-header__inner { flex-wrap: wrap; }
    .dashboard h1 { font-size: 22px; }
    .exam-dashboard { flex-direction: column; align-items: stretch; padding: 16px; gap: 20px; }
    .tasks-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 8px; }
    .task-box { font-size: 12px; }
    .percent-card { text-align: center; }
    .percent-value { font-size: 56px; }
    .task-popup { width: 85vw; max-width: 320px; }
    .message { max-width: 90%; }
    .message-form { flex-direction: column; }
    .message-form button { padding: 10px; }
    .stats-table th, .stats-table td { font-size: 12px; padding: 6px 2px; }
    .exam-countdown { font-size: 12px; }
}

.exam-countdown { background: #fff8e6; border: 1px solid var(--accent-yellow); color: #7a5b00; border-radius: 10px; padding: 14px 18px; font-size: 16px; font-weight: 600; margin-top: 8px; margin-bottom: 24px; }
