

.tts-player{
   --btn: var(--decor);
   --btn-txt: hsl(228, 20%, 90%);

}



/* ==============tts-status-bar===============*/
.tts-status-bar{
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    letter-spacing: 1.2px;
    padding:2px 4px;
    user-select: none;
}

.tts-status-bar-base,
.tts-status-bar-hint {
    position: absolute;
    inset: 0;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* base 永远可见 */
.tts-status-bar-base {
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

/* hint 默认隐藏 */
.tts-status-bar-hint {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    background-color: var(--warn);
    color: var(--text);
    border-radius: inherit;
}

/* hint 激活 → 覆盖 base */
.tts-status-bar-hint.active {
    opacity: 1;
}

/* ==============progress-bar===============*/

.tts-progress {
    --tts-progress: 0;
    --tts-progress-color: var(--bg);
    width: 100%;
    height: 3px;
    cursor: default;
}

.tts-progress-track {
    position: relative;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 999px;
    overflow: hidden;
}

.tts-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: calc(var(--tts-progress) * 100%);
    background: var(--tts-progress-color);
    border-radius: inherit;
    transition: width 0.12s linear;
}

.tts-progress.interactive {
    cursor: pointer;
}


/* ==============Theme Toggler===============*/

.tts-theme-toggler{
    /*icon size*/
    --icon-size:36px;
    --icon-padding:8px;
    width: var(--icon-size);
    height:var(--icon-size);
    
    border-radius: 50%;
    

    color:var(--bg);
    background-color: var(--btn);
    cursor: pointer;

    position: relative;
    transition: box-shadow 0.2s ease-in;
}




.tts-theme-toggler-current{
    background-color: inherit;
    border-radius: 50%;
    position: relative;
    z-index: 1;
}

.tts-theme-option,
.tts-theme-toggler-current{ 
    width: var(--icon-size);
    height: var(--icon-size);
    padding:var(--icon-padding);}

.tts-theme-toggler-popup,
.tts-theme-toggler-current{
    width: inherit;   
    
}

.tts-theme-option{
    transform: scale(0.3);
}



.tts-theme-toggler-popup{
    position: absolute;
    top:0;
    left:0;
    z-index: 0;


    background-color: inherit;
    width:var(--icon-size);
    height:var(--icon-size);

    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;

    transition: all 0.3s ease-in-out;
   
}

/* 水平方向展开（左右/h） */
.tts-theme-toggler-popup.expanded[data-direction="h"],
.tts-theme-toggler-popup.expanded[data-direction="left"],
.tts-theme-toggler-popup.expanded[data-direction="right"] {
    width: calc(3 * var(--icon-size)); /* 3个图标宽 */
    height: var(--icon-size); /* 高度不变 */
}

/* 垂直方向展开（上下/v） */
.tts-theme-toggler-popup.expanded[data-direction="v"],
.tts-theme-toggler-popup.expanded[data-direction="up"],
.tts-theme-toggler-popup.expanded[data-direction="down"] {
    width: var(--icon-size); /* 宽度不变 */
    height: calc(3 * var(--icon-size)); /* 3个图标高 */
}

.tts-theme-toggler-popup.expanded .tts-theme-option{
    transform: scale(1);
}

.tts-theme-toggler-popup[data-direction="up"]{
    bottom: 0;
    top: auto;
    flex-direction: column;
}
.tts-theme-toggler-popup[data-direction="down"]{
    top: 0;
    bottom: auto;
    flex-direction: column;
}
.tts-theme-toggler-popup[data-direction="left"]{
    right: 0;
    left: auto;  
}

.tts-theme-toggler-popup[data-direction="right"]{
    left: 0;
    right: auto;
}
   

.tts-theme-toggler-popup[data-direction="v"]{
    top:50%;
    transform: translateY(-50%);
    flex-direction: column;
}
.tts-theme-toggler-popup[data-direction="h"]
{
    left:50%;
    transform: translateX(-50%);
    flex-direction: row;
   
}


.tts-theme-toggler svg{
    width: 100%;
    height: 100%;
}




/* ============== TTS-Slider ===============*/

/* ===== Slider 容器 ===== */
.tts-slider {
    position: relative;
    width: 100%;
    height: 24px;
    margin-top:1px;
    cursor: pointer;
}

/* ===== Track 底色 ===== */
.tts-slider-track {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 6px;

    border: 1px solid hsla(var(--th), var(--ts), var(--tl), 0.4);
    border-radius: 3px;
    transform: translateY(-50%);
}

/* ===== 进度条 ===== */
.tts-slider-fill {
    position: absolute;
    top: 50%;
    left: 0;
    height: 6px;
    background: var(--decor);
    border-radius: 3px;
    transform: translateY(-50%);
    pointer-events: none;
    /* 关键 */
}

/* ===== Thumb ===== */
.tts-slider-thumb {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    background: var(--decor);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* ===== Tag ===== */
.tts-slider-tag {
    position: absolute;
    top: -12px;
    font-size: 12px;
    color: var(--text);
    transform: translateX(-50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    
}

.tts-slider:hover  .tts-slider-tag{
    opacity: 0.6;
}



/* 滑块容器 */
.tts-rate-slider,
.tts-volume-slider {
    position: relative;
    width: 240px;
    padding-top: 22px;
}

.tts-rate-slider-input,.tts-volume-slider-input{
    width: 100%;
}

/* 浮动标签 */
.tts-rate-slider-tag, .tts-volume-slider-tag{
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    padding: 2px 6px;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;

    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 4px;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
}

/* hover / drag 显示 */
.tts-rate-slider:hover .tts-rate-slider-tag,
.tts-rate-slider.dragging .tts-rate-slider-tag,
.tts-volume-slider:hover .tts-volume-slider-tag,
.tts-volume-slider.dragging .tts-volume-slider-tag{
    opacity: 1;
}


/* ============== TTSToggleButton ===============*/

.tts-toggle-btn {
    width: 58px;
    height: 58px;
    padding: 5px;
    
    border-radius: 50%;
    background-color: var(--btn);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color:var(--bg);
    font-size: 1.5rem;

    transition: box-shadow 0.3s ease-in-out;
}


.tts-toggle-btn:disabled{
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/**/




/* TTSTextEditor ----------------------- */


.tts-editor {
    --bg: var(--bg);
    --mask-color: var(--bg);
    --mask-height: 50px;
    position: relative;
    width: 100%;
    height: 100%;

    overflow: hidden;
}

.tts-editor::before,.tts-editor::after {
    content: ' ';
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none;
    
    height: var(--mask-height);
    z-index: 3;
    transition: all 0.3s ease;

    --mask-color: hsl(var(--h), var(--s), var(--l));
}

.tts-editor::after {
    bottom: 0;
    inset: auto 0 0 0;
    background: linear-gradient(
    to bottom,
    hsla(var(--h), var(--s), var(--l), 0) 0%,
    hsla(var(--h), var(--s), var(--l), 1) 100%
    );

}
.tts-editor::before {
    top: 0;
    inset: 0 0 auto 0;
    /* background:linear-gradient(to bottom,
    color-mix(in srgb, var(--mask-color) 100%, transparent) 0%,
    color-mix(in srgb, var(--mask-color) 0%, transparent) 99%); */
    background: linear-gradient(
    to bottom,
    hsla(var(--h), var(--s), var(--l), 1) 0%,
    hsla(var(--h), var(--s), var(--l), 0) 100%
    );

}

.tts-editor:hover  .tts-editor-mirror-layer { background-color: var(--innerBg);   }


.tts-editor:hover::before,
.tts-editor:hover::after {
    background: transparent;
}


.tts-editor textarea,
.tts-editor .tts-editor-mirror-layer {
    box-sizing: border-box;
    font: 1rem/1.8 monospace;
    padding: 12px 1.6rem;
    width: 100%;
    height: 100%;
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;

    overflow-y: auto;
    overflow-x: hidden;
    /* 隐藏滚动条但仍可滚动 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */


    /*调试*/
    border : 1px solid transparent;

}


.tts-editor textarea::-webkit-scrollbar,
.tts-editor .tts-editor-mirror-layer::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.tts-editor textarea.tts-editor-textarea {
    position: relative;
    z-index: 2;
    background: transparent;
    color: transparent;
    caret-color: black;
    resize: none;


}

.tts-editor .tts-editor-mirror-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    user-select: none;
    
    color: var(--text);
    
    transition: background-color 0.3s ease-in-out;
}