.wk-service-rail {
    --rail-preferred-height: 300px;
    --rail-height: min(var(--rail-preferred-height), calc(100vh - 84px));
    position: fixed;
    z-index: 999;
    top: min(calc(50% - 34px), calc(100% - var(--rail-height) - 8px));
    right: 2px;
    display: grid;
    grid-template-rows: repeat(4, minmax(0, 1fr));
    width: 70px;
    height: var(--rail-height);
    border-radius: 4px;
    background: linear-gradient(90deg, #e72828, #f36262);
    box-shadow: 0 1px 6px rgba(0, 0, 0, .15);
    color: #fff;
    font: 400 12px/18px "Microsoft YaHei", "PingFang SC", sans-serif;
    text-align: center;
}

.wk-service-rail .wk-service-rail__row {
    position: relative;
}

.wk-service-rail .wk-service-rail__row + .wk-service-rail__row::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(90deg, #d72424, #ea5e5e);
    pointer-events: none;
}

.wk-service-rail .wk-service-rail__action {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: white;
    font: inherit;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.wk-service-rail .wk-service-rail__action:hover,
.wk-service-rail .wk-service-rail__action[aria-expanded="true"] {
    background: rgba(157, 16, 16, .14);
}

.wk-service-rail .wk-service-rail__action:focus-visible {
    outline: 2px solid white;
    outline-offset: -3px;
}

.wk-service-rail .wk-service-rail__action img {
    display: block;
    width: 26px;
    height: 26px;
    max-height: 45%;
    object-fit: contain;
}

.wk-service-rail .wk-service-rail__panel {
    box-sizing: border-box;
    position: absolute;
    inset: 0 100% auto auto;
    display: grid;
    justify-items: center;
    gap: 4px;
    width: 140px;
    max-height: calc(100vh - 84px);
    overflow: auto;
    padding: 10px;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .15);
    color: #333;
}

.wk-service-rail .wk-service-rail__panel[hidden] {
    display: none;
}

.wk-service-rail .wk-service-rail__row:nth-child(3) .wk-service-rail__panel {
    top: auto;
    bottom: 0;
    justify-items: start;
    text-align: left;
}

.wk-service-rail .wk-service-rail__panel img {
    display: block;
    width: 95px;
    height: auto;
}

.wk-service-rail .wk-service-rail__panel strong,
.wk-service-rail .wk-service-rail__panel a {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}

.wk-service-rail .wk-service-rail__panel a {
    color: #de2929;
    text-decoration: none;
}

.wk-service-rail .wk-service-rail__panel small {
    color: #666;
    font-size: 12px;
}

dialog.wk-service-chat {
    box-sizing: border-box;
    position: fixed;
    inset: 0;
    width: min(840px, calc(100% - 24px));
    height: min(684px, calc(100vh - 24px));
    height: min(684px, calc(100dvh - 24px));
    margin: auto;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .24);
}

dialog.wk-service-chat::backdrop {
    background: rgba(0, 0, 0, .4);
}

dialog.wk-service-chat:not([open]) {
    display: none;
}

.wk-service-chat .wk-service-chat__frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.wk-service-chat .wk-service-chat__close {
    position: absolute;
    z-index: 1;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
    color: #333;
    font: 24px/1 sans-serif;
    cursor: pointer;
}

.wk-service-chat .wk-service-chat__close:focus-visible,
.wk-service-rail .wk-service-rail__panel a:focus-visible {
    outline: 2px solid #c92218;
    outline-offset: 2px;
}

@supports (height: 100dvh) {
    .wk-service-rail {
        --rail-height: min(var(--rail-preferred-height), calc(100dvh - 84px));
        top: min(calc(50dvh - 34px), calc(100dvh - var(--rail-height) - 8px));
    }

    .wk-service-rail .wk-service-rail__panel {
        max-height: calc(100dvh - 84px);
    }
}

@media (max-width: 767px) {
    .wk-service-rail {
        --rail-preferred-height: 216px;
        width: 52px;
    }

    .wk-service-rail .wk-service-rail__action img {
        width: 22px;
        height: 22px;
    }
}

@media (max-height: 300px) {
    .wk-service-rail .wk-service-rail__action {
        gap: 1px;
        line-height: 14px;
    }
}
