:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --muted: #64748b;
  --text: #1e293b;
  --primary: #3b82f6;
  --primary-700: #1d4ed8;
  --accent: #10b981;
  --danger: #ef4444;
  --grid: #e2e8f0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, var(--bg) 0%, #f1f5f9 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft Yahei', 'Noto Sans CJK SC', 'Noto Sans', Arial, Helvetica, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

/* 顶部导航栏 - 与声调页面一致 */
.top-navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 0;
    box-shadow: 0 2px 20px rgba(102, 126, 234, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-icon {
    font-size: 32px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.app-info {
    display: flex;
    flex-direction: column;
}

.app-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: white;
}

.app-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.nav-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    color: white;
    text-decoration: none;
}

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

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

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--grid);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.card-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.card-header h2 { margin: 0; font-size: 20px; }

.controls-row { display: flex; gap: 8px; align-items: center; }
.control select, .control input { background: var(--card); border: 1px solid var(--grid); color: var(--text); padding: 8px 10px; border-radius: 8px; }

.btn { background: var(--card); color: var(--text); border: 1px solid var(--grid); border-radius: 8px; padding: 8px 12px; cursor: pointer; transition: all 0.2s ease; }
.btn:hover { border-color: var(--primary); background: #f8fafc; }
.btn.primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-700); border-color: var(--primary-700); }
.btn:focus-visible { outline: 3px solid rgba(59,130,246,0.35); outline-offset: 1px; }

.grid-section { margin-top: 12px; }
.grid-section h3 { margin: 0 0 8px 0; font-size: 16px; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }
.grid-tones { grid-template-columns: repeat(6, 1fr); }

/* 韵母网格特殊布局 */
.finals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 6px;
}

/* 韵母容器 */
.finals-container {
  margin-top: 10px;
}

.finals-container.desktop {
  /* 桌面端表格样式 */
  overflow-x: auto;
}

.finals-container.mobile {
  /* 移动端网格样式 */
  overflow: visible;
}

/* 移动端韵母网格 */
.finals-grid-mobile {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 6px;
}

/* 韵母表格样式 */
.finals-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--grid);
  margin-top: 10px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.finals-table td {
  border: 1px solid #edf2f7;
  padding: 8px;
  text-align: center;
}

.cell-button {
  background: var(--card);
  border: 1px solid var(--grid);
  border-radius: 10px;
  padding: 4px;
  width: 100%;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cell-button:hover {
  border-color: var(--primary);
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cell {
  background: var(--card);
  border: 1px solid var(--grid);
  border-radius: 12px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  min-height: 75px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.cell:hover { 
  border-color: var(--primary); 
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.cell .small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }

.cell-symbol {
  font-size: 20px;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 2px;
}

.cell-jyutping {
  font-size: 14px;
  color: var(--primary);
  font-family: 'Courier New', monospace;
}

.cell-guangdong {
  font-size: 16px;
  color: var(--muted);
  font-family: 'Courier New', monospace;
  margin-left: 4px;
}

.cell-characters {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 2px 4px;
  border-radius: 4px;
  position: relative;
}

.cell-characters:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.1);
}

/* 添加小音频图标提示 */
.cell-characters::after {
  content: '🔊';
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cell-characters:hover::after {
  opacity: 0.8;
}

.practice-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.buttons { display: flex; gap: 8px; }

.charts { display: grid; grid-template-columns: 1fr 260px; gap: 12px; align-items: start; }
.canvas-col h4, .result-col h4 { margin: 8px 0; color: var(--muted); font-weight: 500; }

#toneCanvas { 
  background: var(--card); 
  border: 1px solid var(--grid); 
  border-radius: 10px; 
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.score-box { 
  background: var(--card); 
  border: 1px solid var(--grid); 
  border-radius: 10px; 
  padding: 12px; 
  min-height: 60px; 
}
.score-ok { color: var(--accent); }
.score-warn { color: #f59e0b; }
.score-bad { color: var(--danger); }

.site-footer { color: var(--muted); }

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: var(--card);
  margin: 5% auto;
  padding: 0;
  border: 1px solid var(--grid);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--grid);
  background: #f8fafc;
  border-radius: 12px 12px 0 0;
}

.modal-header h3 {
  margin: 0;
  color: var(--text);
}

.modal-header-buttons { display:flex; gap:8px; align-items:center; }
.prev-btn, .next-btn { background: var(--card); color: var(--text); border: 1px solid var(--grid); border-radius: 8px; padding: 6px 10px; cursor: pointer; transition: all 0.2s ease; }
.prev-btn:hover, .next-btn:hover { border-color: var(--primary); background: #f8fafc; }

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: var(--grid);
  color: var(--text);
}

.modal-body {
  padding: 20px;
}

.pronunciation-section,
.audio-section,
.practice-section,
.examples-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--grid);
}

