:root {
    color-scheme: dark;
    --bg: #111318;
    --panel: #191d24;
    --panel-2: #20252e;
    --text: #f5f0e8;
    --muted: #b5b0a6;
    --line: #353b46;
    --accent: #e4b363;
    --accent-2: #6bc5b8;
    --danger: #ff8a8a;
    --shadow: 0 18px 50px rgba(0, 0, 0, .28);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100svh;
    background:
        radial-gradient(circle at top left, rgba(228, 179, 99, .16), transparent 32rem),
        linear-gradient(145deg, #101217 0%, #171a20 52%, #111318 100%);
    color: var(--text);
}

button,
input {
    font: inherit;
}

[hidden] {
    display: none !important;
}

.shell {
    width: min(100%, 920px);
    min-height: 100svh;
    margin: 0 auto;
    padding: max(16px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
    display: grid;
    gap: 14px;
    align-content: start;
}

.scan-panel,
.result-panel {
    background: rgba(25, 29, 36, .92);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.scan-panel {
    padding: 16px;
}

.result-panel {
    min-height: 220px;
    overflow: hidden;
}

.brand-row,
.title-row,
.meta-row {
    display: flex;
    gap: 12px;
}

.brand-row,
.title-row {
    align-items: flex-start;
    justify-content: space-between;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent-2);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 14px;
    font-size: clamp(1.8rem, 9vw, 3rem);
    line-height: .95;
    letter-spacing: 0;
}

.status-pill {
    flex: 0 0 auto;
    max-width: 42%;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 10px;
    color: var(--muted);
    font-size: .8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-pill.busy {
    color: var(--accent);
}

.status-pill.error {
    color: var(--danger);
}

.camera-drop {
    position: relative;
    min-height: 245px;
    display: grid;
    place-items: center;
    gap: 8px;
    padding: 18px;
    border: 1px dashed #5c6573;
    border-radius: 8px;
    background: #12161d;
    text-align: center;
    overflow: hidden;
}

.camera-drop input {
    position: absolute;
    inset: 0;
    opacity: 0;
}

.camera-icon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: #14110c;
    font-size: 2.2rem;
    line-height: 1;
}

.camera-copy {
    font-size: 1.1rem;
    font-weight: 800;
}

.camera-hint,
.empty-state p {
    color: var(--muted);
    line-height: 1.45;
}

#preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lookup-form {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

label span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    background: #0f1217;
    color: var(--text);
}

input:focus {
    outline: 2px solid rgba(228, 179, 99, .7);
    outline-offset: 2px;
}

.meta-row {
    align-items: end;
}

.meta-row label {
    flex: 1 1 0;
    min-width: 0;
}

.primary-button {
    min-height: 52px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #18130a;
    font-weight: 900;
}

.primary-button:active {
    transform: translateY(1px);
}

.empty-state {
    padding: 20px;
}

.card-result {
    display: grid;
    gap: 0;
}

.card-image {
    width: 100%;
    max-height: 58svh;
    object-fit: contain;
    background: #0b0d11;
}

.card-copy {
    padding: 16px;
}

.card-name {
    margin-bottom: 8px;
    font-size: 1.55rem;
    line-height: 1.05;
    letter-spacing: 0;
}

.scryfall-link {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 11px;
    color: var(--accent);
    text-decoration: none;
    font-size: .85rem;
    font-weight: 800;
}

.type-line {
    margin-bottom: 12px;
    color: var(--muted);
    font-weight: 700;
}

.oracle-text {
    white-space: pre-wrap;
    margin: 0 0 16px;
    padding: 14px;
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--text);
    font: inherit;
    line-height: 1.45;
}

.rulings-block {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.rulings-block summary {
    cursor: pointer;
    color: var(--accent-2);
    font-weight: 900;
}

.ruling {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #151922;
}

.ruling time {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 800;
}

.notice {
    padding: 14px 16px;
    color: var(--muted);
}

.notice strong {
    color: var(--text);
}

@media (min-width: 760px) {
    .shell {
        grid-template-columns: 360px 1fr;
        align-items: start;
    }

    .scan-panel {
        position: sticky;
        top: 16px;
    }

    .card-result {
        grid-template-columns: minmax(220px, 38%) 1fr;
    }

    .card-image {
        height: 100%;
        max-height: none;
    }
}
