.aist-switcher {
    --aist-bg: #111827;
    --aist-panel: #ffffff;
    --aist-text: #111827;
    --aist-muted: #6b7280;
    --aist-border: rgba(17, 24, 39, 0.12);
    --aist-shadow: 0 18px 40px rgba(17, 24, 39, 0.18);
    bottom: 24px;
    font-family: inherit;
    position: fixed;
    z-index: 9999;
}

.aist-switcher--right {
    right: 24px;
}

.aist-switcher--left {
    left: 24px;
}

.aist-switcher--custom {
    bottom: var(--aist-custom-y, 24px);
    right: var(--aist-custom-x, 24px);
}

.aist-switcher--inline {
    bottom: auto;
    display: inline-block;
    position: relative;
    right: auto;
    z-index: 1;
}

.aist-switcher__button {
    align-items: center;
    background: var(--aist-bg);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    box-shadow: var(--aist-shadow);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font-size: 14px;
    font-weight: 600;
    gap: 8px;
    min-height: 44px;
    min-width: 84px;
    padding: 10px 14px;
    transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.aist-switcher__button:focus,
.aist-switcher__button:hover {
    background: #1f2937;
    box-shadow: 0 22px 46px rgba(17, 24, 39, 0.24);
    outline: none;
    transform: translateY(-1px);
}

.aist-switcher__flag {
    align-items: center;
    display: inline-flex;
    font-size: 15px;
    font-weight: 700;
    justify-content: center;
    min-width: 24px;
}

.aist-switcher__current {
    letter-spacing: 0;
}

.aist-switcher__chevron {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    height: 0;
    transition: transform 180ms ease;
    width: 0;
}

.aist-switcher.is-open .aist-switcher__chevron {
    transform: rotate(180deg);
}

.aist-switcher__menu {
    background: var(--aist-panel);
    border: 1px solid var(--aist-border);
    border-radius: 8px;
    bottom: calc(100% + 10px);
    box-shadow: var(--aist-shadow);
    min-width: 190px;
    opacity: 0;
    overflow: hidden;
    padding: 6px;
    pointer-events: none;
    position: absolute;
    right: 0;
    transform: translateY(8px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
    visibility: hidden;
}

.aist-switcher--left .aist-switcher__menu {
    left: 0;
    right: auto;
    transform-origin: bottom left;
}

.aist-switcher--inline .aist-switcher__menu {
    bottom: auto;
    margin-top: 8px;
    top: 100%;
    transform-origin: top right;
}

.aist-switcher.is-open .aist-switcher__menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    visibility: visible;
}

.aist-switcher__item {
    align-items: center;
    border-radius: 6px;
    color: var(--aist-text);
    display: flex;
    font-size: 14px;
    gap: 10px;
    line-height: 1.2;
    padding: 10px;
    text-decoration: none;
    transition: background-color 160ms ease, color 160ms ease;
    white-space: nowrap;
}

.aist-switcher__item:focus,
.aist-switcher__item:hover,
.aist-switcher__item.is-current {
    background: #eef2ff;
    color: #1d4ed8;
    outline: none;
}

.aist-switcher__name {
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {
    .aist-switcher {
        bottom: 16px;
        left: 16px;
        right: 16px;
    }

    .aist-switcher--custom {
        bottom: var(--aist-custom-y, 16px);
        left: 16px;
        right: 16px;
    }

    .aist-switcher__button {
        justify-content: center;
        width: 100%;
    }

    .aist-switcher__menu {
        left: 0;
        min-width: 0;
        right: 0;
        width: 100%;
    }

    .aist-switcher--inline {
        left: auto;
        right: auto;
        width: 100%;
    }
}

.aist-language-suggestion {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    display: flex;
    font-family: inherit;
    justify-content: center;
    left: 16px;
    opacity: 1;
    pointer-events: none;
    position: fixed;
    right: 16px;
    transform: translateY(0);
    transition: opacity 180ms ease, transform 180ms ease;
    z-index: 9997;
}

.aist-language-suggestion.is-hidden {
    opacity: 0;
    transform: translateY(10px);
}

.aist-language-suggestion--top {
    bottom: auto;
    top: calc(16px + env(safe-area-inset-top, 0px));
}

.aist-language-suggestion--bottom-left {
    justify-content: flex-start;
}

.aist-language-suggestion--bottom-right {
    justify-content: flex-end;
}

.aist-language-suggestion__inner {
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(17, 24, 39, 0.12);
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(17, 24, 39, 0.18);
    color: #111827;
    display: flex;
    gap: 14px;
    max-width: 760px;
    padding: 12px;
    pointer-events: auto;
    width: min(760px, 100%);
}

.aist-language-suggestion__text {
    flex: 1 1 auto;
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
}

.aist-language-suggestion__actions {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.aist-language-suggestion__button {
    background: #f3f4f6;
    border: 1px solid rgba(17, 24, 39, 0.1);
    border-radius: 6px;
    color: #111827;
    cursor: pointer;
    display: inline-flex;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    padding: 9px 10px;
    text-decoration: none;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
    white-space: nowrap;
}

.aist-language-suggestion__button:focus,
.aist-language-suggestion__button:hover {
    background: #e5e7eb;
    border-color: rgba(17, 24, 39, 0.18);
    color: #111827;
    outline: none;
}

.aist-language-suggestion__button--primary {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

.aist-language-suggestion__button--primary:focus,
.aist-language-suggestion__button--primary:hover {
    background: #1e40af;
    border-color: #1e40af;
    color: #ffffff;
}

.aist-language-suggestion__button--quiet {
    background: transparent;
    border-color: transparent;
    color: #4b5563;
}

.aist-language-suggestion__button--quiet:focus,
.aist-language-suggestion__button--quiet:hover {
    background: #f3f4f6;
    color: #111827;
}

@media (max-width: 640px) {
    .aist-language-suggestion {
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        left: 12px;
        right: 12px;
    }

    .aist-language-suggestion--top {
        bottom: auto;
        top: calc(12px + env(safe-area-inset-top, 0px));
    }

    .aist-language-suggestion__inner {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .aist-language-suggestion__actions {
        align-items: stretch;
        flex-direction: column;
    }

    .aist-language-suggestion__button {
        justify-content: center;
        width: 100%;
    }
}

.aist-dynamic-translator {
    align-items: flex-end;
    bottom: 92px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: fixed;
    right: 24px;
    z-index: 9998;
}

.aist-dynamic-translator__controls {
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(17, 24, 39, 0.12);
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(17, 24, 39, 0.16);
    display: flex;
    gap: 8px;
    padding: 8px;
}

.aist-dynamic-translator__select {
    border: 1px solid rgba(17, 24, 39, 0.18);
    border-radius: 6px;
    min-height: 34px;
}

.aist-dynamic-translator__button {
    align-items: center;
    background: #1d4ed8;
    border: 0;
    border-radius: 999px;
    box-shadow: 0 16px 36px rgba(29, 78, 216, 0.28);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font-size: 14px;
    font-weight: 700;
    justify-content: center;
    min-height: 44px;
    padding: 11px 16px;
    text-decoration: none;
    transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.aist-dynamic-translator__button:focus,
.aist-dynamic-translator__button:hover {
    background: #1e40af;
    box-shadow: 0 20px 42px rgba(29, 78, 216, 0.34);
    outline: none;
    transform: translateY(-1px);
}

.aist-dynamic-translator__button:disabled {
    cursor: progress;
    opacity: 0.78;
}

.aist-dynamic-translator__status {
    color: #4b5563;
    font-size: 12px;
    min-height: 16px;
    padding-right: 8px;
}

@media (max-width: 640px) {
    .aist-dynamic-translator {
        bottom: 92px;
        left: 16px;
        right: 16px;
    }

    .aist-dynamic-translator__controls {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .aist-dynamic-translator__button {
        width: 100%;
    }
}

.aist-live-editor {
    background: #ffffff;
    border-right: 1px solid rgba(17, 24, 39, 0.12);
    bottom: 0;
    box-shadow: 18px 0 42px rgba(17, 24, 39, 0.14);
    box-sizing: border-box;
    color: #111827;
    font-family: inherit;
    left: 0;
    max-width: 360px;
    overflow-y: auto;
    padding: 18px;
    position: fixed;
    top: 32px;
    width: 360px;
    z-index: 100000;
    transition: opacity 180ms ease, transform 180ms ease;
}

.aist-live-editor.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(calc(-100% - 24px));
}

.aist-live-editor__header {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.aist-live-editor__header-actions {
    align-items: center;
    display: flex;
    gap: 10px;
}

.aist-live-editor__header h2,
.aist-live-editor__section h3 {
    color: #111827;
    font-size: 16px;
    line-height: 1.3;
    margin: 0;
}

.aist-live-editor__exit {
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.aist-live-editor__link {
    background: transparent;
    border: 0;
    color: #1d4ed8;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 0;
}

.aist-live-editor__restore {
    background: #1d4ed8;
    border: 0;
    border-radius: 999px;
    bottom: 96px;
    box-shadow: 0 16px 36px rgba(29, 78, 216, 0.28);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    left: 18px;
    min-height: 40px;
    padding: 10px 16px;
    position: fixed;
    z-index: 100000;
}

.aist-live-editor__restore[hidden] {
    display: none;
}

.aist-live-editor__section {
    border-top: 1px solid rgba(17, 24, 39, 0.1);
    display: grid;
    gap: 8px;
    padding: 14px 0;
}

.aist-live-editor label {
    color: #374151;
    font-size: 12px;
    font-weight: 700;
}

.aist-live-editor input,
.aist-live-editor textarea {
    border: 1px solid rgba(17, 24, 39, 0.18);
    border-radius: 6px;
    box-sizing: border-box;
    color: #111827;
    font: inherit;
    font-size: 13px;
    line-height: 1.4;
    padding: 9px 10px;
    width: 100%;
}

.aist-live-editor textarea {
    min-height: 88px;
    resize: vertical;
}

.aist-live-editor__link-fields {
    display: grid;
    gap: 8px;
}

.aist-live-editor__link-fields[hidden] {
    display: none;
}

.aist-live-editor__hint {
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
    margin: 0;
    overflow-wrap: anywhere;
}

.aist-live-editor__actions {
    align-items: center;
    background: #ffffff;
    border-top: 1px solid rgba(17, 24, 39, 0.1);
    bottom: 0;
    display: flex;
    gap: 10px;
    left: 0;
    padding: 14px 18px;
    position: sticky;
}

.aist-live-editor__save {
    background: #1d4ed8;
    border: 0;
    border-radius: 999px;
    color: #ffffff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    min-height: 40px;
    padding: 10px 16px;
}

.aist-live-editor__save:disabled {
    cursor: progress;
    opacity: 0.72;
}

.aist-live-editor__status {
    color: #4b5563;
    font-size: 12px;
}

.aist-live-editor__page-text--hover,
.aist-live-editor__page-text--selected {
    cursor: pointer;
    outline-offset: 3px;
}

.aist-live-editor__page-text--hover {
    background: rgba(29, 78, 216, 0.1);
    outline: 2px solid rgba(29, 78, 216, 0.5);
}

.aist-live-editor__page-text--selected {
    background: rgba(16, 185, 129, 0.14);
    outline: 2px solid #10b981;
}

@media (max-width: 782px) {
    .aist-live-editor {
        border-right: 0;
        bottom: 0;
        max-width: none;
        top: auto;
        width: 100%;
    }

    body.aist-live-editor-open {
        padding-bottom: 60vh;
    }
}
