:root {
    --purple: #1a0f1f;
    --pink: #ff6a88;
    --orange: #ff9a8b;
    --glass: rgba(255, 255, 255, 0.1);
    --red: #ff4d4d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #1a0f1f 0%, #2d1b33 100%);
    color: white;
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(25px);
    border-right: 1px solid var(--glass);
    padding: 40px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(90deg, var(--pink), var(--orange));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 50px;
}

.nav-item {
    background: none;
    border: none;
    color: white;
    padding: 18px;
    border-radius: 20px;
    cursor: pointer;
    opacity: 0.5;
    width: 100%;
    text-align: left;
    transition: 0.3s;
    margin-bottom: 5px;
    font-size: 1rem;
}

.nav-item.active {
    background: var(--glass);
    opacity: 1;
    border-left: 5px solid var(--pink);
}

.content {
    flex-grow: 1;
    padding: 60px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.study-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.camera-box {
    height: 450px;
    position: relative;
    border: 3px solid var(--pink);
    border-radius: 35px;
    overflow: hidden;
    background: linear-gradient(135deg, #1a0f1f, #2d1b33);
}

#ai-status-tag {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0,0,0,0.85);
    padding: 8px 15px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    border: 1px solid var(--pink);
    z-index: 10;
    font-family: monospace;
    backdrop-filter: blur(5px);
}

.scan-bar {
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--pink), transparent);
    top: 0;
    animation: scan 3s linear infinite;
    pointer-events: none;
    z-index: 5;
}

@keyframes scan {
    0% { top: 0; }
    100% { top: 100%; }
}

.intervention-hidden {
    display: none;
}

.intervention-visible {
    display: block;
    margin-top: 25px;
    animation: alertPulse 0.5s ease;
}

@keyframes alertPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.alert-card {
    border: 2px solid var(--red);
    background: rgba(255, 77, 77, 0.15);
    padding: 35px;
    border-radius: 35px;
    backdrop-filter: blur(10px);
}

.alert-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.alert-icon {
    font-size: 3rem;
}

.alert-card.critical {
    background: rgba(255, 0, 0, 0.5) !important;
    border: 3px solid #ff0000 !important;
    animation: intense-shake 0.15s infinite;
}

@keyframes intense-shake {
    0%, 100% { transform: translate(0,0); }
    25% { transform: translate(3px, 3px); }
    75% { transform: translate(-3px, -3px); }
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
}

.option-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid white;
    color: white;
    padding: 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

.option-btn:hover {
    background: white;
    color: black;
    transform: scale(1.02);
}

.ignore-btn:hover {
    background: #ff4d4d;
    border-color: #ff4d4d;
    color: white;
}

.control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.btn-sunset {
    background: linear-gradient(90deg, var(--pink), var(--orange));
    border: none;
    padding: 16px 20px;
    border-radius: 25px;
    color: white;
    font-weight: 800;
    cursor: pointer;
    transition: 0.3s;
    font-size: 14px;
    text-align: center;
    width: 100%;
}

.btn-sunset:hover {
    transform: scale(1.02);
    filter: brightness(1.05);
}

.btn-reset {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    padding: 16px 20px;
    transition: 0.3s;
    font-size: 14px;
    text-align: center;
    width: 100%;
}

.btn-reset:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* SAME SIZE ACTION BUTTONS */
.action-btn {
    padding: 16px 20px;
    font-size: 14px;
    border-radius: 25px;
    width: 100%;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#timeDisplay {
    font-size: 5rem;
    font-weight: 900;
    text-align: center;
    margin: 10px 0;
    letter-spacing: -2px;
    font-family: monospace;
}

.card {
    background: var(--glass);
    border-radius: 35px;
    padding: 30px;
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
}

input, select {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass);
    padding: 15px;
    border-radius: 15px;
    color: white;
    outline: none;
    margin: 10px 0;
    width: 100%;
}

input:focus, select:focus {
    border-color: var(--pink);
}

.wellness-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

.stats-card {
    text-align: center;
}

.chart-card {
    grid-column: span 2;
    height: 300px;
}

.score-text {
    font-size: 3.5rem;
    background: linear-gradient(90deg, var(--pink), var(--orange));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-align: center;
    font-weight: 900;
    margin: 15px 0;
}

.bar-bg {
    height: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--pink), var(--orange));
    border-radius: 6px;
    transition: width 1s ease;
    width: 0%;
}

.tips-card {
    background: linear-gradient(135deg, rgba(255, 154, 139, 0.15), rgba(255, 106, 136, 0.05));
    border: 1px solid var(--orange);
}

#tip-container {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 10px;
}

.tip-icon {
    font-size: 2.5rem;
}

.full-width {
    width: 100%;
}

.timer-setup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.timer-setup input {
    width: 100px;
    text-align: center;
    font-size: 1.5rem;
}

@media (max-width: 800px) {
    .content { padding: 20px; }
    .study-grid { grid-template-columns: 1fr; }
    .wellness-grid { grid-template-columns: 1fr; }
    .chart-card { grid-column: span 1; }
    .sidebar { width: 80px; padding: 20px 10px; }
    .logo { font-size: 1rem; text-align: center; }
    .nav-item { text-align: center; font-size: 0.8rem; padding: 12px; }
}