/* =========================================================================
   EVE-Exchange design system
   Dark-first ("station at night"), light theme via [data-bs-theme="light"].
   Every color is a token; components reference roles, never raw hex.
   ========================================================================= */

:root,
[data-bs-theme="dark"] {
    color-scheme: dark;
    --bg: #090c11;
    --bg-glow: rgba(64, 160, 255, 0.07);
    --surface: #11161d;
    --surface-2: #171d26;
    --surface-3: #1e2631;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #e8edf2;
    --text-2: #a9b4c0;
    --muted: #7d8894;
    --accent: #4cb8ff;
    --accent-ink: #04121d;
    --accent-wash: rgba(76, 184, 255, 0.12);
    --isk: #e8b34b;
    --up: #2fbf71;
    --down: #ef5f5f;
    --grid: #1f2731;
    --axis: #333d48;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    /* chart series - reference palette, dark steps (validated adjacent-pair order) */
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --sec-high: #2fbf71;
    --sec-low: #e8a33b;
    --sec-null: #ef5f5f;

    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-border-color: var(--border);
    --bs-secondary-color: var(--text-2);
    --bs-tertiary-bg: var(--surface-2);
    --bs-emphasis-color: var(--text);
    --bs-link-color: var(--accent);
    --bs-link-color-rgb: 76, 184, 255;
    --bs-link-hover-color: var(--text);
}

[data-bs-theme="light"] {
    color-scheme: light;
    --bg: #f3f5f8;
    --bg-glow: rgba(10, 127, 194, 0.06);
    --surface: #ffffff;
    --surface-2: #f2f4f7;
    --surface-3: #e8ecf1;
    --border: rgba(14, 20, 26, 0.10);
    --border-strong: rgba(14, 20, 26, 0.20);
    --text: #0e141a;
    --text-2: #46515c;
    --muted: #6f7a85;
    --accent: #0a74b8;
    --accent-ink: #ffffff;
    --accent-wash: rgba(10, 116, 184, 0.10);
    --isk: #9a6a00;
    --up: #13824a;
    --down: #c93434;
    --grid: #e5e9ee;
    --axis: #c5ccd3;
    --shadow: 0 10px 30px rgba(14, 20, 26, 0.10);
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --series-4: #eda100;
    --sec-high: #13824a;
    --sec-low: #a86a00;
    --sec-null: #c93434;
}

/* ---------- base ---------- */
html { font-size: 15px; }

body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(1200px 600px at 85% -10%, var(--bg-glow), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, var(--bg-glow), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { color: var(--text); letter-spacing: -0.01em; }

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.num { font-variant-numeric: tabular-nums; }
.text-2 { color: var(--text-2) !important; }
.text-muted, .muted { color: var(--muted) !important; }
.isk { color: var(--isk); }
.up { color: var(--up); }
.down { color: var(--down); }

.page {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.5rem clamp(1rem, 3vw, 2rem) 3rem;
    flex: 1;
}

/* ---------- header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.site-header .bar {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0.7rem clamp(1rem, 3vw, 2rem);
    display: grid;
    /* brand, nav (taking the spare width), tools; the item search is the row below (.search-row) */
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.25rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
    font-family: "Rajdhani", "Inter", sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}
.brand:hover { color: var(--text); }
.brand-mark {
    width: 34px;
    height: 34px;
    flex: none;
}
/* wordmark: EVE in the text color, EXCHANGE in the accent; color does the separating, so no hyphen */
.brand-word { line-height: 1; }
.brand .brand-x { color: var(--accent); }
/* the tagline sits under the wordmark, dropped on small screens where the header is tight */
.brand-text { display: flex; flex-direction: column; gap: 0.2rem; }
.brand-tagline {
    font-family: "Inter", sans-serif;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--muted);
    line-height: 1;
}
@media (max-width: 760px) { .brand-tagline { display: none; } }
/* very narrow phones: the mark alone, so the header (and the log in button) fit */
@media (max-width: 480px) { .brand-word { display: none; } }

