:root {
    --bg: #181012;
    --bg-elev: #1f1416;
    --fg: #ece6da;
    --fg-muted: #ece6da99;
    --accent-red: #e0322f;
    --accent-red-dark: #a31f1d;
    --accent-gold: #c4a862;
    --danger: #b94a48;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
    min-height: 100vh;
}

/* Flash banner ------------------------------------------------------- */
.flash-banner {
    background: var(--danger);
    color: #fff;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
}
.flash-close {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
}

/* Landing ------------------------------------------------------------ */
/* Lock the landing page to the viewport: the character render is sized
   to bleed past its column, and we want that bleed clipped rather than
   producing a scrollbar. Scoped to .landing-page so admin pages, which
   legitimately scroll, are unaffected.

   The body becomes a flex column so an optional .flash-banner takes its
   natural height and .landing fills the remainder — that way the banner
   isn't clipped when present. */
html:has(body.landing-page) { height: 100%; overflow: hidden; }
body.landing-page {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
body.landing-page .landing {
    display: flex;
    flex: 1;
    min-height: 0;             /* let flex children shrink below content size */
    overflow: hidden;
}
.landing {
    display: flex;
    min-height: 100vh;
    position: relative;        /* anchor for .social-links */
}
.social-links {
    position: absolute;
    right: 20px;
    bottom: 16px;
    display: flex;
    gap: 14px;
    align-items: center;
    z-index: 2;                /* above the character render's bleed */
}
.social-links a {
    color: var(--accent-gold);
    opacity: 0.75;
    transition: opacity 120ms, transform 120ms;
    display: inline-flex;
    align-items: center;
}
.social-links a:hover {
    opacity: 1;
    transform: translateY(-1px);
}
.hero-left {
    flex: 1.1;
    padding: 64px 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    background: linear-gradient(135deg, #1a1525 0%, #14111c 100%);
}
.tag {
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #b6a3e3;
}
.wordmark {
    font-family: "Cinzel", "Georgia", serif;
    font-size: 56px;
    letter-spacing: 5px;
    color: var(--fg);
    margin: 0;
}
.tagline {
    font-size: 15px;
    line-height: 1.6;
    color: var(--fg-muted);
    max-width: 380px;
    margin: 0;
}
.cta-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 280px;
    margin-top: 12px;
}
.cta {
    position: relative;
    display: block;
    padding: 12px 20px;
    border-radius: 6px;
    text-align: center;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    isolation: isolate;
    transition: transform 120ms, box-shadow 220ms;
}
/* Animatable angle so we can rotate the conic gradient itself rather
   than transform the pseudo-element (which would misalign the mask). */
@property --cta-spark-angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}
/* Electro spark trail: a conic gradient sweeps around the button's
   bounding box; a thin mask exposes only the border ring so the rest of
   the button stays clean. Hidden by default, eased in on hover. */
.cta::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    --cta-spark-angle: 0deg;
    background: conic-gradient(
        from var(--cta-spark-angle),
        transparent 0deg,
        var(--cta-spark, var(--accent-red)) 60deg,
        #fff 80deg,
        var(--cta-spark, var(--accent-red)) 100deg,
        transparent 160deg,
        transparent 360deg
    );
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0;
    transition: opacity 180ms ease;
    pointer-events: none;
    z-index: 1;
}
.cta:hover { transform: translateY(-1px); }
.cta:hover::before {
    opacity: 1;
    animation: cta-spark-spin 1.4s linear infinite;
}
@keyframes cta-spark-spin {
    to { --cta-spark-angle: 360deg; }
}
.cta-primary {
    --cta-spark: var(--accent-red);
    background: linear-gradient(180deg, var(--accent-red), var(--accent-red-dark));
    color: #fff;
    border: 1px solid var(--accent-red);
}
.cta-primary:hover {
    box-shadow:
        0 0 0 1px rgba(224, 50, 47, 0.45),
        0 0 18px 2px rgba(224, 50, 47, 0.55),
        0 0 32px 4px rgba(224, 50, 47, 0.25);
}
.cta-secondary {
    --cta-spark: var(--accent-gold);
    background: transparent;
    color: var(--fg);
    border: 1px solid var(--accent-gold);
}
.cta-secondary:hover {
    box-shadow:
        0 0 0 1px rgba(196, 168, 98, 0.45),
        0 0 16px 2px rgba(196, 168, 98, 0.45),
        0 0 28px 4px rgba(196, 168, 98, 0.2);
}
/* Respect users who asked the OS to reduce motion: keep the glow but
   stop the spark rotation. */
@media (prefers-reduced-motion: reduce) {
    .cta:hover::before { animation: none; }
}

