/* ── Pinyin Page ──
   AllSet Learning-style full grid chart
*/

.pinyin-wrap { flex: 1; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }

.pinyin-toolbar { display: flex; align-items: center; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.pinyin-toolbar-btn { padding: 8px 16px; border-radius: 20px; border: 1px solid #334155; background: transparent; color: #94a3b8; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.pinyin-toolbar-btn.active { background: linear-gradient(135deg, #3b82f6, #6366f1); border-color: transparent; color: white; box-shadow: 0 2px 10px rgba(59,130,246,0.3); }
.pinyin-toolbar-btn:hover { border-color: #3b82f6; color: #e2e8f0; }
.pinyin-toolbar-btn.purple { background: rgba(139,92,246,0.15); border-color: rgba(139,92,246,0.3); color: #a78bfa; }
.pinyin-toolbar-btn.purple:hover { background: rgba(139,92,246,0.25); }

.pinyin-header { margin-bottom: 16px; }
.pinyin-header h3 { font-size: 20px; font-weight: 800; color: #e2e8f0; margin: 0 0 4px; }
.pinyin-header p { font-size: 13px; color: #64748b; margin: 0; }

/* ── Full Chart Table ── */

.pin-chart-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}

.pin-chart {
  display: flex; flex-direction: column; gap: 0;
  font-size: 12px;
  min-width: max-content;
}

/* Header row */
.pin-chart-row {
  display: flex; align-items: stretch;
}
.pin-chart-header {
  position: sticky; top: 0; z-index: 5;
  background: #0f172a;
  border-bottom: 2px solid #1e293b;
  padding-bottom: 4px;
}

.pin-chart-corner {
  min-width: 70px; width: 70px;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 4px 6px 6px;
  font-size: 9px; font-weight: 600; color: #475569;
  text-transform: uppercase; letter-spacing: 0.5px;
}

.pin-chart-group-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 8px; font-weight: 700; color: #334155;
  text-transform: uppercase; letter-spacing: 1px;
  padding: 2px 4px;
  display: flex; align-items: flex-end; justify-content: center;
  min-width: 12px;
}

.pin-chart-col-label {
  min-width: 36px; width: 36px;
  text-align: center; padding: 4px 0 6px;
  font-size: 10px; font-weight: 700; color: #64748b;
}

/* Initial label column */
.pin-chart-init {
  min-width: 70px; width: 70px;
  display: flex; align-items: center; justify-content: center;
  border-right: 1px solid #1e293b;
  padding: 2px 6px;
}
.pin-chart-init-text {
  font-size: 15px; font-weight: 800;
}

/* Grid cells */
.pin-chart-cell {
  min-width: 36px; width: 36px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  color: #94a3b8; background: #0f172a;
  border: 1px solid transparent;
  transition: all 0.1s;
  margin: 1px 0;
}
.pin-chart-cell:hover {
  background: #1e293b; border-color: #3b82f6;
  color: #e2e8f0; z-index: 2;
}
.pin-chart-cell.active {
  background: #1e3a5f; border-color: #60a5fa;
  color: #93c5fd; box-shadow: 0 0 0 1px rgba(59,130,246,0.3);
}
.pin-chart-empty {
  cursor: default; opacity: 0.08;
}
.pin-chart-empty:hover {
  background: transparent; border-color: transparent;
}

/* Divider between initial groups */
.pin-chart-divider {
  height: 1px;
  background: #1e293b;
  margin: 4px 0;
  position: relative;
}
.pin-chart-divider span {
  display: none;
}

/* ── Tone panel ── */

.pinyin-tone-panel {
  background: linear-gradient(135deg, #1e293b, #1a2332);
  border: 1px solid #334155;
  border-radius: 18px;
  padding: 20px;
  margin-top: 16px;
}
.pinyin-tone-panel .tp-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
}
.pinyin-tone-panel .tp-syllable {
  font-size: 28px; font-weight: 800; color: #e2e8f0;
}
.pinyin-tone-panel .tp-badge {
  font-size: 11px; color: #64748b; background: #0f172a;
  padding: 4px 10px; border-radius: 12px;
}

.tone-cards-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px;
}

.tone-card {
  border-radius: 14px; padding: 14px 8px; text-align: center;
  cursor: pointer; transition: all 0.18s;
  border: 2px solid transparent; position: relative; overflow: hidden;
}
.tone-card:hover { transform: translateY(-3px); }
.tone-card.playing { transform: scale(1.08); }
.tone-card:active { transform: scale(0.95); }
.tone-card .tc-wave {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: currentColor; opacity: 0.3;
}

.tone-card-1 { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.3); color: #60a5fa; }
.tone-card-1:hover, .tone-card-1.playing {
  background: rgba(59,130,246,0.25); border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(59,130,246,0.3);
}
.tone-card-2 { background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.3); color: #22c55e; }
.tone-card-2:hover, .tone-card-2.playing {
  background: rgba(34,197,94,0.25); border-color: #22c55e;
  box-shadow: 0 4px 16px rgba(34,197,94,0.3);
}
.tone-card-3 { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.3); color: #f59e0b; }
.tone-card-3:hover, .tone-card-3.playing {
  background: rgba(245,158,11,0.25); border-color: #f59e0b;
  box-shadow: 0 4px 16px rgba(245,158,11,0.3);
}
.tone-card-4 { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); color: #ef4444; }
.tone-card-4:hover, .tone-card-4.playing {
  background: rgba(239,68,68,0.25); border-color: #ef4444;
  box-shadow: 0 4px 16px rgba(239,68,68,0.3);
}

.tone-card .tc-num {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 4px; opacity: 0.8;
}
.tone-card .tc-syl { font-size: 26px; font-weight: 700; color: #e2e8f0; margin-bottom: 2px; }
.tone-card .tc-desc { font-size: 10px; color: #64748b; }
.tone-card .tc-icon { font-size: 20px; margin-top: 2px; }

.tone-play-all-btn {
  width: 100%; padding: 10px; border-radius: 12px;
  border: 1px dashed #334155; background: transparent;
  color: #94a3b8; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tone-play-all-btn:hover {
  border-color: #3b82f6; color: #60a5fa; background: rgba(59,130,246,0.05);
}
