:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-2: #242836;
    --border: #2e3348;
    --text: #e4e4e7;
    --text-muted: #9ca3af;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.3);
    --green: #22c55e;
    --red: #ef4444;
    --gold: #eab308;
    --plate-bg: #ffffff;
    --plate-text: #000000;
    --plate-border: #333333;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Nav */
header { border-bottom: 1px solid var(--border); }
nav {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.plate-logo {
    display: inline-block;
    background: #1e2028;
    color: #c8ccd4;
    font-family: 'Arial Black', 'Arial', sans-serif;
    font-weight: 900;
    font-size: 1.3rem;
    letter-spacing: 0.04em;
    padding: 0.35rem 0.85rem 0.3rem;
    border-radius: 4px;
    border: 1px solid #3a3d48;
    line-height: 1.3;
}
a .plate-logo, a:visited .plate-logo, a:hover .plate-logo {
    color: #c8ccd4;
}
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

/* Main */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
    width: 100%;
}

/* Hero */
.hero {
    text-align: center;
    padding: 3rem 0;
}
.hero h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.hero p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Search */
.search-box {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    gap: 0.5rem;
}
.search-box input {
    flex: 1;
    padding: 0.85rem 1.2rem;
    font-size: 1.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    outline: none;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}
.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-box button {
    padding: 0.85rem 1.8rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: opacity 0.2s;
}
.search-box button:hover { opacity: 0.9; }
.search-box button:disabled { opacity: 0.6; cursor: progress; }

/* Spinner */
.spinner {
    width: 36px;
    height: 36px;
    margin: 3rem auto;
    border: 3px solid var(--surface-2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Results */
.results { margin-top: 2rem; }
.results h2 { margin-bottom: 1rem; font-size: 1.2rem; }
.vehicle-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.vehicle-tab {
    padding: 0.6rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
}
.vehicle-tab:hover { border-color: var(--accent); color: var(--text); }
.vehicle-tab.active { background: var(--accent); color: white; border-color: var(--accent); }
.results-subhead {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 1rem 0 0.5rem;
    font-weight: 600;
}
.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s;
}
.result-item:hover { border-color: var(--accent); }
.result-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.result-reg {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 2px;
    font-family: monospace;
}
.result-tier {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.result-price {
    color: var(--green);
    font-weight: 600;
}

/* Plate visual */
.plate {
    display: inline-block;
    background: var(--plate-bg);
    color: var(--plate-text);
    font-family: 'Arial Black', 'Impact', sans-serif;
    font-size: 3rem;
    font-weight: 900;
    padding: 0.4rem 1.5rem;
    border: 3px solid var(--plate-border);
    border-radius: 6px;
    letter-spacing: 4px;
    text-align: center;
    min-width: 200px;
}

.plate-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}
.plate-meta {
    display: flex;
    gap: 0.5rem;
}

/* Badges */
.tier-badge, .vehicle-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.tier-badge { background: var(--accent); color: white; }
.vehicle-badge { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

/* Cards */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.card h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

/* Valuation */
.price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--green);
}
/* Gauge */
.gauge-container { padding: 0.5rem 0; }
.gauge {
    position: relative;
    width: 100%;
    height: 36px;
    background: var(--surface-2);
    border-radius: 18px;
    overflow: hidden;
}
.gauge-track {
    position: absolute;
    inset: 0;
    border-radius: 18px;
    background: linear-gradient(90deg, #3b82f6, #06b6d4, #22c55e, #eab308, #f97316, #ef4444);
    opacity: 0.15;
}
.gauge-fill {
    height: 100%;
    border-radius: 18px;
    background: linear-gradient(90deg, #3b82f6, #06b6d4, #22c55e, #eab308, #f97316, #ef4444);
    background-size: calc(100% / var(--gauge-pct, 1) * 100%) 100%;
    transition: width 0.6s ease;
}
.gauge-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 0.9rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* History */
.history-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.history-row:last-child { border-bottom: none; }
.history-date { color: var(--text-muted); }
.history-price { font-weight: 600; color: var(--green); }
.no-data { color: var(--text-muted); font-style: italic; }

/* Price chart */
.price-chart {
    width: 100%;
    max-height: 160px;
    margin-bottom: 1rem;
}
.chart-label {
    fill: var(--text-muted);
    font-size: 10px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Leaderboard */
.tier-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.tier-tab {
    padding: 0.5rem 1.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.tier-tab:hover { border-color: var(--accent); color: var(--text); }
.tier-tab.active { background: var(--accent); color: white; border-color: var(--accent); }

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}
.leaderboard-table th {
    text-align: left;
    padding: 0.7rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
}
.leaderboard-table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
}
.leaderboard-table tr { cursor: pointer; transition: background 0.2s; }
.leaderboard-table tr:hover { background: var(--surface-2); }
.rank { color: var(--text-muted); font-weight: 600; width: 40px; }
.rank-1 { color: var(--gold); }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }

/* Auctions */
.auction-table { width: 100%; border-collapse: collapse; }
.auction-table th {
    text-align: left;
    padding: 0.7rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}
.auction-table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
}
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.5rem;
}
.pagination button {
    padding: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Auction summary */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.summary-stat {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
}
.summary-stat span {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
}
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* About */
.about-content { max-width: 700px; }
.about-section { margin-bottom: 2rem; }
.about-section h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}
.about-section p {
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 0.75rem;
}
.about-section strong { color: var(--text); }

/* Auth forms */
.auth-form {
    max-width: 400px;
}
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}
.form-group input {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
}
.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.btn-primary {
    padding: 0.7rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-secondary {
    padding: 0.6rem 1.2rem;
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
}
.btn-secondary:hover { color: var(--text); border-color: var(--accent); }
.btn-watching { color: var(--accent); border-color: var(--accent); }
.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--red);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.auth-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--green);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.auth-success a { color: var(--green); }
.auth-link {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.auth-link a { color: var(--accent); }

/* Account */
.account-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.account-grid .card:first-child {
    grid-column: 1 / -1;
}
.account-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
}
.account-item:last-child { border-bottom: none; }
.account-item a { color: var(--text); text-decoration: none; }
.account-item a:hover { color: var(--accent); }
.badge-forsale {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.3);
    text-transform: uppercase;
}

/* Messages */
.message-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s;
}
.message-item:hover { border-color: var(--accent); }
.message-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.3rem;
}
.unread-badge {
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
}
.message-preview {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.message-date {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.3rem;
}
.message-thread {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.message-bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
}
.message-bubble.sent {
    align-self: flex-end;
    background: var(--accent);
    color: white;
}
.message-bubble.received {
    align-self: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
}
.message-sender {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    opacity: 0.7;
}
.message-body { line-height: 1.5; }
.message-time {
    font-size: 0.7rem;
    margin-top: 0.3rem;
    opacity: 0.6;
}
.message-compose {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}
.message-compose textarea {
    flex: 1;
    padding: 0.7rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
}
.message-compose textarea:focus {
    border-color: var(--accent);
}

/* Plate actions */
.plate-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.claim-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.claim-owner { color: var(--text-muted); }
.claim-owner strong { color: var(--text); }
.claim-price { color: var(--green); font-weight: 600; }
.claim-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Hidden */
.hidden { display: none !important; }

/* Footer */
footer {
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 700px) {
    .detail-grid { grid-template-columns: 1fr; }
    .summary-grid { grid-template-columns: 1fr; }
    .account-grid { grid-template-columns: 1fr; }
    .plate { font-size: 2rem; }
    .hero h1 { font-size: 1.5rem; }
}
