@font-face {
    font-family: "GT Pressura Mono";
    src: url("/fonts/GT-Pressura-LCGV-Mono-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "GT Pressura Mono";
    src: url("/fonts/GT-Pressura-LCGV-Mono-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #020202;
    --fg: #f0eee8;
    --line: #f0eee8;
    --accent: #eb111f;
    --success: #14b84a;
    --card: #0b0b0b;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--fg);
}

body {
    font-family: "GT Pressura Mono", monospace;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.scanner-page {
    width: min(100vw, 420px);
    margin: 0 auto;
    min-height: 100dvh;
    background: #000;
    padding: calc(env(safe-area-inset-top, 0px) + 12px) 0 calc(env(safe-area-inset-bottom, 0px) + 98px);
}

.scanner-top {
    text-align: center;
    padding: 10px 20px 18px;
}

.scanner-top h1 {
    margin: 0;
    font-family: "Stylish", serif;
    font-size: 25px;
    line-height: 1;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.camera-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 0.79;
    background: #000;
    border-top: 3px solid var(--line);
    border-bottom: 3px solid var(--line);
    overflow: hidden;
}

.camera-video,
.scan-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-canvas {
    display: none;
}

.scan-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 4px;
    background: var(--accent);
    transform: translateY(-50%);
    z-index: 3;
}

.scan-flash {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: #fff;
    opacity: 0;
    pointer-events: none;
}

.scan-flash.is-on {
    animation: rrScanFlash 160ms ease-out;
}

.start-camera {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    border: 0;
    background: transparent;
    color: var(--fg);
    font-family: "Stylish", serif;
    font-size: 25px;
    line-height: 1;
    letter-spacing: 0.01em;
    text-transform: lowercase;
    cursor: pointer;
    padding: 0;
}

.start-camera.is-hidden {
    display: none;
}

.scan-status {
    position: absolute;
    left: 12px;
    bottom: 8px;
    z-index: 4;
    font-size: 14px;
    opacity: 0.88;
    background: rgba(0, 0, 0, 0.45);
    padding: 3px 6px;
}

.scan-status.is-saving {
    animation: rrStatusPulse 0.8s ease-in-out infinite;
    background: rgba(235, 17, 31, 0.7);
}

.record-head {
    border-bottom: 3px solid var(--line);
    padding: 12px 14px;
    min-height: 72px;
}

.record-head p {
    margin: 0;
}

#record-title {
    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;
}

#record-subtitle {
    margin-top: 4px;
    font-size: 13px;
    opacity: 0.88;
}

.record-feedback {
    margin-top: 6px;
    font-size: 13px;
    color: var(--success);
    opacity: 0;
    min-height: 1.2em;
    transition: opacity 120ms ease-out;
}

.record-feedback.is-visible {
    opacity: 1;
}

.strip {
    border-bottom: 3px solid var(--line);
}

.strip-track {
    display: flex;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.strip-track::-webkit-scrollbar {
    display: none;
}

.chip-btn {
    min-width: 86px;
    border: 0;
    border-right: 3px solid var(--line);
    background: #060606;
    color: var(--fg);
    font-family: "GT Pressura Mono", monospace;
    font-size: 25px;
    line-height: 1;
    padding: 14px 18px;
    text-transform: uppercase;
    cursor: pointer;
    flex: 0 0 auto;
}

.chip-btn:last-child {
    border-right: 0;
}

.chip-btn.is-active {
    background: var(--accent);
    color: #fff;
}

.category-btn {
    min-width: 130px;
    border: 0;
    border-right: 3px solid var(--line);
    background: #060606;
    color: var(--fg);
    font-family: "GT Pressura Mono", monospace;
    font-size: 25px;
    line-height: 0.98;
    letter-spacing: 0.01em;
    padding: 12px 12px 14px;
    text-transform: uppercase;
    cursor: pointer;
    flex: 0 0 auto;
    white-space: normal;
}

.category-btn:last-child {
    border-right: 0;
}

.category-btn.is-active {
    background: #151515;
    color: #fff;
    box-shadow: inset 0 -5px 0 var(--accent);
}

.action-row {
    border-bottom: 3px solid var(--line);
    display: flex;
}

.ghost-action {
    width: 100%;
    border: 0;
    background: #000;
    color: var(--fg);
    font-family: "Stylish", serif;
    font-size: 25px;
    line-height: 1;
    padding: 14px 10px;
    cursor: pointer;
    text-transform: lowercase;
}

.ghost-action + .ghost-action {
    border-left: 3px solid var(--line);
}

.ghost-action.is-active {
    background: var(--accent);
    color: #fff;
}

.ghost-action.is-matched {
    background: var(--accent);
    color: #fff;
}

.ghost-action.match-just-saved {
    animation: rrMatchedPulse 900ms ease-in-out 2;
}

.ghost-action.needs-match {
    position: relative;
}

.ghost-action.needs-match::after {
    content: "";
    position: absolute;
    left: -12px;
    right: -12px;
    top: 50%;
    border-top: 4px solid rgba(240, 238, 232, 0.95);
    transform: rotate(13deg);
    pointer-events: none;
    z-index: 1;
}

.discogs-panel {
    border-bottom: 3px solid var(--line);
    background: #050505;
    max-height: 36vh;
    overflow: auto;
}

.discogs-panel.is-hidden {
    display: none;
}

.discogs-list {
    display: grid;
}

.discogs-row {
    display: grid;
    grid-template-columns: 1fr 58px 94px;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid #fff;
    padding: 8px 8px 8px 10px;
}

.discogs-title {
    font-size: 14px;
    line-height: 1.2;
    color: #fff;
}

.discogs-meta {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.25;
    color: #bdb9aa;
}

.discogs-thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border: 1px solid #fff;
    background: #111;
}

