/* 数字大小写切换独有样式 */
.dx-section{
    min-height: 100vh;
    padding: 120px 0 80px;
}
.dx-container{
    max-width: 680px;
    margin: 0 auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 10px 30px rgba(0,0,0,.1);
    backdrop-filter: blur(10px);
}
.dx-container h2{
    text-align: center;
    margin-bottom: .5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2.2rem;
    font-weight: 700;
}
.dx-subtitle{
    text-align: center;
    color: var(--text-gray);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}
.mode-toggle{
    display: flex;
    background: rgba(0,0,0,.05);
    border-radius: 15px;
    padding: 6px;
    margin: 0 auto 2rem;
    max-width: 400px;
    border: 1px solid var(--border-color);
}
.mode-btn{
    flex: 1;
    padding: 12px;
    text-align: center;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all .3s ease;
    color: var(--text-gray);
    position: relative;
    z-index: 2;
}
.mode-btn.active{
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,.1);
    color: #2c3e50;
    transform: translateY(-2px);
}
.form-group{
    margin-bottom: 1.8rem;
}
.form-group label{
    display: block;
    margin-bottom: .8rem;
    color: var(--text-gray);
    font-weight: 500;
    font-size: 1.1rem;
}
.input-box{
    position: relative;
}
textarea{
    width: 100%;
    resize: vertical;
    padding: 1rem 2.5rem 1rem 1rem;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    background: var(--dark-bg);
    color: var(--text-light);
    border-radius: 12px;
    outline: none;
    transition: all .3s ease;
    font-family: inherit;
}
textarea:focus{
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(0,198,255,.2);
}
.clear-btn{
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color .3s ease;
}
.clear-btn:hover{
    color: var(--accent-color);
}
.btn-block{
    width: 100%;
    margin-top: 1.5rem;
    padding: 1.2rem;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-color), #00a8e8);
    box-shadow: 0 8px 25px rgba(0,198,255,.4);
    transition: all .4s ease;
    display: block;
    border: none;
    color: white;
    cursor: pointer;
}
.btn-block:hover{
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0,198,255,.5);
}
.result-box{
    margin-top: 2.5rem;
    padding: 1.8rem;
    background: linear-gradient(135deg, rgba(0,198,255,.08), rgba(0,198,255,.03));
    border-left: 4px solid var(--accent-color);
    border-radius: 12px;
    display: none;
    animation: fadeIn .5s ease-out;
}
.result-box label{
    display: block;
    margin-bottom: .8rem;
    color: var(--text-gray);
    font-weight: 500;
}
.output-area{
    min-height: 100px;
    padding: 1rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 1.3rem;
    line-height: 1.6;
    word-break: break-all;
}
.copy-btn{
    margin-top: 1rem;
    padding: .6rem 1.2rem;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all .3s ease;
}
.copy-btn:hover{
    background: #00a8e8;
    transform: scale(1.05);
}
.back-link{
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-top: 2.5rem;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: all .3s ease;
}
.back-link:hover{
    gap: .8rem;
    color: #00a8e8;
}
@keyframes fadeIn{
    from{opacity: 0; transform: translateY(20px);}
    to{opacity: 1; transform: translateY(0);}
}

/* 历史记录样式 */
/* 历史记录样式 - 修复版 */
.history-section {
    margin-top: 2.5rem;
    padding: 1.8rem;
    background: linear-gradient(135deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    animation: fadeIn .5s ease-out;
    /* 添加固定高度和滚动控制 */
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: .8rem;
    border-bottom: 1px solid var(--border-color);
    /* 防止被压缩 */
    flex-shrink: 0;
}

.history-header h3 {
    color: var(--text-light);
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.clear-history-btn {
    padding: .4rem .8rem;
    background: rgba(255,59,48,.1);
    color: #ff3b30;
    border: 1px solid rgba(255,59,48,.3);
    border-radius: 6px;
    cursor: pointer;
    font-size: .9rem;
    transition: all .3s ease;
}

.clear-history-btn:hover {
    background: rgba(255,59,48,.2);
    transform: scale(1.05);
}

.history-list {
    /* 修复滚动问题 */
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* 重要：允许收缩 */
    /* 移除最大高度限制，由父容器控制 */
}

.history-item {
    padding: 1rem;
    margin-bottom: .8rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all .3s ease;
    position: relative;
    /* 修复布局抖动 */
    transform: translateX(0);
    border-left: 3px solid transparent;
}

.history-item:hover {
    border-color: var(--accent-color);
    background: rgba(0,198,255,.05);
    /* 移除会引起布局变化的 transform */
    /* transform: translateX(5px); */
    box-shadow: 0 2px 8px rgba(0,198,255,.1);
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-input {
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: .3rem;
    word-break: break-all;
    font-size: 0.95rem;
}

.history-output {
    color: var(--accent-color);
    font-weight: 600;
    word-break: break-all;
    font-size: 1rem;
}

.history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: .5rem;
    font-size: .8rem;
    color: var(--text-gray);
}

.history-mode {
    background: rgba(0,198,255,.1);
    color: var(--accent-color);
    padding: .2rem .5rem;
    border-radius: 4px;
    font-size: .75rem;
}

.history-time {
    font-size: .75rem;
}

/* 修复滚动条样式 - 确保只在需要时显示 */
.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(0,198,255,.3);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* 只在悬停时显示滚动条 */
.history-list {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.history-list:hover {
    scrollbar-color: rgba(0,198,255,.3) transparent;
}

.history-list:hover::-webkit-scrollbar-thumb {
    background: rgba(0,198,255,.3);
}

/* 空状态样式 */
.history-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-gray);
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.history-empty i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: .5;
}

/* 确保历史记录项不会超出容器 */
.history-item {
    max-width: 100%;
    box-sizing: border-box;
}

.history-section {
    margin-top: 2.5rem;
    padding: 1.8rem;
    background: linear-gradient(135deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    animation: fadeIn .5s ease-out;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: .8rem;
    border-bottom: 1px solid var(--border-color);
}

.history-header h3 {
    color: var(--text-light);
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.clear-history-btn {
    padding: .4rem .8rem;
    background: rgba(255,59,48,.1);
    color: #ff3b30;
    border: 1px solid rgba(255,59,48,.3);
    border-radius: 6px;
    cursor: pointer;
    font-size: .9rem;
    transition: all .3s ease;
}

.clear-history-btn:hover {
    background: rgba(255,59,48,.2);
    transform: scale(1.05);
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    padding: 1rem;
    margin-bottom: .8rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all .3s ease;
    position: relative;
}

.history-item:hover {
    border-color: var(--accent-color);
    transform: translateX(5px);
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-input {
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: .3rem;
    word-break: break-all;
}

.history-output {
    color: var(--accent-color);
    font-weight: 600;
    word-break: break-all;
}

.history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: .5rem;
    font-size: .8rem;
    color: var(--text-gray);
}

.history-mode {
    background: rgba(0,198,255,.1);
    color: var(--accent-color);
    padding: .2rem .5rem;
    border-radius: 4px;
    font-size: .75rem;
}

.history-time {
    font-size: .75rem;
}

/* 滚动条样式 */
.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: var(--dark-bg);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #00a8e8;
}

/* 空状态样式 */
.history-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-gray);
}

.history-empty i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: .5;
}