/* ==========================================================================
   records.css
   個人記録ページ(サマリー/ヒートマップ/指別/履歴など)
   ========================================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 760px;
  margin-bottom: 8px;
}
.stat-card {
  background: #f7f3ea;
  border: 1px solid #cbbfa5;
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: none;
}
.stat-card .label {
  font-size: 13px;
  color: #3e524c;
  font-family: var(--font-ui);
  margin-bottom: 8px;
  font-weight: 700;
}
.stat-card .value {
  font-size: 30px;
  color: #2b6651;
  font-family: var(--font-mono);
  font-weight: bold;
  line-height: 1.15;
}
.stat-card .sub {
  font-size: 13px;
  color: #42534f;
  margin-top: 6px;
  font-weight: 600;
}

.records-box {
  background: var(--panel);
  padding: 24px;
  border-radius: 10px;
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px var(--panel-shadow);
}
.records-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.records-start-date {
  font-size: 13px;
  color: #344b45;
  font-weight: 700;
}
.records-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--bg-alt);
}
.records-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.records-section h3 {
  font-family: var(--font-ui);
  font-size: 18px;
  color: #2f6f57;
  margin-bottom: 14px;
  font-weight: 700;
}
.heatmap-note {
  font-size: 12px;
  color: #39514a;
  margin-bottom: 9px;
  font-weight: 600;
}

/* キーボードヒートマップ */
.keyboard-map {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  font-family: var(--font-mono);
  padding: 10px 0;
  overflow-x: auto;
}
.kb-row {
  display: flex;
  gap: 4px;
}
.kb-row.row-1 { padding-left: 0; }
.kb-row.row-2 { padding-left: 18px; }
.kb-row.row-3 { padding-left: 36px; }
.kb-row.row-4 { padding-left: 54px; }
.kb-key {
  width: 40px;
  height: 40px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text);
  position: relative;
}
.kb-key.miss-low { background: #d7ecd9; color: var(--text); }
.kb-key.miss-mid { background: #f7dc9c; color: var(--text); }
.kb-key.miss-high { background: #e99a83; color: #fff; }
.kb-key.miss-extreme { background: #c4564a; color: #fff; border-color: #e4716a; }
.kb-key.space { width: 200px; }
.kb-legend {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: #4f605c;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
  font-weight: 600;
}
.kb-legend-item { display: flex; align-items: center; gap: 5px; }
.kb-legend-chip {
  width: 18px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid var(--border);
}

/* 指別統計 */
.finger-stats { width: 100%; }
.finger-matrix {
  display: flex;
  align-items: stretch;
  gap: 14px;
}
.finger-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid #cbbfa5;
  border-radius: 10px;
  overflow: hidden;
  background: #f8f3e8;
}
.finger-group-label {
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: #2f4942;
  background: #efe6d3;
  border-bottom: 1px solid #d7cdb8;
  padding: 8px 0;
}
.finger-group-row {
  display: flex;
  flex: 1;
}
.finger-name {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #355049;
  margin-bottom: 5px;
}
.finger-cell {
  flex: 1;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #d7cdb8;
  gap: 9px;
  padding: 6px 4px;
}
.finger-cell:last-child { border-right: 0; }
.finger-cell .rate {
  font-size: 16px;
  font-weight: 800;
  color: #2d4f45;
}
.finger-cell .keys {
  font-size: 12px;
  font-weight: 700;
  color: #53645f;
  margin-top: 4px;
}

/* 履歴グラフ */
.history-chart {
  width: 100%;
  height: 140px;
  position: relative;
  background: var(--bg-alt);
  border-radius: 5px;
  padding: 10px;
  border: 1px solid var(--border);
}
.history-chart canvas { width: 100%; height: 100%; display: block; }

/* 履歴テーブル */
.history-table {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  border-collapse: collapse;
  color: #2e433f;
}
.history-table th, .history-table td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--bg-alt);
}
.history-table th {
  color: #52635f;
  font-weight: normal;
  text-transform: uppercase;
  font-size: 11px;
}
.history-table td.result-win { color: var(--ok); font-weight: bold; }
.history-table td.result-lose { color: var(--ng); }
.history-table td.result-retreat { color: #5a6a66; }

.weak-keys-empty {
  color: #53645f;
  font-size: 13px;
  font-weight: 600;
}
.weak-key-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--bg-alt);
  font-family: var(--font-mono);
}
.weak-key-name {
  color: #2f433e;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.weak-key-rate {
  color: #4b5d58;
  font-size: 14px;
  font-weight: 600;
}
.weak-key-rate strong {
  color: var(--ng);
}