/* nav links fill the bar's height so the active indicator can sit exactly on the header's bottom border */
.main-nav {
    display: flex;
    gap: 0.25rem;
    align-self: stretch;
}
.main-nav a {
    position: relative;
    display: flex;
    align-items: center;
    color: var(--text-2);
    padding: 0 0.8rem;
    font-weight: 500;
    font-size: 0.93rem;
    white-space: nowrap;
    transition: color .15s;
}
.main-nav a:hover { color: var(--text); }
.main-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.main-nav a[aria-current="page"]::after {
    content: "";
    position: absolute;
    left: 0.8rem;
    right: 0.8rem;
    /* bar's bottom padding + the header's 1px border */
    bottom: calc(-0.7rem - 1px);
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
}

/* the search row: a full-width band under the bar (the nav's active underline sits on the line between them) */
.search-row { border-top: 1px solid var(--border); padding: 0.55rem clamp(1rem, 3vw, 2rem); }
/* lined up with the bar's content (the bar is 1440px wide, less its side padding) */
.search-row .search { max-width: calc(1440px - 2 * clamp(1rem, 3vw, 2rem)); margin: 0 auto; }

.header-tools {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-2);
    font-size: 0.85rem;
}
.eve-clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.15;
}
.eve-clock strong { color: var(--text); font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.eve-clock span { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

/* signed-out: log in button; signed-in: portrait + name with a small menu (a <details>, so it works without script) */
.login-btn { padding: 0.45rem 0.9rem; font-size: 0.88rem; white-space: nowrap; }
/* EVE Online's SSO button in the header (black on dark, white on light, like the log in page) */
.header-sso { margin: 0; display: flex; }
.header-sso-btn { display: inline-flex; padding: 0; border: 0; background: none; border-radius: 6px; cursor: pointer; line-height: 0; }
.header-sso-btn img { height: 30px; width: auto; }
.header-sso-btn:hover { filter: brightness(1.15); }
.header-sso-btn:active { transform: translateY(1px); }
.header-sso-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.header-sso .sso-light { display: none; }
[data-bs-theme="light"] .header-sso .sso-dark { display: none; }
[data-bs-theme="light"] .header-sso .sso-light { display: inline; }
@media (max-width: 600px) { .header-sso-btn img { height: 26px; } }
.user-menu { position: relative; }
.user-menu summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.6rem 0.2rem 0.2rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    max-width: 220px;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover, .user-menu[open] summary { border-color: var(--border-strong); }
.user-menu img, .user-initial { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.user-initial { display: grid; place-items: center; background: var(--accent-wash); color: var(--accent); font-weight: 700; }
.user-ident { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.user-name { font-size: 0.88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the subscription tier under the name */
.user-tier { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); }
.user-tier-trader { color: var(--accent); }
.user-tier-tycoon { color: var(--isk); }
.user-pop {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 1060;
    min-width: 190px;
    padding: 0.35rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}
.user-pop a, .user-pop button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}
.user-sep { height: 1px; margin: 0.3rem 0.35rem; background: var(--border); }
.user-pop a:hover, .user-pop button:hover { background: var(--surface-2); color: var(--text); }
.user-pop form { margin: 0; }
@media (max-width: 600px) { .user-ident { display: none; } .user-menu summary { padding: 0.2rem; } }

/* ---------- search / autocomplete ---------- */
.search {
    position: relative;
    max-width: 640px;
    width: 100%;
    justify-self: center;
}
.search-input,
.field-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: 10px;
    padding: 0.6rem 0.9rem;
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.search-input { padding-left: 2.5rem; padding-right: 2.8rem; }
.search-input::placeholder, .field-input::placeholder { color: var(--muted); }
.search-input:focus, .field-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-wash);
}
.search .search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}
.search kbd {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 5px;
    font-size: 0.75rem;
    padding: 0.05rem 0.4rem;
    font-family: inherit;
}
.search.busy .search-icon { animation: pulse 0.9s ease-in-out infinite; color: var(--accent); }
@keyframes pulse { 50% { opacity: 0.35; } }