.pronunciation-section:last-child,
.audio-section:last-child,
.practice-section:last-child,
.examples-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.pronunciation-section h4,
.audio-section h4,
.practice-section h4,
.examples-section h4 {
  margin: 0 0 12px 0;
  color: var(--text);
  font-size: 16px;
}

.audio-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.audio-status {
  background: #f1f5f9;
  border: 1px solid var(--grid);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

.practice-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.practice-feedback {
  background: #f1f5f9;
  border: 1px solid var(--grid);
  border-radius: 8px;
  padding: 12px;
  min-height: 60px;
  font-size: 14px;
  color: var(--text);
}

.example-words {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.example-word {
  background: var(--card);
  border: 1px solid var(--grid);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.example-word:hover {
  border-color: var(--primary);
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.example-word:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 添加播放图标提示 */
.example-word::before {
  content: '🔊';
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.example-word:hover::before {
  opacity: 0.6;
}

.example-word .word {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.example-word .jyutping {
  font-size: 12px;
  color: var(--muted);
  font-family: 'Courier New', monospace;
}

.example-word .meaning {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* 移动端响应式布局 */
@media (max-width: 768px) {
  .site-header, .site-footer {
    padding: 12px;
  }
  
  .site-header h1 {
    font-size: 24px;
  }
  
  .subtitle {
    font-size: 14px;
  }
  
  .container {
    padding: 12px;
    gap: 12px;
  }
  
  .card {
    padding: 12px;
  }
  
  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .controls-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .control {
    font-size: 14px;
  }
  
  .control select, .control input {
    padding: 6px 8px;
    font-size: 14px;
  }
  
  .btn {
    padding: 8px 12px;
    font-size: 14px;
  }
  
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 6px;
  }
  
  .finals-grid {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 4px;
  }
  
  .grid-tones {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .cell {
    padding: 8px 4px;
    min-height: 60px;
    font-size: 14px;
  }
  
  .cell-symbol {
    font-size: 16px;
  }
  
  .cell-jyutping {
    font-size: 12px;
  }
  
  .cell-guangdong {
    font-size: 14px;
  }
  
  .cell-characters {
    font-size: 12px;
  }
  
  .practice-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .buttons {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .charts {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  #toneCanvas {
    width: 100%;
    height: 120px;
  }
  
  .result-col {
    order: -1;
  }
  
  .modal-content {
    width: 95%;
    margin: 5% auto;
    max-height: 85vh;
  }
  
  .modal-header {
    padding: 12px 16px;
  }
  
  .modal-body {
    padding: 16px;
  }
  
  .modal-header h3 {
    font-size: 16px;
  }
  
  .audio-controls {
    flex-direction: column;
  }
  
  .practice-controls {
    flex-direction: column;
  }
  
  .example-words {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 6px;
  }
  
  .example-word {
    padding: 8px;
  }
  
  .example-word .word {
    font-size: 14px;
  }
  
  .example-word .jyutping {
    font-size: 11px;
  }
  
  .example-word .meaning {
    font-size: 10px;
  }
}

/* 小屏手机优化 */
@media (max-width: 480px) {
  .site-header h1 {
    font-size: 20px;
  }
  
  .subtitle {
    font-size: 12px;
  }
  
  .card-header h2 {
    font-size: 16px;
  }
  
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  }
  
  .finals-grid {
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
  }
  
  .grid-tones {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .cell {
    padding: 6px 2px;
    min-height: 50px;
    font-size: 12px;
  }
  
  .cell-symbol {
    font-size: 14px;
  }
  
  .btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .control select, .control input {
    padding: 4px 6px;
    font-size: 12px;
  }
}

/* 游戏模式样式 */

/* 模式切换按钮 */
.game-mode-toggle {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.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-type-selection {
    text-align: center;
    padding: 40px 20px;
}

.game-selection-title {
    font-size: 24px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 32px;
}

.game-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.game-type-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.game-type-card:hover {
    border-color: #3b82f6;
    background: #f8fafc;
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}

.game-type-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.game-type-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 4px;
}

.game-type-desc {
    font-size: 14px;
    color: #64748b;
}

/* 游戏面板 */
.game-panel {
    margin: 20px;
    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;
}

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

/* 游戏统计 */
.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-section {
    text-align: center;
    margin-bottom: 24px;
}

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

.timer-display.warning {
    color: #ef4444;
    animation: pulse 1s ease-in-out infinite;
}

@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;
    margin-bottom: 24px;
}

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

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

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

.question-audio-hint {
    font-size: 24px;
    font-weight: 600;
    color: #3b82f6;
    margin-bottom: 24px;
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #3b82f6;
    border-radius: 16px;
    animation: audioHintPulse 2s ease-in-out infinite;
}

@keyframes audioHintPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
    }
}

/* 游戏选项 */
.game-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    max-width: 600px;
    margin: 0 auto 24px;
}

.option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 80px;
    font-size: 16px;
    font-weight: 600;
    color: #1a202c;
}

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

.option-btn.selected {
    border-color: #3b82f6;
    background: #3b82f6;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

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

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

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

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

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

/* 游戏结束反馈 */
.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;
}

@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-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);
}

.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;
}

