:root {
    --tb-height: 1px;
    /* bar height */
    --tb-icon: 24px;
    /* icon size */
    --tb-label: 13px;
    /* label font-size */
    --tb-gap: 6px;
    /* space between icon/label */
}

.footerbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 6px;
    padding: 5px 5px calc(10px + env(safe-area-inset-bottom));
    background: var(--bgf);
    backdrop-filter: saturate(140%) blur(6px);
    overflow-x: auto;
    overscroll-behavior-x: contain;

    scrollbar-width: none;
}

.footerbar {
    display: grid !important;
}

.footerbar::-webkit-scrollbar {
    display: none;
}

.tool {
    display: grid;
    justify-items: left;
    align-items: center;
    gap: var(--tb-gap);
    padding: 10px 8px;
    min-width: 72px;
    border-radius: 12px;
    color: var(--muted);
    text-decoration: none;
    font-size: var(--tb-label);
    border: 1px solid transparent;
    -webkit-tap-highlight-color: transparent;
}

.tool:hover {
    background: rgba(255, 255, 255, .04);
    color: var(--text);
}

.tool.is-active {
    color: #dfe6ff;
    background: rgba(122, 162, 255, .16);
    border: 1px solid var(--bd);
}

.icon {
    line-height: 1;
    position: relative;
    display: inline-grid;
    place-items: center;
}

.icon svg {
    width: var(--tb-icon);
    height: var(--tb-icon);
    display: block;
}

.label {
    line-height: 1.1;
}




/* Desktop: hide by default (remove to keep it visible) */
@media (min-width: 980px) {
    .footerbar {
        display: none;
    }
}

/* XS phones: bump sizes a bit */
@media (max-width: 860px) {
    :root {
        --tb-height: 20px;
        --tb-icon: 26px;
        --tb-label: 13.5px;
        --tb-gap: 7px;
    }
}

/* Parent needs positioning context */
.footerbar .tool.has-sub {
    position: relative;
}

/* Submenu popover */
.fb-submenu {
    position: absolute;
    bottom: calc(100% + 8px);
    /* show above the bar */
    left: 50%;
    transform: translateX(-50%);
    min-width: 180px;
    max-width: 240px;
    background: var(--card);
    border: 1px solid var(--bd);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 6px;
    display: none;
    z-index: 70;
}

/* Little arrow */
.fb-submenu::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: var(--card);
    border-left: 1px solid var(--bd);
    border-top: 1px solid var(--bd);
    transform: translateX(-50%) rotate(45deg);
}

/* Visible state */
.tool.has-sub.is-open .fb-submenu {
    display: block;
}

/* Items */
.fb-subitem {
    display: block;
    padding: 10px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    border: 1px solid transparent;
    white-space: nowrap;
}

.fb-subitem:hover {
    background: rgba(255, 255, 255, .06);
    border-color: var(--bd);
}

/* Make sure popover stays on screen edges */
.footerbar {
    position: fixed;
}

/* already done earlier */
/* Buttons (reuse your theme if you have .btn already) */
.btn {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--bd);
    background: var(--button);
    color: var(--text);
    cursor: pointer
}

.btn.primary {
    border-color: var(--acc);
    background: linear-gradient(180deg, rgba(122, 162, 255, .18), rgba(122, 162, 255, .08))
}

.btn.ghost {
    background: transparent
}

/* Modal base */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(244, 245, 247, 0);
    backdrop-filter: blur(2px);
    z-index: 90;
}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 91;
}

.modal[hidden],
.modal-backdrop[hidden] {
    display: none !important;
}

/* Card */
.modal-card {
    width: min(92vw, 420px);
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--bd);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 12px;
    animation: pop .18s ease-out;
}

@keyframes pop {
    from {
        transform: scale(.98);
        opacity: .6
    }

    to {
        transform: scale(1);
        opacity: 1
    }
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 4px 10px;
    border-bottom: 1px dashed var(--bd);
}

