/* Thème Halloween, commun aux pages publiques et au dashboard. Tout ce qui est ici n'apparaît que
   si halloween.js a posé data-halloween sur <html> (octobre, ou choix du joueur).
   Couleurs : jetons des pages publiques (--ink, --ash, --blood), sinon ceux du dashboard. */

/* ── Araignée : descend au chargement, remonte au clic (halloween.js) ──
   Sa position est propre à chaque page (style-public.css, .spider--dash ci-dessous). */
.spider[hidden] { display: none; }
:root:not([data-halloween]) .spider { display: none; }

.spider-sway {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform-origin: 50% 0;
    animation: spider-sway 5.5s ease-in-out infinite;
}

.spider-thread {
    width: 1px;
    height: 0;
    background: var(--ash, var(--text-dim));
    transition: height 1.8s cubic-bezier(.45, 0, .2, 1);
}

.spider-body {
    margin: 0;
    padding: 4px;
    border: 0;
    background: transparent;
    color: var(--ink, var(--text-bright));
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-size: 12px;
    line-height: 13px;
    text-align: left;
    white-space: pre;
    cursor: pointer;
}
.spider-body:hover { color: var(--blood, var(--danger)); }

@keyframes spider-sway {
    0%, 100% { transform: rotate(-2.5deg); }
    50% { transform: rotate(2.5deg); }
}

/* ── Dashboard : araignée posée dans la barre du haut, gouttes de sang au bord supérieur ── */
.spider--dash {
    position: fixed;
    top: 0;
    left: calc(var(--sidebar-w, 250px) + 34%);
    z-index: 1050;
}

.hw-drips {
    position: fixed;
    top: 0;
    left: var(--sidebar-w, 250px);
    right: 0;
    height: 0;
    z-index: 1049;
    pointer-events: none;
}
:root:not([data-halloween]) .hw-drips { display: none; }

.hw-drips i {
    position: absolute;
    top: 0;
    width: 3px;
    height: var(--len, 12px);
    border-radius: 0 0 3px 3px;
    background: var(--blood, var(--danger));
    opacity: .85;
}
/* La goutte qui se détache et tombe */
.hw-drips i::after {
    content: '';
    position: absolute;
    left: -1px;
    top: 100%;
    width: 5px;
    height: 7px;
    border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
    background: inherit;
    opacity: 0;
    animation: hw-drop var(--every, 6s) ease-in var(--delay, 0s) infinite;
}
.hw-drips i:nth-child(1) { left: 9%;  --len: 10px; --every: 7s;   --delay: .5s; }
.hw-drips i:nth-child(2) { left: 23%; --len: 18px; --every: 5.5s; --delay: 2s; }
.hw-drips i:nth-child(3) { left: 48%; --len: 8px;  --every: 8s;   --delay: 3.5s; }
.hw-drips i:nth-child(4) { left: 67%; --len: 15px; --every: 6.5s; --delay: 1s; }
.hw-drips i:nth-child(5) { left: 88%; --len: 11px; --every: 7.5s; --delay: 4.5s; }

@keyframes hw-drop {
    0%, 55% { transform: translateY(-4px) scale(.4); opacity: 0; }
    62%     { transform: translateY(0) scale(1); opacity: 1; }
    92%     { transform: translateY(46px) scale(.9, 1.15); opacity: 1; }
    100%    { transform: translateY(52px); opacity: 0; }
}

@media (max-width: 900px) {
    .hw-drips { left: 0; }
    .spider--dash { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .spider-sway { animation: none; }
    .spider-thread { transition: none; }
    .hw-drips i::after { animation: none; }
}

/* Interrupteur du menu du compte (dashboard) : coche quand le thème est actif */
#btn-halloween-toggle[aria-checked="true"]::after {
    content: '✓';
    margin-left: auto;
    color: var(--blood, var(--danger));
}
