#story-toolkit-container [hidden] {
    display: none !important;
}

#story-toolkit-container {
    position: fixed;
    left: 30px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --st-ink: #17212b;
    --st-accent: #0b6e69;
    --st-accent-hover: #075954;
    --st-reset: #b64034;
    --st-reset-hover: #913127;
    --st-bookmark-highlight: #fff3b0;
}

#story-toolkit-container.st-position-left-top {
    top: 30px;
    bottom: auto;
}

#story-toolkit-container.st-position-left-center {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
}

#story-toolkit-container.st-position-left-bottom {
    bottom: 30px;
    top: auto;
}

#story-toolkit-container.st-position-right-top {
    top: 30px;
    right: 30px;
    bottom: auto;
    left: auto;
}

#story-toolkit-container.st-position-right-center {
    top: 50%;
    right: 30px;
    bottom: auto;
    left: auto;
    transform: translateY(-50%);
}

#story-toolkit-container.st-position-right-bottom {
    right: 30px;
    bottom: 30px;
    top: auto;
    left: auto;
}

#story-toolkit-container.st-position-top-center {
    top: 30px;
    right: 50%;
    bottom: auto;
    left: auto;
    transform: translateX(50%);
}

#story-toolkit-container.st-position-bottom-center {
    right: 50%;
    bottom: 30px;
    top: auto;
    left: auto;
    transform: translateX(50%);
}

#story-toolkit-buttons {
    display: flex;
    gap: 2px;
    min-height: 52px;
    background: rgba(255, 255, 255, 0.98);
    padding: 6px;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(23, 33, 43, 0.12);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(23, 33, 43, 0.08);
    align-items: center;
}

#story-toolkit-container[data-direction="column"] #story-toolkit-buttons {
    flex-direction: column;
}

#story-toolkit-container[data-direction="column"][data-align="left"] #story-toolkit-buttons button {
    justify-content: flex-start;
}

#story-toolkit-container[data-direction="column"][data-align="right"] #story-toolkit-buttons button {
    justify-content: flex-end;
}

#story-toolkit-container[data-direction="column"][data-align="center"] #story-toolkit-buttons button {
    justify-content: center;
}

#story-toolkit-buttons button {
    min-height: 44px;
    box-sizing: border-box;
    background: transparent;
    color: var(--st-ink);
    border: none;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

#story-toolkit-buttons button:hover {
    background: rgba(11, 110, 105, 0.1);
    color: var(--st-accent-hover);
}

#story-toolkit-buttons button:focus-visible,
.st-drawer-header button:focus-visible {
    outline: 2px solid #0b6e69;
    outline-offset: 2px;
}

#story-toolkit-buttons .st-icon {
    display: inline-flex;
    line-height: 0;
}

#story-toolkit-buttons .st-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

#st-bookmark-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.st-bookmark-tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    padding: 7px 10px;
    background: #17212b;
    color: #fff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 5px 12px rgba(23, 33, 43, 0.2);
}

#story-toolkit-buttons button.st-toggled {
    background: var(--st-accent);
    color: #fff;
    box-shadow: none;
}

.st-story-card-save-host {
    position: relative;
}

.st-story-card-save {
    position: absolute;
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    box-sizing: border-box;
    pointer-events: auto;
    text-shadow: 1px 1px 2px black;
}

.st-story-card-save:hover,
.st-story-card-save:focus-visible {
    color: #b64034;
}

.st-story-card-save:focus-visible {
    outline: 2px solid #0b6e69;
    outline-offset: 2px;
}

.st-story-card-save.st-toggled {
    background: transparent;
    color: #b64034;
}

.st-story-card-save svg {
    width: 20px;
    height: 20px;
    fill: none;
}

.st-story-card-save.st-toggled svg {
    fill: currentColor;
}

#st-bookmark-btn.selecting {
    background: #c06b12;
    color: #fff;
    box-shadow: 0 0 0 3px rgba(192, 107, 18, 0.2);
}

#st-bookmark-btn.selecting:hover {
    background: #9b560e;
}

