/* ── Variables ── */
:root {
    --bg:           #111010;
    --surface:      #1c1b1b;
    --surface-alt:  #252424;
    --border:       #3a3535;
    --amber:        #e8a020;
    --amber-dim:    #b87a10;
    --amber-glow:   rgba(232, 160, 32, 0.12);
    --amber-subtle: rgba(232, 160, 32, 0.38);
    --red:          #e0524a;
    --red-glow:     rgba(224, 82, 74, 0.12);
    --green:        #4caf50;
    --fuchsia:      #ff80ff;
    /* Item-card, trophy and requisition tiers, lowest to highest. */
    --tier-grey:    #8a8a8a;
    --tier-green:   #2e8b45;
    --tier-blue:    #1e63c9;
    --tier-red:     #c62828;
    --tier-fuchsia: #ee4ee0;
    /* Garage component tiers T1-T4 (brighter shades than the item tiers). */
    --garage-green: #4caf50;
    --garage-blue:  #3b82f6;
    --garage-red:   #e85d5d;
    --garage-gold:  #f2c94c;
    /* Rig skin cards. */
    --skin-border:  #888;
    --owned-green:  #22c55e;
    --text:         #d4cfc9;
    --text-muted:   #7a746e;
    --text-heading: #f0ebe4;
    --font-main:    'Source Code Pro', monospace;
    --font-display: 'Bebas Neue', Georgia, serif;
}

/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

/* Suppress the mobile browser's translucent tap overlay; controls have their own states. */
html {
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    font-size: 15px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 39px,
            rgba(255,255,255,0.018) 39px,
            rgba(255,255,255,0.018) 40px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 39px,
            rgba(255,255,255,0.018) 39px,
            rgba(255,255,255,0.018) 40px
        );
}

div {
    line-height: 160%;
    padding: 0px;
    font-family: var(--font-main);
    color: var(--text);
}

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

a:hover {
    text-decoration: underline;
}

/* ── Header ── */
header {
    background-color: var(--surface);
    border-bottom: 2px solid var(--amber);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}

/* Keep site links inside the header instead of widening the page on mobile. */
.header-inner > nav {
    min-width: 0;
    max-width: 100%;
}

.header-inner > nav ul {
    flex-wrap: wrap;
}

.header-inner > nav li {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* ── Logo ── */
a.logo {
    text-decoration: none;
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin-block: 0.625rem;
    user-select: none;
}

a.logo:hover {
    text-decoration: none;
}

.logo-geo {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-heading);
    letter-spacing: 0.02em;
}

.logo-loder {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: bold;
    color: var(--amber);
    letter-spacing: 0.02em;
}

.logo-tag {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    margin-left: 0;
    align-self: flex-end;
    line-height: 1;
}

/* ── Nav ── */
nav ul {
    list-style: none;
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

nav a {
    display: block;
    padding: 0.4rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: 1px solid transparent;
    border-radius: 2px;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

nav a:hover {
    color: var(--amber);
    border-color: var(--amber-dim);
    background: var(--amber-glow);
    text-decoration: none;
}

nav a:active {
    padding-top: calc(0.4rem + 1px);
    padding-bottom: calc(0.4rem - 1px);
}

nav a.nav-cta {
    color: var(--bg);
    background: var(--amber);
    border-color: var(--amber);
    font-weight: bold;
}

nav a.nav-cta:hover {
    background: var(--amber-dim);
    border-color: var(--amber-dim);
    color: var(--bg);
}

#site_nav_toggle {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 4px 8px;
    border: 1px solid var(--amber-subtle);
    border-radius: 5px;
    background: var(--surface);
    color: var(--amber);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

#site_nav_toggle:focus-visible,
#site_navigation a:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: -2px;
}

@media (max-width: 960px) {
    body > header { padding-inline: 1rem; }

    .header-inner {
        position: relative;
        z-index: 100;
    }

    #site_nav_toggle { display: inline-flex; }
    #site_nav_toggle[aria-expanded="false"] + #site_navigation { display: none; }

    #site_navigation {
        position: absolute;
        top: 100%;
        right: 0;
        width: min(20rem, 100%);
        max-height: calc(100vh - 80px);
        max-height: calc(100dvh - 80px);
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 8px;
        border: 1px solid var(--amber-subtle);
        border-radius: 5px;
        background: var(--surface);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    }

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

    #site_navigation a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* ── Breadcrumbs ── */
#breadcrumbs {
    max-width: 1200px;
    margin: 8px auto;
    padding: 0 2rem;
    font-size: small;
    width: 100%;
}

#breadcrumbs div {
    display: inline-block;
}

#breadcrumbs div a {
    color: var(--amber);
    text-decoration: none;
}

#breadcrumbs div a:hover {
    color: var(--amber-dim);
    text-decoration: underline;
}

