:root {
    --tsm-primary: #667eea;
    --tsm-accent: #764ba2;
    --tsm-text: #1a202c;
    --tsm-button-radius: 8px;
    --tsm-button-padding-y: 12px;
    --tsm-button-padding-x: 20px;
    --tsm-panel-width: 360px;
    --tsm-panel-max-height: 500px;
    --tsm-font-size: 14px;
    --tsm-breathe-intensity: 1
}

#tsm-floating-widget {
    position: fixed;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    bottom: 30px
}

.tsm-position-right {
    right: 30px
}

.tsm-position-left {
    left: 30px
}

.tsm-position-center {
    left: 50%;
    transform: translateX(-50%)
}

.tsm-widget-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: var(--tsm-button-padding-y, 12px) var(--tsm-button-padding-x, 20px);
    background: var(--tsm-primary, #2563eb);
    color: #fff;
    border-radius: var(--tsm-button-radius, 8px);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .2);
    transition: background .2s ease, box-shadow .2s ease;
    border: 1px solid rgba(255, 255, 255, .1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    animation: tsm-breathe 2.5s ease-in-out infinite
}

@keyframes tsm-breathe {

    0%,
    100% {
        box-shadow: 0 2px 8px rgba(37, 99, 235, calc(.2 * var(--tsm-breathe-intensity, 1)));
        transform: scale(1)
    }

    50% {
        box-shadow: 0 6px 20px rgba(37, 99, 235, calc(.45 * var(--tsm-breathe-intensity, 1)));
        transform: scale(calc(1 + .02 * var(--tsm-breathe-intensity, 1)))
    }
}

.tsm-position-center .tsm-widget-trigger {
    animation: tsm-breathe-center 2.5s ease-in-out infinite
}

@keyframes tsm-breathe-center {

    0%,
    100% {
        box-shadow: 0 2px 8px rgba(37, 99, 235, calc(.2 * var(--tsm-breathe-intensity, 1)))
    }

    50% {
        box-shadow: 0 6px 20px rgba(37, 99, 235, calc(.45 * var(--tsm-breathe-intensity, 1)))
    }
}

.tsm-widget-trigger:hover {
    background: var(--tsm-accent, #1d4ed8);
    box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
    animation: none;
    transform: scale(1)
}

.tsm-icon {
    font-size: 18px;
    line-height: 1
}

.tsm-trigger-text {
    font-weight: 500;
    font-size: 15px;
    white-space: nowrap
}

.tsm-breathing-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    flex-shrink: 0
}

.tsm-widget-panel {
    display: none;
    position: absolute;
    bottom: 100%;
    margin-bottom: 12px;
    width: var(--tsm-panel-width, 360px);
    max-height: var(--tsm-panel-max-height, 500px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .08);
    overflow: hidden;
    flex-direction: column;
    border: 1px solid #e5e7eb
}

.tsm-position-right .tsm-widget-panel {
    right: 0
}

.tsm-position-left .tsm-widget-panel {
    right: auto;
    left: 0
}

.tsm-position-center .tsm-widget-panel {
    right: auto;
    left: 50%;
    margin-left: calc(var(--tsm-panel-width, 360px)/-2)
}

#tsm-floating-widget.tsm-widget-expanded .tsm-widget-panel {
    display: flex;
    animation: tsm-panel-fade .2s ease-out
}

@keyframes tsm-panel-fade {
    from {
        opacity: 0;
        transform: translateY(8px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.tsm-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0
}

.tsm-panel-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--tsm-text, #111827);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif
}

.tsm-panel-close {
    background: 0 0;
    border: none;
    color: #6b7280;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center
}

.tsm-panel-close:hover {
    background: #e5e7eb;
    color: #111827
}

.tsm-panel-content {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0
}

.tsm-panel-content::-webkit-scrollbar {
    width: 6px
}

.tsm-panel-content::-webkit-scrollbar-track {
    background: 0 0
}

.tsm-panel-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px
}

.tsm-panel-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af
}

.tsm-accordion-item {
    border-bottom: 1px solid #f3f4f6
}

.tsm-accordion-item:last-child {
    border-bottom: none
}

.tsm-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    transition: background .15s
}

.tsm-topic-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    padding: 14px 12px 14px 20px;
    text-decoration: none;
    color: inherit;
    transition: background .15s
}

.tsm-topic-link:hover {
    background: #f9fafb
}

.tsm-topic-link:hover .tsm-accordion-title {
    color: var(--tsm-primary, #2563eb)
}

.tsm-accordion-toggle {
    background: none;
    border: none;
    padding: 14px 20px 14px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0
}

.tsm-accordion-toggle:hover {
    background: #f3f4f6
}

.tsm-accordion-toggle:focus {
    outline: none
}

.tsm-accordion-title {
    margin: 0;
    font-size: var(--tsm-font-size, 14px);
    font-weight: 600;
    color: var(--tsm-text, #111827);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: color .15s
}

.tsm-items-count {
    font-size: 12px;
    color: #6b7280;
    font-weight: 400
}

.tsm-accordion-icon {
    font-size: 10px;
    transition: transform .2s;
    color: #9ca3af;
    flex-shrink: 0
}

.tsm-accordion-expanded .tsm-accordion-icon {
    transform: rotate(180deg)
}

.tsm-accordion-content {
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease-out
}

.tsm-topic-items {
    list-style: none;
    margin: 0;
    padding: 12px 20px
}

.tsm-item {
    margin-bottom: 2px
}

.tsm-item:last-child {
    margin-bottom: 0
}

.tsm-item-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: #374151;
    font-size: var(--tsm-font-size, 14px);
    transition: all .15s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif
}

.tsm-item-link:hover {
    background: #f3f4f6;
    color: var(--tsm-primary, #2563eb)
}

.tsm-link-icon {
    font-size: 14px;
    flex-shrink: 0;
    opacity: .6
}

.tsm-item-title {
    flex: 1;
    line-height: 1.4
}

.tsm-arrow {
    font-size: 12px;
    opacity: 0;
    transition: all .15s;
    color: var(--tsm-primary, #2563eb)
}

.tsm-item-link:hover .tsm-arrow {
    opacity: 1;
    transform: translateX(2px)
}

.tsm-item-active {
    margin-bottom: 6px
}

.tsm-item-current {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #eff6ff;
    border-radius: 6px;
    border-left: 3px solid var(--tsm-primary, #2563eb)
}

.tsm-current-indicator {
    width: 4px;
    height: 4px;
    background: var(--tsm-primary, #2563eb);
    border-radius: 50%;
    flex-shrink: 0
}

.tsm-item-current .tsm-item-title {
    font-size: var(--tsm-font-size, 14px);
    font-weight: 500;
    color: #1e40af;
    flex: 1;
    line-height: 1.4
}

.tsm-current-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--tsm-primary, #2563eb);
    color: #fff;
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase
}

@media (max-width:480px) {
    #tsm-floating-widget {
        bottom: 15px;
        right: 15px !important;
        left: auto !important
    }

    .tsm-position-left,
    .tsm-position-center {
        right: 15px !important;
        left: auto !important;
        transform: none !important
    }

    .tsm-widget-panel {
        width: calc(100vw - 30px) !important;
        max-width: 95vw;
        right: 0 !important;
        left: auto !important;
        margin-left: 0 !important
    }

    .tsm-widget-trigger {
        padding: 10px 16px
    }

    .tsm-trigger-text {
        font-size: 13px
    }
}