* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    touch-action: pan-y;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* 提词器显示区域 */
.teleprompter-display-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #000;
    padding: 0;
    overflow: hidden;
}

.teleprompter-display {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    background: #000;
    padding: 20px;
    -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    /* 优化滚动性能 */
    will-change: scroll-position;
    transform: translateZ(0); /* 启用硬件加速 */
    -webkit-transform: translateZ(0);
    /* 固定高度，确保滚动框 */
    height: 100%;
    box-sizing: border-box;
}

.text-content {
    text-align: center;
    line-height: 1.8;
    font-size: 40px;
    color: #ffffff;
    max-width: 90%;
    margin: 0 auto;
    word-wrap: break-word;
    padding: 20px 0;
    min-height: calc(100% - 40px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.text-content .char {
    display: inline;
    transition: color 0.2s ease;
    color: #ffffff;
}

.text-content .char.read {
    color: #aaaaaa; /* 已读文字颜色 - 不太浅但明显区分 */
}

.text-content .char.current {
    color: #ffffff;
    position: relative;
}

.text-content .char.current::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: #0066ff;
    opacity: 0.5;
}

/* 控制面板 */
.control-panel {
    display: flex;
    justify-content: space-around;
    padding: 15px;
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid #333;
    gap: 10px;
    flex-wrap: wrap;
}

.control-btn {
    flex: 1;
    min-width: 120px;
    padding: 15px 20px;
    background: #1a1a1a;
    color: #fff;
    border: 2px solid #333;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.control-btn:active {
    transform: scale(0.95);
    background: #333;
}

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

.control-btn.active {
    background: #0066ff;
    border-color: #0066ff;
}

.btn-icon {
    font-size: 24px;
}

.btn-text {
    font-size: 14px;
}

/* 状态栏 */
.status-bar {
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.9);
    border-top: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.recognition-text {
    color: #00ff00;
    font-weight: bold;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 设置面板 */
.settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: none;
    overflow-y: auto;
    padding: 20px;
}

.settings-panel.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.settings-content {
    background: #1a1a1a;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    margin-top: 20px;
    border: 1px solid #333;
}

.settings-content h2 {
    margin-bottom: 25px;
    text-align: center;
    color: #fff;
}

.setting-group {
    margin-bottom: 25px;
}

.setting-group label {
    display: block;
    margin-bottom: 10px;
    color: #fff;
    font-size: 16px;
}

.setting-group input[type="range"] {
    width: 100%;
    height: 8px;
    background: #333;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #0066ff;
    border-radius: 50%;
    cursor: pointer;
}

.setting-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #0066ff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.setting-group input[type="color"] {
    width: 100%;
    height: 50px;
    border: 2px solid #333;
    border-radius: 8px;
    cursor: pointer;
    -webkit-appearance: none;
}

.setting-group input[type="text"],
.setting-group select {
    width: 100%;
    padding: 12px;
    background: #2a2a2a;
    border: 2px solid #333;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    margin-top: 5px;
}

.setting-group select {
    cursor: pointer;
}

#fontSizeValue,
#scrollSpeedValue {
    display: inline-block;
    margin-left: 10px;
    color: #0066ff;
    font-weight: bold;
}

.close-btn {
    width: 100%;
    padding: 15px;
    background: #0066ff;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    touch-action: manipulation;
    margin-top: 20px;
}

.close-btn:active {
    transform: scale(0.98);
}

/* 录制面板 */
.record-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: none;
    overflow-y: auto;
    padding: 20px;
}

.record-panel.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.record-content {
    background: #1a1a1a;
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    margin-top: 20px;
    border: 1px solid #333;
}

.record-content h2 {
    margin-bottom: 20px;
    text-align: center;
    color: #fff;
}

#promptTextarea {
    width: 100%;
    min-height: 300px;
    padding: 15px;
    background: #2a2a2a;
    border: 2px solid #333;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 15px;
}

.record-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.record-actions .control-btn {
    flex: 1;
    min-width: 100px;
}

.saved-prompts {
    margin-top: 20px;
}

.saved-prompt-item {
    background: #2a2a2a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.saved-prompt-item:hover {
    background: #333;
    border-color: #0066ff;
}

.saved-prompt-item h3 {
    color: #fff;
    margin-bottom: 5px;
    font-size: 16px;
}

.saved-prompt-item p {
    color: #aaa;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-prompt-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.saved-prompt-actions button {
    flex: 1;
    padding: 8px;
    background: #0066ff;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
}

.saved-prompt-actions button.delete {
    background: #ff3333;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .text-content {
        font-size: 32px;
        max-width: 95%;
    }

    .control-btn {
        min-width: 100px;
        padding: 12px 15px;
    }

    .btn-text {
        font-size: 12px;
    }

    .settings-content,
    .record-content {
        padding: 20px;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .text-content {
        font-size: 28px;
    }

    .control-panel {
        padding: 10px;
    }

    .control-btn {
        min-width: 80px;
        padding: 10px 12px;
    }
}

/* 滚动动画 */
@keyframes scroll {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-100%);
    }
}

.scrolling {
    animation: scroll linear infinite;
}

