﻿html, body {
    max-width: 100%;
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

:root {
    --bg: #07111f;
    --bg-soft: #0b1728;
    --surface: #0f1d31;
    --surface-2: #13243b;
    --surface-3: #18273b;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.11);
    --text: #e6edf5;
    --text-strong: #f2f5f9;
    --muted: #98a5b7;
    --muted-2: #75849a;
    --accent: #2fa8ff;
    --accent-soft: rgba(47, 168, 255, 0.14);
    --positive: #27d17f;
    --positive-soft: rgba(39, 209, 127, 0.14);
    --warning: #d8ad62;
    --danger: #ff8b8b;
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.22);
    --radius-lg: 16px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

body {
    margin: 0;
    font-family: Inter, system-ui, sans-serif;
    background: radial-gradient(circle at top left, rgba(47, 168, 255, 0.12), transparent 28%), radial-gradient(circle at top right, rgba(120, 90, 255, 0.07), transparent 22%), linear-gradient(180deg, #07111f 0%, #050d17 100%);
    color: var(--text);
    min-height: 100vh;
}

.page {
    max-width: 980px;
    margin: 0 auto;
    padding: 28px 16px 56px;
}

.hero {
    margin-bottom: 22px;
}

.heroInner {
    padding: 10px 2px 6px;
}

.eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}

h1 {
    margin: 0 0 12px;
    font-size: 38px;
    line-height: 1.04;
    letter-spacing: -0.03em;
    color: var(--text-strong);
}

.intro {
    max-width: 700px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--muted);
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

input {
    padding: 14px 14px;
    width: 100%;
    margin: 0 0 16px;
    font-size: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

    input::placeholder {
        color: var(--muted-2);
    }

    input:focus {
        border-color: rgba(47, 168, 255, 0.45);
        box-shadow: 0 0 0 3px rgba(47, 168, 255, 0.10);
        background: rgba(255, 255, 255, 0.055);
    }

button {
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 11px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

    button:hover {
        transform: translateY(-1px);
    }

.primaryBtn {
    background: linear-gradient(180deg, #182538 0%, #101a29 100%);
    color: var(--text-strong);
    font-weight: 700;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

    .primaryBtn:hover {
        opacity: 1;
        border-color: var(--border-strong);
    }

    .primaryBtn:disabled {
        opacity: 0.78;
        cursor: not-allowed;
        transform: none;
    }

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    background: linear-gradient(180deg, rgba(18, 31, 49, 0.96) 0%, rgba(11, 21, 35, 0.96) 100%);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(8px);
    margin-top: 10px;
}

.formCard {
    margin-top: 0;
    padding: 22px;
}

.resultCard {
    margin-top: 22px;
}

.innerCard {
    margin-top: 0;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(20, 35, 55, 0.94) 0%, rgba(13, 24, 39, 0.94) 100%);
    box-shadow: var(--shadow-md);
}

.resultTop {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.bottleName {
    font-size: 30px;
    font-weight: 750;
    line-height: 1.14;
    margin-top: 4px;
    letter-spacing: -0.02em;
    color: var(--text);
}

.valueSummary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

    .valueSummary > div,
    .collectionSummary > div {
        padding: 16px;
        border-radius: var(--radius-md);
        background: rgba(255, 255, 255, 0.035);
        border: 1px solid rgba(255, 255, 255, 0.055);
    }

.heroValue {
    font-size: 42px;
    font-weight: 780;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--text-strong);
}

.headline {
    font-size: 19px;
    font-weight: 700;
    margin: 12px 0 8px;
    color: var(--text);
}

.explain {
    margin-top: 0;
    margin-bottom: 8px;
    line-height: 1.6;
    color: var(--muted);
}

.trustLine {
    margin: 0 0 18px;
    font-size: 14px;
    color: var(--muted);
}

.rowTop {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
}

.col {
    display: grid;
    gap: 14px;
}

.kpiGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.kpi {
    font-size: 28px;
    font-weight: 760;
    letter-spacing: -0.02em;
    color: var(--text-strong);
}

.kpiLabel {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 8px;
}

.tableWrap {
    overflow-x: auto;
    margin-top: 10px;
    border-radius: var(--radius-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
}

th, td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 10px 8px;
    font-size: 14px;
    word-break: break-word;
    text-align: left;
    color: var(--text);
}

th {
    background: rgba(255, 255, 255, 0.025);
    color: var(--muted);
    font-weight: 600;
}

td {
    background: transparent;
}

.tableActions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.btnLink {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font-size: 14px;
    text-decoration: underline;
    box-shadow: none;
}

    .btnLink:hover {
        text-decoration: none;
        transform: none;
    }

.muted {
    color: var(--muted);
}

.small {
    font-size: 12px;
}

.smallLabel {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.badge {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: 0.05em;
    font-size: 12px;
    white-space: nowrap;
    text-transform: uppercase;
}

.good {
    background: var(--positive-soft);
    border: 1px solid rgba(39, 209, 127, 0.25);
    color: #84e7b5;
}

.neutral {
    background: rgba(216, 173, 98, 0.12);
    border: 1px solid rgba(216, 173, 98, 0.26);
    color: #e5c384;
}

.risky {
    background: rgba(255, 139, 139, 0.10);
    border: 1px solid rgba(255, 139, 139, 0.22);
    color: #f2aaaa;
}

.unknown {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: var(--muted);
}

svg {
    display: block;
    width: 100%;
    height: 120px;
    background: linear-gradient(180deg, rgba(255,255,255,0.025) 0%, rgba(255,255,255,0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
}

.closeWrap {
    margin: 0;
}

.closeMatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.loadingState {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border);
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.16);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex: 0 0 auto;
}

.loadingText {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.95rem;
    color: var(--text);
}

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

.matchChip {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.07);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
}

    .matchChip:hover {
        background: rgba(255, 255, 255, 0.06);
    }

.sources {
    margin-top: 18px;
    color: var(--muted);
}

.rawBlock {
    margin-top: 14px;
}

.sourceName {
    font-weight: 500;
}

.externalLink {
    text-decoration: none;
    color: var(--accent);
}

    .externalLink:hover {
        text-decoration: underline;
    }

.extIcon {
    font-size: 0.85em;
    margin-left: 4px;
    opacity: 0.7;
}

.contentWrap {
    margin-top: 6px;
}

.desktopTabsWrap {
    margin-bottom: 18px;
}

.desktopTabsBar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.tabBtn {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    padding: 10px 18px;
    cursor: pointer;
    font: inherit;
    color: var(--muted);
    line-height: 1.2;
    border-radius: 10px;
    font-weight: 600;
}

    .tabBtn.active {
        background: linear-gradient(180deg, rgba(47, 168, 255, 0.18) 0%, rgba(47, 168, 255, 0.10) 100%);
        color: var(--text-strong);
        border-color: rgba(47, 168, 255, 0.18);
    }

.mobileTabBar {
    display: none;
}

#searchView,
#collectionView {
    margin-top: 0;
    padding-top: 0;
    background: transparent;
    transition: none;
}
    #collectionView .heroValue {
        font-size: 30px;
        font-weight: 700;
        letter-spacing: -0.02em;
    }
    #collectionView .kpiLabel {
        font-size: 10px;
        opacity: 0.8;
    }
    #collectionView .collectionSummaryCard {
        background: rgba(255, 255, 255, 0.025);
    }
