/**
 * 粤语声调学习页面样式
 */

/* 页面基础样式 */
.tones-page {
    background: #f8fafc;
}

/* 内容区域 */
.tones-page .content-area {
    max-width: 1400px;
    margin: 0 auto;
}

/* 区域标题 */
.section-header {
    text-align: center;
    margin-bottom: 20px; /* 减少下边距 */
}

.section-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: #1a202c;
    margin: 0 0 8px 0;
}

.section-footer {
    font-size: 28px;
    font-weight: 600;
    color: #1a202c;
    padding: 24px;
}

.section-subtitle {
    font-size: 16px;
    color: #64748b;
    margin: 0;
}

/* 游戏模式切换 */
.game-mode-toggle {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 10px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    justify-content: center;
}

.mode-btn:hover {
    border-color: #3b82f6;
    background: #f1f5f9;
    color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.mode-btn.active {
    border-color: #10b981;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.mode-btn.active:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.mode-icon {
    font-size: 18px;
}

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

/* 游戏面板 */
.game-panel {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 2px solid #10b981;
    animation: slideInDown 0.5s ease;
}

.game-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.control-item {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 0;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: bold;
    color: #1a202c;
}

.timer-display {
    color: #f59e0b;
    font-size: 24px;
    transition: color 0.3s ease;
}

.timer-display.warning {
    color: #ef4444;
}

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

.pause-control-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.pause-control-btn:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.question-section {
    text-align: center;
}

.question-header {
    margin-bottom: 20px;
}

.question-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
}

.question-content {
    text-align: center;
    margin-bottom: 20px;
}

.question-character {
    font-size: 80px;
    font-weight: bold;
    color: #1a202c;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: characterPulse 2s ease-in-out infinite;
}

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

.question-jyutping {
    font-size: 18px;
    color: #64748b;
    font-family: 'Courier New', monospace;
    margin-bottom: 16px;
    font-weight: 600;
}

.play-question-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.play-question-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.play-icon {
    font-size: 16px;
}

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

/* 声调选择区域 */
.tone-selection {
    margin: 24px 0;
    text-align: center;
}

.tone-selection-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 16px;
}

.tone-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    max-width: 100%;
    margin: 0 auto;
    flex-wrap: wrap;
}

.tone-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 70px;
    min-width: 80px;
    justify-content: center;
    position: relative;
    overflow: hidden;
    flex: 1;
    max-width: 120px;
}

.tone-btn:hover {
    border-color: var(--tone-color);
    background: linear-gradient(135deg, var(--tone-color), rgba(255, 255, 255, 0.9));
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tone-btn.selected {
    border-color: var(--tone-color);
    background: var(--tone-color);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    animation: toneSelection 0.5s ease;
}

.tone-btn.correct {
    border-color: #10b981;
    background: #10b981;
    color: white;
    animation: correctTone 1s ease;
}

.tone-btn.incorrect {
    border-color: #ef4444;
    background: #ef4444;
    color: white;
    animation: incorrectTone 0.8s ease;
}

.tone-btn.disabled {
    pointer-events: none;
    opacity: 0.6;
}

.tone-number {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 4px;
    line-height: 1;
}

.tone-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    line-height: 1;
}

.tone-desc {
    font-size: 11px;
    opacity: 0.8;
    line-height: 1;
}

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

@keyframes correctTone {
    0%, 100% {
        transform: scale(1.05);
    }
    25%, 75% {
        transform: scale(1.1);
    }
    50% {
        transform: scale(1.15);
    }
}

@keyframes incorrectTone {
    0%, 100% {
        transform: scale(1.05);
    }
    25%, 75% {
        transform: scale(0.95);
    }
    50% {
        transform: scale(1.1);
    }
}

.question-feedback {
    text-align: center;
    padding: 20px;
    border-radius: 12px;
    margin-top: 16px;
    animation: feedbackSlideIn 0.5s ease;
}

.question-feedback.correct {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid #10b981;
    color: #065f46;
}

.question-feedback.incorrect {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 2px solid #ef4444;
    color: #991b1b;
}

.feedback-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.feedback-icon {
    font-size: 20px;
}

.feedback-text {
    font-size: 16px;
    font-weight: bold;
}

.feedback-detail {
    font-size: 14px;
    opacity: 0.8;
}

/* 游戏反馈区域 */
.game-feedback-section {
    text-align: left;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* 游戏结束反馈样式 */
.game-end-feedback {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #10b981;
    border-radius: 20px;
    padding: 32px;
    margin-top: 24px;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.15);
    animation: gameEndSlideIn 0.6s ease;
}

