/* ============ TOKENS ============ */
:root {
    --ink: #12151A;
    --surface: #1A1F27;
    --surface-2: #232A35;
    --surface-3: #2C3442;
    --border: rgba(237, 234, 227, 0.08);
    --border-strong: rgba(237, 234, 227, 0.16);

    --ember: #FF5A36;
    --ember-dark: #D93F1F;
    --ember-glow: rgba(255, 90, 54, 0.35);

    --volt: #C6FF3D;
    --volt-glow: rgba(198, 255, 61, 0.35);

    --bone: #F2EFE9;
    --slate: #97A0AF;
    --slate-dim: #626B7A;

    --gold: #FFD447;
    --silver: #C9CFD8;
    --bronze: #D9843A;

    --radius: 14px;
    --radius-lg: 22px;
    --font-display: 'Oswald', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Themeable accent — defaults to ember, overridden per-user via JS */
    --user-accent: var(--ember);
    --user-accent-dark: var(--ember-dark);
    --user-accent-glow: var(--ember-glow);
    --user-text-on-accent: var(--ink);
    --user-text-outline: none;
}

/* ============ RESET / BASE ============ */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--ink);
    color: var(--bone);
    font-family: var(--font-body);
    min-height: 100vh;
}

body {
    position: relative;
    overflow-x: hidden;
}

/* Ambient moving gradient glow behind everything */
body::before {
    content: "";
    position: fixed;
    inset: -20%;
    z-index: -1;
    background:
            radial-gradient(circle at 20% 20%, var(--user-accent-glow), transparent 40%),
            radial-gradient(circle at 80% 30%, rgba(198, 255, 61, 0.15), transparent 45%),
            radial-gradient(circle at 50% 80%, var(--user-accent-glow), transparent 40%);
    filter: blur(60px);
    animation: driftGlow 22s ease-in-out infinite alternate;
    opacity: 0.8;
}

@keyframes driftGlow {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(-3%, 4%) scale(1.08); }
    100% { transform: translate(4%, -3%) scale(1.02); }
}

::selection {
    background: var(--user-accent);
    color: var(--ink);
}

*:focus-visible {
    outline: 2px solid var(--volt);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: var(--ink);
}
::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--user-accent-dark);
}

/* ============ TYPOGRAPHY ============ */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--bone);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin: 0 0 6px 0;
}

h1 {
    font-size: clamp(2.4rem, 6vw, 4rem);
    font-weight: 700;
    line-height: 1;
}

h3 {
    font-size: 1.7rem;
    font-weight: 600;
    border-left: 4px solid var(--user-accent);
    padding-left: 14px;
    animation: slideFadeIn 0.4s ease both;
}

h4 {
    font-size: 1.1rem;
    color: var(--slate);
    font-weight: 500;
}

p {
    color: var(--slate);
    line-height: 1.6;
}

strong {
    color: var(--bone);
}

a {
    color: var(--user-accent);
    text-decoration: none;
}

hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
    margin: 28px 0;
}

/* ============ BOOT / LOADING SCREEN ============ */
.boot-screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

.boot-mark {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 4px solid var(--surface-3);
    border-top-color: var(--user-accent);
    animation: spin 0.9s linear infinite;
}

.boot-text {
    font-family: var(--font-display);
    letter-spacing: 0.35em;
    color: var(--slate);
    font-size: 0.85rem;
}

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

/* ============ NAV ============ */
.nav-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 16px 32px;
    background: rgba(18, 21, 26, 0.7);
    backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    color: var(--bone);
    text-decoration: none;
    margin-right: 12px;
    padding: 12px 24px;
    border: 3px solid var(--user-accent);
    border-radius: var(--radius);
    box-shadow: 0 0 14px var(--user-accent-glow);
    outline: none;
}

.nav-brand:focus,
.nav-brand:focus-visible {
    outline: none;
}

.nav-bar a {
    position: relative;
    color: var(--slate);
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 6px 2px;
    transition: color 0.2s ease;
}

.nav-bar a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0%;
    height: 2px;
    background: var(--user-accent);
    transition: width 0.25s ease;
}

.nav-bar a:hover {
    color: var(--bone);
}

.nav-bar a:hover::after {
    width: 100%;
}

.nav-bar a.active {
    color: var(--bone);
}

.nav-bar a.active::after {
    width: 100%;
    background: var(--volt);
}

/* ============ PAGE SHELL ============ */
.page-content {
    padding: 40px 32px 80px;
    max-width: 960px;
    margin: 0 auto;
}

/* ============ BUTTONS ============ */
button {
    font-family: var(--font-body);
    background: var(--surface-2);
    color: var(--bone);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 14px 20px;
    font-weight: 600;
    font-size: 0.98rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    position: relative;
}

