/* ===== CSS变量定义 ===== */
:root {
    --timelineBG: #000;
    --timeViewPot: #111;
    --heighLight: #fff;
    --save-top: env(safe-area-inset-top);
    --safe-area-top: env(safe-area-inset-top);
    --save-bottom: env(safe-area-inset-bottom);
    --save-area-bottom: env(safe-area-inset-bottom);
    --primary-back: #A42;
    --primary-back-opc: #f848;
    --primary-birght: #f84;
    --secondary-bright: #00EDAE;
    --secondary-back: #279175;
    --headerHeight: 90px;
}

/* ===== 恢复默认值 ===== */
div,
span {
    display: block;
    align-items: normal;
    justify-content: normal;
    text-align: left;
    opacity: 1;
}

/* ===== 基础重置和全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    /* user-drag: none; */
}

body {
    color: var(--heighLight);
    /* background-color: #111; */
    scrollbar-width: none;
    overflow: hidden;
    position: fixed;
    width: 100vw;
    height: 100vh;
    -webkit-overflow-scrolling: touch;
    touch-action: none;
    overscroll-behavior: none;
}

/* ===== 用户选择和拖拽控制 ===== */
body,
.page,
.header,
.player,
.music-list {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* ===== 全局禁用右键菜单 ===== */
* {
    -webkit-context-menu: none;
    -moz-context-menu: none;
    -ms-context-menu: none;
    /* context-menu: none; */
}

input,
textarea,
[contenteditable] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    touch-action: manipulation;
}

/* ===== 可编辑元素移动端输入法支持 ===== */
.editable-cell,
.editable-container .editable-cell {
    touch-action: manipulation;
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

img {
    pointer-events: none;
}

/* ===== iOS Safari 全屏WebApp 专用样式 ===== */


/* ===== 布局工具类 ===== */
.row {
    display: flex;
    flex-direction: row;
}

.col {
    display: flex;
    flex-direction: column;
}

.center {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
}

.v-center {
    display: flex;
    align-items: center;
}

.h-center {
    display: flex;
    justify-content: center;
}

.hidden {
    display: none !important;
}


.fakeOut {
    opacity: 0;
}

.shrink {
    max-width: 0% !important;
}

.grow {
    min-width: 100% !important;
}


.top {
    padding-top: var(--save-top);
}

.bottom {
    padding-bottom: var(--save-bottom);
}

/* 封面 */
.cover-text-min {
    color: #fff6;
    font-size: 0.4em;
}


/* ===== 页面主体结构 ===== */
.page {
    width: 100%;
    height: 100vh;
    color: var(--heighLight);
    position: fixed;
    top: 0;
    left: 0;
    -webkit-overflow-scrolling: touch;
    touch-action: none;
    overscroll-behavior: none;
    -webkit-touch-callout: none;
    /* 渐变色 */
    background: linear-gradient(to bottom, var(--secondary-bright) 0%, #111 calc(5% + var(--safe-area-top)));
}

/* ===== 分屏布局 ===== */
.splitPage {
    scrollbar-width: none;
}

.splitPage-left {
    width: 96%;
    /* background-color: #111; */
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-width: none;
    min-width: 80%;
}

.splitPage-right {
    width: 4%;
    max-width: 15%;
    min-width: 2.5em;
    background-color: #0b0b0b;
    z-index: 2;
    position: relative;
}

.splitPage-right:hover {
    min-width: 5em;
    width: 15%;
    background-color: #3331;
}

.currentArea {
    position: absolute;
    width: 100%;
    background-color: #234;
    pointer-events: none;
    z-index: 8;
    mix-blend-mode: hue;
}

.timeline-canvas {
    position: absolute;
    height: 100vh;
    width: 100%;
    top: 0;
    z-index: 6;
    mix-blend-mode: luminosity;
    touch-action: none;
}

/* ===== 头部区域 ===== */
.splitPage-left-top {
    position: sticky;
    top: 0;
    backdrop-filter: blur(3px);
    z-index: 100;
}


.header {
    justify-content: space-between;
    height: var(--headerHeight);
}

.header-left {
    display: flex;
    align-items: center;
}

.header-left-icon {
    padding: 0 16px;
    align-items: center;
}

#mainIcon {
    position: fixed;
    width: 48px;
    height: 48px;
    left: 15px;
    top: calc(20px + var(--safe-area-top));
    /* top: calc(20px + var(--safe-area-top)); */
    /* position: fixed; */
    transform: scale(1.8);
    z-index: 0;
    /* background-color: #fff8; */
    /* border-radius: 30px; */
}

.mainIconPlace {
    max-width: 130px;
    min-width: 130px;
}

#Play-Pole {
    transform-origin: left bottom;
    transform-origin: 15px 142px;
}