.hero-right {
    flex: 1;
    position: relative;
    background:
        radial-gradient(ellipse at 40% 60%, rgba(224,50,47,0.35), transparent 65%),
        linear-gradient(160deg, #2b2040 0%, #0f0a18 100%);
    overflow: visible;            /* allow the render to bleed past the edge */
    display: flex;
    align-items: center;
    justify-content: center;
}
.character-render {
    max-height: 110%;             /* deliberately taller than the container */
    max-width: 130%;
    transform: translateY(2%);
    pointer-events: none;
    user-select: none;
}

@media (max-width: 800px) {
    .landing { flex-direction: column; }
    .hero-left { padding: 36px 28px; }
    .hero-right { min-height: 320px; }
    .wordmark { font-size: 42px; }
    .character-render { max-height: 95%; max-width: 95%; transform: none; }
}

/* Admin shell, user management ------------------------------------- */
.admin-shell {
    max-width: 880px;
    margin: 0 auto;
    padding: 56px 32px;
}
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(196,168,98,0.18);
}
.admin-header h1 {
    font-family: "Cinzel", "Georgia", serif;
    letter-spacing: 3px;
    font-size: 28px;
    margin: 0;
}
.admin-header-meta {
    display: flex;
    gap: 18px;
    align-items: baseline;
}
.admin-greeting { color: var(--fg-muted); font-size: 13px; }
.admin-logout {
    color: var(--accent-gold);
    text-decoration: none;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.admin-logout:hover { text-decoration: underline; }

.admin-section { margin-top: 36px; }
.admin-section-title {
    font-family: "Cinzel", "Georgia", serif;
    font-size: 18px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--fg-muted);
    margin: 0 0 14px;
}

.admin-empty { color: var(--fg-muted); font-style: italic; }

.admin-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.admin-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    background: rgba(224,50,47,0.04);
    transition: background 120ms, border-color 120ms;
}
.admin-row:hover {
    background: rgba(224,50,47,0.10);
    border-color: rgba(196,168,98,0.25);
}
.admin-row-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-elev);
}
.admin-row-meta {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
.admin-row-name {
    font-family: "Cinzel", "Georgia", serif;
    font-size: 15px;
    letter-spacing: 1px;
}
.admin-row-id {
    font-family: "SF Mono", "Menlo", monospace;
    font-size: 11px;
    color: var(--fg-muted);
}
.admin-row-date {
    font-size: 11px;
    color: var(--fg-muted);
}
.admin-row-self {
    font-size: 11px;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.admin-row-remove { margin: 0; }
.admin-row-remove-btn {
    background: transparent;
    border: 1px solid rgba(185,74,72,0.4);
    color: #d97c7a;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 120ms;
}
.admin-row-remove-btn:hover { background: rgba(185,74,72,0.18); }

.admin-add-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 480px;
}
.admin-form-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--fg-muted);
}
.admin-form-input {
    background: var(--bg-elev);
    border: 1px solid rgba(255,255,255,0.10);
    color: var(--fg);
    padding: 10px 14px;
    border-radius: 6px;
    font-family: "SF Mono", "Menlo", monospace;
    font-size: 14px;
}
.admin-form-input:focus {
    outline: none;
    border-color: var(--accent-red);
}
.admin-form-hint {
    font-size: 12px;
    color: var(--fg-muted);
    margin: 0;
}
.admin-form-submit {
    align-self: flex-start;
    margin-top: 4px;
    padding: 10px 22px;
    cursor: pointer;
    font-family: inherit;
}

