* {
    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;
    color: #333;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

/* 美化的头部 */
.main-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 30px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    margin-bottom: 20px;
    color: white;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.logo-text h1 {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.tagline {
    font-size: 0.75rem;
    margin: 3px 0 0 0;
    opacity: 0.9;
    font-weight: 400;
}

.main-nav {
    display: flex;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.nav-item:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.4);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.nav-item.active {
    background: white;
    color: #667eea;
    border-color: white;
    font-weight: 600;
}

.nav-icon {
    font-size: 1.1rem;
}

.nav-text {
    font-size: 0.9rem;
}

.main-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.section {
    margin-bottom: 30px;
}

.section h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #667eea;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.section h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #667eea;
}

/* 录音人输入区域 */
.recorder-input-form {
    display: flex;
    gap: 15px;
    align-items: center;
}

.name-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1.1rem;
    transition: all 0.3s;
}

.name-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 会话头部 */
.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.session-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.recorder-name {
    font-size: 1.1rem;
    color: #666;
}

.recorder-name strong {
    color: #667eea;
}

/* 当前录音控制 */
.current-recording {
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 20px;
    z-index: 100;
    margin-bottom: 20px;
}

.current-text-display {
    margin-bottom: 20px;
}

.text-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
}

.text-content {
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    padding: 20px;
    background: white;
    border-radius: 10px;
    text-align: center;
    line-height: 1.6;
}

.recording-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
}

.recording-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
    margin-top: 8px;
}

.status-text {
    font-weight: 600;
    color: #667eea;
}

.status-text.recording {
    color: #dc3545;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.duration-text {
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

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

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-large {
    padding: 15px 30px;
    font-size: 1.1rem;
}

/* 文本列表 */
.texts-recording-list {
    margin-top: 30px;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.pagination-controls label {
    font-size: 0.9rem;
    color: #666;
}

.page-size-select,
.status-filter-select {
    padding: 6px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    background-color: white;
    transition: border-color 0.3s;
}

.page-size-select:hover,
.status-filter-select:hover {
    border-color: #667eea;
}

.page-size-select:focus,
.status-filter-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.texts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 600px;
    overflow-y: auto;
}

.text-list-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    align-items: flex-start;
}

.text-list-item:hover {
    border-color: #667eea;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.1);
    transform: translateX(5px);
}

.text-list-item.active {
    border-color: #f59e0b;
    border-width: 3px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2), 0 5px 20px rgba(245, 158, 11, 0.4);
    transform: scale(1.02);
}

.text-list-item.recorded {
    border-color: #28a745;
    background: #f0fff4;
}

.text-list-item.recorded:hover {
    border-color: #28a745;
}

.text-list-item.recorded.active {
    border-color: #10b981;
    border-width: 3px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25), 0 5px 20px rgba(16, 185, 129, 0.4);
    transform: scale(1.02);
}

.text-list-item.recorded.active .item-number {
    background: #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.item-number {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 2px;
}

.text-list-item.recorded .item-number {
    background: #28a745;
}

.text-list-item.active .item-number {
    background: #f59e0b;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-text {
    font-size: 1rem;
    color: #333;
    margin-bottom: 8px;
    font-weight: 500;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    overflow: visible;
    line-height: 1.5;
}

.item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    font-size: 0.9rem;
    color: #666;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.status-recorded {
    color: #28a745;
    font-weight: 600;
}

.status-pending {
    color: #999;
}