#circlePlay,
#Play-Icon {
    transform-origin: center;
}

.playing-circle {
    transform-origin: center;
    animation: rotate360 12s linear infinite;
}

@keyframes rotate360 {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.descriptions-title {
    font-size: 0.8em;
    min-width: 4em;
    color: #888;
}

.descriptions-text {
    font-size: 1.2em;
}

.pageContainer {
    padding: 1em 0.2em;
}

.header-right {
    display: flex;
    flex-direction: column;
    justify-content: end;
    width: 100%;
}

.header-description {
    display: flex;
    align-items: center;
    width: 100%;
    height: 2em;
}

.description-text {
    font-size: 0.9em;
    padding: 0;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
}

.description-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.description-icon:hover {
    opacity: 1;
}

.lyric-line-icon.selectedRow::before,
.multiRowSelected::before {
    display: flex;
    align-items: center;
    content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none"><circle cx="8" cy="8" r="7" stroke="%23ffffff" stroke-width="1"/><path d="M5 8l2 2 4-4" stroke="%23ffffff" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    margin-right: 10px;
    /* display: inline-block; */
}

.description-icon.locked svg path {
    fill: #f84;
}

.locked {
    animation: lock 0.5s ease;
}

.lock-tip {
    font-size: 0.5em;
    color: #fff;
    border-color: #f84 !important;
}

@keyframes lock {
    0% {
        transform: scale(1);

    }

    50% {
        transform: scale(1.5);
    }

    100% {
        transform: scale(1);
    }
}


.description-icon.active svg path {
    fill: #f84;
}

.header-functions {
    height: 2em;
    width: 90%;
    display: flex;
}

.file-operate {
    width: 100%;
    justify-content: space-between;
}

.functions {
    height: 2em;
    align-items: center;
    display: flex;
    gap: 10px;
}

.functions-icon {
    opacity: 0.5;
}

.format-btn {
    display: flex;
    color: var(--primary-birght);
}

.functions-icon:hover {
    opacity: 1;
}

.s-btn {
    padding: 1px 5px;
    min-width: 40px;
    border-radius: 2em;
    border: 1.5px solid var(--heighLight);
    font-size: 0.4em;
}

/* ===== 内容容器 ===== */
.lyrics-container,
.file-container,
.setting-container {
    padding: 1em;
}

.file-container,
.setting-container {
    padding-bottom: var(--save-bottom);
}

.lyrics-container {
    padding-bottom: 50vh;
}

.lyrics-content,
.file-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* ===== 文本行样式 ===== */
.text-line {
    background-color: transparent;
    padding: 5px 10px;
    display: flex;
    justify-content: space-between;
}

.header-title {
    /* text-shadow: #000 1px 2px 1px; */
    padding: 5px;
}

.head-line {
    width: 88%;
}

.text-line:hover,
.head-line:hover {
    background-color: rgba(0, 0, 0, 0.6);
    transform: scale(1.01);
}

.line-number {
    display: flex;
    justify-content: end;
    margin-left: -25px;
    padding: 0 2px;
    font-size: 9px;
    color: #fff8;
    width: 16px;
}

.line-text {
    font-size: 1em;
    padding-left: 10px;
    overflow: visible;
    width: 100%;
    word-wrap: break-word;
    white-space: normal;
}

.line-text.new-file-text {
    white-space: nowrap;
}


.line-text-new {
    display: flex;
    width: 100%;
    color: #fff6;
    font-size: 1.5em;
    gap: 10px;
    justify-content: space-between;
}

.Lyric-new-line {
    border-radius: 30px;
    justify-content: end;
    background: linear-gradient(0deg, #111, #6663);
    backdrop-filter: blur(10px);
    bottom: calc(100px + var(--save-bottom));
    position: sticky;
}

.lyric-action-btn-text {
    font-size: 0.7em;
    color: #888;
}

/* 歌词操作按钮样式 */
.lyric-action-btn {
    color: #888;
    background: #333;
    padding: 2px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.lyric-action-btn svg {
    width: 20px;
    height: 20px;
    transition: all 0.2s ease;
}

.lyric-action-btn:hover {
    /* color: var(--secondary-bright); */
    color: #f84;
}

.lyric-action-btn:hover svg {
    transform: scale(1.1);
}

.lyric-action-btn:active,
.lyric-action-btn.active {
    color: #f84;
    border-color: #007bff;
}

.lyric-action-btn:disabled {
    color: #555;
    cursor: not-allowed;
    opacity: 0.6;
}

.lyric-action-btn:disabled svg {
    opacity: 0.5;
}

.Lyric-line {
    padding: 6px;
}


/* 等待选择状态样式 */
.Lyric-line.waitForSelect {
    background-color: #f841;
    cursor: pointer;
    transition: all 0.3s ease;
}

.Lyric-line.waitForSelect:hover {
    background-color: var(--primary-back-opc);
    transform: scale(1.02);
}

/* 选中状态样式 */
.Lyric-line.lyric-line-icon.selected {
    background-color: var(--secondary-bright);
}

.multiRowSelected {
    background-color: var(--secondary-back) !important;
    color: var(--highLight) !important;
}

.file-new-line {
    background-color: #8881;
}

.badge {
    display: flex;
    font-size: 10px;
    margin-right: -0.5em;
    border-radius: 1em;
    color: #fff4;
    background-color: #0002;
    align-items: center;
    min-width: 60px;
    justify-content: center;
    height: 20px;
}

.badge-edit {
    background-color: #2228;
}

.badage-click:hover {
    color: #fff;
}

.badge-edit:hover {
    background-color: #fff5;
    color: #000;
}

.line-text:hover {
    color: var(--primary-birght)
}

.file-line .badge {
    min-width: 110px;
    background: #0002;
}

.file-line .badge:hover {
    background: #842;
    color: #fff;
}

.file-line-icon::before {
    content: url('data:image/svg+xml;utf8,<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 4.9V13.2944C13.0006 13.3864 12.9854 13.4776 12.9553 13.5629C12.9251 13.6481 12.8806 13.7257 12.8242 13.7913C12.7679 13.8568 12.7008 13.909 12.6268 13.9448C12.5529 13.9806 12.4735 13.9994 12.3931 14H2.60683C2.446 14 2.29174 13.9269 2.17795 13.7967C2.06417 13.6665 2.00016 13.4898 2 13.3056V0.6944C2 0.3185 2.27317 0 2.60989 0H8.72221V4.2C8.72221 4.38565 8.7866 4.5637 8.9012 4.69497C9.01581 4.82625 9.17124 4.9 9.33332 4.9H13ZM13 3.5H9.94443V0.00209997L13 3.5Z" fill="white" /></svg>');
}

/* ===== 时间轴区域 ===== */
.search {
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--headerHeight);
    gap: 5px;
    z-index: 20;
    padding-bottom: 0.5em;
}

.search * {
    pointer-events: none;
}

.time-badge {
    font-size: 11px;
    border-radius: 2em;
    color: #fff7;
    min-width: 28px;
    height: 14px;
}

.viewPot {
    position: relative;
    top: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    height: calc(95vh - var(--headerHeight)*2);
    z-index: 20;
    pointer-events: none;
}

/* 移动端优化 */
/* @media (max-width: 768px) {
    .viewPot {
        height: calc(90vh - var(--headerHeight)*1.5);
    }

    .lyrics-container,
    .file-container {
        padding: 0.5em;
    }

    .text-line {
        padding: 8px 5px;
    }

    .line-text {
        font-size: 0.9em;
        line-height: 1.4;
    }
} */



.markline,
.upLine,
.downLine {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 50px;
    align-items: center;
    z-index: 10;
    position: relative;
    pointer-events: auto;
}

/* 修正线的位置 */
.markline {
    margin-top: -20px;
    z-index: 20;
}

.downLine {
    margin-top: -5px;
    z-index: 18;
}


.markline-container {
    width: 100%;
    overflow: hidden;
}

.mark-line {
    width: 100%;
    height: 1px;
    background-color: #842;
    transition: all 0.25s linear;
}

.mark-line.highlight {
    background-color: #f84;
}

.mark-Digits.highlight {
    color: #f84 !important;
}

/* 歌词行高亮样式 */
.Lyric-line.highlight {
    background-color: rgba(255, 136, 68, 0.2);
    border-left: 3px solid #f84;
    transition: all 0.3s ease;
}

.Lyric-line.highlight .line-text {
    color: #f84;
    font-weight: bold;
    transform: scale(1.2) translateX(20px);
}

.Lyric-line.highlight .badge {
    color: #f84;
    background-color: rgba(255, 136, 68, 0.3);
}


.startDrag .mark-line {
    background-color: var(--primary-birght);
}

.startDrag .mark-Digits {
    color: var(--primary-birght);
}

.startDrag .handler {
    background-color: #005e45;
}


.mark-Digits {
    width: 100%;
    height: 20px;
    font-size: 0.7em;
    color: #842a;
}

.mark-icon {
    width: 100%;
    justify-content: center;
    height: 5px;
}

.mark-handler {
    display: flex;
    justify-content: center;
    width: 100%;
    height: 50px;
}

.handler {
    width: 90%;
    height: 25px;
    border-radius: 0 0 75px 75px;
    background-color: #8424;
}

.markhandler {
    background-color: #8420;
}

.handler:hover,
.markhandler:hover {
    background-color: #1238;
}

.handler-icon path {
    fill: #a42;
}

.mid-line-handler {
    position: fixed;
    right: 0px;
    top: calc(100vh/2 - var(--headerHeight)/2 + 15px);
    width: 25px;
    height: 50px;
    border-radius: 75px 0 0 75px;
}

/* ===== 播放控制器 ===== */
.docker {
    position: fixed;
    display: flex;
    flex-direction: column;
    background: radial-gradient(at bottom left,
            #005e45 0%,
            rgba(0, 0, 0, 0.5) 60%);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    left: 10px;
    bottom: calc(10px + var(--save-bottom));
    border-radius: 10px;
    padding: 1em;
    z-index: 1000;
    width: 80%;
    min-height: 80px;
    padding-bottom: 40px;
    min-width: 260px;
    transition: all 0.3s ease;
    border: outset 1px solid #fff2;
}

.player {
    position: absolute;
    z-index: 2;
    bottom: 20px;
    width: 80%;
}

.waveCanvas {
    position: absolute;
    bottom: 1px;
    left: 1px;
    width: 100%;
    height: 75px;
    border-radius: 9px;
    pointer-events: none;
    z-index: 0;
    color: #b4b411;
}

.player {
    display: flex;
    flex-direction: row;
}

.loadFile {
    color: #f84;
    line-height: 2em;
}

.musicListor {
    flex-shrink: 0;
    max-height: 250px;
    overflow: hidden;
}

.musicList {
    max-height: 250px;
    overflow-y: scroll;
    scrollbar-width: none;
    padding-bottom: 0.5em;

}

.driver-line {
    width: 100%;
    height: 1px;
    background-color: #0008;
    padding: 0;
    margin: 0.5em 0;
}

.groupContainer {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
}

.hideList {
    max-height: 0px !important;
}


.musicItem {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    line-height: 2em;
}

.musicName {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 200px;
}

.musicName,
.musicDuration,
.timer {
    font-size: 0.8em;
}

.timer {
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    width: 100%;
    padding: 0 0.5em;
}

.btn-container {
    flex: 1;
}

.btn-container .icon {
    flex-shrink: 0;
    cursor: pointer;
}

.btn-container .icon:hover {
    transform: scale(1.1);
}

.currentMusic {
    gap: 0.5em;
    padding-bottom: .5em;
    overflow: hidden;
    width: 100%;
    background-color: 0001;
}

.musicIco {
    min-width: 16px;
    min-height: 16px;
}

.music-text-con {
    overflow: hidden;
    width: 100%;
    flex: 1;
}

.music-text {
    color: var(--heighLight);
    font-size: 0.8em;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    width: auto;
}

.music-text:not(.scrolling) {
    text-overflow: ellipsis;
}

.music-text.scrolling {
    animation: scroll-text 20s linear infinite;
    text-overflow: unset;
}

@keyframes scroll-text {
    0% {
        transform: translateX(100%);
    }

    50% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);

    }

}

.volume-container {
    display: flex;
    min-width: 30%;
    align-items: center;
    gap: 5px;
}

.volume {
    display: flex;
    font-size: 0.5em;
    color: var(--primary-back);
    min-width: 3em;
    justify-content: end;
}

.volume-bar {
    flex: 2;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
}

.volume-value {
    height: 100%;
    background: var(--primary-back);
    border-radius: 2px;
    width: 30%;
}

.waveform-controls {
    position: absolute;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.waveform-controls .icon {
    flex-shrink: 0;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
}

.waveform-controls .icon:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.2);
}

audio {
    display: none;
}