button:hover {
    transform: translateY(-2px);
    border-color: var(--user-accent);
    box-shadow: 0 8px 20px -8px var(--user-accent-glow);
}

button:active {
    transform: translateY(0);
}

.button-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 380px;
    animation: slideFadeIn 0.45s ease both;
}

.button-column button {
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.button-column button::after {
    content: "→";
    color: var(--slate-dim);
    transition: transform 0.2s ease, color 0.2s ease;
}

.button-column button:hover::after {
    transform: translateX(4px);
    color: var(--user-accent);
}

.back-button {
    background: transparent;
    border: none;
    color: var(--slate);
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
    padding: 6px 0;
    box-shadow: none;
}

.back-button:hover {
    color: var(--user-accent);
    transform: translateX(-3px);
    box-shadow: none;
    border: none;
}

/* Hero buttons (Home page) */
.hero-actions button {
    background: linear-gradient(135deg, var(--user-accent), var(--user-accent-dark));
    border: none;
    color: var(--user-text-on-accent);
    text-shadow: var(--user-text-outline);
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 1rem;
    padding: 18px 26px;
    box-shadow: 0 10px 30px -10px var(--user-accent-glow);
}

.hero-actions button:hover {
    box-shadow: 0 14px 36px -8px var(--user-accent-glow);
    transform: translateY(-3px);
}

.hero-actions button::after {
    content: none;
}

/* ============ LISTS / RANKINGS ============ */
ol, ul {
    padding-left: 0;
    list-style: none;
}

ol li, ul li {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 10px;
    animation: slideFadeIn 0.4s ease both;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

ol li:hover, ul li:hover {
    border-color: var(--border-strong);
    transform: translateX(2px);
}

ol {
    counter-reset: rank;
}

ol li {
    position: relative;
    padding-left: 56px;
}

ol li::before {
    content: attr(data-rank);
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    color: var(--slate);
}

ol li[data-rank="1"]::before {
    background: linear-gradient(135deg, var(--gold), #c99a1f);
    color: var(--ink);
    box-shadow: 0 0 14px rgba(255, 212, 71, 0.5);
}

ol li[data-rank="2"]::before {
    background: linear-gradient(135deg, var(--silver), #8b93a1);
    color: var(--ink);
    box-shadow: 0 0 12px rgba(201, 207, 216, 0.4);
}

ol li[data-rank="3"]::before {
    background: linear-gradient(135deg, var(--bronze), #a35a24);
    color: var(--ink);
    box-shadow: 0 0 12px rgba(217, 132, 58, 0.4);
}

ol li button, ul li button {
    margin-top: 8px;
    padding: 8px 14px;
    font-size: 0.85rem;
}

/* stagger the list entrance */
ol li:nth-child(1), ul li:nth-child(1) { animation-delay: 0.02s; }
ol li:nth-child(2), ul li:nth-child(2) { animation-delay: 0.06s; }
ol li:nth-child(3), ul li:nth-child(3) { animation-delay: 0.10s; }
ol li:nth-child(4), ul li:nth-child(4) { animation-delay: 0.14s; }
ol li:nth-child(5), ul li:nth-child(5) { animation-delay: 0.18s; }
ol li:nth-child(n+6), ul li:nth-child(n+6) { animation-delay: 0.22s; }

/* ============ STATES ============ */
.error-text {
    color: var(--ember);
    background: rgba(255, 90, 54, 0.08);
    border: 1px solid rgba(255, 90, 54, 0.3);
    border-radius: var(--radius);
    padding: 14px 16px;
}

/* ============ ANIMATIONS ============ */
@keyframes slideFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============ ERROR UI (suppressed) ============ */
#blazor-error-ui {
    display: none !important;
}

.auth-input {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 14px 16px;
    color: var(--bone);
    font-family: var(--font-body);
    font-size: 0.98rem;
}

.auth-input:focus {
    outline: none;
    border-color: var(--user-accent);
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 40px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 8px;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    box-shadow: 0 12px 30px -10px rgba(0,0,0,0.5);
    z-index: 60;
}

.dropdown-menu a {
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--bone);
    text-transform: none;
    font-family: var(--font-body);
    font-weight: 500;
    letter-spacing: 0;
}

.dropdown-menu a::after {
    content: none;
}

.dropdown-menu a:hover {
    background: var(--surface-2);
    color: var(--user-accent);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 360px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-box h4 {
    margin-bottom: 4px;
}

select.auth-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2397A0AF' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 42px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

select.auth-input:hover {
    border-color: var(--user-accent);
}

select.auth-input option {
    background: var(--surface);
    color: var(--bone);
}

.plate-inc-btn:hover {
    background: #90EE90 !important;
    border-color: #90EE90 !important;
    color: var(--ink) !important;
}
.plate-dec-btn:hover {
    background: #FF9999 !important;
    border-color: #FF9999 !important;
    color: var(--ink) !important;
}

.color-swatch-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-swatch-row input[type="color"] {
    width: 48px;
    height: 48px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: none;
    cursor: pointer;
    padding: 0;
}

.color-preview-btn {
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--user-accent), var(--user-accent-dark));
    color: var(--user-text-on-accent);
    text-shadow: var(--user-text-outline);
    border: none;
    text-align: center;
}
.custom-select {
    position: relative;
    flex: 1;
}

.custom-select-box {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 14px 16px;
    color: var(--bone);
    font-family: var(--font-body);
    font-size: 0.98rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.custom-select-box:hover {
    border-color: var(--user-accent);
}

.custom-select-box .arrow {
    color: var(--slate);
    font-size: 0.7rem;
    margin-left: 10px;
    transition: transform 0.2s ease;
}

.custom-select-box.open .arrow {
    transform: rotate(180deg);
}

.custom-select-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    max-height: 220px;
    overflow-y: auto;
    z-index: 70;
    box-shadow: 0 12px 30px -10px rgba(0,0,0,0.5);
    animation: slideFadeIn 0.15s ease both;
}

.custom-select-item {
    padding: 12px 16px;
    cursor: pointer;
    color: var(--bone);
    transition: background 0.15s ease;
}

.custom-select-item:hover {
    background: var(--surface-2);
    color: var(--user-accent);
}

.custom-select-item.empty {
    color: var(--slate);
    cursor: default;
}

.custom-select-item.empty:hover {
    background: none;
    color: var(--slate);
}
.search-result-item {
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--bone);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.search-result-item:hover {
    border-color: var(--user-accent);
    background: var(--surface-3);
}
.mobile-menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    color: var(--bone);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    box-shadow: none;
}

.mobile-menu-toggle:hover {
    transform: none;
    border-color: var(--user-accent);
    box-shadow: none;
}

.nav-links-desktop {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-mobile-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border-strong);
    flex-direction: column;
    padding: 10px 20px 20px;
    gap: 4px;
    z-index: 55;
    box-shadow: 0 12px 24px -10px rgba(0,0,0,0.5);
}

