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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2.5rem;
    color: #4f46e5;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    color: #64748b;
    font-weight: 400;
}

.user-info-bar {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 15px 25px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #4f46e5;
}

.user-info-label {
    font-weight: 600;
    color: #4f46e5;
    font-size: 0.95rem;
}

.user-info-value {
    color: #333;
    font-weight: 500;
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 6px;
}

.control-panel {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #333;
}

.btn-export {
    background: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
    color: white;
}

.camera-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.permission-box {
    padding: 60px 20px;
}

.permission-icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.permission-box h3 {
    font-size: 1.5rem;
    color: #4f46e5;
    margin-bottom: 10px;
}

.permission-box p {
    color: #64748b;
    font-size: 1rem;
}

#cameraFeed {
    width: 100%;
    max-width: 600px;
    border-radius: 15px;
    display: none;
    background: #000;
    margin: 0 auto;
}

.sections {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 30px;
}

.section-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid transparent;
}

.section-card:nth-child(1) { border-color: #667eea; }
.section-card:nth-child(2) { border-color: #f093fb; }
.section-card:nth-child(3) { border-color: #4ade80; }

.section-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px 20px;
    border-radius: 12px;
    margin: -10px -10px 20px -10px;
}

.section-card:nth-child(1) .section-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
}
.section-card:nth-child(2) .section-header {
    background: linear-gradient(135deg, rgba(240, 147, 251, 0.15) 0%, rgba(245, 87, 108, 0.15) 100%);
}
.section-card:nth-child(3) .section-header {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.15) 0%, rgba(22, 163, 74, 0.15) 100%);
}

.section-icon { font-size: 2.5rem; }