.ac-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1050;
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-height: min(60vh, 440px);
    overflow-y: auto;
}
.ac-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text);
}
.ac-item img { width: 32px; height: 32px; border-radius: 6px; background: var(--surface-2); flex: none; }
.ac-item .ac-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ac-item .ac-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-item .ac-detail { color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-item .ac-label mark { background: none; color: var(--accent); padding: 0; font-weight: 600; }
.ac-item .ac-sub { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.ac-item[aria-selected="true"] { background: var(--accent-wash); }
.ac-empty { padding: 0.75rem; color: var(--muted); }

/* ---------- panels / cards ---------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.15rem 1.25rem;
    min-width: 0;
}
.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
    flex-wrap: wrap;
}
.panel-title { font-size: 1rem; font-weight: 600; margin: 0; }
.panel-sub { color: var(--muted); font-size: 0.82rem; margin: 0.15rem 0 0; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.page-head h1 { font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 700; margin: 0; }
.page-head p { color: var(--text-2); margin: 0.25rem 0 0; }
.eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.grid { display: grid; gap: 1rem; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) {
    .grid-2-1, .grid-1-1 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- stat tiles ---------- */
.stat {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
    overflow: hidden;
}
.stat-label { color: var(--text-2); font-size: 0.85rem; display: flex; align-items: center; gap: 0.45rem; }
.stat-label img { width: 22px; height: 22px; border-radius: 4px; }
.stat-value { font-size: 1.7rem; font-weight: 650; line-height: 1.1; color: var(--text); }
.stat-value small { font-size: 0.85rem; color: var(--muted); font-weight: 500; margin-left: 0.25rem; }
.stat-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.82rem; color: var(--muted); }
.delta { font-weight: 600; white-space: nowrap; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.flat { color: var(--muted); }
.spark { width: 110px; height: 32px; flex: none; }
.spark path.line { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }

.hero-value { font-size: clamp(2.2rem, 4vw, 3.2rem); font-weight: 700; line-height: 1; }

.live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--up);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--up) 60%, transparent);
    animation: live 2s infinite;
    display: inline-block;
}
@keyframes live { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- charts ---------- */
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 240px; }
.chart-box.xs { height: 160px; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.82rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

.seg {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 2px;
    gap: 2px;
}
.seg button {
    border: 0;
    background: none;
    color: var(--text-2);
    padding: 0.28rem 0.65rem;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.25); }

.link-btn {
    border: 0; background: none; padding: 0;
    color: var(--muted); font-size: 0.8rem; cursor: pointer;
}
.link-btn:hover { color: var(--accent); }

.skeleton {
    background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
    background-size: 200% 100%;
    animation: shimmer 1.4s linear infinite;
    border-radius: 8px;
    color: transparent !important;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.empty-state {
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--muted);
    padding: 2rem 1rem;
    height: 100%;
}

/* ---------- data tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -1.25rem; padding: 0 1.25rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th {
    text-align: left;
    color: var(--muted);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--surface);
}
.data-table td {
    padding: 0.6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
}
.data-table td.r, .data-table th.r { text-align: right; font-variant-numeric: tabular-nums; }
/* gains and losses in a table cell keep their colour (the cell colour above would otherwise win) */
.data-table td.up { color: var(--up); }
.data-table td.down { color: var(--down); }
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table th[data-sort] { cursor: pointer; user-select: none; }
.data-table th[data-sort]:hover { color: var(--text); }
.data-table th[aria-sort="ascending"]::after { content: " ▲"; color: var(--accent); }
.data-table th[aria-sort="descending"]::after { content: " ▼"; color: var(--accent); }
.data-table .item-cell { display: flex; align-items: center; gap: 0.6rem; min-width: 140px; }
.data-table .item-cell img { width: 28px; height: 28px; border-radius: 5px; background: var(--surface-2); }
.scroll-y { max-height: 560px; overflow-y: auto; }

