/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.subtitle {
    opacity: 0.9;
    font-size: 1rem;
}

/* 主要内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 500px;
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* 输入和输出区域通用样式 */
.input-section,
.output-section {
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.input-section {
    border-right: 1px solid #eee;
}

h2 {
    font-size: 1.25rem;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

/* 表单元素 */
.form-group {
    margin-bottom: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.6;
    resize: none;
    transition: border-color 0.3s ease;
    font-family: inherit;
    height: 420px;
    overflow-y: auto;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

/* 按钮样式 */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f5f5f5;
    color: #555;
}

.btn-secondary:hover:not(:disabled) {
    background: #e8e8e8;
}

/* 输出区域样式 */
.output-wrapper {
    background: #fafafa;
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    height: 420px;
    overflow-y: auto;
    overflow-x: auto;
}

.output-content {
    padding: 20px;
    line-height: 2.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.placeholder-text {
    color: #999;
    text-align: center;
    padding: 100px 0;
}

/* 注音样式 (ruby标签) */
ruby {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin-right: 0.2em;
}

rt {
    font-size: 0.8em;
    color: #667eea;
    line-height: 1;
    text-align: center;
    order: -1;
}

/* 标点符号样式 - 与汉字同行 */
.punctuation {
    display: inline-block;
    vertical-align: bottom;
}

/* 多音字样式 */
.duoyinzi {
    cursor: pointer;
    border-bottom: 2px dashed #667eea;
    border-radius: 2px;
}

.duoyinzi:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

/* 拼音选择器样式 */
.pinyin-selector {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 10px;
    z-index: 1000;
    min-width: 120px;
}

.pinyin-selector-title {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.pinyin-option {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    margin: 2px 0;
    transition: background-color 0.2s;
}

.pinyin-option:hover {
    background-color: #f0f0f0;
}

.pinyin-option.selected {
    background-color: #667eea;
    color: white;
}

/* 页脚 */
footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.875rem;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* 成功提示动画 */
.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4caf50;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2s forwards;
    z-index: 1000;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        visibility: hidden;
    }
}