#breadcrumbs div::after {
    content: ">";
    margin-left: 5px;
    margin-right: 5px;
    color: var(--text-muted);
}

#breadcrumbs div:last-child::after {
    content: "";
}

/* ── Content ── */
div.content_root {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

div.content_root > div.page_card {
    width: 88%;
    max-width: 640px;
    margin: 15px auto;
    padding: 15px;
    padding-top: 5px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
}

div.page_card h1 {
    font-family: var(--font-display);
    font-size: xx-large;
    color: var(--text-heading);
    text-decoration: underline;
    text-decoration-color: var(--amber);
    padding-top: 15px;
    margin-bottom: 12px;
}

/* ── Policy Documents ── */
.policy_version {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.policy_body {
    font-size: 14px;
    line-height: 1.7;
}

.policy_body h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: normal;
    letter-spacing: 0.04em;
    color: var(--amber);
    margin: 22px 0 6px;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--border);
}

.policy_body h3 {
    font-size: 1rem;
    color: var(--text-heading);
    margin: 16px 0 4px;
}

.policy_body p {
    margin: 0 0 10px;
}

.policy_body ul,
.policy_body ol {
    margin: 0 0 10px 22px;
}

.policy_body li {
    margin-bottom: 4px;
}

.policy_body li::marker {
    color: var(--amber);
}

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

.policy_body code {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0 4px;
}

.policy_body blockquote {
    border-left: 3px solid var(--amber-subtle);
    background: var(--amber-glow);
    padding: 8px 12px;
    margin: 0 0 10px;
}

.policy_body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 18px 0;
}

/* ── Form Styles ── */
div.form_card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

div.form_item {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    background: var(--surface-alt);
    border-radius: 4px;
    border: 1px solid var(--border);
    margin: 5px;
    padding: 10px 15px;
}

div.form_item > div.input_label {
    min-width: 180px;
}

div.form_item > div {
    font-weight: bold;
}

div.form_links {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    gap: 20px;
    margin-top: 10px;
}

div.form_links > div {
    font-size: small;
}

div.form_controls {
    display: flex;
    flex-direction: row;
    gap: 25px;
    justify-content: center;
    width: 100%;
}

div.form_item input[type=text],
div.form_item input[type=password],
#vault_share_url {
    padding: 5px;
    width: 300px;
    border-radius: 2px;
    border: 1px solid var(--border);
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
}

div.form_item input[type=text]:focus,
div.form_item input[type=password]:focus,
#vault_share_url:focus {
    outline: 1px solid var(--amber);
    border-color: var(--amber);
}

button {
    padding-left: 10px;
    padding-right: 10px;
    color: var(--bg);
    font-size: large;
    font-weight: bold;
    font-family: var(--font-main);
    border-radius: 2px;
    border: 1px solid var(--amber);
    background-color: var(--amber);
    min-width: 150px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

button:hover {
    background-color: var(--amber-dim);
    border-color: var(--amber-dim);
}

button.small_green {
    background-color: var(--amber) !important;
    border-radius: 2px !important;
    padding: 3px !important;
    min-width: 100px !important;
    font-size: small !important;
}

button.small_green:hover {
    background-color: var(--amber-dim) !important;
    border-color: var(--amber-dim) !important;
}

/* ── Cookie Notice ── */
#accept_cookies_footer {
    background-color: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    padding: 10px;
    text-align: center;
    font-size: medium;
    color: var(--text);
}

#accept_cookies_footer input[type=submit] {
    margin-left: 15px;
    padding: 4px 10px;
    color: var(--bg);
    font-size: large;
    font-weight: bold;
    font-family: var(--font-display);
    border-radius: 2px;
    border: 1px solid var(--amber);
    background-color: var(--amber);
    cursor: pointer;
    transition: background 0.2s;
}

#accept_cookies_footer input[type=submit]:hover {
    background-color: var(--amber-dim);
    border-color: var(--amber-dim);
}

/* ── Footer ── */
footer {
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    padding: 0.5rem 0.5rem 0;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-brand {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--text-muted);
}

.footer-brand span {
    color: var(--amber);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.footer-links + .footer-links {
    margin-left: 7rem;
}

.footer-links a {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    letter-spacing: 0.05em;
}

.footer-links a:hover {
    color: var(--amber);
}

.token img {
    width: 72px;
    opacity: 0.7;
    padding-top: 5px;
}

/* ── Misc ── */
div.erroneous_form_item {
    border: 1px solid #c0392b !important;
}

div.erroneous_form_item_msg {
    display: none;
}

div.explanation {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    cursor: help;
}

div.explanation .icon {
    width: 20px;
    height: 20px;
    display: inline-block;
}

div.explanation .icon img {
    width: 100%;
    height: 100%;
    display: block;
}

div.explanation .message {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--surface-alt);
    border: 2px solid var(--amber);
    border-radius: 4px;
    padding: 8px 10px;
    z-index: 1000;
    width: 400px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    color: var(--text);
    font-size: 0.85rem;
}