.sec { font-weight: 600; font-variant-numeric: tabular-nums; }
.sec-high { color: var(--sec-high); }
.sec-low { color: var(--sec-low); }
.sec-null { color: var(--sec-null); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.field label { font-size: 0.8rem; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 0.35rem; }
.field .hint { font-size: 0.75rem; color: var(--muted); }
.field-wrap { position: relative; }
.field-suffix {
    position: absolute; right: 0.8rem; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: 0.8rem; pointer-events: none;
}
.field-wrap .field-input.has-suffix { padding-right: 3rem; }
select.field-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
.field-input.invalid { border-color: var(--down); }
.tip {
    display: inline-grid; place-items: center;
    width: 15px; height: 15px; border-radius: 50%;
    border: 1px solid var(--border-strong);
    color: var(--muted); font-size: 0.65rem; cursor: help;
}

.btn-primary-x {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    background: var(--accent);
    color: var(--accent-ink);
    border: 0;
    border-radius: 10px;
    padding: 0.65rem 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s, transform .05s;
}
.btn-primary-x:hover { filter: brightness(1.1); color: var(--accent-ink); }
.btn-primary-x:active { transform: translateY(1px); }
.btn-primary-x:disabled { opacity: 0.6; cursor: progress; }
.btn-ghost {
    display: inline-flex; align-items: center; gap: 0.45rem;
    background: var(--surface-2); color: var(--text-2);
    border: 1px solid var(--border); border-radius: 10px;
    padding: 0.55rem 1rem; font-weight: 500; cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }

.spinner {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chip {
    display: inline-flex; align-items: center; gap: 0.3rem;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text-2); border-radius: 999px;
    padding: 0.15rem 0.6rem; font-size: 0.78rem; white-space: nowrap;
}

/* ---------- footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.8rem;
}
.site-footer .inner {
    max-width: 1440px; margin: 0 auto;
    padding: 1.25rem clamp(1rem, 3vw, 2rem);
    display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.site-footer a { color: var(--text-2); }

/* ---------- responsive header ---------- */
/* the nav gets a row of its own once brand + nav + tools no longer fit on one line */
@media (max-width: 1180px) {
    .site-header .bar { grid-template-columns: 1fr auto; row-gap: 0.6rem; }
    /* the bar's last row, so the active underline still sits on the line above the search row */
    .main-nav { grid-column: 1 / -1; order: 3; overflow-x: auto; }
    .main-nav a { min-height: 40px; }
}
@media (max-width: 960px) {
    .search kbd { display: none; }
    .eve-clock { display: none; }
}

/* ---------- third-party overrides ---------- */
.glitchy-toast-container, .glitchy-toast { font-family: inherit; }

/* small button size, used with btn-ghost / btn-primary-x across pages (named for where it started, the trade finder) */
.tf-btn-sm { padding: .4rem .8rem; font-size: .85rem; border-radius: 9px; }
.tf-btn-sm:disabled { opacity: .5; cursor: not-allowed; }

/* in-game buttons (game.js): route actions under a location, and the character picker */
.game-route { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.15rem; color: var(--muted); }
.game-route .link-btn { font-size: inherit; }
.game-picker { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--text-2); white-space: nowrap; }
.game-picker[hidden] { display: none; }
.game-picker .field-input { width: auto; padding: 0.3rem 2rem 0.3rem 0.5rem; font-size: 0.82rem; }
.game-icon { display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--muted); padding: 0 .2rem; cursor: pointer; vertical-align: -2px; }
.game-icon:hover { color: var(--accent); }
.game-icon:disabled { opacity: .45; cursor: progress; }

/* ad spots (Pages/Shared/_AdSlot.cshtml): free accounts and visitors only. Sized for a 728x90 banner, or the phone size
   below; the placeholder marks the spot until an ad network's code replaces it */
.ad-slot { margin: 0 auto 1rem; max-width: 728px; text-align: center; }
.ad-slot-label { display: block; margin-bottom: .25rem; font-size: .62rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.ad-slot-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
    min-height: 90px; border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--muted); font-size: .78rem;
    background: repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--muted) 6%, transparent) 10px 20px);
}
.ad-slot-placeholder strong { color: var(--text-2); font-weight: 600; }
main.page > .ad-slot:first-child { margin-top: .25rem; }
@media (max-width: 760px) {
    .ad-slot { max-width: 320px; }
    .ad-slot-placeholder { min-height: 100px; }
    .ad-slot[data-ad-slot="dashboard"], .ad-slot[data-ad-slot="item"], .ad-slot[data-ad-slot="trade-finder"], .ad-slot[data-ad-slot="contracts"] { max-width: 300px; }
    .ad-slot[data-ad-slot="dashboard"] .ad-slot-placeholder, .ad-slot[data-ad-slot="item"] .ad-slot-placeholder,
    .ad-slot[data-ad-slot="trade-finder"] .ad-slot-placeholder, .ad-slot[data-ad-slot="contracts"] .ad-slot-placeholder { min-height: 250px; }
}