.icon-x {
    width: 34px;
    height: 34px;
    border: 1px solid var(--bd);
    border-radius: 10px;
    background: var(--button);
    color: var(--text);
    cursor: pointer
}

.theme-form {
    display: grid;
    gap: 10px;
    padding: 12px 2px
}

.opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--bd);
    border-radius: 12px;
    cursor: pointer;
}

.opt input {
    width: 18px;
    height: 18px
}

.opt:hover {
    background: rgba(255, 255, 255, .03)
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px dashed var(--bd);
}

/* Small screens */
@media (max-width:420px) {
    .modal-card {
        border-radius: 14px;
        padding: 10px
    }
}

/* Container (optional) */
.theme-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* Button-styled option */
.theme-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--bd);
    background: var(--button);
    color: var(--text);
    cursor: pointer;
    user-select: none;
    line-height: 1;
    font: inherit;
    /* inherit font from page */
    transition: transform .08s ease, filter .15s ease, border-color .15s ease, box-shadow .15s ease;
}

/* If you switch to <button class="theme-option">, this keeps native buttons clean */
.theme-option,
.theme-option:where(button) {
    appearance: none;
    text-decoration: none;
    gap: 8px;
    padding: 8px 12px;


}

/* Hover / active press */
.theme-option:hover {
    filter: brightness(1.06);
}

.theme-option:active {
    transform: translateY(1px);
}

/* Keyboard focus ring */
.theme-option:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(122, 162, 255, .35);
}

/* Selected state (active theme) */
.theme-option.is-active,
.theme-option[aria-pressed="true"] {
    border-color: var(--acc);
    box-shadow: 0 0 0 3px rgba(33, 34, 36, 0.672);
    font-weight: 700;
}

/* Optional: tiny color swatch inside the button */
.theme-option .swatch {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 1px solid var(--bd);
    box-shadow: inset 0 0 0 1px #0002;
}

.theme-option[data-theme="skin-blue"] .swatch {
    background: #7aa2ff;
}

.theme-option[data-theme="skin-light"] .swatch {
    background: #9e9fa3;
}


.theme-option[data-theme="skin-red"] .swatch {
    background: #ef7272;
}

.theme-option[data-theme="skin-green"] .swatch {
    background: #4ade80;
}

.theme-option[data-theme="skin-white"] .swatch {
    background: #f7f8f8;
}

.theme-option[data-theme="skin-dark"] .swatch {
    background: #2b3140;
}

.icon_footer {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 10px;

    cursor: pointer;
}

.icon_image_footer {
    width: var(--w, 36px);
    height: var(--h, 30px);
    display: inline-block;
    object-fit: contain;
}

.sitePage {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.siteMain {
    flex: 1 0 auto;
}

.siteFooter {
    margin-top: auto;
    background:
        radial-gradient(circle at top right,
            rgba(132, 180, 248, 0.846),
            transparent 30%),
        linear-gradient(135deg,
            rgba(145, 182, 241, 0.551),
            rgba(150, 180, 215, 0.727));
    border-top: 1px solid rgba(81, 118, 220, .18);
    padding: 18px 0 20px;
}

.siteFooter__inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
}

.siteFooter__links,
.siteFooter__bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.siteFooter__links a,
.siteFooter__bottom a {
    color: #1f2a44;
    text-decoration: none;
    font-weight: 700;
}

.siteFooter__links a:hover,
.siteFooter__bottom a:hover {
    text-decoration: underline;
}

.siteFooter__sep {
    opacity: .55;
}

.siteFooter__copy {
    color: #1f2a44;
    font-weight: 700;
}

@media (max-width: 640px) {
    .siteFooter {
        padding: 16px 0 18px;
    }

    .siteFooter__inner {
        gap: 8px;
    }

    .siteFooter__links,
    .siteFooter__bottom {
        gap: 8px;
    }
}