/* 游戏结束操作按钮 */
.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-mode-toggle {
        flex-direction: column;
        gap: 12px;
    }
    
    .mode-btn {
        min-width: auto;
        padding: 10px 20px;
    }
    
    .game-type-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .game-type-card {
        min-height: 120px;
        padding: 20px;
    }
    
    .game-type-icon {
        font-size: 28px;
    }
    
    .game-type-title {
        font-size: 16px;
    }
    
    .game-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .timer-display {
        font-size: 36px;
    }
    
    .question-character {
        font-size: 60px;
    }
    
    .question-title {
        font-size: 18px;
    }
    
    .game-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .option-btn {
        min-height: 70px;
        padding: 12px 8px;
        font-size: 14px;
    }
    
    .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-stats {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .game-options {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .option-btn {
        min-height: 60px;
        padding: 10px;
        font-size: 13px;
    }
    
    .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;
    }
}

/* 适配新的导航栏结构 - 使用更兼容的方式 */
.jyutping-page .site-header {
  background: #f8fafc;
}

.jyutping-page .container {
  max-width: 1400px;
  margin: 0;
  padding: 0;
  display: block;
}

.jyutping-page .content-area {
    max-width: 1400px;
    margin: 0 auto;
}

/* 确保卡片在新结构下正常显示 */
.jyutping-page .card {
  margin-bottom: 24px;
}

/* 移除原有的footer在新结构下的显示 */
.jyutping-page .site-footer {
  display: none;
}
/* 左右对照布局样式 */
.jyutping-layout {
  display: grid;
  grid-template-columns: 350px 1fr; /* 声母固定宽度，韵母自适应 */
  gap: 32px;
  margin-top: 20px;
}

.jyutping-column {
  background: #ffffff;
  border: 1px solid var(--grid);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.column-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--grid);
}

.column-header h3 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
}

.column-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* 声母网格优化 - 三列布局 */
.initials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 300px; /* 限制声母区域宽度，让韵母有更多空间 */
}

/* 韵母容器在新布局下的样式 */
.jyutping-column .finals-container {
  margin-top: 0;
}

.jyutping-column .finals-container.desktop .finals-table {
  width: 100%;
  font-size: 13px;
}

.jyutping-column .finals-container.desktop .finals-table td {
  padding: 4px;
}

.jyutping-column .finals-container.desktop .cell-button {
  min-height: 45px;
  font-size: 13px;
}

.jyutping-column .finals-container.mobile .grid {
  grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
  gap: 6px;
}

.jyutping-column .finals-container.mobile .cell {
  min-height: 45px;
  font-size: 13px;
}

/* 移动端响应式 */
@media (max-width: 1024px) {
  .jyutping-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .jyutping-column {
    padding: 16px;
  }
  
  .initials-grid {
    max-width: none;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
}

@media (max-width: 768px) {
  .jyutping-layout {
    gap: 16px;
  }
  
  .jyutping-column {
    padding: 12px;
  }
  
  .column-header h3 {
    font-size: 16px;
  }
  
  .initials-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 6px;
  }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
  .cell, .btn, .nav-link, .example-word, .game-type-card, .option-btn, .game-action-btn {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .cell {
    padding: 12px 6px;
  }
  
  .btn {
    padding: 12px 16px;
    min-height: 44px;
  }
  
  .nav-link {
    padding: 10px 14px;
    min-height: 44px;
  }
  
  .control select, .control input {
    padding: 10px 8px;
    min-height: 44px;
  }
  
  .game-type-card {
    min-height: 120px;
    padding: 16px;
  }
  
  .option-btn {
    min-height: 60px;
    padding: 12px;
  }
  
  .game-action-btn {
    min-height: 50px;
    padding: 14px 20px;
  }
  
  .cell:hover, .btn:hover, .nav-link:hover, .example-word:hover,
  .game-type-card:hover, .option-btn:hover, .game-action-btn:hover {
    transform: none;
    box-shadow: none;
  }
  
  .cell:active, .btn:active, .nav-link:active, .example-word:active {
    background: var(--primary);
    color: white;
    transform: scale(0.95);
  }
  
  .game-type-card:active, .option-btn:active, .game-action-btn:active {
    transform: scale(0.95);
  }
  
  .modal-content {
    -webkit-overflow-scrolling: touch;
  }
  
  .cell, .btn, .nav-link, .game-type-card, .option-btn, .game-action-btn {
    touch-action: manipulation;
  }
  
  .cell-symbol {
    font-size: 18px;
  }
  
  .cell-jyutping, .cell-guangdong {
    font-size: 14px;
  }
  
  .cell-characters {
    font-size: 13px;
  }
}