/* ========================== RUST STATS - COMPONENTS =========================== */

/* ------------------------- 14. LOADER & SKELETONS ------------------------- */

/* The Play-view skeleton reuses the real layout classes (.profile-grid, .profile-aside,
   .trust-stack …) so it occupies exactly the same width and column split as the profile
   it replaces; only the block heights are approximated. Nothing moves when data lands. */
#loader { padding: 0 0 80px; }
#loader.hidden { display: none; }

.skel-view-head {
    display: flex;
    align-items: flex-end;
    box-sizing: border-box;
    height: 83px;
    min-height: 83px;
    margin-bottom: 26px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}
.skel-view-head .skel-col { justify-content: flex-end; gap: 8px; }

#loader .skel-profile-card { min-height: 326px; justify-content: space-between; gap: 16px; }
#loader .skel-ai-panel { min-height: 750px; gap: 12px; }
.skel-ai-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}
#loader .trust-stack { margin-top: 24px; }
#loader .skel-tf-panel { min-height: 77px; justify-content: center; }
#loader .skel-mini-stat { min-height: 66px; justify-content: space-between; }

@media (max-width: 1024px) {
    #loader .skel-ai-panel { min-height: 380px; }
    #loader .skel-profile-card { min-height: 0; }
    .skel-view-head { height: 74px; min-height: 74px; }
}
@media (max-width: 700px) {
    #loader .skel-ai-panel { min-height: 330px; }
    #loader .trust-row { grid-template-columns: 1fr; }
    .skel-view-head { height: 64px; min-height: 64px; margin-bottom: 18px; padding-bottom: 14px; }
    #loader { padding-bottom: 56px; }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- shared shimmer blocks (every view's loading state) --- */
.skel {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.055);
}
.skel::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    animation: skelSweep 1.4s ease-in-out infinite;
}
@keyframes skelSweep { 100% { transform: translateX(100%); } }
.skel-circle { border-radius: 50%; }
.skel-line { height: 11px; border-radius: 4px; }
.skel-title { height: 17px; border-radius: 5px; }
.skel-row { display: flex; align-items: center; gap: 13px; }
.skel-col { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }
.skel-card { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); padding: 15px; }
.skel-panel { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 20px; }
.skel-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.skel-grid-inv { grid-template-columns: repeat(2, 1fr); gap: 12px; }
.skel-hero { display: grid; grid-template-columns: minmax(280px, 1fr) 2fr; gap: 22px; align-items: start; }
.skel-avatar-lg { width: 100%; height: 320px; border-radius: var(--r-sm); }
@media (max-width: 1024px) { .skel-hero { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .skel-avatar-lg { height: 240px; } }
@media (min-width: 640px) { .skel-grid-inv { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .skel-grid-inv { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1280px) { .skel-grid-inv { grid-template-columns: repeat(6, 1fr); } }

/* Keep the play view's empty state out of the way while the profile skeleton shows. */
#loader:not(.hidden) ~ #view-play #empty-state { display: none; }

/* --------------------------- 15. PROFILE BADGES --------------------------- */

.profile-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 10px;
    min-height: 22px;
}
.profile-badges:empty { display: none; }
.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--line-2);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    white-space: nowrap;
}
.profile-badge svg { width: 12px; height: 12px; }
.demo-badge-tag { background: rgba(59, 130, 246, 0.14); border-color: rgba(59, 130, 246, 0.45); color: #a9cdff; }
.rank-badge-tag { background: rgba(155, 197, 61, 0.12); border-color: rgba(155, 197, 61, 0.4); color: #cfe89a; }
.rank-1-badge { background: rgba(245, 185, 66, 0.16); border-color: rgba(245, 185, 66, 0.5); color: #ffd76b; }
.rank-2-badge { background: rgba(215, 221, 230, 0.14); border-color: rgba(215, 221, 230, 0.4); color: #e6ebf2; }
.rank-3-badge { background: rgba(231, 154, 92, 0.14); border-color: rgba(231, 154, 92, 0.4); color: #f0b483; }
.rank-1-border { border-color: #f5b942 !important; box-shadow: 0 0 26px rgba(245, 185, 66, 0.4) !important; }
.rank-2-border { border-color: #d7dde6 !important; box-shadow: 0 0 26px rgba(215, 221, 230, 0.3) !important; }
.rank-3-border { border-color: #e79a5c !important; box-shadow: 0 0 26px rgba(231, 154, 92, 0.3) !important; }
.rank-1-text { color: #ffd76b !important; }
.rank-2-text { color: #e6ebf2 !important; }
.rank-3-text { color: #f0b483 !important; }
.demo-avatar-border { border-color: #3b82f6 !important; box-shadow: 0 0 26px rgba(59, 130, 246, 0.4) !important; }

/* ---------------------------- 16. BADGE SYSTEM ---------------------------- */

.badge-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid currentColor;
    background: color-mix(in srgb, currentColor 16%, transparent);
    white-space: nowrap;
}
.pf-badge.badge-pill { margin: 0; }
.lb-tag.badge-pill { padding: 2px 7px; font-size: 9px; }

.badge-glow { box-shadow: 0 0 10px -1px currentColor, 0 0 18px -6px currentColor; }

@keyframes bGlow {
    0%, 100% { box-shadow: 0 0 6px -2px currentColor; }
    50% { box-shadow: 0 0 16px 0 currentColor, 0 0 26px -6px currentColor; }
}
@keyframes bPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}
@keyframes bShine {
    0% { background-position: -120% 0; }
    100% { background-position: 220% 0; }
}
@keyframes bRainbow {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}
.badge-anim-glow { animation: bGlow 2s ease-in-out infinite; }
.badge-anim-pulse { animation: bPulse 1.6s ease-in-out infinite; }
.badge-anim-shine {
    background-image: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: bShine 2.6s linear infinite;
}
.badge-anim-rainbow { animation: bRainbow 4s linear infinite; }

.badge-avatar-border {
    border-color: var(--b-color, #ffb694) !important;
    box-shadow: 0 0 26px -4px var(--b-color, #ffb694) !important;
}
.badge-name-glow { color: var(--b-color, #fff); text-shadow: 0 0 14px var(--b-color, rgba(255, 255, 255, 0.4)); }

.pf-hero.badge-anim-glow { animation: bGlow 2.4s ease-in-out infinite; }
.pf-hero.badge-anim-pulse { animation: bPulse 1.8s ease-in-out infinite; }
.pf-hero.badge-anim-rainbow { animation: bRainbow 6s linear infinite; }
.pf-hero.badge-anim-glow .pf-avatar-frame,
.pf-hero.badge-anim-rainbow .pf-avatar-frame {
    border-color: var(--b-color, transparent);
    box-shadow: 0 0 32px -6px var(--b-color, transparent);
}

/* Main stats-page profile — badge glow + animation on the avatar */
.profile-aside.badge-anim-glow .avatar-frame img,
.profile-aside.badge-anim-pulse .avatar-frame img,
.profile-aside.badge-anim-rainbow .avatar-frame img,
.profile-aside.badge-anim-shine .avatar-frame img {
    border-color: var(--b-color, #ffb694) !important;
    box-shadow: 0 0 34px -4px var(--b-color, #ffb694) !important;
}
.profile-aside.badge-anim-glow .avatar-frame img { animation: bGlow 2.4s ease-in-out infinite; }
.profile-aside.badge-anim-pulse .avatar-frame img { animation: bPulse 1.8s ease-in-out infinite; }
.profile-aside.badge-anim-rainbow .avatar-frame img { animation: bRainbow 6s linear infinite; }

/* ----------------------------- 17. SHARE CARD ----------------------------- */

#share-canvas, #card-preview {
    position: relative;
    width: 1000px;
    min-height: 560px;
    font-family: var(--font-ui);
    overflow: hidden;
    background: #0a0a0a;
}
#share-canvas { position: absolute; left: -99999px; top: 0; }
#card-preview { border-radius: 14px; }

.sc-bg-layer { position: absolute; inset: 0; background: linear-gradient(135deg, #0a0a0f, #141018 55%, #1a0f08); }
.sc-grid-overlay {
    position: absolute; inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.6;
}
.sc-hazard-strip {
    position: absolute; left: 0; right: 0; height: 8px;
    background: repeating-linear-gradient(45deg, #ff5a1e, #ff5a1e 18px, #0a0a0f 18px, #0a0a0f 36px);
    opacity: 0.85;
}
.sc-hazard-strip.top { top: 0; }
.sc-hazard-strip.bottom { bottom: 0; }
.sc-watermark {
    position: absolute;
    right: 40px; bottom: -12px;
    font-family: var(--font-display);
    font-size: 120px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.03);
    letter-spacing: 0.04em;
    user-select: none;
}
.sc-topbar {
    position: relative; z-index: 2;
    display: flex; align-items: center; justify-content: space-between;
    padding: 22px 56px 0;
}
.sc-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 22px; color: #fff; letter-spacing: 0.06em; }
.sc-brand-ico { width: 22px; height: 22px; color: var(--accent); }
.sc-brand-sub { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.34em; color: rgba(255, 255, 255, 0.35); text-transform: uppercase; }

.sc-content { position: relative; z-index: 2; display: flex; align-items: flex-start; gap: 46px; padding: 30px 56px 40px; }
.sc-profile-col { width: 280px; text-align: center; flex-shrink: 0; }
.sc-avatar-frame { position: relative; width: 190px; height: 190px; margin: 0 auto 18px; border-radius: 18px; overflow: hidden; border: 3px solid var(--accent); box-shadow: 0 0 50px rgba(var(--accent-rgb), 0.4); }
.sc-avatar-frame img { width: 100%; height: 100%; object-fit: cover; }
.sc-avatar-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.7)); }
.sc-rank-badge {
    position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
    font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.16em;
    color: #000; background: var(--accent); padding: 5px 14px; border-radius: 999px; white-space: nowrap;
}
.sc-badge-noob { background: #666; color: #fff; }
.sc-badge-survivor { background: #9bc53d; }
.sc-badge-veteran { background: var(--accent); }
.sc-badge-dev { background: #fff; color: #000; box-shadow: 0 0 20px #ff5a1e; }
.sc-badge-custom { background: #ffb694; }
.sc-profile-col h2 { font-family: var(--font-display); font-size: 38px; color: #fff; margin: 0 0 6px; line-height: 1; word-break: break-word; }
.sc-profile-col #sc-id { font-family: var(--font-mono); font-size: 12px; color: rgba(255, 255, 255, 0.5); }
.sc-profile-badges { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.sc-pbadge { font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.1em; padding: 4px 10px; border-radius: 6px; border: 1px solid transparent; }
.sc-pbadge-dev { background: rgba(139, 92, 246, 0.2); color: #c9b6ff; border: 1px solid rgba(139, 92, 246, 0.5); }
.sc-pbadge-vip { background: rgba(245, 185, 66, 0.18); color: #ffd76b; border: 1px solid rgba(245, 185, 66, 0.5); }

.sc-stats-col { flex: 1; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.sc-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.sc-tile { background: rgba(255, 255, 255, 0.045); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; justify-content: center; gap: 5px; overflow: hidden; }
.sc-tile-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; color: rgba(255, 255, 255, 0.45); text-transform: uppercase; white-space: nowrap; }
.sc-tile-value { font-family: var(--font-display); font-size: 30px; line-height: 1.15; color: #fff; white-space: nowrap; }
.sc-tile-value--md { font-size: 22px; }
.sc-tile-value--sm { font-size: 16px; }
.sc-tile:first-child { border-color: rgba(var(--accent-rgb), 0.4); }
.sc-tile:first-child .sc-tile-value { color: var(--accent); }
.sc-empty { grid-column: 1 / -1; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; color: rgba(255, 255, 255, 0.35); padding: 30px; text-align: center; border: 1px dashed rgba(255, 255, 255, 0.15); border-radius: 12px; }

.sc-footer-info { display: flex; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 12px; color: rgba(255, 255, 255, 0.4); line-height: 1.5; }
.sc-foot-ico { width: 20px; height: 20px; color: var(--accent); }

/* ---- card builder modal ---- */
.cb-overlay { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 22px; background: rgba(5, 5, 8, 0.82); backdrop-filter: blur(6px); }
.cb-overlay.active { display: flex; }
.cb-box { width: 100%; max-width: 1180px; max-height: 92vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.cb-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.cb-head-left { display: flex; align-items: center; gap: 13px; }
.cb-head-ico { width: 22px; height: 22px; color: var(--accent); }
.cb-title { font-family: var(--font-display); font-size: 20px; color: #fff; letter-spacing: 0.05em; }
.cb-sub { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.cb-close { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; color: var(--muted); cursor: pointer; transition: background 0.2s, color 0.2s; }
.cb-close:hover { background: rgba(var(--accent-rgb), 0.14); color: #fff; }
.cb-body { flex: 1; display: grid; grid-template-columns: 330px 1fr; overflow: hidden; }
.cb-controls { padding: 20px; overflow-y: auto; border-right: 1px solid var(--line); }
.cb-group-title { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); margin: 16px 0 9px; }
.cb-group-title:first-child { margin-top: 0; }
.cb-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.cb-chip { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--muted); cursor: pointer; transition: all 0.18s ease; }
.cb-chip:hover { color: #fff; border-color: var(--line-2); }
.cb-chip.on { color: #fff; background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.22), rgba(var(--accent-rgb), 0.08)); border-color: rgba(var(--accent-rgb), 0.55); }
.cb-chip.on::before { content: '✓ '; color: var(--accent); }
.cb-preview-col { padding: 20px; overflow-y: auto; background: var(--bg-2); }
.cb-preview-frame { position: relative; width: 100%; overflow: hidden; border-radius: 14px; }
.cb-foot { display: flex; align-items: center; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }
.cb-foot-spacer { flex: 1; }
.cb-btn { font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 11px 18px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: all 0.2s ease; }
.cb-btn:hover { border-color: var(--accent); color: #fff; }
.cb-btn.primary { background: linear-gradient(135deg, var(--accent), #a8321a); border-color: transparent; color: #fff; }
.cb-btn.primary:hover { box-shadow: 0 10px 26px -10px rgba(var(--accent-rgb), 0.9); }
body.no-scroll { overflow: hidden; }

@media (max-width: 760px) {
    .cb-overlay { padding: 10px; }
    .cb-body { grid-template-columns: 1fr; }
    .cb-controls { border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; }
    .cb-preview-col { max-height: 38vh; }
    .cb-foot { flex-wrap: wrap; }
}

/* ------------------------------- 18. MODAL -------------------------------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(4, 4, 6, 0.78);
    backdrop-filter: blur(8px);
}
.modal-overlay.active { display: flex; animation: fadeIn 0.26s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
    width: 100%;
    max-width: 720px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--r);
    background: var(--elev);
    border: 1px solid var(--line-2);
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: modalIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(22px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.05), transparent);
}
.modal-title { font-family: var(--font-display); font-size: 24px; letter-spacing: 0.04em; color: #fff; }
.modal-close { cursor: pointer; color: var(--muted); transition: color 0.2s ease, transform 0.2s ease; }
.modal-close:hover { color: var(--accent); transform: rotate(90deg); }
.modal-body { padding: 22px; overflow-y: auto; }

.modal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.contact-card {
    padding: 15px;
    border-radius: var(--r-sm);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: border-color 0.2s ease;
}
.contact-card:hover { border-color: rgba(var(--accent-rgb), 0.3); }
.contact-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.contact-val { font-family: var(--font-mono); font-size: 13px; color: var(--text); word-break: break-word; }

.api-terminal-view {
    font-family: var(--font-mono);
    font-size: 12px;
    background: #08080b;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 14px;
    overflow-x: auto;
}
.code-line { white-space: pre; line-height: 1.8; color: #b9b9c4; }
.c-method { color: var(--green); font-weight: 700; }
.c-url { color: var(--accent); }
.c-comment { color: var(--faint); }

.terms-list { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.9; color: var(--muted); padding-left: 18px; }
.terms-title { font-family: var(--font-display); font-size: 19px; color: #fff; margin: 20px 0 8px; }

/* VIP donate block (modal) */
.vip-header { text-align: center; margin-bottom: 18px; }
.vip-per { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.vip-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px;
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--amber), #c98f1f);
    color: #000;
    font-family: var(--font-display);
    font-size: 20px;
    letter-spacing: 0.08em;
    text-decoration: none;
    cursor: pointer;
    border: 0;
    transition: all 0.22s ease;
}
.vip-btn:hover { filter: brightness(1.08); box-shadow: 0 16px 40px -16px rgba(245, 185, 66, 0.9); }

/* Advertising / media-kit modal (cinematic entrance + warm bloom) */
#modal-overlay[data-modal="advertise"] { background: rgba(4, 4, 6, 0.82); }
#modal-overlay[data-modal="advertise"] .modal-box {
    position: relative;
    max-width: 880px;
    animation: advBoxIn 0.5s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
@keyframes advBoxIn {
    from { opacity: 0; transform: translateY(30px) scale(0.96); box-shadow: 0 0 0 rgba(var(--accent-rgb), 0); }
    to   { opacity: 1; transform: none; box-shadow: var(--shadow), 0 0 64px -26px rgba(var(--accent-rgb), 0.6); }
}
#modal-overlay[data-modal="advertise"] .modal-title { text-shadow: 0 0 22px rgba(var(--accent-rgb), 0.35); }
#modal-overlay[data-modal="advertise"] .modal-header { position: relative; }
#modal-overlay[data-modal="advertise"] .modal-header::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.6), transparent);
    animation: advSheen 1.1s ease 0.25s both;
}
@keyframes advSheen {
    from { opacity: 0; transform: scaleX(0.15); }
    to   { opacity: 1; transform: none; }
}
#modal-overlay[data-modal="advertise"] .advm > * {
    animation: advRise 0.52s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
#modal-overlay[data-modal="advertise"] .advm > *:nth-child(1) { animation-delay: 0.06s; }
#modal-overlay[data-modal="advertise"] .advm > *:nth-child(2) { animation-delay: 0.12s; }
#modal-overlay[data-modal="advertise"] .advm > *:nth-child(3) { animation-delay: 0.18s; }
#modal-overlay[data-modal="advertise"] .advm > *:nth-child(4) { animation-delay: 0.24s; }
#modal-overlay[data-modal="advertise"] .advm > *:nth-child(5) { animation-delay: 0.3s; }
#modal-overlay[data-modal="advertise"] .advm > *:nth-child(6) { animation-delay: 0.36s; }
@keyframes advRise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

.advm { display: flex; flex-direction: column; }
.advm-lead { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.65; }

.advm-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 12px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent-2);
}
.advm-label::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-warm), transparent); }

.advm-formats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.advm-fmt {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008));
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.advm-fmt:hover {
    border-color: var(--line-warm);
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -20px rgba(var(--accent-rgb), 0.8);
}
.advm-fmt-ico {
    flex: none;
    width: 34px; height: 34px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    color: var(--accent-2);
    border: 1px solid var(--line-warm);
    background: rgba(var(--accent-rgb), 0.08);
}
.advm-fmt-ico svg { width: 17px; height: 17px; }
.advm-fmt-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.advm-fmt-copy b { color: #fff; font-size: 13.5px; letter-spacing: 0.01em; }
.advm-fmt-copy span { color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.advm-packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.advm-pack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.006));
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.advm-pack:hover { transform: translateY(-2px); border-color: var(--line-2); }
.advm-pack b { font-family: var(--font-display); font-size: 15px; letter-spacing: 0.1em; color: #fff; }
.advm-pack span { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.advm-pack.hot {
    border-color: rgba(255, 154, 60, 0.5);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.12), rgba(255, 255, 255, 0.01));
    box-shadow: 0 0 34px -18px rgba(var(--accent-rgb), 0.9);
}
.advm-pack.hot b { color: var(--accent-2); }

.advm-foot {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.advm-note { margin: 0; flex: 1 1 320px; color: var(--faint); font-size: 12.5px; line-height: 1.55; }
.advm-cta {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 12px 20px;
    border-radius: var(--r-sm);
    border: 0;
    cursor: pointer;
    text-decoration: none;
    color: #180a04;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    box-shadow: var(--glow);
    transition: transform 0.16s ease, filter 0.2s ease;
}
.advm-cta svg { width: 16px; height: 16px; }
.advm-cta:hover { transform: translateY(-1px); filter: brightness(1.06); }

@media (max-width: 700px) {
    .advm-formats { grid-template-columns: 1fr; }
    .advm-packs { grid-template-columns: 1fr; }
    .advm-foot { flex-direction: column; align-items: stretch; }
    .advm-cta { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    #modal-overlay[data-modal="advertise"] .modal-box,
    #modal-overlay[data-modal="advertise"] .modal-header::after,
    #modal-overlay[data-modal="advertise"] .advm > * {
        animation: none !important;
    }
}

/* --------------------------- 19. SNOW / FLAKES ---------------------------- */

.snow-container { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.snow-container.hidden { display: none; }
.snowflake {
    position: absolute;
    top: -12px;
    width: 6px; height: 6px;
    background: #fff;
    border-radius: 50%;
    opacity: 0.7;
    animation: snowfall linear infinite;
}
.snowflake:nth-child(1) { left: 8%;  animation-duration: 9s;  animation-delay: 0s; }
.snowflake:nth-child(2) { left: 22%; animation-duration: 12s; animation-delay: 2s; }
.snowflake:nth-child(3) { left: 36%; animation-duration: 8s;  animation-delay: 1s; }
.snowflake:nth-child(4) { left: 50%; animation-duration: 13s; animation-delay: 3s; }
.snowflake:nth-child(5) { left: 63%; animation-duration: 10s; animation-delay: 0.5s; }
.snowflake:nth-child(6) { left: 75%; animation-duration: 11s; animation-delay: 2.5s; }
.snowflake:nth-child(7) { left: 86%; animation-duration: 9s;  animation-delay: 1.5s; }
.snowflake:nth-child(8) { left: 95%; animation-duration: 12s; animation-delay: 4s; }
@keyframes snowfall { to { transform: translateY(102vh) rotate(360deg); } }

/* ================================= VIEWS ================================== */

/* --------------------------- 19. AI INFO MODAL ---------------------------- */

#modal-overlay[data-modal="ai_info"] .modal-box { max-width: 780px; }
.ai-info { display: flex; flex-direction: column; gap: 16px; }
.ai-info-lead { margin: 0; color: var(--muted); font-size: 0.94rem; line-height: 1.55; }

.ai-info-flow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.ai-info-step {
    display: flex;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}
.ai-info-num { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; color: var(--accent); padding-top: 2px; }
.ai-info-step-txt { display: flex; flex-direction: column; gap: 4px; }
.ai-info-step-txt b { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--text); }
.ai-info-step-txt small { color: var(--muted); font-size: 0.78rem; line-height: 1.45; }

.ai-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ai-info-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-left: 2px solid var(--accent);
    border-radius: var(--r-sm);
    background: var(--surface);
}
.ai-info-card:nth-child(2) { border-left-color: #9bc53d; }
.ai-info-kicker { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--accent); margin-bottom: 7px; }
.ai-info-card:nth-child(2) .ai-info-kicker { color: #9bc53d; }
.ai-info-card p { margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.55; }
.ai-info-tags { display: flex; gap: 5px; margin-top: 9px; }
.ai-info-tags span { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em; padding: 2px 6px; border: 1px solid var(--line-2); border-radius: 4px; color: var(--faint); }

.ai-info-quota { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border: 1px solid var(--line-warm); border-radius: var(--r-sm); background: rgba(var(--accent-rgb), 0.06); }
.ai-info-quota-ico { color: var(--amber); display: flex; padding-top: 2px; }
.ai-info-quota-ico svg { width: 16px; height: 16px; }
.ai-info-quota b { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--amber); margin-bottom: 4px; }
.ai-info-quota p { margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.ai-info-quota p b { display: inline; font-family: inherit; font-size: inherit; letter-spacing: 0; color: var(--text); }

.ai-info-cta { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px dashed rgba(var(--accent-rgb), 0.45); border-radius: var(--r-sm); background: rgba(var(--accent-rgb), 0.08); }
.ai-info-cta-copy { display: flex; flex-direction: column; gap: 4px; }
.ai-info-cta-copy b { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--accent); }
.ai-info-cta-copy small { color: var(--muted); font-size: 0.79rem; line-height: 1.45; max-width: 380px; }
.ai-info-cta-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; flex-shrink: 0; }
.ai-info-cta-btn { border: 0; cursor: pointer; padding: 9px 14px; border-radius: var(--r-xs); background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #140a05; font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; }
.ai-info-cta-btn:hover { filter: brightness(1.08); }
.ai-info-cta-link { color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.06em; text-decoration: none; border-bottom: 1px dashed var(--line-2); }
.ai-info-cta-link:hover { color: var(--text); border-color: var(--muted); }

@media (max-width: 640px) {
    .ai-info-flow, .ai-info-grid { grid-template-columns: 1fr; }
    .ai-info-cta { flex-direction: column; align-items: stretch; }
    .ai-info-cta-actions { align-items: stretch; }
    .ai-info-cta-btn { width: 100%; }
    .ai-info-cta-link { text-align: center; border-bottom: 0; }
}

/* ========================= 34. HALLOWEEN EVENT THEME ========================= */
/* Applied by seasonal.js through html.hw-mode / body.hw-mode between 24 Oct and
   2 Nov only. The admin panel can force the skin off at any moment. */

html.hw-mode { background: #09050f; }

body.hw-mode {
    /* One palette for the whole site: aubergine surfaces, pumpkin primary,
       witch purple as the secondary hue, candy-corn gold and slime green as the
       only other accents — no stray blues or warm Rust oranges left over. */
    --bg:        #09050f;
    --bg-2:      #0d0717;
    --elev:      #110a1d;
    --surface:   #171026;
    --surface-2: #1d1430;
    --surface-3: #251a3c;

    --line:      rgba(186, 148, 255, 0.14);
    --line-2:    rgba(196, 158, 255, 0.24);
    --line-warm: rgba(255, 122, 30, 0.28);

    --text:      #f4eeff;
    --muted:     #a99cc2;
    --faint:     #6d6090;

    --accent:     #ff7a1e;
    --accent-rgb: 255, 122, 30;
    --accent-2:   #ffb347;
    --amber:      #ffc857; /* candy corn */
    --green:      #8fe34b; /* slime */
    --red:        #ff3b47; /* blood */
    --blue:       #b98cff; /* witch light, replaces the steel blue */

    --hw-purple:      #a855f7;
    --hw-purple-deep: #6f24a8;
    --glow: 0 0 0 1px rgba(255, 122, 30, 0.35), 0 12px 40px -12px rgba(168, 85, 247, 0.5);

    scrollbar-color: #33264d transparent;
}
body.hw-mode * { scrollbar-color: #33264d transparent; }
html.hw-mode ::-webkit-scrollbar-thumb { background: #2c2145; background-clip: content-box; }
html.hw-mode ::-webkit-scrollbar-thumb:hover { background: #3d2f5e; background-clip: content-box; }

body.hw-mode::before {
    background:
        radial-gradient(58% 46% at 82% -6%, rgba(255, 110, 26, 0.22), transparent 62%),
        radial-gradient(50% 44% at 6% 2%, rgba(150, 60, 255, 0.2), transparent 66%),
        radial-gradient(115% 90% at 50% 42%, transparent 50%, rgba(8, 3, 14, 0.78) 100%);
}

/* the photo behind everything is tinted into the same aubergine dusk */
body.hw-mode .bg-photo {
    background-image:
        radial-gradient(130% 95% at 50% 30%, rgba(10, 4, 18, 0.38) 0%, rgba(10, 4, 18, 0.76) 68%, rgba(6, 2, 12, 0.94) 100%),
        linear-gradient(180deg, rgba(26, 9, 38, 0.62), rgba(8, 3, 14, 0.88)),
        url('../assets/background.jpg');
    filter: saturate(0.7) contrast(1.06) hue-rotate(-12deg) brightness(0.92);
}

body.hw-mode ::selection { background: rgba(168, 85, 247, 0.45); }

body.hw-mode .rust-header {
    background: linear-gradient(180deg, rgba(16, 9, 26, 0.94), rgba(9, 4, 16, 0.82));
    border-bottom-color: rgba(168, 85, 247, 0.24);
}
body.hw-mode .rust-header.is-scrolled {
    border-bottom-color: rgba(168, 85, 247, 0.34);
    box-shadow: 0 16px 40px -24px rgba(0, 0, 0, 0.95);
}

body.hw-mode .rust-header::before {
    background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.55), rgba(255, 122, 30, 0.6), transparent 85%);
}

body.hw-mode .logo-icon-svg,
body.hw-mode .rust-logo-group:hover .logo-icon-svg {
    filter: drop-shadow(0 8px 20px rgba(255, 122, 30, 0.45)) drop-shadow(0 0 26px rgba(168, 85, 247, 0.35));
}

body.hw-mode .logo-badge {
    color: #f0cbff;
    background: rgba(168, 85, 247, 0.16);
    border-color: rgba(168, 85, 247, 0.48);
}

body.hw-mode .nav-menu {
    background: rgba(168, 85, 247, 0.07);
    border-color: rgba(186, 148, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
body.hw-mode .nav-btn { color: #b6a7cf; }
body.hw-mode .nav-btn:hover { color: #ffe0b8; background: rgba(255, 190, 120, 0.1); }
body.hw-mode .nav-btn.active {
    background: linear-gradient(135deg, var(--accent), var(--hw-purple-deep));
    box-shadow: 0 8px 26px -10px rgba(168, 85, 247, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

body.hw-mode .sidebar {
    background: linear-gradient(180deg, rgba(16, 9, 26, 0.72), rgba(9, 4, 16, 0.45));
    border-right-color: rgba(186, 148, 255, 0.12);
}
body.hw-mode .footer {
    background: linear-gradient(180deg, rgba(14, 8, 24, 0.86), rgba(6, 2, 12, 0.97));
    border-top-color: rgba(186, 148, 255, 0.14);
}

body.hw-mode .search-hints { background: rgba(16, 9, 26, 0.97); }
body.hw-mode .search-btn { background: linear-gradient(135deg, var(--accent), var(--hw-purple-deep)); }

body.hw-mode .view-title { text-shadow: 0 0 30px rgba(255, 122, 30, 0.2); }
body.hw-mode .empty-radar i { color: rgba(168, 85, 247, 0.8); }

body.hw-mode .side-main-btn.active,
body.hw-mode .sidebar-btn.active {
    box-shadow: inset 3px 0 0 var(--hw-purple), 0 0 22px -12px rgba(168, 85, 247, 0.9);
}

/* the last raw near-black fills (connect field, toolbar/filter inputs, wipe bar)
   get the aubergine base so no cold grey panel is left in the middle of the skin */
body.hw-mode .connect-field,
body.hw-mode .toolbar-input,
body.hw-mode .filter-input { background: #120b1e; }
body.hw-mode .wipe-progress-track { background: #251a3c; }

/* focus rings glow purple so inputs stop reading as Rust-orange */
body.hw-mode .search-input:focus,
body.hw-mode .toolbar-input:focus,
body.hw-mode .filter-input:focus,
body.hw-mode .cmp-search-input:focus {
    border-color: rgba(168, 85, 247, 0.55);
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.14);
}

/* --- the layers injected by seasonal.js (never interactive) --- */

/* Moon and fog belong to the backdrop: they sit behind every panel and card so
   they never cover text, charts or buttons. */
#hw-backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}
body:not(.hw-mode) #hw-backdrop { display: none; }

/* Bats and pumpkins float above the page, but they are tiny, dark and
   pointer-events: none. */
#hw-decor {
    position: fixed;
    inset: 0;
    z-index: 4;
    overflow: hidden;
    pointer-events: none;
}
body:not(.hw-mode) #hw-decor { display: none; }

.hw-moon {
    position: absolute;
    top: 150px;
    right: 54px;
    width: 168px;
    height: 168px;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 32%, #fff3d6, #ffc46b 46%, #f08b28 78%, rgba(224, 122, 30, 0.12) 100%);
    box-shadow: 0 0 90px 26px rgba(255, 145, 40, 0.18), 0 0 200px 80px rgba(168, 85, 247, 0.12);
    opacity: 0.34;
}

.hw-fog {
    position: absolute;
    left: -12%;
    right: -12%;
    bottom: -8vh;
    height: 46vh;
    opacity: 0.85;
    filter: blur(26px);
    background:
        radial-gradient(42% 60% at 18% 70%, rgba(168, 85, 247, 0.14), transparent 70%),
        radial-gradient(38% 55% at 52% 80%, rgba(255, 122, 30, 0.12), transparent 72%),
        radial-gradient(52% 65% at 84% 66%, rgba(120, 60, 190, 0.12), transparent 74%);
    animation: hwFogDrift 26s ease-in-out infinite alternate;
}

.hw-bat {
    position: absolute;
    left: 0;
    width: 38px;
    height: auto;
    fill: #0b0510;
    opacity: 0.62;
    filter: drop-shadow(0 0 6px rgba(255, 122, 30, 0.55));
    animation: hwBatFly 42s linear infinite;
}
.hw-bat-1 { top: 15%; width: 34px; animation-duration: 28s; animation-delay: -4s; }
.hw-bat-2 { top: 27%; width: 52px; animation-duration: 34s; animation-delay: -26s; }
.hw-bat-3 { top: 40%; width: 26px; animation-duration: 41s; animation-delay: -12s; }
.hw-bat-4 { top: 54%; width: 40px; animation-duration: 37s; animation-delay: -31s; }
.hw-bat-5 { top: 68%; width: 30px; animation-duration: 46s; animation-delay: -18s; }
.hw-bat-6 { top: 80%; width: 44px; animation-duration: 52s; animation-delay: -44s; }

.hw-pumpkins {
    position: absolute;
    right: 10px;
    bottom: -6px;
    display: flex;
    align-items: flex-end;
    gap: 0;
}

.hw-pumpkin {
    width: 78px;
    height: 78px;
    animation: hwPumpkinGlow 5.5s ease-in-out infinite;
}
.hw-pumpkin-small {
    width: 48px;
    height: 48px;
    margin-left: -10px;
    opacity: 0.85;
    animation-delay: -2.4s;
}
.hw-pumpkin ellipse { fill: #ff7a1e; }
.hw-pumpkin ellipse:nth-of-type(2) { fill: #ff9a3c; }
.hw-pumpkin ellipse:nth-of-type(3),
.hw-pumpkin ellipse:nth-of-type(4) { fill: #e8631a; }
.hw-pumpkin-stem { fill: #6f9a3c; }
.hw-pumpkin-face { fill: #1a0a04; }

@keyframes hwBatFly {
    0%   { transform: translate3d(-18vw, 0, 0) rotate(-6deg) scale(1); }
    25%  { transform: translate3d(22vw, -24px, 0) rotate(4deg) scale(0.96); }
    50%  { transform: translate3d(58vw, 14px, 0) rotate(-4deg) scale(1.04); }
    75%  { transform: translate3d(90vw, -18px, 0) rotate(5deg) scale(0.98); }
    100% { transform: translate3d(126vw, 6px, 0) rotate(-3deg) scale(1); }
}

@keyframes hwFogDrift {
    from { transform: translate3d(-2%, 0, 0) scale(1); }
    to   { transform: translate3d(3%, -2%, 0) scale(1.06); }
}

@keyframes hwPumpkinGlow {
    0%, 100% { filter: drop-shadow(0 0 14px rgba(255, 122, 30, 0.32)); }
    50%      { filter: drop-shadow(0 0 30px rgba(255, 152, 46, 0.6)); }
}

@media (max-width: 720px) {
    .hw-moon { display: none; }
    .hw-bat-3, .hw-bat-5, .hw-bat-6 { display: none; }
    .hw-pumpkin { width: 52px; height: 52px; }
    .hw-pumpkin-small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .hw-bat, .hw-fog, .hw-pumpkin { animation: none !important; }
}