.mini-player {
    height: 30px;
    max-width: 200px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

/* 响应式设计 - 移动端优化 */
@media (max-width: 768px) {
    /* 基础布局 */
    body {
        padding: 10px;
    }
    
    .container {
        padding: 5px;
    }
    
    /* 头部优化 - 极度紧凑 */
    .main-header {
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .header-content {
        flex-direction: row;
        gap: 8px;
        align-items: center;
        justify-content: space-between;
    }
    
    .logo-section {
        gap: 6px;
        flex: 1;
    }
    
    .logo-icon {
        font-size: 1.5rem;
    }
    
    .logo-text h1 {
        font-size: 1.1rem;
    }
    
    .tagline {
        display: none; /* 移动端隐藏标语 */
    }
    
    /* 导航优化 */
    .main-nav {
        display: flex;
        gap: 4px;
    }
    
    .nav-item {
        padding: 6px 10px;
        font-size: 0.8rem;
        border-radius: 6px;
    }
    
    .nav-icon {
        font-size: 1rem;
    }
    
    .nav-text {
        display: none; /* 只显示图标 */
    }
    
    /* 内容区域 */
    .main-content {
        padding: 6px;
    }
    
    .section {
        padding: 8px;
        margin-bottom: 8px;
    }
    
    /* 录音人输入区 */
    .recorder-input-form {
        flex-direction: row;
        gap: 6px;
    }
    
    .name-input {
        flex: 1;
        font-size: 16px; /* 防止iOS自动缩放 */
        padding: 8px;
    }
    
    .btn {
        justify-content: center;
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    /* 录音会话区 */
    .session-header {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        justify-content: space-between;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        padding: 8px;
        margin: -8px -8px 8px -8px;
        border-bottom: 2px solid #e9ecef;
    }
    
    .session-header h2 {
        font-size: 1rem;
        margin: 0;
    }
    
    .session-info {
        flex-direction: row;
        gap: 6px;
        align-items: center;
    }
    
    .recorder-name {
        font-size: 0.8rem;
    }
    
    .btn-small {
        font-size: 0.75rem;
        padding: 4px 8px;
        flex-shrink: 0;
    }
    
    /* 录音控制区 */
    .current-recording {
        padding: 8px;
        position: sticky;
        top: 40px; /* 紧贴会话头部 */
        background: white;
        z-index: 9;
        border-bottom: 2px solid #e9ecef;
        margin: -8px -8px 0px -8px; /* 下边距改为0 */
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
    
    .recording-controls {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap; /* 强制单行 */
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .btn-large {
        flex: 1;
        min-width: fit-content;
        padding: 14px 10px;
        font-size: 1rem;
        min-height: 50px; /* 增大触摸区域 */
        white-space: nowrap;
        font-weight: 600;
        border: none;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        transition: all 0.2s;
    }
    
    .btn-large:active {
        transform: scale(0.95);
        box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    }
    
    .btn-large:disabled {
        opacity: 0.5;
        transform: none;
    }
    
    .recording-status {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        padding: 10px;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        border-radius: 8px;
        margin-top: 8px;
        box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .status-text {
        font-size: 0.95rem;
        font-weight: 600;
        color: #495057;
    }
    
    .status-text.recording {
        color: #dc3545;
        animation: pulse 1.5s infinite;
    }
    
    .duration-text {
        font-size: 1.1rem;
        font-weight: 700;
        color: #667eea;
        font-family: 'Courier New', monospace;
    }
    
    @keyframes pulse {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.6; }
    }
    
    /* 文本列表区 */
    .texts-recording-list {
        padding: 6px 8px 0 8px; /* 上padding减小 */
        background: white;
        border-radius: 12px;
        margin: 4px 0 0 0; /* 上边距4px */
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
    
    .list-header {
        margin-bottom: 6px;
        padding-top: 2px;
    }
    
    .pagination-controls {
        display: flex;
        flex-direction: row;
        gap: 4px;
        align-items: center;
        background: #f8f9fa;
        padding: 6px;
        border-radius: 6px;
    }
    
    .pagination-controls label {
        font-size: 0.75rem;
        white-space: nowrap;
        min-width: fit-content;
        font-weight: 600;
        color: #495057;
        flex-shrink: 0;
    }
    
    .page-size-select,
    .status-filter-select {
        min-width: 80px;
        font-size: 14px;
        padding: 6px 8px;
        border: 2px solid #dee2e6;
        border-radius: 6px;
        font-weight: 500;
        min-height: 36px; /* 增大触摸区域 */
    }
    
    /* 文本列表项 - 移动端优化 */
    .texts-list {
        max-height: calc(100vh - 255px); /* 动态高度，占满剩余空间 */
        gap: 6px;
        margin-top: 0; /* 移除上边距 */
    }
    
    .text-list-item {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start;
        gap: 10px;
        padding: 10px;
        cursor: pointer;
        transition: all 0.2s;
        min-height: auto;
    }
    
    .text-list-item:hover {
        border-color: #667eea;
        transform: translateX(3px);
    }
    
    .text-list-item:active {
        transform: scale(0.98);
    }
    
    .text-list-item.active {
        border-color: #f59e0b;
        border-width: 3px;
        background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
        box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25), 0 3px 12px rgba(245, 158, 11, 0.4);
    }
    
    .text-list-item.recorded {
        border-color: #28a745;
        background-color: #f0fff4;
    }
    
    .text-list-item.recorded.active {
        border-color: #10b981;
        border-width: 3px;
        background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
        box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25), 0 3px 12px rgba(16, 185, 129, 0.4);
    }
    
    .text-list-item.recorded.active .item-number {
        background: #10b981;
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    }
    
    .item-number {
        flex-shrink: 0;
        width: 35px;
        height: 35px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
        font-weight: 700;
    }
    
    .item-content {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding-right: 0; /* 默认无右边距 */
    }
    
    .item-text {
        font-size: 0.85rem;
        line-height: 1.5;
        font-weight: 500;
        color: #333;
        word-wrap: break-word;
        word-break: break-word;
        white-space: normal;
        overflow: visible;
        margin-bottom: 0;
        display: block;
        padding-right: 0; /* 确保文本不会超出内容区域 */
    }
    
    .item-meta {
        display: none !important; /* 移动端隐藏元数据 */
    }
    
    .meta-item {
        display: none !important;
    }
    
    .status-recorded {
        display: none !important;
    }
    
    /* 移动端隐藏音频播放器 */
    .mini-player {
        display: none !important;
    }
    
    /* 播放按钮 */
    .play-button {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(102, 126, 234, 0.1);
        border-radius: 50%;
        cursor: pointer;
        font-size: 1rem;
        transition: all 0.2s;
        z-index: 2;
    }
    
    .play-button:hover {
        background: rgba(102, 126, 234, 0.2);
        transform: translateY(-50%) scale(1.1);
    }
    
    .play-button:active {
        transform: translateY(-50%) scale(0.95);
    }
    
    .play-button.playing {
        background: rgba(102, 126, 234, 0.3);
        animation: pulse 1.5s infinite;
    }
    
    /* 正在播放的项添加边框 */
    .text-list-item.playing {
        border-color: #667eea;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    }
    
    .text-list-item {
        position: relative;
        padding-right: 10px;
    }
    
    /* 有播放按钮的项，item-content需要更多右边距，避免文字被遮挡 */
    .text-list-item.has-play-button .item-content {
        padding-right: 50px;
    }
    
    /* 分页控件 */
    .pagination-wrapper {
        gap: 10px;
    }
    
    .pagination-info {
        font-size: 0.9rem;
        text-align: center;
    }
    
    .pagination-buttons {
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .btn-page {
        padding: 8px 12px;
        min-width: 36px;
        font-size: 0.85rem;
    }
    
    /* 空状态 */
    .empty-state {
        padding: 30px 15px;
        font-size: 0.9rem;
    }
}

/* 超小屏幕优化 (手机竖屏) */
@media (max-width: 480px) {
    .logo-text h1 {
        font-size: 1rem;
    }
    
    .nav-item {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .btn-large {
        font-size: 0.9rem;
        padding: 12px 8px;
        min-height: 48px; /* 保持足够大 */
    }
    
    .recording-status {
        padding: 8px;
    }
    
    .status-text {
        font-size: 0.85rem;
    }
    
    .duration-text {
        font-size: 1rem;
    }
    
    .pagination-controls {
        padding: 5px;
        gap: 3px;
    }
    
    .pagination-controls label {
        font-size: 0.7rem;
        flex-shrink: 0;
    }
    
    .page-size-select,
    .status-filter-select {
        min-width: 65px;
        font-size: 13px;
        padding: 4px 5px;
        min-height: 32px;
    }
    
    .text-list-item {
        padding: 10px;
        min-height: 55px;
        gap: 8px;
    }
    
    .item-number {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    
    .item-text {
        font-size: 0.8rem;
        font-weight: 500;
        line-height: 1.5;
        word-wrap: break-word;
        word-break: break-word;
        white-space: normal;
        overflow: visible;
    }
    
    .play-button {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    /* 超小屏幕：有播放按钮的项，item-content需要更多右边距 */
    .text-list-item.has-play-button .item-content {
        padding-right: 45px;
    }
    
    .item-meta {
        display: none !important; /* 超小屏幕也隐藏 */
    }
    
    .meta-item {
        display: none !important;
    }
    
    .mini-player {
        height: 28px;
        margin-top: 3px;
    }
    
    .text-list-item {
        padding: 8px;
        min-height: auto;
        align-items: flex-start;
    }
    
    .btn-page {
        padding: 6px 8px;
        font-size: 0.75rem;
        min-width: 30px;
    }
    
    .section {
        padding: 6px;
    }
}

/* 分页控件 */
.pagination {
    margin-top: 20px;
}

.pagination-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.pagination-info {
    font-size: 0.9rem;
    color: #666;
}

.pagination-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-page {
    padding: 8px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    color: #333;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 40px;
}

.btn-page:hover:not(:disabled) {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-1px);
}

.btn-page.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.btn-page.disabled,
.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 8px;
    color: #999;
}

/* 滚动条样式 */
.texts-list::-webkit-scrollbar {
    width: 8px;
}

.texts-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.texts-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.texts-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}
