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

body {
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }
}

.app-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #d14000 0%, #ff6b35 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(209, 64, 0, 0.3);
}

.app-header h1 {
    color: white;
    font-size: 2.2em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
    .app-header {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .app-header h1 {
        font-size: 1.5em;
    }
}

.main-content {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
}

.webcam-panel {
    background: #eee;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: 400px;
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .webcam-panel {
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .webcam-panel {
        padding: 15px;
    }
}

.video-container {
    position: relative;
    width: 360px;
    height: 270px;
    margin: 0 auto 20px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

@media (max-width: 480px) {
    .video-container {
        width: 100%;
        height: auto;
        aspect-ratio: 4/3;
    }
}

.video-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
    pointer-events: none;
}

.status-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.9em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 10;
    max-width: calc(100% - 20px);
    word-wrap: break-word;
}

@media (max-width: 480px) {
    .status-overlay {
        font-size: 0.8em;
        padding: 6px 12px;
    }
}

.status-up {
    background: rgba(34, 197, 94, 0.9);
    color: white;
}

.status-down {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.status-stop {
    background: rgba(156, 163, 175, 0.9);
    color: white;
}

.status-inactive {
    background: rgba(55, 65, 81, 0.9);
    color: white;
}

.status-error {
    background: rgba(220, 38, 38, 0.9);
    color: white;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    margin-top: 15px;
    font-weight: 500;
}

.error-message {
    background: rgba(220, 38, 38, 0.1);
    border: 2px solid rgba(220, 38, 38, 0.5);
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 0.9em;
    line-height: 1.5;
}

@media (max-width: 480px) {
    .error-message {
        font-size: 0.85em;
        padding: 10px;
    }
}

.btn-retry {
    margin-top: 10px;
    width: 100%;
    padding: 10px;
    font-size: 0.9em;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-retry:hover {
    background: #1d4ed8;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

@media (max-width: 480px) {
    .controls {
        flex-direction: column;
    }
}

.btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 1em;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

@media (max-width: 480px) {
    .btn {
        padding: 16px 20px;
        font-size: 1.05em;
        /* Larger touch targets on mobile */
    }
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

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

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

.btn-start {
    background: #22c55e;
    color: white;
}

.btn-stop {
    background: #ef4444;
    color: white;
}

.instructions {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.instructions h3 {
    color: #d14000;
    margin-bottom: 10px;
    font-size: 1.1em;
}

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

.instructions li {
    padding: 6px 0;
    font-size: 0.9em;
    line-height: 1.4;
}

@media (max-width: 480px) {
    .instructions li {
        font-size: 0.85em;
    }
}

.recipe-panel {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 800px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

@media (max-width: 768px) {
    .recipe-panel {
        padding: 20px;
        max-height: 600px;
    }
}

@media (max-width: 480px) {
    .recipe-panel {
        padding: 15px;
    }
}

.recipe-title {
    color: #d14000;
    font-size: 2.5em;
    margin-bottom: 15px;
    border-bottom: 3px solid #ff6b35;
    padding-bottom: 10px;
}

@media (max-width: 768px) {
    .recipe-title {
        font-size: 2em;
    }
}

@media (max-width: 480px) {
    .recipe-title {
        font-size: 1.6em;
    }
}

.recipe-intro {
    font-size: 1.1em;
    line-height: 1.6;
    color: #555;
    margin-bottom: 20px;
    font-style: italic;
}

@media (max-width: 480px) {
    .recipe-intro {
        font-size: 1em;
    }
}

.recipe-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding: 15px;
    background: #fff5f0;
    border-radius: 8px;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .recipe-meta {
        gap: 10px;
        padding: 12px;
        font-size: 0.9em;
    }
}

.recipe-meta span {
    font-weight: 600;
    color: #d14000;
}

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

.recipe h2 {
    color: #d14000;
    font-size: 1.8em;
    margin-bottom: 15px;
    border-bottom: 2px solid #ffd7c4;
    padding-bottom: 8px;
}

@media (max-width: 768px) {
    .recipe h2 {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    .recipe h2 {
        font-size: 1.3em;
    }
}

.recipe h3 {
    color: #ff6b35;
    font-size: 1.3em;
    margin: 15px 0 10px;
}

@media (max-width: 480px) {
    .recipe h3 {
        font-size: 1.1em;
    }
}

.recipe ul, .recipe ol {
    line-height: 1.8;
    padding-left: 25px;
}

@media (max-width: 480px) {
    .recipe ul, .recipe ol {
        padding-left: 20px;
    }
}

.recipe li {
    margin-bottom: 8px;
}

.recipe p {
    line-height: 1.6;
    color: #444;
    margin-bottom: 10px;
}

.recipe strong {
    color: #d14000;
}

.recipe-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #ffd7c4;
    text-align: center;
    font-size: 1.1em;
    color: #666;
}

@media (max-width: 480px) {
    .recipe-footer {
        font-size: 1em;
    }
}

.scroll-hint {
    margin-top: 10px;
    font-style: italic;
    color: #999;
}

.app-footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9em;
}

.app-footer a {
    color: #d14000;
    text-decoration: none;
    font-weight: 600;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* Scrollbar styling */
.recipe-panel::-webkit-scrollbar {
    width: 12px;
}

.recipe-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.recipe-panel::-webkit-scrollbar-thumb {
    background: #d14000;
    border-radius: 6px;
}

.recipe-panel::-webkit-scrollbar-thumb:hover {
    background: #a33000;
}

@media (max-width: 768px) {
    .recipe-panel::-webkit-scrollbar {
        width: 8px;
    }
}