/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6C63FF;
    --primary-light: #8B85FF;
    --primary-dark: #4A42DB;
    --success: #00C853;
    --warning: #FFB300;
    --danger: #FF5252;
    --bg: #F5F7FF;
    --bg-card: #FFFFFF;
    --text: #2D3436;
    --text-light: #636E72;
    --text-muted: #B2BEC3;
    --shadow: 0 4px 20px rgba(108, 99, 255, 0.1);
    --shadow-lg: 0 8px 40px rgba(108, 99, 255, 0.15);
    --radius: 16px;
    --radius-sm: 10px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Screens ===== */
.screen {
    display: none;
    min-height: 100vh;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* ===== Buttons ===== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-large {
    padding: 16px 40px;
    font-size: 18px;
    border-radius: var(--radius);
}

.btn-back {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--primary);
    cursor: pointer;
    padding: 8px 0;
    font-weight: 600;
    margin-bottom: 16px;
    display: inline-block;
}

.btn-back:hover {
    color: var(--primary-dark);
}

.btn-voice {
    padding: 10px 20px;
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-voice.listening {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(255, 82, 82, 0); }
}

/* ===== Profile Screen ===== */
.profile-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 60px 24px;
    text-align: center;
}

.app-title {
    font-size: 42px;
    color: var(--primary);
    margin-bottom: 8px;
}

.app-subtitle {
    font-size: 18px;
    color: var(--text-light);
    margin-bottom: 48px;
}

.profile-cards {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.profile-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px 28px 28px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow);
    flex: 1;
    min-width: 240px;
    max-width: 340px;
    text-align: center;
}

.profile-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--primary);
}

.profile-avatar {
    font-size: 64px;
    margin-bottom: 16px;
}

.avatar-photo {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
    transition: all 0.3s ease;
}

.profile-card:hover .avatar-photo {
    border-color: var(--primary-dark);
    box-shadow: 0 6px 28px rgba(108, 92, 231, 0.45);
    transform: scale(1.05);
}

.profile-card h2 {
    font-size: 22px;
    margin-bottom: 4px;
    color: var(--text);
}

.profile-card p {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 8px;
}

.profile-stars {
    color: #FFD700;
    font-size: 18px;
    margin-bottom: 4px;
}

.profile-level {
    margin-bottom: 8px;
}

.level-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.xp-bar {
    height: 6px;
    background: #E0E0E0;
    border-radius: 3px;
    margin-top: 4px;
    overflow: hidden;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 3px;
    transition: width 0.5s;
}

.profile-streak {
    font-size: 13px;
    color: #FF6D00;
    font-weight: 600;
    margin-top: 4px;
}

.home-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== Setup Screen ===== */
.setup-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 32px 24px;
}

.setup-container h1 {
    font-size: 28px;
    margin-bottom: 32px;
    color: var(--primary);
}

.setup-form {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 16px;
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #E0E0E0;
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.time-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.time-input-row input {
    width: 120px !important;
    flex: none;
}

.time-unit {
    color: var(--text-light);
    font-size: 16px;
}

.subject-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag {
    padding: 10px 18px;
    border: 2px solid #E0E0E0;
    border-radius: 25px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag:hover, .tag.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

/* Today's homework list */
.today-homework {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.today-homework h3 {
    margin-bottom: 16px;
    color: var(--text);
}

.homework-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--bg);
}

.homework-item.completed {
    opacity: 0.7;
}

.homework-item .hw-name {
    font-weight: 600;
}

.homework-item .hw-details {
    font-size: 13px;
    color: var(--text-light);
}

.homework-item .hw-score {
    font-weight: 700;
    font-size: 18px;
}

.hw-score.excellent { color: var(--success); }
.hw-score.good { color: #4CAF50; }
.hw-score.needs-improvement { color: var(--warning); }
.hw-score.bad { color: var(--danger); }

/* ===== Session Screen ===== */
.session-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: #1a1a2e;
    color: white;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    margin-bottom: 12px;
}

.session-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.child-badge, .homework-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.child-badge {
    background: var(--primary);
}

.homework-badge {
    background: rgba(255, 255, 255, 0.15);
}

.session-main {
    flex: 1;
    display: flex;
    gap: 20px;
    min-height: 0;
}

/* Camera */
.camera-section {
    flex: 1;
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}

#camera-feed {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scaleX(-1);
}

#face-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
}

.attention-indicator {
    display: none;
}

.attention-character {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 10;
    pointer-events: none;
}

.character-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s ease;
}

.character-icon.hero {
    background: rgba(255, 215, 0, 0.2);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    animation: heroFloat 3s ease-in-out infinite;
}

.character-icon.monster {
    background: rgba(255, 71, 87, 0.25);
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.4);
    animation: monsterShake 0.8s ease-in-out infinite;
}

.character-svg {
    width: 65px;
    height: 65px;
}

.character-label {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    backdrop-filter: blur(6px);
    white-space: nowrap;
    transition: all 0.5s ease;
}

.character-label.hero-label {
    background: rgba(46, 213, 115, 0.8);
}

