/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f8fa;
    --bg-card: #ffffff;
    --bg-muted: #f0f2f5;
    --accent: #c8ff7d;
    --accent-dark: #0d1117;
    --accent-hover: #b8f06d;
    --green: #22c55e;
    --red: #ef4444;
    --orange: #f59e0b;
    --text-primary: #0d1117;
    --text-secondary: #6b7280;
    --text-dim: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f0f0f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.1);
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 9999px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.screen {
    display: none;
    min-height: 100vh;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== SVG ICON SYSTEM ===== */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-badge {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-badge svg {
    width: 28px;
    height: 28px;
}

.icon-badge.lime {
    background: var(--accent);
    color: var(--accent-dark);
}

.icon-badge.dark {
    background: var(--accent-dark);
    color: #fff;
}

.icon-badge.outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-secondary);
}

/* ===== BASE LOGIN LAYOUT ===== */
.login-container {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 60px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-header {
    text-align: center;
    margin-bottom: 48px;
}

.logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 24px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 17px;
    margin-top: 12px;
    font-weight: 500;
    line-height: 1.5;
}

.login-form {
    width: 100%;
    max-width: 380px;
    border-radius: var(--radius-xl);
    padding: 40px 36px;
}

.login-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--radius-full);
    color: #ffffff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-btn svg {
    width: 20px;
    height: 20px;
}

/* ===== LOGIN SCREEN (SUPERHERO THEME) ===== */
#screen-login {
    position: relative;
    background: linear-gradient(135deg, #0f0c29 0%, #1a1245 30%, #24243e 60%, #0f0c29 100%);
    overflow: hidden;
    align-items: center;
    justify-content: center;
}

#screen-login::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(79, 70, 229, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(124, 58, 237, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(255, 215, 0, 0.05) 0%, transparent 40%);
    animation: heroAuraPulse 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes heroAuraPulse {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }

    50% {
        transform: scale(1.1) rotate(3deg);
        opacity: 0.8;
    }
}

#hero-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

#screen-login .login-container {
    position: relative;
    z-index: 1;
}

.hero-shield {
    width: 110px !important;
    height: 130px !important;
    background: none !important;
    border-radius: 0 !important;
    position: relative;
    box-shadow: none !important;
    margin-bottom: 28px !important;
    animation: shieldFloat 4s ease-in-out infinite;
}

.hero-shield svg {
    width: 110px !important;
    height: 130px !important;
    filter: drop-shadow(0 0 20px rgba(79, 70, 229, 0.5)) drop-shadow(0 0 40px rgba(255, 215, 0, 0.2));
}