.game-end-feedback .game-feedback-section {
    background: transparent;
    border: none;
    padding: 0;
    margin-top: 0;
}

@keyframes gameEndSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.game-end-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.game-end-icon {
    font-size: 48px;
    margin-bottom: 12px;
    animation: bounceIn 0.8s ease;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.game-end-title {
    font-size: 28px;
    font-weight: bold;
    color: #1a202c;
    margin-bottom: 16px;
}

.game-end-score {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    min-width: 100px;
}

.score-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 4px;
}

.score-value {
    font-size: 20px;
    font-weight: bold;
    color: #1a202c;
}

.score-value.grade-s {
    color: #10b981;
}

.score-value.grade-a {
    color: #3b82f6;
}

.score-value.grade-b {
    color: #f59e0b;
}

.score-value.grade-c {
    color: #ef4444;
}

.score-value.grade-d {
    color: #6b7280;
}

/* 游戏结束操作按钮 */
.game-end-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.game-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.restart-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.restart-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.learning-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.learning-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.game-action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

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

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

/* 响应式设计 */
@media (max-width: 768px) {
    .game-end-feedback {
        padding: 24px 20px;
        margin-top: 16px;
    }
    
    .game-end-icon {
        font-size: 40px;
    }
    
    .game-end-title {
        font-size: 24px;
    }
    
    .game-end-score {
        gap: 16px;
    }
    
    .score-item {
        padding: 10px 16px;
        min-width: 80px;
    }
    
    .score-value {
        font-size: 18px;
    }
    
    .game-end-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .game-action-btn {
        padding: 12px 24px;
        font-size: 14px;
        min-width: auto;
    }
    
    .btn-icon {
        font-size: 16px;
    }
    
    .btn-text {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .game-end-score {
        flex-direction: column;
        gap: 12px;
    }
    
    .score-item {
        flex-direction: row;
        justify-content: space-between;
        padding: 12px 16px;
        min-width: auto;
    }
    
    .score-label {
        margin-bottom: 0;
        font-size: 14px;
    }
    
    .score-value {
        font-size: 16px;
    }
}

.feedback-title {
    font-size: 18px;
    font-weight: bold;
    color: #047857;
    margin-bottom: 12px;
    text-align: center;
}

.feedback-message {
    font-size: 14px;
    line-height: 1.6;
    color: #374151;
    margin-bottom: 16px;
    text-align: center;
}

.feedback-suggestions {
    margin-bottom: 16px;
}

.suggestions-title {
    font-size: 16px;
    font-weight: 600;
    color: #047857;
    margin-bottom: 8px;
}

.suggestions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.suggestions-list li {
    font-size: 14px;
    line-height: 1.5;
    color: #4b5563;
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.suggestions-list li::before {
    content: '•';
    color: #10b981;
    font-weight: bold;
    position: absolute;
    left: 0;
    top: 0;
}

.feedback-encouragement {
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #059669;
    background: rgba(16, 185, 129, 0.1);
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #10b981;
}

@keyframes feedbackSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 游戏模式下的表格样式 */
.game-mode .tones-table-container {
    position: relative;
}

.game-mode .tone-column {
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-mode .tone-column:hover {
    background: var(--tone-color);
    color: white;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.game-mode .tone-column.game-selected {
    background: var(--tone-color);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    animation: gameSelection 0.5s ease;
}

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

.game-mode .tone-column.game-correct {
    background: #10b981 !important;
    color: white !important;
    animation: correctAnswer 1s ease;
}

@keyframes correctAnswer {
    0%, 100% {
        transform: scale(1.05);
    }
    25%, 75% {
        transform: scale(1.1);
    }
    50% {
        transform: scale(1.15);
    }
}

.game-mode .tone-column.game-incorrect {
    background: #ef4444 !important;
    color: white !important;
    animation: incorrectAnswer 0.8s ease;
}

@keyframes incorrectAnswer {
    0%, 100% {
        transform: scale(1.05);
    }
    25%, 75% {
        transform: scale(0.95);
    }
    50% {
        transform: scale(1.1);
    }
}

/* 游戏模式下隐藏不必要的交互 */
.game-mode .example-cell,
.game-mode .tone-number-cell,
.game-mode .tone-value-cell,
.game-mode .pitch-cell {
    pointer-events: none;
    opacity: 0.7;
}

.game-mode .tone-column {
    pointer-events: all;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-mode-toggle {
        flex-direction: column;
        gap: 12px;
    }
    
    .mode-btn {
        min-width: auto;
        padding: 10px 20px;
    }
    
    .game-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .pause-control-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .question-character {
        font-size: 60px;
    }
    
    .question-title {
        font-size: 18px;
    }
    
    .feedback-content {
        flex-direction: column;
        gap: 4px;
    }
    
    /* 游戏反馈响应式 */
    .game-feedback-section {
        padding: 16px;
        margin-top: 12px;
    }
    
    .feedback-title {
        font-size: 16px;
    }
    
    .feedback-message {
        font-size: 13px;
    }
    
    .suggestions-title {
        font-size: 14px;
    }
    
    .suggestions-list li {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .feedback-encouragement {
        font-size: 14px;
        padding: 10px;
    }
    
    /* 声调按钮响应式 */
    .tone-buttons {
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .tone-btn {
        padding: 10px 12px;
        min-height: 60px;
        min-width: 70px;
        max-width: 100px;
    }
    
    .tone-number {
        font-size: 18px;
    }
    
    .tone-name {
        font-size: 11px;
    }
    
    .tone-desc {
        font-size: 9px;
    }
    
    .tone-selection-title {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .game-stats {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .tone-buttons {
        gap: 6px;
    }
    
    .tone-btn {
        padding: 8px 10px;
        min-height: 55px;
        min-width: 60px;
        max-width: 80px;
    }
    
    .tone-number {
        font-size: 16px;
    }
    
    .tone-name {
        font-size: 10px;
    }
    
    .tone-desc {
        font-size: 8px;
    }
}

/* 声调总览区域 */
.tones-overview-section {
    margin-bottom: 48px;
}

/* 声调表格容器 */
.tones-table-container {
    background: white;
    border-radius: 16px;
    padding: 24px; /* 减少内边距 */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* 声调表格 */
.tones-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 16px;
}

.tones-table th,
.tones-table td {
    padding: 12px 8px; /* 减少内边距 */
    text-align: center;
    border: 2px solid #e2e8f0;
    position: relative;
}

/* 表格头部 */
.table-header {
    background: #f8fafc;
    font-weight: 600;
    color: #4a5568;
    border-color: #cbd5e0;
}

/* 可点击的行头 */
.row-header {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.row-header:hover {
    background: #e2e8f0;
    color: #2563eb;
}

.row-header:hover::after {
    content: "🔊";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
}

/* 声调列头 */
.tone-column {
    background: #f8fafc;
    font-weight: 600;
    color: #1a202c;
    cursor: pointer;
    transition: all 0.3s ease;
    border-color: #cbd5e0;
}

.tone-column:hover {
    background: var(--tone-color);
    color: white;
    transform: translateY(-2px);
}

.tone-column.selected {
    background: var(--tone-color);
    color: white;
    border-color: var(--tone-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* 调序单元格 */
.tone-number-cell {
    font-size: 24px;
    font-weight: bold;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tone-number-cell:hover {
    background: #f1f5f9;
    transform: scale(1.1);
}

.tone-number-cell.selected {
    /* 移除单元格选中样式，只保留基本样式 */
    background: inherit;
    color: inherit;
    border-color: inherit;
}

/* 调值单元格 */
.tone-value-cell {
    font-size: 18px;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tone-value-cell:hover {
    background: #f1f5f9;
    transform: scale(1.05);
}

.tone-value-cell.selected {
    background: inherit;
    color: inherit;
    border-color: inherit;
}

/* 音高刻度行 */
.pitch-row {
    height: 32px; /* 减少高度 */
}

.pitch-scale {
    width: 80px;
    font-size: 18px;
    font-weight: bold;
    color: #3b82f6;
}

/* 音高单元格 */
.pitch-cell {
    vertical-align: middle;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.pitch-cell:hover {
    background: #f8fafc;
}

.pitch-cell.selected {
    /* 移除单元格选中样式，只保留基本样式 */
    background: inherit;
    border-color: inherit;
}

/* 音高指示器 */
.pitch-indicator {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.pitch-indicator.active::before {
    content: '';
    width: 80%;
    height: 6px;
    background: var(--tone-color);
    border-radius: 3px;
    display: block;
}

/* 特殊的音调曲线处理 */
/* 1调：高平调 - 在第5行显示水平线 */
.pitch-5 [data-tone="1"] .pitch-indicator.active::before {
    width: 80%;
}

/* 3调：中平调 - 在第3行显示水平线 */
.pitch-3 [data-tone="3"] .pitch-indicator.active::before {
    width: 80%;
}

/* 6调：低平调 - 在第2行显示水平线 */
.pitch-2 [data-tone="6"] .pitch-indicator.active::before {
    width: 80%;
}

/* 2调：高升调 - 从第3行左下角到第5行右上角的斜线 */
.pitch-3 [data-tone="2"] .pitch-indicator {
    position: relative;
    overflow: visible;
}

.pitch-3 [data-tone="2"] .pitch-indicator.active::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 110%; /* 增加宽度，使线条延伸到更远 */
    height: 6px;
    background: var(--tone-color);
    border-radius: 3px;
    transform: rotate(-35deg); /* 更陡的斜度，跨越3行到第5行 */
    transform-origin: left bottom;
    z-index: 10;
}

/* 隐藏2调在其他行的指示器 */
.pitch-4 [data-tone="2"] .pitch-indicator.active::before,
.pitch-5 [data-tone="2"] .pitch-indicator.active::before {
    display: none;
}

/* 4调：低降调 - 从第2行左上角到第1行右下角的斜线 */
.pitch-2 [data-tone="4"] .pitch-indicator {
    position: relative;
    overflow: visible;
}

.pitch-2 [data-tone="4"] .pitch-indicator.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 6px;
    background: var(--tone-color);
    border-radius: 3px;
    transform: rotate(20deg); /* 向下倾斜，跨越1行 */
    transform-origin: left top;
    z-index: 10;
}

/* 隐藏4调在其他行的指示器 */
.pitch-1 [data-tone="4"] .pitch-indicator.active::before,
.pitch-3 [data-tone="4"] .pitch-indicator.active::before {
    display: none;
}

/* 5调：低升调 - 从第1行左下角到第3行右上角的斜线 */
.pitch-1 [data-tone="5"] .pitch-indicator {
    position: relative;
    overflow: visible;
}

.pitch-1 [data-tone="5"] .pitch-indicator.active::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 110%; /* 增加宽度，使线条延伸到更远 */
    height: 6px;
    background: var(--tone-color);
    border-radius: 3px;
    transform: rotate(-35deg); /* 向上倾斜，跨越2行 */
    transform-origin: left bottom;
    z-index: 10;
}

/* 隐藏5调在其他行的指示器 */
.pitch-2 [data-tone="5"] .pitch-indicator.active::before,
.pitch-3 [data-tone="5"] .pitch-indicator.active::before {
    display: none;
}

/* 例字单元格 */
.example-cell {
    cursor: pointer;
    transition: all 0.3s ease;
    vertical-align: middle;
    padding: 8px 12px; /* 减少内边距 */
}

.example-cell:hover {
    background: #f8fafc;
    transform: translateY(-2px);
}

.example-cell.selected {
    /* 移除单元格选中样式，只保留基本样式 */
    background: inherit;
    border-color: inherit;
}

.example-content {
    display: flex;
    flex-direction: column;
    gap: 2px; /* 减少间距 */
    align-items: center;
    justify-content: center;
    min-height: 40px; /* 减少最小高度 */
}

.example-jyutping {
    font-size: 10px; /* 减小字体 */
    color: #64748b;
    font-family: 'Courier New', monospace;
    line-height: 1.2; /* 紧凑行高 */
}

.example-char {
    font-size: 20px; /* 减小字体 */
    font-weight: bold;
    color: #1a202c;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1; /* 紧凑行高 */
}

.example-char:hover {
    color: #3b82f6;
}

/* 声调卡片 */
.tone-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.tone-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-color: var(--tone-color);
}

.tone-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--tone-color);
}

/* 声调卡片头部 */
.tone-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.tone-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--tone-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
}

.tone-info {
    flex: 1;
}

.tone-name {
    font-size: 20px;
    font-weight: 600;
    color: #1a202c;
    margin: 0 0 4px 0;
}

.tone-pattern {
    font-size: 14px;
    color: #64748b;
    font-family: 'Courier New', monospace;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

/* 声调曲线 */
.tone-curve {
    height: 60px;
    margin: 16px 0;
    position: relative;
    background: #f8fafc;
    border-radius: 8px;
    overflow: hidden;
}

.curve-line {
    position: absolute;
    width: 100%;
    height: 4px;
    background: var(--tone-color);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* 不同声调的曲线样式 */
.flat-high .curve-line {
    top: 15px;
}

.rising-high .curve-line {
    top: 35px;
    transform: rotate(15deg);
    transform-origin: left center;
}

.flat-mid .curve-line {
    top: 28px;
}

.falling-low .curve-line {
    top: 15px;
    transform: rotate(-15deg);
    transform-origin: left center;
}

.rising-low .curve-line {
    top: 45px;
    transform: rotate(20deg);
    transform-origin: left center;
}

.flat-low .curve-line {
    top: 45px;
}

/* 声调描述 */
.tone-description {
    font-size: 14px;
    color: #4a5568;
    line-height: 1.5;
    margin-bottom: 16px;
}

/* 示例词汇 */
.tone-examples {
    margin-bottom: 20px;
}

.example-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.example-item:hover {
    background: #e2e8f0;
}

.example-char {
    font-size: 18px;
    font-weight: 600;
    color: var(--tone-color);
    min-width: 24px;
}

.example-jyutping {
    font-size: 14px;
    color: #64748b;
    font-family: 'Courier New', monospace;
    min-width: 60px;
}

.example-meaning {
    font-size: 14px;
    color: #4a5568;
}

/* 播放按钮 */
.play-tone-btn {
    width: 100%;
    padding: 12px;
    background: var(--tone-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.play-tone-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.play-icon {
    font-size: 12px;
}

/* 播放状态样式 */
.example-char.playing {
    color: #10b981;
    transform: scale(1.1);
    animation: phrasePlay 1.5s ease-in-out infinite;
}

/* 列播放动画（词组播放） */
@keyframes phrasePlay {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1.1);
        box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% { 
        opacity: 0.8; 
        transform: scale(1.15);
        box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
    }
}

/* 行播放动画（声调对比） */
.example-char.playing.row-play {
    color: #3b82f6;
    animation: rowPlay 1.2s ease-in-out infinite;
}

@keyframes rowPlay {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1.1);
        box-shadow: 0 0 0 rgba(59, 130, 246, 0.4);
    }
    50% { 
        opacity: 0.9; 
        transform: scale(1.12);
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.7);
    }
}

/* 单字播放时的动画（保持原有效果） */
.example-char.playing.single-play {
    animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1.1);
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.15);
    }
}

/* 高亮效果 */
.highlighting {
    animation: highlight 1s ease;
}

@keyframes highlight {
    0% { 
        background: var(--tone-color, #3b82f6); 
        color: white; 
        transform: scale(1.05);
    }
    100% { 
        background: inherit; 
        color: inherit; 
        transform: scale(1);
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .tones-table-container {
        padding: 16px; /* 进一步减少内边距 */
        overflow-x: auto;
    }
    
    .tones-table {
        min-width: 600px;
    }
    
    .tones-table th,
    .tones-table td {
        padding: 6px 4px; /* 减少内边距 */
        font-size: 14px;
    }
    
    .pitch-row {
        height: 28px; /* 减少高度 */
    }
    
    .example-char {
        font-size: 18px; /* 减小字体 */
    }
    
    .tone-number-cell {
        font-size: 18px; /* 减小字体 */
    }
    
    .tone-value-cell {
        font-size: 16px; /* 减小字体 */
    }
    
    .pitch-scale {
        font-size: 14px; /* 减小字体 */
    }
    
    .example-content {
        min-height: 32px; /* 减少最小高度 */
    }
    
    .example-jyutping {
        font-size: 9px; /* 减小字体 */
    }
}

@media (max-width: 768px) {
    .tones-page .content-area {
        padding: 12px; /* 减少内边距 */
    }
    
    .tones-table-container {
        padding: 12px; /* 减少内边距 */
    }
    
    .tones-table th,
    .tones-table td {
        padding: 4px 3px; /* 进一步减少内边距 */
        font-size: 12px;
    }
    
    .pitch-row {
        height: 24px; /* 减少高度 */
    }
    
    .example-char {
        font-size: 16px; /* 减小字体 */
    }
    
    .tone-number-cell {
        font-size: 16px; /* 减小字体 */
    }
    
    .tone-value-cell {
        font-size: 14px; /* 减小字体 */
    }
    
    .pitch-scale {
        font-size: 12px; /* 减小字体 */
        width: 50px; /* 减少宽度 */
    }
    
    .example-content {
        min-height: 28px; /* 减少最小高度 */
    }
    
    .example-jyutping {
        font-size: 8px; /* 减小字体 */
    }
    
    .section-header {
        margin-bottom: 16px; /* 减少边距 */
    }
    
    .section-header h2 {
        font-size: 24px;
    }
}

/* 选中列的外边框效果 */
.tone-column.selected {
    background: var(--tone-color);
    color: white;
    border-color: var(--tone-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-left: 3px solid var(--tone-color);
    border-right: 3px solid var(--tone-color);
    border-top: 2px solid var(--tone-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3); /* 很细的分隔线 */
}

.tone-number-cell.selected {
    /* 移除单元格选中样式，只保留基本样式 */
    background: inherit;
    color: inherit;
    border-left: 3px solid var(--tone-color, #3b82f6);
    border-right: 3px solid var(--tone-color, #3b82f6);
    border-top: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1); /* 很细的分隔线 */
}

.pitch-cell.selected {
    /* 移除单元格选中样式，只保留基本样式 */
    background: inherit;
    border-left: 3px solid var(--tone-color, #3b82f6);
    border-right: 3px solid var(--tone-color, #3b82f6);
    border-top: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1); /* 很细的分隔线 */
}

.example-cell.selected {
    /* 移除单元格选中样式，只保留基本样式 */
    background: inherit;
    border-left: 3px solid var(--tone-color, #3b82f6);
    border-right: 3px solid var(--tone-color, #3b82f6);
    border-top: none;
    border-bottom: 2px solid var(--tone-color, #3b82f6); /* 最后一行保留下边框 */
}

/* 声调波形弹出窗口 */
.waveform-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.4s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    text-align: center;
}

.modal-header h3 {
    font-size: 24px;
    font-weight: 600;
    color: #1a202c;
    margin: 0 0 8px 0;
}

.modal-subtitle {
    font-size: 16px;
    color: #64748b;
    margin: 0;
}

.close-modal-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-modal-btn:hover {
    background: #e2e8f0;
    color: #475569;
    transform: scale(1.1);
}

.modal-body {
    padding: 24px;
}

.waveform-canvas {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.waveform-info {
    text-align: center;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 4px solid #10b981;
}

.waveform-info p {
    margin: 0 0 8px 0;
    color: #4a5568;
    font-size: 14px;
}

.waveform-tip {
    font-size: 12px !important;
    color: #64748b !important;
    font-style: italic;
    margin-bottom: 12px !important;
    opacity: 0.8;
}

/* 重听按钮样式 */
.replay-waveform-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    animation: fadeInUp 0.5s ease;
}

.replay-waveform-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.replay-waveform-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.replay-icon {
    font-size: 16px;
    animation: none;
    transition: transform 0.3s ease;
}

.replay-waveform-btn:hover .replay-icon {
    transform: rotate(180deg);
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 波形动画 */
.waveform-animating #waveformPath {
    opacity: 1;
}

/* 字符独立波形路径样式 */
.character-waveform-path {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 字符标记样式 */
.character-marker {
    animation: fadeInScale 0.8s ease;
    opacity: 0;
    animation-fill-mode: forwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.character-marker circle {
    stroke: white;
    stroke-width: 3;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: all 0.3s ease;
}

.character-marker text {
    fill: white;
    font-size: 16px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

/* 粤拼文字样式 */
.jyutping-text {
    fill: #64748b;
    font-size: 10px;
    font-weight: 500;
    text-anchor: middle;
    dominant-baseline: central;
    font-family: 'Courier New', monospace;
    pointer-events: none;
}

/* 含义文字样式 */
.meaning-text {
    fill: #4a5568;
    font-size: 11px;
    font-weight: 500;
    text-anchor: middle;
    dominant-baseline: central;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.3s ease;
}

.meaning-text:hover {
    fill: #3b82f6 !important;
    font-weight: bold !important;
}

/* 含义背景样式 */
.meaning-bg {
    fill: transparent;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.3s ease;
}

.meaning-bg:hover {
    fill: rgba(59, 130, 246, 0.1) !important;
}

/* 声调标签动画 */
.tone-label {
    animation: slideInFromTop 0.6s ease;
    opacity: 0;
    animation-fill-mode: forwards;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header {
        padding: 20px 20px 12px;
    }
    
    .modal-header h3 {
        font-size: 20px;
    }
    
    .modal-subtitle {
        font-size: 14px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .waveform-canvas {
        padding: 16px;
    }
    
    #waveformSvg {
        height: 190px;
    }
    
    .character-marker text {
        font-size: 14px;
    }
    
    .jyutping-text {
        font-size: 9px !important;
    }
    
    .meaning-text {
        font-size: 10px !important;
    }
    
    .character-marker circle {
        r: 16;
    }
}