.resultActions {
    margin: 18px 0 22px;
}

    .resultActions .primaryBtn {
        min-width: 220px;
        background: linear-gradient(180deg, #2f8fff 0%, #1f6fe5 100%);
        border: 1px solid rgba(255, 255, 255, 0.14);
        box-shadow: 0 12px 28px rgba(31, 111, 229, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
        color: #fff;
    }

        .resultActions .primaryBtn:hover {
            background: linear-gradient(180deg, #3b9bff 0%, #2b7cf0 100%);
            box-shadow: 0 14px 30px rgba(31, 111, 229, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
        }

    .resultActions button[disabled] {
        opacity: 1;
        background: linear-gradient(180deg, #314765 0%, #24364d 100%);
        border-color: rgba(255,255,255,0.08);
        color: #fff;
        cursor: default;
    }

    .resultActions .muted.small {
        margin-top: 8px;
        color: var(--muted);
    }

.collectionSummaryCard {
    margin-bottom: 10px;
    padding: 16px;
}

.collectionHeader {
    margin-bottom: 10px;
}

.collectionTitle {
    margin: 0;
    font-size: 22px;
    letter-spacing: -0.02em;
    color: var(--text);
}

.collectionSummary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 8px;
    margin-bottom: 6px;
}

.collectionActions {
    margin-top: 14px;
}

#authStatus {
    margin-top: 10px;
    line-height: 1.6;
    color: var(--muted);
}

#signOutBtn {
    margin-left: 10px;
}

#saveCollectionForm {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-top: 12px;
    flex-wrap: wrap;
}

    #saveCollectionForm input {
        flex: 1 1 auto;
        min-width: 0;
        margin: 0;
        padding: 14px 12px;
    }

    #saveCollectionForm button {
        flex: 0 0 auto;
        margin: 0;
    }