.character-label.monster-label {
    background: rgba(255, 71, 87, 0.85);
}

@keyframes heroFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-6px) scale(1.05); }
}

@keyframes monsterShake {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-3deg) scale(1.08); }
    75% { transform: rotate(3deg) scale(1.08); }
}

.camera-status {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    backdrop-filter: blur(10px);
    display: none;
}

.camera-status.visible {
    display: block;
}

/* Stats */
.stats-section {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timer-display {
    display: flex;
    justify-content: center;
}

.timer-ring {
    position: relative;
    width: 180px;
    height: 180px;
}

.timer-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: var(--success);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.5s;
}

.timer-progress.warning {
    stroke: var(--warning);
}

.timer-progress.danger {
    stroke: var(--danger);
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

#timer-value {
    font-size: 36px;
    font-weight: 700;
    display: block;
}

.timer-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* Score Display */
.score-card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.score-card h3 {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
}

.score-value {
    font-size: 48px;
    font-weight: 800;
    color: var(--success);
    transition: color 0.3s;
}

.score-value.good { color: var(--success); }
.score-value.okay { color: var(--warning); }
.score-value.bad { color: var(--danger); }

.score-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 12px 0 8px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    width: 100%;
    background: var(--success);
    border-radius: 4px;
    transition: width 0.5s, background 0.5s;
}

.score-label {
    font-size: 14px;
    font-weight: 600;
}

/* Session Stats */
.session-stats {
    display: flex;
    gap: 8px;
}

.stat-item {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 12px 8px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
}

.session-controls {
    display: flex;
    justify-content: center;
}

/* Reminder Toast */
.reminder-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 16px 32px;
    border-radius: var(--radius);
    font-size: 18px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    animation: slideUp 0.3s ease;
    max-width: 90%;
    text-align: center;
}

.reminder-toast.hidden {
    display: none;
}

@keyframes slideUp {
    from { transform: translate(-50%, 20px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

/* ===== Complete Screen ===== */
.complete-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 48px 24px;
    text-align: center;
}

.complete-animation {
    font-size: 80px;
    margin-bottom: 16px;
    animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.complete-container h1 {
    font-size: 32px;
    margin-bottom: 8px;
}

.complete-container > p {
    color: var(--text-light);
    margin-bottom: 32px;
    font-size: 16px;
}

.complete-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.complete-stat {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 16px 8px;
    box-shadow: var(--shadow);
}

.complete-stat-value {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
}

.complete-stat-label {
    font-size: 12px;
    color: var(--text-light);
}

.complete-rating {
    margin: 24px 0;
    padding: 16px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
}

.complete-rating.excellent {
    background: #E8F5E9;
    color: #2E7D32;
}

.complete-rating.good {
    background: #E8F5E9;
    color: #388E3C;
}

.complete-rating.needs-improvement {
    background: #FFF8E1;
    color: #F57F17;
}

.complete-rating.bad {
    background: #FFEBEE;
    color: #C62828;
}

.complete-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== Analytics Screen ===== */
.analytics-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px;
}

.analytics-container h1 {
    font-size: 28px;
    margin-bottom: 24px;
    color: var(--primary);
}

.analytics-tabs, .analytics-profile-select {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab, .profile-tab {
    padding: 10px 24px;
    border: 2px solid #E0E0E0;
    border-radius: 25px;
    background: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active, .profile-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.analytics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.summary-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.summary-card .value {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
}

.summary-card .label {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
}

.chart-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.chart-container h3 {
    margin-bottom: 16px;
    color: var(--text);
}

.chart-container canvas {
    max-height: 300px;
}

/* Records */
.records-section, .rewards-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.records-section h3, .rewards-section h3 {
    margin-bottom: 16px;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    margin-bottom: 8px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
    gap: 8px;
}

.record-item .rec-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.record-item .rec-subject {
    font-size: 24px;
}

.record-item .rec-name {
    font-weight: 600;
}

.record-item .rec-meta {
    font-size: 12px;
    color: var(--text-light);
}

.record-item .rec-score {
    font-size: 22px;
    font-weight: 800;
}

.reward-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
}

.reward-item.reward {
    background: #E8F5E9;
}

.reward-item.punishment {
    background: #FFEBEE;
}

.reward-item .reward-icon {
    font-size: 28px;
}

.reward-item .reward-text {
    font-weight: 600;
}

.reward-item .reward-detail {
    font-size: 13px;
    color: var(--text-light);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ===== PIN Modal ===== */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden { display: none; }

.modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 340px;
    width: 90%;
}

.modal-content h2 {
    font-size: 22px;
    margin-bottom: 8px;
}

.modal-content > p {
    color: var(--text-light);
    margin-bottom: 20px;
}

.pin-display {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
}

.pin-dot {
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    transition: all 0.2s;
}

.pin-dot.filled {
    background: var(--primary);
}

.pin-display.shake {
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.pin-key {
    padding: 14px;
    border: 1px solid #E0E0E0;
    border-radius: var(--radius-sm);
    background: white;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s;
}

.pin-key:active {
    background: var(--primary);
    color: white;
}

.pin-key-enter {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pin-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* ===== Yesterday's Performance ===== */
.yesterday-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.yesterday-header h3 {
    margin-bottom: 16px;
    color: var(--text);
}

.yesterday-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.ystat {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 12px 8px;
    text-align: center;
}

.ystat-value {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

.ystat-value.score-good { color: var(--success); }
.ystat-value.score-ok { color: var(--warning); }
.ystat-value.score-low { color: var(--danger); }

.ystat-label {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
    display: block;
}

.yesterday-subjects {
    margin-bottom: 16px;
}

.ysubject-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: var(--bg);
}

.ysubject-name {
    font-weight: 600;
    font-size: 14px;
}

.ysubject-score {
    font-weight: 800;
    font-size: 18px;
}

.ysubject-score.score-good { color: var(--success); }
.ysubject-score.score-ok { color: var(--warning); }
.ysubject-score.score-low { color: var(--danger); }

.yesterday-advice-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.yesterday-advice {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    align-items: flex-start;
    border-left: 4px solid transparent;
}

.yesterday-advice.excellent {
    background: #E8F5E9;
    border-left-color: var(--success);
}

.yesterday-advice.great {
    background: #E8F5E9;
    border-left-color: #4CAF50;
}

.yesterday-advice.improving {
    background: #FFF8E1;
    border-left-color: var(--warning);
}

.yesterday-advice.needs-work {
    background: #FFF3E0;
    border-left-color: #FF9800;
}

.yesterday-advice.motivation {
    background: #F3E5F5;
    border-left-color: var(--primary);
}

.advice-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.advice-text strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text);
}

.advice-text p {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
    margin: 0;
}

/* ===== Session Header Actions ===== */
.session-header-actions {
    display: flex;
    gap: 8px;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #00A844;
}

/* ===== Badge Earned (Completion Screen) ===== */
.badge-earned {
    margin: 12px 0 20px;
}

.badge-earned.hidden { display: none; }

.xp-gained {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), #8B85FF);
    color: white;
    padding: 6px 20px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 16px;
    animation: bounceIn 0.5s ease;
}

.level-up-notice {
    margin-top: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: #333;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 16px;
    animation: bounceIn 0.6s ease;
}

/* ===== Break Timer Screen ===== */
.break-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 60px 24px;
    text-align: center;
}

.break-animation {
    font-size: 80px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.break-container h1 {
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 8px;
}

.break-container > p {
    color: var(--text-light);
    margin-bottom: 32px;
}

.break-timer {
    margin-bottom: 32px;
}

#break-timer-value {
    font-size: 64px;
    font-weight: 800;
    color: var(--primary);
}

.break-suggestions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 32px;
}

