body { background: #111; color: #f0f0f0; }

.scan-page {
    padding: 1.5rem 1rem 2rem;
}

.scan-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.scan-header h1 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: #fff;
}

.back-btn {
    color: #aaa;
    text-decoration: none;
    font-size: 1.4rem;
    line-height: 1;
}

.camera-wrap {
    position: relative;
    background: #000;
    height: min(55vh, 520px);
    max-width: 640px;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
}

#videoEl {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.scan-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.scan-reticle {
    width: 55%;
    aspect-ratio: 3/4;
    border: 2px dashed rgba(255,255,255,0.35);
    border-radius: 8px;
}

.scan-status {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.65);
    color: #ccc;
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    white-space: nowrap;
    max-width: 80%;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 10;
}

.scan-status.match {
    background: rgba(22, 101, 52, 0.85);
    color: #86efac;
}

.scan-paused-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.scan-paused-overlay.visible {
    display: flex;
}

.restart-btn {
    background: #fff;
    color: #111;
    border: none;
    border-radius: 24px;
    padding: 0.6rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.02em;
}

.restart-btn:hover {
    background: #e5e5e5;
}

.results-panel {
    display: none;
    max-width: 640px;
    margin: 0.75rem auto 0;
    background: rgba(15, 15, 15, 0.92);
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
}

.results-panel.visible {
    display: block;
}

.results-header {
    padding: 0.4rem 1rem;
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid #2a2a2a;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #252525;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.result-item:hover, .result-item:focus {
    background: #242424;
}

.result-thumb {
    flex: 0 0 40px;
    width: 40px;
    height: 54px;
    object-fit: cover;
    border-radius: 3px;
    background: #2a2a2a;
}

.result-thumb-placeholder {
    flex: 0 0 40px;
    width: 40px;
    height: 54px;
    border-radius: 3px;
    background: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #555;
}

.result-info {
    flex: 1 1 auto;
    min-width: 0;
}

.result-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #f0f0f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-meta {
    font-size: 0.75rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-score {
    flex: 0 0 auto;
    font-size: 0.8rem;
    font-weight: 700;
    color: #4ade80;
}

.empty-state {
    padding: 1.5rem 1rem;
    text-align: center;
    color: #666;
    font-size: 0.85rem;
}

.error-badge {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: #7f1d1d;
    color: #fca5a5;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    z-index: 100;
    display: none;
}
.result-in-collection {
    font-size: 0.7rem;
    font-weight: 600;
    color: #4ade80;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.result-not-in-collection {
    font-size: 0.7rem;
    color: #888;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