.nav-mobile-dropdown.open {
    display: flex;
}

.nav-mobile-dropdown a {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
    text-transform: none;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 1rem;
}

.nav-mobile-dropdown a:last-child {
    border-bottom: none;
}

.nav-mobile-dropdown a::after {
    content: none;
}

@media (max-width: 768px) {
    .nav-links-desktop {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .nav-bar {
        position: sticky;
        flex-wrap: nowrap;
    }
}
.updates-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #FFD447;
    color: #12151A;
    font-size: 11px;
    font-weight: 800;
    margin-left: 4px;
    vertical-align: super;
}

.message-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 48px 56px;
    padding: 10px 0 40px;
}

.message-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}

.message-card.floaty {
    animation-name: floatWiggle;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-duration: var(--float-duration, 10s);
    animation-delay: var(--float-delay, 0s);
}

@keyframes floatWiggle {
    0%   { transform: translate(0, 0) rotate(0deg); }
    25%  { transform: translate(var(--tx1, 6px), var(--ty1, -8px)) rotate(-1deg); }
    50%  { transform: translate(var(--tx2, -5px), var(--ty2, 5px)) rotate(1deg); }
    75%  { transform: translate(var(--tx3, 4px), var(--ty3, 4px)) rotate(-0.5deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

.updates-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #FFD447;
    color: #12151A;
    font-size: 11px;
    font-weight: 800;
    margin-left: 4px;
    vertical-align: super;
}

.message-card.floaty {
    --tx1: 20px;
    --ty1: -22px;
    --tx2: -18px;
    --ty2: 20px;
    --tx3: 16px;
    --ty3: 16px;
    --float-duration: 20s;
    --float-delay: 0s;

    animation-name: floatWiggle;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-duration: var(--float-duration);
    animation-delay: var(--float-delay);
}

@keyframes floatWiggle {
    0%   { transform: translate(0, 0) rotate(0deg); }
    25%  { transform: translate(var(--tx1), var(--ty1)) rotate(-1.5deg); }
    50%  { transform: translate(var(--tx2), var(--ty2)) rotate(1.5deg); }
    75%  { transform: translate(var(--tx3), var(--ty3)) rotate(-1deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

.weight-convert-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 14px 16px;
    color: var(--bone);
    font-weight: 600;
    text-align: center;
    line-height: 1;
    cursor: pointer;
}

.weight-convert-btn:hover {
    border-color: var(--user-accent);
    color: var(--user-accent);
}

h1:focus-visible {
    outline: none;
}