/* the subscribe modal (shared/tiers.js): what a tier unlocks, what it costs, and how to pay */
.tier-modal {
    width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; padding: 1.5rem;
    border: 1px solid var(--border-strong); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.tier-modal::backdrop { background: rgba(4, 8, 14, 0.65); backdrop-filter: blur(2px); }
.tier-modal h2 { margin: 0.15rem 0 0.5rem; font-size: 1.4rem; font-weight: 700; }
.tier-x { position: absolute; top: 0.75rem; right: 0.9rem; border: 0; background: none; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.tier-x:hover { color: var(--text); }
.tier-message { color: var(--text-2); margin-bottom: 0.4rem; }
.tier-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.tier-card { padding: 0.9rem 1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.tier-card-unlocks { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); }
.tier-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.tier-card-name { font-weight: 700; font-size: 1.05rem; }
.tier-name-trader { color: var(--accent); }
.tier-name-tycoon { color: var(--isk); }
.tier-card-badge { padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.68rem; font-weight: 700; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.tier-card-price { margin: 0.35rem 0 0.5rem; font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.tier-card-price span { font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.tier-card ul { margin: 0; padding-left: 1.1rem; font-size: 0.85rem; color: var(--text-2); }
.tier-card li + li { margin-top: 0.2rem; }
.tier-subhead { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0.5rem 0 0.4rem; }
.tier-steps { margin: 0 0 0.5rem; padding-left: 1.2rem; font-size: 0.9rem; }
.tier-steps li + li { margin-top: 0.3rem; }
.tier-copy { border: 0; background: none; padding: 0 0.2rem; color: var(--muted); cursor: pointer; }
.tier-copy:hover { color: var(--accent); }
.tier-later { padding: 0.6rem 0.8rem; border-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.tier-warn { font-size: 0.85rem; color: var(--down); }
.tier-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
.tier-modal:focus { outline: none; }

/* the first-visit cookie prompt (consent.js), a narrower version of the tier modal */
.consent-modal { width: min(520px, calc(100vw - 32px)); }
.consent-text p { color: var(--text-2); margin-bottom: 0.6rem; }
.consent-text .consent-reason { color: var(--text); font-weight: 600; padding: 0.55rem 0.75rem; border-left: 3px solid var(--accent); background: var(--accent-wash); border-radius: 6px; }
@media (max-width: 480px) { .consent-modal .tier-actions { flex-direction: column-reverse; } .consent-modal .tier-actions button { width: 100%; } }

/* site messages (Admin > Messages), at the top of every page; colored by level, with an icon so it's not color alone */
.site-messages { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.site-message {
    --message: var(--accent);
    /* centred, so one line of text sits in the middle beside the taller close button */
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.65rem 0.8rem 0.65rem 0.9rem;
    border: 1px solid color-mix(in srgb, var(--message) 45%, var(--border));
    border-left: 4px solid var(--message);
    border-radius: 10px;
    background: color-mix(in srgb, var(--message) 10%, var(--surface));
    color: var(--text);
}
.site-message-success { --message: var(--up); }
.site-message-warning { --message: var(--isk); }
.site-message-danger { --message: var(--down); }
.site-message-icon { flex: none; color: var(--message); }
.site-message-text { flex: 1; margin: 0; font-size: 0.9rem; line-height: 1.45; }
.site-message-text a { font-weight: 600; margin-left: 0.3rem; white-space: nowrap; }
.site-message-close { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.site-message-close:hover { color: var(--text); background: color-mix(in srgb, var(--message) 15%, transparent); }
