.toolbar_container {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: calc(var(--navbar-height) + 24px); /* level with "Mục lục" */
    right: 0;
    zoom: var(--ui-scale);
    align-items: center;
    gap: 25px;
    margin-right: 20px;
    z-index: 100;
    transition:
        opacity 360ms var(--ease-out) 250ms,
        transform 460ms var(--ease-out) 250ms;
}

/* Out of the way on the cover; slides in when reading starts */
body.st-cover .toolbar_container {
    opacity: 0;
    transform: translateX(14px);
    pointer-events: none;
    transition-delay: 0ms;
    transition-duration: 200ms;
}

/* ---- Shared button reset ---- */
.toolbar_container button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.2s ease;
}
.toolbar_container button:hover {
    opacity: 0.5;
}
.toolbar_container button:disabled {
    opacity: 0.25;
    cursor: default;
}

/* ---- Zoom ---- */
.zoom_container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.zoom_container img {
    display: block;
    width: 25px;
    height: 25px;
}
.zoom_percent {
    min-width: 4ch;
    margin-top: -5px;
    text-align: center;
    font-size: 0.8rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.toolbar_container .zoom_percent {
    opacity: 0.7;
}

/* ---- Fit & page mode ---- */
.fit_icon,
.page_mode_icon,
.cmt_icon {
    display: block;
    width: 25px;
    height: 25px;
    object-fit: contain;
}
/* Wider (or taller) than the others only by its arrows; the margins keep
   the column's spacing */
.fit_icon.width {
    width: 31px;
    margin: 0 -3px;
}
.fit_icon.height {
    height: 31px;
    margin: -3px 0;
}
.fit_icon * {
    vector-effect: none; /* scales with the icon, like the <img> icons */
}

/* ---- Download ---- */
.download_container {
    position: relative;
    display: flex;
    justify-content: center;
}
.download_icon {
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
}
.download_icon:hover {
    opacity: 0.5;
}
.download_icon img {
    width: 25px;
    height: 25px;
}
.download_options_container {
    position: absolute;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.dl_thischap_btn, .dl_all_btn {
    text-align: left;
    font-size: 0.8rem;
}
.download_container:hover .download_options_container {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}

/* ---- Phone contents button ---- */
.toc_btn {
    display: none;
    font-size: 15px;
}
.toc_btn span:first-child {
    position: relative;
    z-index: 1;
}
.toc_btn .glow-ul {
    --rgb: 250, 250, 250;
    height: 18px;
    margin-top: -10px;
}

/* Hint that follows the cursor over a control */
.tool-hint {
    position: fixed;
    left: 0;
    top: 0;
    padding: 6px 10px;
    background: var(--chip);
    color: #fff;
    font-size: 0.8rem;
    white-space: nowrap;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transform: translate(calc(-100% - 12px), 12px);
    transition: opacity 0.15s ease;
    z-index: 1000;
}
.tool-hint.visible {
    opacity: 1;
}

/* ---- Phones: a bar along the bottom ---- */
@media (max-width: 760px) {
    .toolbar_container {
        zoom: 1;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        flex-direction: row;
        justify-content: space-between;
        padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px));
        background: linear-gradient(to top, #000 72%, rgba(0, 0, 0, 0));
    }
    body.st-cover .toolbar_container {
        transform: translateY(14px);
    }
    .zoom_container,
    .fit_btn,
    .dual_page_toggler,
    .download_container {
        display: none;
    }
    .toc_btn {
        display: block;
    }
    .toast {
        bottom: 84px;
    }
}