.shield-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.3) 0%, rgba(124, 58, 237, 0.1) 40%, transparent 70%);
    border-radius: 50%;
    animation: glowPulse 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shieldFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes glowPulse {

    0%,
    100% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

.hero-title {
    font-size: 52px !important;
    font-weight: 900 !important;
    letter-spacing: -2px !important;
    line-height: 1 !important;
    color: #fff !important;
}

.hero-text-line {
    color: #ffffff;
}

.hero-text-accent {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 18px !important;
    font-weight: 500;
    margin-top: 16px !important;
    letter-spacing: 0.5px;
}

.hero-form {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.hero-form .password-input-wrap {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
}

.hero-form .password-input-wrap:focus-within {
    border-color: rgba(79, 70, 229, 0.6);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.hero-form input {
    color: #ffffff !important;
    background: transparent !important;
}

.hero-form input::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

.hero-form .eye-btn {
    color: rgba(255, 255, 255, 0.5) !important;
}

.hero-form .eye-btn:hover {
    color: rgba(255, 255, 255, 0.8) !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.hero-btn {
    background: linear-gradient(135deg, #4F46E5, #7C3AED) !important;
    border: none !important;
    color: #ffffff !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.4) !important;
    position: relative;
    overflow: hidden;
}

.hero-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.hero-btn:hover {
    background: linear-gradient(135deg, #5B52F0, #8B47F5) !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 30px rgba(79, 70, 229, 0.5) !important;
}

.hero-btn:hover::before {
    left: 100%;
}

.hero-btn:active {
    transform: translateY(-1px) !important;
}

.hero-form .password-error {
    color: #ff6b6b !important;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-8px);
    }

    40%,
    80% {
        transform: translateX(8px);
    }
}

.shake {
    animation: shake 0.4s ease;
}

/* ===== PASSWORD MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 17, 23, 0.5);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 44px 40px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    position: relative;
    box-shadow: var(--shadow-xl);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg-muted);
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--border);
    color: var(--text-primary);
}

.modal-avatar-wrap {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.modal-avatar-wrap svg {
    width: 32px;
    height: 32px;
}

.modal-avatar-wrap.lime {
    background: var(--accent);
    color: var(--accent-dark);
}

.modal-avatar-wrap.dark {
    background: var(--accent-dark);
    color: #fff;
}

.modal-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.password-input-wrap {
    position: relative;
    margin-bottom: 8px;
}

.password-input-wrap input {
    width: 100%;
    padding: 14px 48px 14px 20px;
    background: var(--bg-muted);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 4px;
    outline: none;
    transition: var(--transition);
}

.password-input-wrap input:focus {
    border-color: var(--accent-dark);
    background: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(13, 17, 23, 0.08);
}

.eye-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.4;
    transition: var(--transition);
    color: var(--text-secondary);
}

.eye-btn:hover {
    opacity: 1;
}

.password-error {
    color: var(--red);
    font-size: 13px;
    font-weight: 600;
    min-height: 22px;
    margin-bottom: 12px;
}

.modal-submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent-dark);
    border: none;
    border-radius: var(--radius-full);
    color: #ffffff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.modal-submit-btn:hover {
    background: #1a2332;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

/* ===== TASK SCREEN ===== */
#screen-task {
    flex-direction: column;
    padding: 0;
    background: var(--bg-secondary);
}

.task-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}

.back-btn {
    background: var(--bg-muted);
    border: none;
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.back-btn svg {
    width: 16px;
    height: 16px;
}

.back-btn:hover {
    background: var(--accent-dark);
    color: #fff;
}

.score-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    padding: 8px 20px;
    border-radius: var(--radius-full);
    font-size: 18px;
    font-weight: 800;
    color: var(--accent-dark);
}

.score-icon {
    display: flex;
    align-items: center;
}

.score-icon svg {
    width: 20px;
    height: 20px;
}

#score-value {
    min-width: 20px;
    text-align: center;
}

.task-topic-badge {
    background: var(--bg-muted);
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ===== TIMER ===== */
.timer-bar-container {
    width: 100%;
    height: 5px;
    background: var(--bg-muted);
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: var(--accent);
    transition: width 1s linear, background 2s ease;
    border-radius: 0 3px 3px 0;
}

.timer-bar.warning {
    background: var(--orange);
}

.timer-bar.danger {
    background: var(--red);
    animation: timerPulse 0.5s ease-in-out infinite;
}

@keyframes timerPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.timer-text {
    text-align: center;
    font-size: 32px;
    font-weight: 800;
    padding: 16px 0 4px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
}

/* ===== TASK CARD ===== */
.task-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 24px;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

.task-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2.5px;
    margin-bottom: 16px;
}

.task-question {
    font-size: 26px;
    font-weight: 700;
    text-align: center;
    line-height: 1.35;
    margin-bottom: 36px;
    padding: 0 16px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.task-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 540px;
}

.option-btn {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.option-btn:hover {
    border-color: var(--accent-dark);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.option-btn:active {
    transform: translateY(-1px);
}

.option-btn.correct {
    border-color: var(--green) !important;
    background: #f0fdf4 !important;
    animation: correctPop 0.4s ease;
}

.option-btn.wrong {
    border-color: var(--red) !important;
    background: #fef2f2 !important;
    animation: shake 0.4s ease;
}

.option-btn.disabled {
    pointer-events: none;
    opacity: 0.5;
}

@keyframes correctPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.04);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

/* ===== TASK FEEDBACK ===== */
.task-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 500;
    animation: feedbackPop 0.5s ease;
}

.feedback-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.feedback-icon svg {
    width: 40px;
    height: 40px;
}

.feedback-icon.success {
    background: var(--accent);
    color: var(--accent-dark);
}

.feedback-icon.fail {
    background: #fee2e2;
    color: var(--red);
}

.feedback-text {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

@keyframes feedbackPop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    60% {
        transform: translate(-50%, -50%) scale(1.08);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* ===== PARENT DASHBOARD ===== */
#screen-parent {
    flex-direction: column;
    background: var(--bg-secondary);
}

.parent-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 28px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}

.parent-title {
    font-size: 20px;
    font-weight: 700;
    flex: 1;
    letter-spacing: -0.3px;
}

.parent-title svg {
    width: 20px;
    height: 20px;
    vertical-align: -3px;
    margin-right: 8px;
}

.parent-content {
    flex: 1;
    padding: 32px 24px;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.child-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 28px 32px;
    display: flex;
    align-items: center;
    gap: 24px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.child-stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-avatar svg {
    width: 28px;
    height: 28px;
}

.stat-avatar.blue {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #2563eb;
}

.stat-avatar.green {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #16a34a;
}

.stat-info {
    flex: 1;
}

.stat-name {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.2px;
}

.stat-score-wrap,
.stat-tasks-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-score {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent-dark);
    letter-spacing: -1px;
}

.stat-tasks {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-secondary);
}

.reset-btn {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--red);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.reset-btn svg {
    width: 14px;
    height: 14px;
}

.reset-btn:hover {
    background: #fee2e2;
    border-color: var(--red);
    transform: translateY(-2px);
}

/* ===== HISTORY ===== */
.history-section {
    margin-top: 16px;
}

.history-section h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-section h3 svg {
    width: 18px;
    height: 18px;
    color: var(--text-dim);
}

.score-history {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-entry {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
}

.history-child {
    color: var(--text-primary);
    font-weight: 600;
}

.history-date {
    color: var(--text-dim);
    font-size: 12px;
}

.history-action {
    color: var(--green);
    font-weight: 700;
    font-size: 13px;
}

.history-action.reset {
    color: var(--red);
}

.no-history {
    color: var(--text-dim);
    text-align: center;
    padding: 24px;
    font-size: 14px;
}

/* ===== CHESS BOARD ===== */
.chess-board-wrap {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    width: 320px;
    height: 320px;
    border: 2px solid var(--accent-dark);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.chess-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    line-height: 1;
    user-select: none;
}

.chess-cell.light {
    background: #f0e6d3;
}

.chess-cell.dark {
    background: #b58863;
}

.chess-hint {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 10px;
    text-align: center;
    background: var(--bg-muted);
    padding: 6px 14px;
    border-radius: var(--radius-full);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .profiles {
        flex-direction: column;
        align-items: center;
    }

    .profile-card {
        width: 100%;
        max-width: 280px;
    }

    .task-question {
        font-size: 20px;
    }

    .task-options {
        grid-template-columns: 1fr;
    }

    .option-btn {
        padding: 16px;
        font-size: 16px;
    }

    .child-stat-card {
        flex-direction: column;
        text-align: center;
    }

    .stat-score-wrap,
    .stat-tasks-wrap {
        justify-content: center;
    }

    .task-topic-badge {
        display: none;
    }

    .chess-board {
        width: 260px;
        height: 260px;
    }

    .chess-cell {
        font-size: 26px;
    }
}