.discogs-no-thumb {
    width: 52px;
    height: 52px;
    border: 1px solid #fff;
    background: #111;
    display: grid;
    place-items: center;
    color: #666;
    font-size: 11px;
}

.discogs-match-btn {
    width: 100%;
    border: 2px solid #fff;
    background: #000;
    color: #fff;
    font-family: "GT Pressura Mono", monospace;
    font-size: 13px;
    text-transform: lowercase;
    padding: 9px 6px;
    cursor: pointer;
}

.discogs-match-btn[disabled] {
    opacity: 0.45;
    cursor: default;
}

.discogs-empty {
    border-bottom: 2px solid #fff;
    padding: 12px 10px;
    font-size: 14px;
}

.catalog-panel {
    border-bottom: 3px solid var(--line);
    background: var(--card);
    max-height: 38vh;
    overflow: auto;
}

.catalog-panel.is-hidden {
    display: none;
}

.catalog-search-row {
    padding: 10px;
    border-bottom: 2px solid #fff;
}

.catalog-search-row input {
    width: 100%;
    border: 2px solid #fff;
    background: #000;
    color: #fff;
    font-family: "GT Pressura Mono", monospace;
    font-size: 16px;
    padding: 8px 10px;
}

.catalog-list {
    display: grid;
}

.catalog-item {
    border: 0;
    border-bottom: 2px solid #2f2f2f;
    text-align: left;
    background: #000;
    color: #fff;
    padding: 10px;
    font-family: "GT Pressura Mono", monospace;
    cursor: pointer;
}

.catalog-item-title {
    font-size: 15px;
    font-weight: 700;
}

.catalog-item-meta {
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.9;
}

.catalog-more {
    width: 100%;
    border: 0;
    border-top: 2px solid #fff;
    background: #000;
    color: #fff;
    font-family: "GT Pressura Mono", monospace;
    font-size: 15px;
    padding: 12px;
    cursor: pointer;
}

.catalog-more[disabled] {
    opacity: 0.4;
    cursor: default;
}

.scanner-footer {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: min(100vw, 420px);
    height: calc(80px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #fff;
    font-family: "Stylish", serif;
    font-size: 25px;
    letter-spacing: 0.02em;
    border-top: 4px solid #fff;
}

.chip-btn.is-saved,
.category-btn.is-saved {
    animation: rrSavedBlink 0.9s ease-in-out 2;
}

.chip-btn.is-pending,
.category-btn.is-pending {
    position: relative;
    animation: rrPendingPulse 0.75s linear infinite;
}

@keyframes rrPendingPulse {
    0% {
        box-shadow: inset 0 0 0 0 rgba(235, 17, 31, 0.65);
        filter: brightness(1);
    }
    55% {
        box-shadow: inset 0 -12px 0 0 rgba(235, 17, 31, 1);
        filter: brightness(1.35);
    }
    100% {
        box-shadow: inset 0 0 0 0 rgba(235, 17, 31, 0.65);
        filter: brightness(1);
    }
}

@keyframes rrSavedBlink {
    0% {
        filter: brightness(1);
    }
    35% {
        filter: brightness(1.9);
    }
    100% {
        filter: brightness(1);
    }
}

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

@keyframes rrScanFlash {
    0% {
        opacity: 0;
    }
    18% {
        opacity: 0.9;
    }
    100% {
        opacity: 0;
    }
}

@keyframes rrMatchedPulse {
    0% {
        filter: brightness(1);
    }
    45% {
        filter: brightness(1.45);
    }
    100% {
        filter: brightness(1);
    }
}
