* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    color: #333;
}

/* 动态背景 */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 装饰元素 */
.decoration {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 6s ease-in-out infinite;
}

.decoration:nth-child(1) {
    width: 80px;
    height: 80px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.decoration:nth-child(2) {
    width: 100px;
    height: 100px;
    top: 70%;
    left: 80%;
    animation-delay: 2s;
}

.decoration:nth-child(3) {
    width: 60px;
    height: 60px;
    top: 20%;
    left: 85%;
    animation-delay: 4s;
}

.decoration:nth-child(4) {
    width: 120px;
    height: 120px;
    top: 80%;
    left: 15%;
    animation-delay: 1s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

.container {
    background: rgba(255, 255, 255, 0.92);
    padding: 40px;
    border-radius: 25px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    text-align: center;
    width: 90%;
    max-width: 900px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: transform 0.3s ease;
}

.container:hover {
    transform: translateY(-1px);
}

h1 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 3em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    background: linear-gradient(45deg, #2575fc, #6a11cb, #e73c7e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: titleGradient 5s ease infinite;
}

@keyframes titleGradient {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.font-selector, .theme-selector, .display-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

select {
    padding: 10px 15px;
    border-radius: 10px;
    border: 2px solid #ddd;
    background: white;
    font-size: 1em;
    transition: all 0.3s ease;
    outline: none;
}

select:focus {
    border-color: #6a11cb;
    box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.2);
}

label {
    font-weight: bold;
    color: #2c3e50;
}

.input-area {
    margin-bottom: 30px;
}

#chineseInput {
    width: 100%;
    padding: 20px;
    font-size: 1.5em;
    border: 2px solid #ddd;
    border-radius: 15px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    font-family: inherit;
    text-align: center;
}

#chineseInput:focus {
    border-color: #6a11cb;
    box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.2);
    outline: none;
}

.pinyin-display-container {
    position: relative;
    margin-bottom: 20px;
}

.pinyin-display {
    min-height: 200px;
    max-height: 400px;
    padding: 30px;
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
    border-radius: 20px;
    border: 2px dashed #6a11cb;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 2em;
    line-height: 1.8;
    box-shadow: inset 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 自定义滚动条 */
.pinyin-display::-webkit-scrollbar {
    width: 12px;
}

.pinyin-display::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.pinyin-display::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #6a11cb, #2575fc);
    border-radius: 10px;
}

.pinyin-display::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #2575fc, #6a11cb);
}

.pinyin-ruby {
    margin: 0 10px 15px 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.pinyin-char {
    color: #2c3e50;
    font-weight: bold;
    transition: all 0.3s ease;
}

.pinyin-tone {
    color: #e74c3c;
    font-size: 0.7em;
    margin-bottom: 5px;
    font-weight: bold;
}

.hint {
    color: #7f8c8d;
    margin-top: 20px;
    font-size: 1.1em;
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #6a11cb;
}

.stat-label {
    font-size: 0.9em;
    color: #7f8c8d;
}

.scroll-indicator {
    position: absolute;
    bottom: 10px;
    right: 20px;
    color: #6a11cb;
    font-size: 0.9em;
    display: none;
}

/* 字体样式 */
.font-default {
    font-family: 'KaiTi', '楷体', serif;
}

.font-fangsong {
    font-family: 'FangSong', '仿宋', serif;
}

.font-kaiti {
    font-family: 'KaiTi', '楷体', serif;
}

.font-mashanzheng {
    font-family: 'Ma Shan Zheng', cursive;
}

.font-xiaowei {
    font-family: 'ZCOOL XiaoWei', serif;
}

.font-qingke {
    font-family: 'ZCOOL QingKe HuangYou', cursive;
}

/* 显示模式 */
.display-compact .pinyin-ruby {
    margin: 0 4px 8px 4px;
    min-width: 45px;
}

.display-compact .pinyin-display {
    font-size: 1.5em;
    line-height: 1.4;
}

.display-normal .pinyin-ruby {
    margin: 0 5px 10px 5px;
    min-width: 50px;
}

.display-normal .pinyin-display {
    font-size: 1.6em;
    line-height: 1.6;
}

.display-spacious .pinyin-ruby {
    margin: 0 15px 20px 15px;
    min-width: 70px;
}

.display-spacious .pinyin-display {
    font-size: 2.4em;
    line-height: 2;
}

/* 主题样式 */
.theme-classic {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
}

.theme-sunset {
    background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%);
}

.theme-ocean {
    background: linear-gradient(135deg, #1a2980 0%, #26d0ce 100%);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 25px;
    }

    h1 {
        font-size: 2.2em;
    }

    .controls {
        flex-direction: column;
        align-items: center;
    }

    .pinyin-display {
        font-size: 1.6em;
        padding: 20px;
        max-height: 300px;
    }

    .pinyin-ruby {
        margin: 0 8px 10px 8px;
    }
}