.section-header h2 { font-size: 1.4rem; font-weight: 700; }
.section-card:nth-child(1) .section-header h2 { color: #4f46e5; }
.section-card:nth-child(2) .section-header h2 { color: #f5576c; }
.section-card:nth-child(3) .section-header h2 { color: #16a34a; }

.placeholder-chart {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 150px;
    background: #f8fafc;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
}

.chart-bar {
    width: 30px;
    background: linear-gradient(to top, #667eea, #764ba2);
    border-radius: 5px 5px 0 0;
    transition: height 0.5s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.section-card:nth-child(2) .chart-bar {
    background: linear-gradient(to top, #f093fb, #f5576c);
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
}
.section-card:nth-child(3) .chart-bar {
    background: linear-gradient(to top, #4ade80, #16a34a);
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
}

.data-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #555;
}

.data-summary strong {
    color: #4f46e5;
    font-weight: 700;
}

.time-display {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-bottom: 15px;
}

.time-item {
    flex: 1;
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.section-card:nth-child(2) .time-item {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.3);
}

.time-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
}

.time-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
}

.path-visualization {
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
}

.path-svg {
    width: 100%;
    height: 180px;
}

.path-svg circle,
.path-svg line {
    transition: all 0.8s ease-in-out;
}

.section-desc {
    color: #64748b;
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.5;
    font-style: italic;
}

.suggestions-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 35px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 2px solid #fbbf24;
}

.suggestions-panel h2 {
    font-size: 1.5rem;
    color: #92400e;
    margin-bottom: 20px;
    text-align: center;
}

.suggestion-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.suggestion-item {
    background: #fffbeb;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #fde68a;
}

.suggestion-item h3 {
    color: #92400e;
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.suggestion-item p {
    color: #555;
    line-height: 1.6;
    font-size: 0.95rem;
}

.suggestion-item ul {
    list-style: none;
    padding: 0;
}

.suggestion-item ul li {
    padding: 6px 0;
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
}

.suggestion-item ul li::before {
    content: "✅ ";
}

.suggestion-item code {
    background: #fde68a;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
}

.footer {
    text-align: center;
    padding: 25px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.footer p { color: #64748b; font-size: 0.95rem; }

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    margin: 8% auto;
    padding: 40px;
    border-radius: 20px;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-content h2 { font-size: 1.8rem; color: #4f46e5; margin-bottom: 20px; }
.modal-content p { color: #64748b; margin-bottom: 15px; line-height: 1.6; }

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 0;
}

.form-group-half {
    flex: 1;
    min-width: 0;
}

.form-group-half input,
.form-group-half select {
    width: 100%;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #4f46e5;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    outline: none;
}

.form-group input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    outline: none;
    background: #fff;
    cursor: pointer;
    appearance: auto;
}

.form-group select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.tips-box {
    background: #fff8e1;
    border: 2px solid #ffcc02;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 10px;
    text-align: left;
}

.tips-box h3 {
    font-size: 1.05rem;
    color: #e65100;
    margin-bottom: 10px;
}

.tips-box ol {
    margin: 0;
    padding-left: 20px;
    color: #5d4037;
    line-height: 1.8;
    font-size: 0.9rem;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.video-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.video-header-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #ef4444;
    text-align: center;
    padding: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    z-index: 10000;
    letter-spacing: 2px;
}

#videoCanvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#testVideo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.video-complete-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.video-complete-box {
    text-align: center;
    background: #1e293b;
    padding: 40px 60px;
    border-radius: 20px;
    border: 2px solid #22c55e;
    box-shadow: 0 0 40px rgba(34, 197, 94, 0.3);
}

.video-complete-box h2 {
    font-size: 2rem;
    color: #22c55e;
    margin-bottom: 15px;
}

.video-complete-box p {
    color: #ccc;
    font-size: 1.1rem;
    margin-bottom: 25px;
}

.video-selection {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    text-align: center;
    border: 2px solid #334155;
}

.video-selection h2 {
    font-size: 1.8rem;
    color: #fbbf24;
    margin-bottom: 10px;
}

.video-selection-desc {
    color: #94a3b8;
    font-size: 1rem;
    margin-bottom: 25px;
}

.video-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.video-card {
    background: #1a1a2e;
    border: 2px solid #334155;
    border-radius: 16px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.video-card:hover {
    border-color: #667eea;
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.video-card.completed {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
    cursor: default;
}

.video-card.completed:hover {
    transform: none;
    box-shadow: none;
    border-color: #22c55e;
}

.video-card-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.video-card h3 {
    font-size: 1.1rem;
    color: #e2e8f0;
    margin-bottom: 12px;
    line-height: 1.4;
}

.video-card-status {
    display: inline-block;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #334155;
    color: #94a3b8;
}

.video-card.completed .video-card-status {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.video-export-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.video-export-buttons .btn {
    min-width: 180px;
}

.video-timer {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    z-index: 10000;
}

.exit-fullscreen-btn {
    position: absolute;
    bottom: 30px;
    left: 30px;
    background: #ef4444;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.exit-fullscreen-btn.visible {
    opacity: 1;
}

.exit-fullscreen-btn:hover {
    background: #dc2626;
}

.calibration-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10001;
    background: #1a1a2e;
}

.calibration-instruction {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: #fff;
    z-index: 10002;
    background: rgba(0, 0, 0, 0.6);
    padding: 20px 40px;
    border-radius: 15px;
}

.calibration-instruction h2 {
    font-size: 2rem;
    color: #fbbf24;
    margin-bottom: 10px;
}

.calibration-instruction p {
    font-size: 1.1rem;
    color: #ccc;
    margin: 5px 0;
}

.calibration-progress {
    font-size: 1.3rem !important;
    color: #4ade80 !important;
    font-weight: 700;
    margin-top: 8px !important;
}

.calibration-grid {
    position: relative;
    width: 100%;
    height: 100%;
}

.cal-point {
    position: absolute;
    width: 40px;
    height: 40px;
    background: #fbbf24;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.6);
}

.cal-point.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.8);
    background: #ef4444;
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.8);
    animation: pulse 0.8s ease-in-out infinite;
}

.cal-point.done {
    opacity: 0.3;
    background: #22c55e;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.4);
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1.8); }
    50% { transform: translate(-50%, -50%) scale(2.4); }
}

.heatmap-section {
    margin-bottom: 30px;
}

.heatmap-card {
    width: 100%;
    border-color: #f59e0b !important;
}

.heatmap-card .section-header {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(239, 68, 68, 0.15) 100%) !important;
}

.heatmap-card .section-header h2 {
    color: #f59e0b !important;
}

.heatmap-canvas {
    width: 100%;
    height: 300px;
    background: #1a1a2e;
    border-radius: 12px;
    margin-bottom: 15px;
}

@media (max-width: 1024px) {
    .sections { grid-template-columns: repeat(2, 1fr); }
    .suggestion-content { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .header h1 { font-size: 1.6rem; }
    .header { padding: 25px 15px; }
    .sections { grid-template-columns: 1fr; }
    .control-panel { flex-direction: column; }
    .btn { width: 100%; padding: 14px 20px; font-size: 1rem; }
    .modal-content { margin: 3% 12px; padding: 20px 16px; max-height: none; border-radius: 16px; }
    .modal-content h2 { font-size: 1.3rem; }
    .modal-content p { font-size: 0.85rem; }
    .data-summary { grid-template-columns: 1fr; }
    .suggestion-content { grid-template-columns: 1fr; }
    .video-cards { grid-template-columns: 1fr; }
    .video-export-buttons { flex-direction: column; align-items: center; }
    .video-export-buttons .btn { width: 100%; }
    .form-row { flex-direction: column; gap: 0; }
    .form-group-half { flex: none; width: 100%; }
    .form-group { margin-bottom: 14px; }
    .form-group label { font-size: 0.9rem; }
    .form-group input,
    .form-group select { padding: 10px 14px; font-size: 16px; }
    .tips-box { padding: 12px 14px; }
    .tips-box ol { font-size: 0.82rem; line-height: 1.6; }
    .tips-box h3 { font-size: 0.95rem; }
    .modal-buttons { margin-top: 20px; }
    .modal-buttons .btn { width: 100%; padding: 14px; font-size: 1rem; }
    .video-header-bar { font-size: 1rem; padding: 10px; }
    .video-timer { font-size: 1.2rem; padding: 8px 16px; bottom: 20px; right: 20px; }
    .video-complete-box { padding: 30px 24px; }
    .video-complete-box h2 { font-size: 1.5rem; }
    .video-complete-box p { font-size: 0.95rem; }
    .user-info-bar { padding: 10px 15px; flex-wrap: wrap; gap: 8px; font-size: 0.85rem; }
    .time-display { flex-direction: column; gap: 10px; }
    .time-item { padding: 14px; }
    .time-value { font-size: 1.5rem; }
}