/* Flash banner severity treatment */
.flash-success { background: linear-gradient(180deg, #2f7a4c, #235836); }
/* .flash-error already covered by .flash-banner base. */

/* Admin section nav ------------------------------------------------- */
.admin-section-nav {
    display: flex;
    gap: 6px;
    margin: 16px 0 0;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(196,168,98,0.18);
}
.admin-section-nav-link {
    color: var(--fg-muted);
    text-decoration: none;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.06);
}
.admin-section-nav-link:hover { color: var(--fg); border-color: rgba(196,168,98,0.3); }
.admin-section-nav-link.active {
    color: var(--accent-gold);
    border-color: rgba(196,168,98,0.4);
    background: rgba(196,168,98,0.06);
}

/* Region pill ------------------------------------------------------- */
.region-pill {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 8px;
    border: 1px solid rgba(196,168,98,0.35);
    color: var(--accent-gold);
    border-radius: 12px;
    display: inline-block;
}
.region-pill-orphan {
    border-color: rgba(185,74,72,0.45);
    color: #d97c7a;
}

.admin-row-domain {
    font-family: "SF Mono", "Menlo", monospace;
    font-size: 12px;
    color: var(--fg-muted);
}

/* Autocomplete ------------------------------------------------------ */
.autocomplete-dropdown {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(196,168,98,0.25);
    border-radius: 6px;
    background: var(--bg-elev);
    max-height: 220px;
    overflow-y: auto;
    display: none;
}
.autocomplete-dropdown.open { display: block; }
.autocomplete-item {
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.autocomplete-item:last-child { border-bottom: 0; }
.autocomplete-item:hover { background: rgba(224,50,47,0.10); }

/* Domain cards (artifact sources nested-under-domain) ----------------- */
.domain-cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.domain-card {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    background: rgba(224,50,47,0.04);
    padding: 18px 20px;
    overflow: hidden;
    /* Filter transition: opacity is the visible effect; max-height (with a
       generous ceiling) lets the surrounding cards slide together once a
       hidden card collapses. margin transitions so the gap between cards
       closes too. */
    max-height: 2000px;
    transition:
        opacity 180ms ease,
        max-height 280ms ease,
        margin 180ms ease,
        padding 180ms ease,
        border-width 180ms ease;
}
.domain-card.is-hidden {
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    pointer-events: none;
    /* aria-hide for screen readers; visually-collapsed already. */
}
@media (prefers-reduced-motion: reduce) {
    .domain-card { transition: none; }
}
.domain-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(196,168,98,0.10);
}
.domain-card-name {
    font-family: "Cinzel", "Georgia", serif;
    font-size: 17px;
    letter-spacing: 2px;
    flex: 1;
    min-width: 0;
}
.domain-card-sources {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.domain-card-empty {
    margin: 14px 0;
    color: var(--fg-muted);
    font-style: italic;
    font-size: 13px;
}
.domain-card-add-form {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}
.domain-card-add-form .admin-form-input { flex: 1; }
.domain-card-add-form .autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 110px;          /* keep the dropdown to the left of the Add button */
    z-index: 5;
    margin-top: 4px;
}
.domain-card-add-btn {
    padding: 8px 18px;
    font-size: 12px;
}

.admin-section-subtitle {
    font-size: 13px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--fg-muted);
    margin: 28px 0 10px;
}

/* Artifact icons (autocomplete + source rows) ----------------------- */
.artifact-row-icon {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid rgba(196,168,98,0.25);
    background: rgba(20,17,28,0.6);
    object-fit: contain;
    flex-shrink: 0;
}
.artifact-row-icon-empty {
    /* Placeholder when the set's icon isn't in the cache. */
    display: inline-block;
    width: 32px;
    height: 32px;
}
.autocomplete-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(196,168,98,0.20);
    background: rgba(20,17,28,0.6);
    object-fit: contain;
    margin-right: 10px;
    vertical-align: middle;
    flex-shrink: 0;
}
.autocomplete-item {
    display: flex;
    align-items: center;
}

/* Sync-warning banner (wiki couldn't map some sets) ------------------ */
.sync-warning {
    background: rgba(196,168,98,0.08);
    border: 1px solid rgba(196,168,98,0.40);
    border-radius: 8px;
    padding: 14px 18px;
    margin-top: 16px;
    color: var(--accent-gold);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.sync-warning-body { flex: 1; }
.sync-warning-list {
    list-style: disc;
    margin: 8px 0 8px 22px;
    padding: 0;
    color: var(--fg);
    font-size: 13px;
}
.sync-warning-domain {
    color: var(--accent-gold);
    font-weight: 600;
}
.sync-warning-hint {
    font-size: 12px;
    color: var(--fg-muted);
    margin: 8px 0 0;
}

/* Domain card banner (wiki-sourced image) ---------------------------- */
.domain-card-with-banner {
    padding: 0;
    overflow: hidden;
}
.domain-card-banner {
    position: relative;
    height: 120px;
    overflow: hidden;
    background: linear-gradient(160deg, #2b2040 0%, #0f0a18 100%);
}
.domain-card-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}
.domain-card-banner-overlay {
    position: absolute;
    inset: 0;
    padding: 12px 24px;
    display: flex;
    align-items: center;       /* vertical center */
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(
        to right,
        rgba(20, 17, 28, 0.78) 0%,
        rgba(20, 17, 28, 0.28) 40%,
        rgba(20, 17, 28, 0.28) 60%,
        rgba(20, 17, 28, 0.78) 100%
    );
}
.domain-card-banner-overlay .domain-card-name {
    min-width: 0;
    color: #efe9e2;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
    font-size: 18px;
}
/* Bigger region pill, used in the banner overlay only. */
.region-pill-lg {
    font-size: 13px;
    letter-spacing: 2px;
    padding: 5px 14px;
    border-radius: 16px;
    border: 1px solid rgba(196,168,98,0.55);
    color: var(--accent-gold);
    text-transform: uppercase;
    background: rgba(20, 17, 28, 0.45);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
    display: inline-block;
    white-space: nowrap;
}
.domain-card-with-banner .domain-card-sources,
.domain-card-with-banner .domain-card-empty,
.domain-card-with-banner .domain-card-add-form {
    margin-left: 18px;
    margin-right: 18px;
}
.domain-card-with-banner .domain-card-sources,
.domain-card-with-banner .domain-card-empty {
    margin-top: 14px;
}
.domain-card-with-banner .domain-card-add-form {
    margin-bottom: 18px;
}

/* Region filter row (sub-nav on /admin/artifacts) -------------------- */
.region-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0 0;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(196,168,98,0.10);
}
.region-filter-label {
    color: var(--fg-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 6px 4px 6px 0;
    align-self: center;
    margin-right: 6px;
}
.region-filter-link {
    color: var(--fg-muted);
    text-decoration: none;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.06);
    background: transparent;
    font-family: inherit;
    cursor: pointer;
    transition: color 120ms, border-color 120ms, background 120ms;
}
.region-filter-link:hover { color: var(--fg); border-color: rgba(196,168,98,0.25); }
.region-filter-link.active {
    color: var(--accent-gold);
    border-color: rgba(196,168,98,0.45);
    background: rgba(196,168,98,0.10);
}

