.sp-osk-root {
    --sp-osk-panel-bg: rgba(236, 239, 244, 0.94);
    --sp-osk-panel-border: rgba(148, 163, 184, 0.22);
    --sp-osk-panel-shadow: 0 -18px 48px rgba(15, 23, 42, 0.20);
    --sp-osk-key-bg: #ffffff;
    --sp-osk-key-bg-soft: #d8dee7;
    --sp-osk-key-bg-active: #f28b26;
    --sp-osk-key-text: #18212f;
    --sp-osk-key-text-muted: #516070;
    --sp-osk-key-border: rgba(148, 163, 184, 0.28);
    --sp-osk-safe-bottom: 0px;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 2147481000;
    pointer-events: none;
}

.sp-osk-root.is-mobile-native {
    display: none;
}

.sp-osk-toggle,
.sp-osk-panel {
    pointer-events: auto;
}

.sp-osk-toggle {
    position: fixed;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px) + var(--sp-osk-safe-bottom));
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    background: rgba(18, 24, 34, 0.92);
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.22);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 140ms ease, transform 140ms ease, background-color 140ms ease;
}

.sp-osk-root.is-button-visible .sp-osk-toggle {
    opacity: 1;
    transform: translateY(0);
}

.sp-osk-root.is-open .sp-osk-toggle {
    bottom: calc(var(--sp-osk-height, 0px) + 16px + env(safe-area-inset-bottom, 0px));
    background: rgba(242, 139, 38, 0.95);
}

.sp-osk-toggle__icon {
    font-size: 18px;
    line-height: 1;
}

.sp-osk-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    border-radius: 26px 26px 0 0;
    border: 1px solid var(--sp-osk-panel-border);
    border-bottom: 0;
    background: var(--sp-osk-panel-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--sp-osk-panel-shadow);
    transform: translateY(calc(100% + 24px));
    transition: transform 150ms ease;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
}

.sp-osk-root.is-open .sp-osk-panel {
    transform: translateY(0);
}

.sp-osk-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.sp-osk-header__meta {
    min-width: 0;
}

.sp-osk-title {
    color: #1e293b;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sp-osk-target {
    margin-top: 4px;
    color: #5b6473;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-osk-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 14px;
    background: rgba(148, 163, 184, 0.28);
    color: #1e293b;
    font-size: 28px;
    line-height: 1;
    flex: 0 0 42px;
}

.sp-osk-keys {
    display: grid;
    gap: 7px;
}

.sp-osk-row {
    display: grid;
    grid-template-columns: repeat(var(--sp-osk-cols), minmax(0, 1fr));
    gap: 7px;
    align-items: stretch;
}

.sp-osk-row--indent-sm {
    padding-inline: clamp(12px, 2vw, 26px);
}

.sp-osk-row--indent-xs {
    padding-inline: clamp(24px, 4vw, 58px);
}

.sp-osk-key {
    min-width: 0;
    min-height: 48px;
    border: 1px solid var(--sp-osk-key-border);
    border-radius: 15px;
    background: var(--sp-osk-key-bg);
    color: var(--sp-osk-key-text);
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    box-shadow: inset 0 -1px 0 rgba(148, 163, 184, 0.14);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: transform 70ms ease, background-color 110ms ease, border-color 110ms ease, color 110ms ease;
}

.sp-osk-key:active {
    transform: translateY(1px);
}

.sp-osk-key.is-special {
    background: var(--sp-osk-key-bg-soft);
    color: var(--sp-osk-key-text-muted);
}

.sp-osk-key.is-space {
    font-size: 16px;
    letter-spacing: 0.01em;
}

.sp-osk-key.is-accent,
.sp-osk-key.is-active {
    background: var(--sp-osk-key-bg-active);
    border-color: rgba(194, 65, 12, 0.22);
    color: #ffffff;
}

.sp-osk-key.is-shift.is-active {
    box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.16);
}

.sp-osk-has-open {
    padding-bottom: calc(var(--sp-osk-offset, 0px) + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 1200px) {
    .sp-osk-panel {
        max-width: none;
    }
}

@media (max-width: 1024px) {
    .sp-osk-key {
        min-height: 46px;
        font-size: 17px;
    }

    .sp-osk-row--indent-sm,
    .sp-osk-row--indent-xs {
        padding-inline: 0;
    }
}

@media (max-width: 768px) {
    .sp-osk-panel {
        padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
        border-radius: 22px 22px 0 0;
    }

    .sp-osk-header {
        margin-bottom: 10px;
    }

    .sp-osk-title,
    .sp-osk-target {
        font-size: 12px;
    }

    .sp-osk-close {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .sp-osk-key {
        min-height: 44px;
        border-radius: 13px;
        font-size: 15px;
    }

    .sp-osk-toggle {
        right: 14px;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px) + var(--sp-osk-safe-bottom));
    }
}
