/* スコアバッジ（トップ画面のカードと統一） */
.piece-item .piece-scores-line {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  margin-top: 6px;
}

.piece-item .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid rgba(0,0,0,0.06);
}

.piece-item .badge .k {
  opacity: 0.95;
}

.piece-item .badge .v {
  font-variant-numeric: tabular-nums;
}

.piece-item .b-total {
  background: #EFE8F8;
  color: #6E5A9E;
  border-color: rgba(110,90,158,0.22);
}

.piece-item .b-tech {
  background: #F5E6E2;
  color: #A05544;
  border-color: rgba(160,85,68,0.22);
}

.piece-item .b-exp {
  background: #E6EEF6;
  color: #4F6F91;
  border-color: rgba(79,111,145,0.22);
}

.piece-key-archive {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 20px;
}

.piece-key-archive-header {
  margin-bottom: 32px;
}

.piece-key-archive-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
  color: #333;
}

.piece-key-archive-subtitle {
  font-size: 1.1rem;
  margin: 0;
  opacity: 0.95;
  font-weight: 500;
}

.piece-key-content {
  margin-bottom: 40px;
}

.piece-key-content .composer-block {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 2px solid #e0e0e0;
  transition: all 0.3s ease;
}

.piece-key-content .composer-block:hover {
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
  border-color: #667eea;
  transform: translateY(-2px);
}

.piece-key-content .composer-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 16px 0;
  color: #333;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.piece-key-content .composer-title a {
  color: #667eea;
  text-decoration: none;
  transition: color 0.2s;
}

.piece-key-content .composer-title a:hover {
  color: #764ba2;
  text-decoration: underline;
}

.piece-key-content .composer-count {
  background: #f8f9fa;
  color: #666;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.piece-key-content .piece-type-section,
.piece-key-content .piece-type-block {
  margin-bottom: 28px;
}

.piece-key-content .piece-type-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #667eea;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #e0e0e0;
}

.piece-key-content .piece-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.piece-key-content .piece-item {
  margin: 0;
}

.piece-key-content .piece-item a {
  display: block;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 8px;
  text-decoration: none;
  color: #333;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.piece-key-content .piece-item-title {
  display: block;
}

.piece-key-content .piece-item-duration {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #666;
}

.piece-key-content .piece-item a::before {
  content: none;
}

.piece-key-content .piece-item a:hover {
  background: #e3f2fd;
  border-color: #1976d2;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.15);
}

.piece-key-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  color: #666;
  font-size: 1rem;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e0e0e0;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.piece-key-end {
  text-align: center;
  padding: 32px;
  color: #999;
  font-size: 1rem;
  background: #f8f9fa;
  border-radius: 12px;
  margin-top: 24px;
}

.piece-key-empty {
  text-align: center;
  padding: 80px 20px;
}

.piece-key-empty p {
  font-size: 1.1rem;
  color: #999;
}

@media (max-width: 768px) {
  .piece-key-archive {
    padding: 24px 12px;
  }

  .piece-key-archive-header {
    margin-bottom: 24px;
  }

  .piece-key-archive-title {
    font-size: 1.6rem;
  }

  .piece-key-archive-subtitle {
    font-size: 1rem;
  }

  .piece-key-content .composer-block {
    padding: 16px;
    margin-bottom: 16px;
  }

  .piece-key-content .composer-title {
    font-size: 1.3rem;
    margin-bottom: 12px;
  }

  .piece-key-content .piece-type-title {
    font-size: 1rem;
  }

  .piece-key-content .piece-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .piece-key-content .piece-item a {
    font-size: 13px;
    padding: 10px 14px;
  }

  .piece-key-content .piece-item a::before {
    font-size: 14px;
    left: 8px;
  }
}

.pia-infinite-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  z-index: 10000;
}

.pia-infinite-overlay.is-visible {
  display: flex;
}

.pia-infinite-overlay__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.pia-infinite-overlay__spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(25, 118, 210, 0.2);
  border-top-color: #1976d2;
  animation: piaInfiniteSpin 0.8s linear infinite;
}

.pia-infinite-overlay__text {
  font-size: 14px;
  font-weight: 700;
  color: #333;
}

@keyframes piaInfiniteSpin {
  to {
    transform: rotate(360deg);
  }
}

.piece-key-endline {
  display: none;
  height: 1px;
  background: linear-gradient(90deg, rgba(0,0,0,0), rgba(0,0,0,0.08), rgba(0,0,0,0));
  margin: 24px 0 8px;
}

.piece-key-endline.is-visible {
  display: block;
}
