:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --success-color: #10b981;
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --glow: 0 0 20px rgba(59, 130, 246, 0.5);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: radial-gradient(circle at 50% -20%, #1e293b, var(--bg-color));
}

.app-container {
    width: 100%;
    max-width: 480px;
    padding: 24px;
    margin: 0 auto;
}

.view {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.view.active {
    display: block;
}

.hidden {
    display: none !important;
}

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

header {
    text-align: center;
    margin-bottom: 32px;
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(to right, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.time-display {
    font-size: 64px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 32px;
    letter-spacing: -2px;
    text-shadow: var(--glow);
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 18px;
    margin-bottom: 16px;
    font-weight: 600;
}

.input-group {
    margin-bottom: 20px;
}

input[type="time"] {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 24px;
    padding: 12px 16px;
    border-radius: 12px;
    text-align: center;
    outline: none;
    transition: all 0.3s;
}

input[type="time"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.primary-btn:hover {
    background-color: var(--accent-hover);
    box-shadow: var(--glow);
}

.secondary-btn {
    background-color: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.secondary-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.active-time {
    font-size: 36px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    color: var(--accent-color);
}

/* Challenge View */
.warning-banner {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--danger-color);
    opacity: 0.1;
    animation: pulseAnim 1.5s infinite;
}

@keyframes pulseAnim {
    0% { opacity: 0.1; }
    50% { opacity: 0.3; }
    100% { opacity: 0.1; }
}

.warning-banner h2 {
    color: var(--danger-color);
    font-size: 20px;
    margin-bottom: 4px;
    position: relative;
}

.warning-banner p {
    font-size: 14px;
    color: var(--text-secondary);
    position: relative;
}

.challenge-card {
    text-align: center;
    margin-bottom: 24px;
}

.challenge-card h3 {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

.target-item {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-color);
    margin: 8px 0;
    text-shadow: var(--glow);
}

.instruction {
    font-size: 14px;
    color: var(--text-secondary);
}

.camera-container {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    position: relative;
    margin-bottom: 24px;
    border: 2px solid var(--glass-border);
    box-shadow: var(--shadow);
}

#webcam-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#webcam-container canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

.overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(16, 185, 129, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    animation: fadeIn 0.3s;
}

.success-icon {
    width: 64px;
    height: 64px;
    background: white;
    color: var(--success-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 16px;
}

.overlay h2 {
    color: white;
    font-size: 24px;
    font-weight: 700;
}

.progress-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 24px;
    border: 1px solid var(--glass-border);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.progress-track {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-color), #60a5fa);
    border-radius: 6px;
    transition: width 0.1s linear, background-color 0.3s;
}

.progress-fill.success {
    background: var(--success-color);
}

.labels-list-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--glass-border);
}

.labels-list-card h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.labels-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.label-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    color: var(--text-primary);
}
