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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

header h1 {
    font-size: 1.5rem;
    color: #00d9ff;
}

.status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status.loading {
    background: #ff9f1c;
    color: #1a1a2e;
}

.status.ready {
    background: #2ec4b6;
    color: #1a1a2e;
}

.status.active {
    background: #00d9ff;
    color: #1a1a2e;
    animation: pulse 1.5s infinite;
}

.status.error {
    background: #e63946;
    color: white;
}

.capture-info {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.75rem;
    color: #ccc;
}
.capture-info li { padding: 0.15rem 0; }
.capture-info b { color: #888; font-weight: normal; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

#video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #0f0f1a;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.panel {
    background: #16213e;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.panel h2, .panel h3 {
    font-size: 1rem;
    color: #00d9ff;
    margin-bottom: 0.75rem;
}

.panel.hidden {
    display: none;
}

/* Model loading status */
.model-status {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.model-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.25rem 1rem;
    align-items: center;
}

.model-name {
    font-size: 0.875rem;
    color: #ccc;
}

.model-state {
    font-size: 0.75rem;
    color: #888;
    text-align: right;
}

.model-state.loading {
    color: #ff9f1c;
}

.model-state.ready {
    color: #2ec4b6;
}

.model-state.error {
    color: #e63946;
}

.progress-bar {
    grid-column: 1 / -1;
    height: 4px;
    background: #0f0f1a;
    border-radius: 2px;
    overflow: hidden;
}

.progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00d9ff, #2ec4b6);
    transition: width 0.3s ease;
}

/* Plate results */
#plate-results {
    min-height: 60px;
}

#plate-results .placeholder {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

.plate-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #0f0f1a;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.plate-item:last-child {
    margin-bottom: 0;
}

.plate-text {
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    font-weight: bold;
    color: #00d9ff;
    letter-spacing: 2px;
}

.plate-confidence {
    font-size: 0.75rem;
    color: #888;
}

.plate-confidence.high {
    color: #2ec4b6;
}

.plate-confidence.medium {
    color: #ff9f1c;
}

.plate-confidence.low {
    color: #e63946;
}

/* Controls */
#controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

button {
    flex: 1;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#start-btn {
    background: #2ec4b6;
    color: #1a1a2e;
}

#start-btn:hover:not(:disabled) {
    background: #25a99d;
}

#stop-btn {
    background: #e63946;
    color: white;
}

#stop-btn:hover:not(:disabled) {
    background: #c42d38;
}

/* Debug panel */
#debug-panel {
    background: #0f0f1a;
    font-size: 0.75rem;
}

#debug-panel h3 {
    font-size: 0.875rem;
}

#debug-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

#debug-info p {
    color: #888;
}

#debug-info span {
    color: #00d9ff;
    font-family: monospace;
}

/* Mobile optimizations */
@media (max-width: 600px) {
    #app {
        padding: 0.5rem;
    }

    header h1 {
        font-size: 1.25rem;
    }

    #video-container {
        aspect-ratio: 4/3;
        border-radius: 8px;
    }

    .panel {
        padding: 0.75rem;
        border-radius: 8px;
    }

    button {
        padding: 0.875rem;
    }

    #debug-info {
        grid-template-columns: 1fr;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    #video-container {
        aspect-ratio: 21/9;
        max-height: 50vh;
    }
}