.collectionList {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.collectionItem {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
}

.collectionItemMain {
    flex: 1;
    min-width: 0;
}

.collectionItemName {
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.35;
    font-size: 20px;
    color: var(--text);
}

.collectionItemStats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    line-height: 1.6;
}

    .collectionItemStats span {
        display: inline-block;
        color: var(--muted);
    }

@media (max-width: 700px) {
    .page {
        padding: 22px 14px 84px;
    }

    h1 {
        font-size: 30px;
    }

    .desktopTabsWrap {
        display: none;
    }

    .valueSummary,
    .kpiGrid,
    .collectionSummary {
        grid-template-columns: 1fr;
    }

        .collectionSummaryCard,
        .collectionSummary,
        .collectionSummary .kpiLabel {
            text-align: center;
        }

    .rowTop {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

        .rowTop > .col:first-child {
            display: contents;
        }

        .rowTop > .col:last-child {
            display: contents;
        }

    .recentSalesCard {
        order: 1;
    }

    .recentPointsCard {
        order: 2;
    }

    .kpiGrid {
        order: 3;
    }

    .heroValue {
        font-size: 34px;
    }

    #collectionTotal {
        font-size: 44px;
    }

    .bottleName {
        font-size: 25px;
    }

    .collectionItem {
        flex-direction: column;
        align-items: flex-start;
    }

    #saveCollectionForm {
        flex-direction: column;
        align-items: stretch;
    }

        #saveCollectionForm input,
        #saveCollectionForm button,
        .collectionActions .primaryBtn {
            width: 100%;
        }

        #saveCollectionForm input,
        #saveCollectionForm button {
            flex: 0 0 auto;
        }

    #signOutBtn {
        margin-left: 0;
        margin-top: 8px;
        display: inline-block;
    }

    .collectionItemStats {
        display: block;
    }

        .collectionItemStats span {
            display: block;
            margin-top: 4px;
        }

    .mobileTabBar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        background: rgba(10, 19, 31, 0.97);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.28);
        backdrop-filter: blur(12px);
        z-index: 30;
    }

    .mobileTabBtn {
        appearance: none;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--muted);
        font: inherit;
        font-size: 14px;
        font-weight: 600;
        padding: 10px 8px;
        text-align: center;
        min-height: 42px;
    }

        .mobileTabBtn.active {
            background: rgba(47, 168, 255, 0.14);
            color: var(--text-strong);
        }
}

@media (min-width: 701px) {
    .contentWrap {
        margin-top: 10px;
    }

    .mobileTabBar {
        display: none;
    }
}