div.explanation:hover .message {
    display: block;
}

.hidden {
    display: none !important;
}

.form_error {
    border: 1px solid #c0392b !important;
    background-color: rgba(192, 57, 43, 0.1);
}

.money {
    font-weight: bold;
    text-decoration: underline;
    color: var(--amber);
}

/* ── Modal ── */
.modal_overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal_box {
    position: relative;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 20px;
    min-width: 280px;
    max-width: 90vw;
    max-height: 85vh;
    overflow: auto;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.modal_close {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    user-select: none;
}

.modal_close:hover {
    color: var(--amber);
}

.modal_title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--text-heading);
    padding-right: 24px;
    margin-bottom: 10px;
}
html.immersive-page,
body.immersive-game {
    height: auto;
    min-height: 100%;
    overflow: visible;
}

#player_status_bar {
    font-size: calc(1.125rem - 1pt);
    position: sticky;
    top: var(--vitals-viewport-top, 0px);
    z-index: 90;
    flex-shrink: 0;
    padding: 6px 8px;
    background: var(--surface);
    border-bottom: 1px solid var(--amber-subtle);
}

#player_status_bar_inner {
    display: flex;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 4pt 9pt;
}

#player_status_bar [data-player-name] {
    display: inline-block;
    max-width: 15ch;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    font-weight: bold;
}
/* Keep name, location and level on one line; only the expanded renown may wrap below them. */
#player_status_bar .player_name_level { white-space: nowrap; }
#player_status_level { white-space: normal; }
#player_status_level.hidden { display: none; }
#player_status_bar .player_level_toggle,
#player_status_bar .player_level_up {
    min-width: 0;
    padding: 0 4px;
    font-size: inherit;
    line-height: 1.2;
}
#player_status_bar .player_level_toggle {
    color: var(--amber);
    background: none;
    border-color: var(--amber-subtle);
}
#player_status_bar .player_level_toggle:hover { background: var(--amber-glow); }
#player_status_bar .player_level_detail {
    display: inline-flex;
    align-items: center;
    gap: 4pt;
    padding: 1px 6px;
    white-space: nowrap;
    vertical-align: middle;
    border-radius: 2px;
    background: var(--amber-glow);
}
#player_status_bar .player_level_detail.hidden { display: none; }
#player_status_bar .player_level_bar {
    display: inline-block;
    width: 64px;
    height: 6px;
    overflow: hidden;
    border: 1px solid var(--amber-subtle);
    border-radius: 3px;
    background: var(--surface-alt);
}
#player_status_bar .player_level_bar.hidden { display: none; }
#player_status_bar .player_level_fill {
    display: block;
    height: 100%;
    width: 0;
    background: var(--amber);
    transition: width 0.3s;
}
/* "+N Renown" popup, placed by showRenownGain() just below the bar under the level. */
#player_status_bar .renown_gain {
    position: absolute;
    top: 100%;
    transform: translateX(-50%);
    color: var(--fuchsia);
    font-weight: bold;
    white-space: nowrap;
    pointer-events: none;
}
#player_status_bar_inner > div { white-space: nowrap; }
#player_status_bar_inner > .player_identity { white-space: normal; overflow-wrap: anywhere; }
#player_status_bar .vital-empty { color: #ff6b6b; }
#player_status_bar .vital-full { color: #6bd98b; }

/* procurium.png shown at text size wherever Procurium appears (Shop, admin pages). */
.procurium_icon {
    height: 1em;
    width: auto;
    vertical-align: -0.125em;
}

@media (max-width: 640px) {
    #player_status_bar { font-size: calc(0.95rem - 1pt); }
    #player_status_bar_inner > .player_identity { flex-basis: 100%; }
    #player_status_bar .player_level_bar { width: 40px; }
}

.tab-carousel {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.tab-carousel > .tab-carousel-track {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    min-width: 0;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}

.tab-carousel-track::-webkit-scrollbar { display: none; }
.tab-carousel-track > .nav_item {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

.tab-carousel :focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }

/* toggle() macro in macros.html.j2: a checkbox styled as an on/off switch */
.toggle { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.toggle_switch { appearance: none; position: relative; flex: none; width: 40px; height: 22px; margin: 0; border-radius: 11px; background: var(--border); cursor: pointer; transition: background .15s; }
.toggle_switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-heading); transition: transform .15s; }
.toggle_switch:checked { background: var(--amber); }
.toggle_switch:checked::before { transform: translateX(18px); }
.toggle_switch:not(:checked) ~ .toggle_active { display: none; }