.break-tip {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    font-size: 14px;
}

.break-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ===== Date Navigation ===== */
.analytics-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.date-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-icon {
    width: 36px; height: 36px;
    border: 2px solid #E0E0E0;
    border-radius: 50%;
    background: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
}

#date-range-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    min-width: 120px;
    text-align: center;
}

/* ===== Badges Section ===== */
.badges-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.badges-section h3 {
    margin-bottom: 16px;
}

#badges-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.badge-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 2px solid #E8E8E8;
}

.badge-item.earned {
    background: #F0F7FF;
    border-color: var(--primary-light);
}

.badge-item.locked {
    opacity: 0.5;
}

.badge-icon { font-size: 28px; }
.badge-name { font-weight: 700; font-size: 14px; }
.badge-desc { font-size: 12px; color: var(--text-light); }

/* ===== Export Section ===== */
.export-section {
    text-align: center;
    padding: 16px 0 32px;
}

/* ===== Backup Section ===== */
.backup-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
}

.backup-section h3 {
    margin-bottom: 8px;
}

.backup-hint {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 16px;
}

.backup-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-upload {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.backup-status {
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}

.backup-status.success {
    background: rgba(46, 213, 115, 0.15);
    color: #2ED573;
}

.backup-status.error {
    background: rgba(255, 82, 82, 0.15);
    color: #FF5252;
}

.backup-status.hidden {
    display: none;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .session-main {
        flex-direction: column;
    }

    .stats-section {
        width: 100%;
    }

    .camera-section {
        height: 40vh;
        flex: none;
    }

    .complete-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .timer-ring {
        width: 140px;
        height: 140px;
    }

    #timer-value {
        font-size: 28px;
    }

    .score-value {
        font-size: 36px;
    }

    .app-title {
        font-size: 28px;
    }

    .profile-card {
        padding: 20px;
    }

    .profile-avatar {
        font-size: 48px;
    }

    .avatar-photo {
        width: 120px;
        height: 120px;
    }

    .session-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .session-header-actions {
        flex-wrap: wrap;
    }

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

    .break-suggestions {
        grid-template-columns: 1fr;
    }

    .analytics-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    #badges-list {
        grid-template-columns: 1fr;
    }

    .pin-pad {
        max-width: 250px;
        margin: 0 auto 16px;
    }
}
