/* Cookie consent: a floating FAB + pill on the category overview, and a
   blurred-backdrop settings modal that slides up from the bottom. */

.cookie-root {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 2500;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.85rem;
}

.cookie-root[hidden] {
    display: none;
}

/* --- FAB ---------------------------------------------------------------- */
.cookie-fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--text-color);
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, var(--page-color-transition);
}

.cookie-fab:hover {
    transform: translateY(-2px);
}

.cookie-fab-glyph {
    position: relative;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid currentColor;
}

.cookie-fab-glyph::before,
.cookie-fab-glyph::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
}

.cookie-fab-glyph::before { top: 3px; left: 6px; }
.cookie-fab-glyph::after { bottom: 4px; right: 4px; }

/* --- Pill --------------------------------------------------------------- */
.cookie-pill {
    max-width: min(360px, calc(100vw - 3rem));
    background: var(--bg-color);
    border: 1px solid var(--text-color);
    border-radius: 24px;
    padding: 1.1rem 1.25rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

.cookie-pill[hidden] {
    display: none;
}

.cookie-pill-text {
    margin: 0 0 0.85rem;
    font-size: 1rem;
    line-height: 1.4;
    opacity: 0.85;
}

.cookie-pill-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cookie-btn {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--text-color);
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    transition: opacity 0.2s ease, var(--page-color-transition);
}

.cookie-btn:hover {
    opacity: 0.7;
}

.cookie-btn-primary {
    background: var(--text-color);
    color: var(--bg-color);
}

.cookie-btn-ghost {
    border-color: transparent;
    opacity: 0.7;
}

/* --- Settings modal ----------------------------------------------------- */
.cookie-modal {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.cookie-modal[hidden] {
    display: none;
}

.cookie-modal-backdrop {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--bg-color) 70%, transparent);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cookie-modal.active .cookie-modal-backdrop {
    opacity: 1;
}

.cookie-modal-panel {
    position: relative;
    width: min(520px, calc(100vw - 2rem));
    margin-bottom: 1.5rem;
    background: var(--bg-color);
    border: 1px solid var(--text-color);
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.25);
    transform: translateY(24px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1), opacity 0.3s ease;
}

.cookie-modal.active .cookie-modal-panel {
    transform: translateY(0);
    opacity: 1;
}

.cookie-modal-panel h2 {
    margin: 0 0 1.25rem;
    font-family: 'VT323', monospace;
    font-size: 1.7rem;
    font-weight: 400;
}

.cookie-cat {
    padding: 0.9rem 0;
    border-top: 1px solid color-mix(in srgb, var(--text-color) 16%, transparent);
}

.cookie-cat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.cookie-cat-name {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
}

.cookie-cat-locked {
    opacity: 0.45;
}

.cookie-cat-desc {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    line-height: 1.35;
    opacity: 0.65;
}

/* Toggle switch */
.cookie-switch {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    cursor: pointer;
}

.cookie-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.cookie-switch-track {
    width: 42px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid var(--text-color);
    position: relative;
    transition: background 0.2s ease, var(--page-color-transition);
}

.cookie-switch-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-color);
    transition: transform 0.2s ease, var(--page-color-transition);
}

.cookie-switch input:checked + .cookie-switch-track {
    background: var(--text-color);
}

.cookie-switch input:checked + .cookie-switch-track::after {
    transform: translateX(18px);
    background: var(--bg-color);
}

.cookie-switch input:focus-visible + .cookie-switch-track {
    outline: 2px dashed var(--text-color);
    outline-offset: 2px;
}

.cookie-modal-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.cookie-modal-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-color);
}

.cookie-modal-close i {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 2px;
    background: currentColor;
}

.cookie-modal-close i:first-child { transform: translate(-50%, -50%) rotate(45deg); }
.cookie-modal-close i:last-child { transform: translate(-50%, -50%) rotate(-45deg); }

@media (prefers-reduced-motion: reduce) {
    .cookie-modal-panel,
    .cookie-modal-backdrop {
        transition: none;
    }
}