/* Domain card footer (single timestamp per card) --------------------- */
.domain-card-footer {
    margin-top: 14px;
    padding: 8px 14px;
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 11px;
    color: var(--fg-muted);
    text-align: right;
    font-family: "SF Mono", "Menlo", monospace;
}
.domain-card-with-banner .domain-card-footer {
    margin-left: 0;
    margin-right: 0;
    padding-left: 20px;
    padding-right: 20px;
}

/* Bug reports ------------------------------------------------------- */
.bug-report-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.bug-report-card {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    background: rgba(224,50,47,0.04);
    padding: 14px 18px;
}
.bug-report-resolved {
    opacity: 0.55;
}
.bug-report-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(196,168,98,0.10);
}
.bug-report-meta {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
.bug-report-body {
    margin: 12px 0;
    color: var(--fg);
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.bug-report-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px solid rgba(196,168,98,0.05);
}

/* ===================================================================
   Hourboost-specific components
   =================================================================== */

/* Login shell -------------------------------------------------------- */
/* Centers the login card in the full viewport; body stays at min-height
   100vh so it fills on short content. */
.login-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px 20px;
}
.login-card {
    background: var(--bg-elev);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 40px 44px;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.login-card .wordmark {
    font-size: 36px;
    letter-spacing: 4px;
    text-align: center;
}
.login-tagline {
    font-size: 13px;
    color: var(--fg-muted);
    text-align: center;
    margin: 0;
    line-height: 1.5;
}

/* Status badge (account state pill) --------------------------------- */
/* Reuses the region-pill shape; state variants override color/border. */
.status-badge {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid currentColor;
    display: inline-block;
    white-space: nowrap;
}
.status-idling,
.status-online {
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.40);
    background: rgba(74, 222, 128, 0.08);
}
.status-connecting {
    color: var(--accent-gold);
    border-color: rgba(196, 168, 98, 0.40);
    background: rgba(196, 168, 98, 0.08);
}
.status-offline {
    color: var(--fg-muted);
    border-color: rgba(255, 255, 255, 0.10);
    background: transparent;
}
.status-error {
    color: var(--danger);
    border-color: rgba(185, 74, 72, 0.40);
    background: rgba(185, 74, 72, 0.08);
}

/* Account card ------------------------------------------------------- */
/* Matches .admin-section / .domain-card look; used on the dashboard to
   display individual Steam account rows. */
.account-card {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    background: rgba(224,50,47,0.04);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background 120ms, border-color 120ms;
}
.account-card:hover {
    background: rgba(224,50,47,0.08);
    border-color: rgba(196,168,98,0.20);
}

/* Games list under an account card ---------------------------------- */
.status-games {
    font-family: "SF Mono", "Menlo", monospace;
    font-size: 11px;
    color: var(--fg-muted);
    margin: 0;
}

/* Engine offline banner --------------------------------------------- */
/* Same visual weight as .flash-banner + .flash-error; engine-offline is
   a transient error state that deserves the same prominence. */
#engine-banner {
    background: var(--danger);
    color: #fff;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
}