.st-bookmark-selecting p {
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.st-bookmark-selecting p:hover {
    background-color: #fff1cf;
    box-shadow: inset 4px 0 0 #c06b12;
}

.st-highlighted-block {
    display: block;
    background-color: var(--st-bookmark-highlight) !important;
    box-shadow: inset 4px 0 0 #d49a18;
    transition: background-color 1s ease;
    padding: 8px 12px;
    border-radius: 6px;
}

.st-inline-remove-bookmark {
    display: inline-flex;
    align-items: center;
    margin: 0 0 6px;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid #b64034;
    color: #b64034;
    border-radius: 999px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
}

.st-inline-remove-bookmark:hover {
    background: #b64034;
    color: #fff;
}

.st-drawer {
    position: absolute;
    bottom: 65px;
    left: 0;
    width: 300px;
    max-height: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #eee;
}

.st-drawer.active {
    display: flex;
}

.st-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f7f7f7;
    border-bottom: 1px solid #eee;
}

.st-drawer-header h3 {
    margin: 0;
    font-size: 16px;
    color: #111;
}

.st-drawer-header button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #333;
}

.st-drawer ul {
    margin: 0;
    padding: 12px;
    overflow-y: auto;
    list-style: none;
    max-height: 330px;
}

.st-drawer li {
    margin-bottom: 8px;
}

.st-saved-list-drawer li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.st-saved-list-drawer li.st-empty-state {
    display: block;
    color: #5c6670;
    font-size: 13px;
}

.st-saved-list-drawer .st-saved-story-link {
    flex: 1;
}

.st-saved-list-drawer .st-saved-story-current {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
}

.st-saved-list-drawer .st-remove-saved-page {
    min-width: 30px;
    min-height: 30px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: var(--st-reset);
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.st-drawer li.st-h3-item {
    padding-left: 15px;
}

.st-drawer a {
    color: #333;
    text-decoration: none;
    font-size: 13px;
    display: block;
}

.st-drawer a:hover {
    color: #0073aa;
}

.st-drawer a.st-current-chapter,
.st-saved-list-drawer .st-saved-story-current {
    margin-left: -8px;
    padding: 6px 8px;
    border-left: 3px solid var(--st-accent);
    background: rgba(11, 110, 105, 0.1);
    color: var(--st-accent-hover);
    font-weight: 700;
}

@media screen and (max-width: 768px) {
    #story-toolkit-container,
    #story-toolkit-container.st-position-left-top,
    #story-toolkit-container.st-position-left-center,
    #story-toolkit-container.st-position-left-bottom,
    #story-toolkit-container.st-position-right-top,
    #story-toolkit-container.st-position-right-center,
    #story-toolkit-container.st-position-right-bottom,
    #story-toolkit-container.st-position-top-center,
    #story-toolkit-container.st-position-bottom-center {
        right: 0;
        bottom: 0;
        left: 0;
        top: auto;
        transform: none;
    }

    #story-toolkit-buttons {
        width: 100%;
        box-sizing: border-box;
        min-height: 56px;
        gap: 2px;
        padding: 6px calc(6px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left));
        border-radius: 0;
        justify-content: space-around;
    }

    #story-toolkit-container[data-direction="column"] #story-toolkit-buttons {
        flex-direction: row;
    }

    #story-toolkit-buttons > button,
    #story-toolkit-buttons > #st-bookmark-wrapper {
        flex: 1 1 0;
        min-width: 44px;
        height: 46px;
    }

    #story-toolkit-buttons button {
        padding: 4px;
        justify-content: center;
    }

    #st-bookmark-wrapper #st-bookmark-btn {
        width: 100%;
        height: 100%;
    }

    #story-toolkit-buttons .st-icon svg {
        width: 20px;
        height: 20px;
    }

    #story-toolkit-buttons .st-text {
        display: none;
    }

    .st-bookmark-tip {
        bottom: calc(100% + 10px);
        left: 50%;
        transform: translateX(-50%);
    }

    .st-drawer {
        right: 8px;
        bottom: 64px;
        left: 8px;
        width: auto;
        max-height: min(400px, calc(100vh - 92px));
    }
}