/* ===== 1. Main Layout ===== */
.piece-detail-wrapper {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 20px 0;
  overflow-x: hidden !important;
  width: 100%;
  box-sizing: border-box !important;
  position: relative !important;
  touch-action: pan-y pinch-zoom !important;
}

.piece-detail-wrapper > * {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.piece-detail-wrapper section,
.piece-detail-wrapper .piece-detail-scores,
.piece-detail-wrapper .piece-community-stats,
.piece-detail-wrapper .suitability-chart {
  overflow: visible !important;
}

/* ===== ランクバッジ ===== */
.piece-rank-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  white-space: nowrap;
  letter-spacing: 0.03em;
}
.rank-beginner   { background: #64748b; }
.rank-easy       { background: #10b981; }
.rank-mid        { background: #3b82f6; }
.rank-hard       { background: #f59e0b; }
.rank-very-hard  { background: #ef4444; }
.rank-ex         { background: #7c3aed; }
.rank-unset      { background: #9ca3af; color: #fff; }

/* ===== ヘッダーメタ（バッジ＋お気に入り数） ===== */
.piece-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.piece-fav-count {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 4px;
  padding: 1.5px 10px;
  border-radius: 20px;
  border: 1.5px solid #f9a8c9;
  background: #fff0f6;
  color: #d6567a;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  box-sizing: border-box;
  transition: background 0.15s, border-color 0.15s;
}
.piece-fav-count:hover {
  background: #ffe0ef;
  border-color: #e879a8;
  text-decoration: none;
}
.piece-fav-count-heart {
  font-size: 12px;
  color: #e05c8a;
  line-height: 1;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .piece-detail-wrapper {
    padding: 10px 13px 0 !important;
    overflow-x: hidden !important;
  }

  /* ヘッダー部分*/
  .piece-detail-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
  }

  /* タイトルセクション */
  .piece-detail-title-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }

  .piece-detail-title-content {
    flex: 1;
    min-width: 0;
  }

  .piece-header-meta {
    margin-bottom: 0;
    align-items: center;
  }
  .piece-rank-badge {
    height: 22px;
    padding: 0 8px;
    line-height: 22px;
    vertical-align: middle;
  }
  .piece-fav-count {
    min-height: 0 !important;
    height: auto !important;
    padding: 3px 8px !important;
    font-size: 13px !important;
    line-height: 1 !important;
  }
  .piece-fav-count-heart {
    font-size: 12px !important;
    line-height: 1 !important;
  }

  /* 日本語タイトル */
  .piece-detail-title-ja {
    font-size: 17px !important;
    font-weight: 700 !important;
    margin: 0 0 3px 0 !important;
    color: #333 !important;
  }

  .piece-detail-composer-link {
    color: #1976d2 !important;
    text-decoration: none;
    font-weight: 700;
  }

  .piece-detail-composer-link:hover {
    text-decoration: underline;
  }

  /* 英語タイトル */
  .piece-detail-title-en {
    font-size: 14px !important;
    color: #999 !important;
    margin: 0 !important;
    line-height: 1.5;
  }

  /* メタ情報 */
  .piece-detail-meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 0;
    font-size: 13px !important;
    color: #666;
    margin: 0 !important;
    align-items: center;
  }

  .piece-detail-meta-text {
    display: inline-flex;
    align-items: center;
    line-height: 1.6;
  }

  /* 曲種と調性の間で改行させない */
  .piece-detail-meta-type {
    white-space: nowrap;
    margin-right: 12px;
  }

  .piece-detail-meta-key {
    white-space: nowrap;
    margin-right: 12px;
  }

  .piece-detail-meta-duration {
    white-space: nowrap;
  }

  .piece-detail-meta-link {
    color: #1976d2;
    text-decoration: none;
  }

  /* お気に入りボタン（タイトル右側の小さいアイコン） */
  .piece-favorite-btn-header {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
  }

  .piece-favorite-btn-header .favorite-icon {
    font-size: 24px;
    color: #ff6ea8;
    line-height: 1;
  }

  .piece-favorite-btn-header .favorite-text {
    display: none;
  }

  .piece-favorite-btn-header.is-on {
    background: rgba(255, 110, 168, 0.05);
    border-color: #ff6ea8;
  }

  /* シェアセクション */
  .piece-share-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 16px;
  }

  /* ステータスボタン（弾いた/練習中/弾きたい） - 最初の3つ */
  .piece-status-btn {
    padding: 12px 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    border: 1px solid #e0e0e0 !important;
    background: #fff !important;
    color: #333 !important;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    grid-column: span 1;
    text-align: center !important;
    justify-content: center !important;
  }

  .piece-status-btn.is-on {
    background: #1976d2 !important;
    border-color: #1976d2 !important;
    color: #fff !important;
  }

  .piece-status-btn.is-off:hover {
    border-color: #1976d2;
    color: #1976d2;
  }

  /* 練習記録・シェアボタン - 次の3つ */
  .piece-practice-btn,
  .piece-share-x,
  .piece-share-facebook {
    padding: 12px 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    border: none !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
    grid-column: span 1;
  }

  .piece-practice-btn {
    background: #9b59b6 !important;
    color: #fff !important;
  }

  .piece-share-x {
    background: #000 !important;
    color: #fff !important;
  }

  .piece-share-facebook {
    background: #1976d2 !important;
    color: #fff !important;
  }

  .piece-share-btn svg {
    width: 14px;
    height: 14px;
  }

  .piece-detail-score-row {
    display: flex !important;
    align-items: center;
    gap: 10px;
  }

  .piece-detail-score-label {
    width: 48px;
    flex: 0 0 auto;
    margin: 0;
    font-size: 13px !important;
  }

  .piece-detail-score-meter {
    flex: 1;
  }

  .piece-detail-score-meter .meter {
    height: 20px;
  }

  .piece-detail-score-meter .meter-label {
    font-size: 14px;
    font-weight: 700;
  }

  .piece-detail-score-row {
    display: flex !important;
    align-items: center;
    gap: 10px;
  }

  .piece-detail-score-label {
    width: 48px;
    flex: 0 0 auto;
    margin: 0;
    font-size: 13px !important;
  }

  .piece-detail-score-meter {
    flex: 1;
  }

  .piece-detail-score-meter .meter {
    height: 20px;
  }

  .piece-detail-score-meter .meter-label {
    font-size: 14px;
    font-weight: 700;
  }

}

/* トータルスコアのメーターバー色 */
  .piece-detail-score-row {
    display: flex !important;
    align-items: center;
    gap: 10px;
  }

  .piece-detail-score-label {
    width: 48px;
    flex: 0 0 auto;
    margin: 0;
    font-size: 13px !important;
  }

  .piece-detail-score-meter {
    flex: 1;
  }

  .piece-detail-score-meter .meter {
    height: 20px;
  }

  .piece-detail-score-meter .meter-label {
    font-size: 14px;
    font-weight: 700;
  }
  
  .piece-detail-score-row {
    display: flex !important;
    align-items: center;
    gap: 10px;
  }

  .piece-detail-score-label {
    width: 48px;
    flex: 0 0 auto;
    margin: 0;
    font-size: 13px !important;
  }

  .piece-detail-score-meter {
    flex: 1;
  }

  .piece-detail-score-meter .meter {
    height: 20px;
  }

  .piece-detail-score-meter .meter-label {
    font-size: 14px;
    font-weight: 700;
  }
.meter-total {
  background: #9b59b6;
}

/* ===== Score Rings ===== */
.score-rings {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 12px 0 4px;
  flex-wrap: wrap;
}
.score-ring-wrap {
  position: relative;
  width: 150px;
  height: 150px;
}
.score-ring-svg {
  width: 100%;
  height: 100%;
}
.score-ring-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.score-ring-label {
  font-size: 11px;
  color: #999;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.score-ring-value {
  font-size: 30px;
  font-weight: 700;
  color: #333;
  line-height: 1;
}
.score-ring-progress {
  stroke-dasharray: 0 251.33;
  transition: stroke-dasharray 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (max-width: 480px) {
  .score-rings {
    gap: 10px;
  }
  .score-ring-wrap {
    width: 100px;
    height: 100px;
  }
  .score-ring-value {
    font-size: 22px;
  }
  .score-ring-label {
    font-size: 10px;
  }
}

/* スマホの時難易度ラベルの英語部分は非表示 */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .score-label-en {
    display: none;
  }

  .piece-detail-score-row {
    display: flex !important;
    align-items: center;
    gap: 10px;
  }

  .piece-detail-score-label {
    width: 48px;
    flex: 0 0 auto;
    margin: 0;
    font-size: 13px !important;
  }

  .piece-detail-score-meter {
    flex: 1;
  }

  .piece-detail-score-meter .meter {
    height: 20px;
  }

  .piece-detail-score-meter .meter-label {
    font-size: 14px;
    font-weight: 700;
  }

  .piece-detail-score-row {
    display: flex !important;
    align-items: center;
    gap: 10px;
  }

  .piece-detail-score-label {
    width: 48px;
    flex: 0 0 auto;
    margin: 0;
    font-size: 13px !important;
  }

  .piece-detail-score-meter {
    flex: 1;
  }

  .piece-detail-score-meter .meter {
    height: 20px;
  }

  .piece-detail-score-meter .meter-label {
    font-size: 14px;
    font-weight: 700;
  }

}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .piece-detail-scores .piece-detail-score-row {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .piece-detail-scores .piece-detail-score-label {
    width: 48px;
    flex: 0 0 auto;
    margin: 0;
    font-size: 13px;
  }

  .piece-detail-scores .piece-detail-score-meter {
    flex: 1;
  }

  .piece-detail-scores .piece-detail-score-meter .meter {
    height: 20px;
  }

  .piece-detail-scores .piece-detail-score-meter .meter-label {
    font-size: 14px;
    font-weight: 700;
  }
}

/* ===== 2. Rating Form ===== */
      .piece-rate-form-page {
        max-width: 800px;
        margin: 40px auto;
        padding: 20px;
      }

      .piece-rate-header {
        margin-bottom: 30px;
        padding-bottom: 20px;
        border-bottom: 2px solid #e0e0e0;
      }

      .piece-rate-title {
        font-size: 28px;
        font-weight: 700;
        margin-bottom: 10px;
        color: #333;
      }

      .piece-rate-composer {
        font-size: 18px;
        color: #666;
        margin-bottom: 15px;
      }

      .piece-rate-back-link {
        display: inline-block;
        color: #1976d2;
        text-decoration: none;
        font-size: 14px;
        padding: 8px 16px;
        border: 1px solid #1976d2;
        border-radius: 4px;
        transition: all 0.2s;
      }

      .piece-rate-back-link:hover {
        background: #1976d2;
        color: white;
      }

      .piece-rate-content {
        background: #fff;
      }

      .pia-rate-success-box {
        background: #e8f5e9;
        border: 2px solid #4caf50;
        border-radius: 8px;
        padding: 24px;
        margin-bottom: 24px;
        text-align: center;
      }

      .pia-rate-success {
        font-size: 18px;
        font-weight: 600;
        color: #2e7d32;
        margin-bottom: 16px;
      }

      .pia-rate-success-link {
        display: inline-block;
        background: #4caf50;
        color: white;
        padding: 10px 24px;
        border-radius: 4px;
        text-decoration: none;
        font-weight: 500;
        transition: all 0.2s;
      }

      .pia-rate-success-link:hover {
        background: #45a049;
      }

      .piece-rate-info {
        margin-bottom: 30px;
      }

      .piece-rate-description {
        font-size: 16px;
        color: #333;
        margin-bottom: 20px;
      }

      .piece-rate-delta {
        background: #f5f5f5;
        border-radius: 8px;
        padding: 20px;
        margin-top: 20px;
      }

      .piece-rate-delta h3 {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 12px;
        color: #333;
      }

      .piece-rate-delta-values {
        display: flex;
        gap: 24px;
        margin-bottom: 12px;
      }

      .piece-rate-delta-item {
        font-size: 16px;
        color: #333;
      }

      .piece-rate-delta-note {
        font-size: 13px;
        color: #666;
        margin-top: 8px;
      }

      .piece-rate-delta-note a {
        color: #1976d2;
        text-decoration: none;
      }

      .piece-rate-delta-note a:hover {
        text-decoration: underline;
      }

      .piece-rate-form-main {
        background: #f8f9fa;
        border-radius: 8px;
        padding: 24px;
      }

      .pia-status-row {
        margin-top: 24px;
      }

      .pia-status-row > label {
        display: block;
        font-weight: 600;
        margin-bottom: 12px;
        color: #333;
      }

      .pia-status-radios {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
      }

      .pia-status-radio {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 16px;
        background: #ffffff;
        border: 2px solid #e0e0e0;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s;
        min-width: 140px;
      }

      .pia-status-radio:hover {
        background: #f0f4ff;
        border-color: #1976d2;
      }

      .pia-status-radio input[type="radio"] {
        width: 18px;
        height: 18px;
        cursor: pointer;
      }

      .pia-status-radio input[type="radio"]:checked + span {
        font-weight: 600;
        color: #1976d2;
      }

      .pia-status-radio span {
        font-size: 14px;
        color: #555;
      }

      .pia-suitability-row {
        margin-top: 24px;
      }

      .pia-suitability-row > label {
        display: block;
        font-weight: 600;
        margin-bottom: 12px;
        color: #333;
      }

      .pia-suitability-checkboxes {
        display: flex;
        flex-direction: column;
        gap: 12px;
      }

      .pia-suitability-checkbox {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 16px;
        background: #f8f9fa;
        border: 2px solid #e0e0e0;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s;
      }

      .pia-suitability-checkbox:hover {
        background: #e3f2fd;
        border-color: #1976d2;
      }

      .pia-suitability-checkbox input[type="checkbox"] {
        width: 18px;
        height: 18px;
        cursor: pointer;
      }

      .pia-suitability-checkbox input[type="checkbox"]:checked + span {
        font-weight: 600;
        color: #1976d2;
      }

      .pia-suitability-checkbox span {
        font-size: 14px;
        color: #555;
      }

      .piece-rate-actions {
        display: flex;
        gap: 16px;
        align-items: center;
        margin-top: 24px;
      }

      .piece-rate-submit {
        flex: 1;
        max-width: 300px;
        font-size: 16px;
        padding: 14px 24px;
      }

      .piece-rate-cancel {
        color: #666;
        text-decoration: none;
        padding: 10px 20px;
        border: 1px solid #ccc;
        border-radius: 4px;
        transition: all 0.2s;
      }

      .piece-rate-cancel:hover {
        background: #f5f5f5;
        border-color: #999;
      }

      .piece-rate-login {
        text-align: center;
        padding: 40px 20px;
      }

      .piece-rate-login p {
        font-size: 16px;
        color: #666;
        margin-bottom: 20px;
      }

      @media (max-width: 768px), (hover: none) and (pointer: coarse) {
        .piece-rate-form-page {
          padding: 10px;
        }

        .piece-rate-title {
          font-size: 22px;
        }

        .piece-rate-composer {
          font-size: 16px;
        }

        .piece-rate-delta-values {
          flex-direction: column;
          gap: 8px;
        }

        .pia-status-radios {
          flex-direction: column;
        }

        .pia-status-radio {
          padding: 10px 12px;
          min-width: auto;
          width: 100%;
        }

        .pia-status-radio span {
          font-size: 13px;
        }

        .pia-suitability-checkbox {
          padding: 10px 12px;
        }

        .pia-suitability-checkbox span {
          font-size: 13px;
        }

        .piece-rate-actions {
          flex-direction: column;
        }

        .piece-rate-submit {
          max-width: 100%;
        }
      }
      

/* ===== 3. Ratings List ===== */
      .piece-ratings-list-page {
        max-width: 900px;
        margin: 40px auto;
        padding: 20px;
      }

      .piece-ratings-header {
        margin-bottom: 30px;
        padding-bottom: 20px;
        border-bottom: 2px solid #e0e0e0;
      }

      .piece-ratings-title {
        font-size: 28px;
        font-weight: 700;
        margin-bottom: 10px;
        color: #333;
      }

      .piece-ratings-composer {
        font-size: 18px;
        color: #666;
        margin-bottom: 10px;
      }

      .piece-ratings-count {
        font-size: 16px;
        color: #1976d2;
        font-weight: 600;
        margin-bottom: 15px;
      }

      .piece-ratings-back-link {
        display: inline-block;
        color: #1976d2;
        text-decoration: none;
        font-size: 14px;
        padding: 8px 16px;
        border: 1px solid #1976d2;
        border-radius: 4px;
        transition: all 0.2s;
      }

      .piece-ratings-back-link:hover {
        background: #1976d2;
        color: white;
      }

      .piece-ratings-content {
        background: #fff;
      }

      .piece-ratings-empty {
        text-align: center;
        color: #999;
        padding: 60px 20px;
        font-size: 16px;
      }

      /* 印象行のスタイル */
      .pia-ratings-list-full {
        display: flex;
        flex-direction: column;
        gap: 16px;
      }

      .pia-ratings-list-full .pia-rating-row {
        padding: 16px;
        background: #fff;
        border-radius: 12px;
        border: 1px solid #e0e0e0;
        margin-bottom: 0;
      }

      .pia-ratings-list-full .pia-rating-row:first-child {
        border-top: 1px solid #e0e0e0;
      }

      .pia-rating-row.is-current-user {
        background: #f0f7ff;
        border: 1px solid #1976d2;
      }

      .pia-rating-row-head {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
        gap: 8px;
      }

      .pia-rating-row-right {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
      }

      .pia-rating-user {
        font-weight: 700;
        font-size: 15px;
        display: flex;
        align-items: center;
        gap: 8px;
      }

      .pia-rating-user-avatar-link {
        display: flex;
        align-items: center;
        flex-shrink: 0;
      }

      .pia-rating-user-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid #e0e0e0;
      }

      .pia-rating-user-avatar-default {
        width: 32px;
        height: 32px;
        color: #999;
        background: #f0f0f0;
        border-radius: 50%;
        padding: 6px;
        border: 2px solid #e0e0e0;
      }

      .pia-rating-user-link {
        color: #1976d2;
        text-decoration: none;
      }

      .pia-rating-user-link:hover {
        text-decoration: underline;
      }

      .pia-rating-date {
        font-size: 13px;
        color: #999;
      }

      .pia-rating-row .piece-scores-line {
        margin-bottom: 12px;
      }

      .pia-rating-comment {
        color: #333;
        line-height: 1.6;
        margin-bottom: 16px;
        padding: 12px;
        background: #f8f9fa;
        border-radius: 4px;
      }

      .pia-rating-like-section {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding-top: 12px;
        border-top: 1px solid #f0f0f0;
      }

      .pia-rating-like-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 12px;
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 20px;
        cursor: pointer;
        transition: all 0.2s;
        font-size: 16px;
      }

      .pia-rating-like-btn:hover {
        background: #f5f5f5;
        border-color: #f44336;
      }

      .pia-rating-like-btn.liked {
        background: #ffebee;
        border-color: #f44336;
      }

      .pia-rating-like-btn .like-icon {
        font-size: 20px;
        line-height: 1;
      }

      .pia-rating-like-btn .like-count {
        font-weight: 600;
        color: #666;
        font-size: 14px;
      }

      .pia-rating-like-btn.liked .like-count {
        color: #f44336;
      }

      .pia-rating-like-display {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 12px;
        font-size: 16px;
        color: #999;
      }

      .pia-rating-like-display .like-icon {
        font-size: 20px;
      }

      .pia-rating-like-display .like-count {
        font-weight: 600;
        font-size: 14px;
      }

      /* 報告メニュー */
      .pia-report-menu {
        position: relative;
        display: inline-block;
      }

      .pia-report-menu-btn {
        background: none;
        border: none;
        font-size: 1.2rem;
        cursor: pointer;
        padding: 4px 8px;
        color: #666;
        border-radius: 4px;
        transition: all 0.2s;
      }

      .pia-report-menu-btn:hover {
        background: #f5f5f5;
        color: #333;
      }

      .pia-report-menu-dropdown {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        min-width: 140px;
        z-index: 1000;
        margin-top: 4px;
      }

      .pia-report-menu.is-open .pia-report-menu-dropdown {
        display: block;
      }

      .pia-report-menu-item {
        display: block;
        padding: 10px 16px;
        color: #333;
        text-decoration: none;
        transition: all 0.2s;
        cursor: pointer;
        border: none;
        background: none;
        width: 100%;
        text-align: left;
        font-size: 0.95rem;
      }

      .pia-report-menu-item:hover {
        background: #f5f5f5;
      }

      .pia-report-menu-item:first-child {
        border-radius: 8px 8px 0 0;
      }

      .pia-report-menu-item:last-child {
        border-radius: 0 0 8px 8px;
      }

      /* レスポンシブ */
      @media (max-width: 768px), (hover: none) and (pointer: coarse) {
        .pia-rating-row {
          padding: 14px;
        }

        .pia-rating-scores {
          flex-direction: column;
          gap: 6px;
        }

        .pia-rating-score {
          width: 100%;
        }

        .piece-ratings-list-page {
          padding: 10px;
        }
      }

      /* ページング */
      .piece-ratings-pagination {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        margin-top: 40px;
        padding-top: 30px;
        border-top: 1px solid #e0e0e0;
      }

      .pagination-btn {
        padding: 10px 20px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 6px;
        text-decoration: none;
        color: #333;
        font-weight: 500;
        transition: all 0.2s;
        cursor: pointer;
      }

      .pagination-btn:not(.disabled):hover {
        background: #1976d2;
        color: #fff;
        border-color: #1976d2;
      }

      .pagination-btn.disabled {
        opacity: 0.4;
        cursor: not-allowed;
      }

      .pagination-numbers {
        display: flex;
        align-items: center;
        gap: 6px;
      }

      .pagination-num {
        min-width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #ddd;
        border-radius: 6px;
        text-decoration: none;
        color: #333;
        font-weight: 500;
        background: #fff;
        transition: all 0.2s;
      }

      .pagination-num:hover {
        background: #f5f5f5;
        border-color: #1976d2;
        color: #1976d2;
      }

      .pagination-num.active {
        background: #1976d2;
        color: #fff;
        border-color: #1976d2;
        font-weight: 700;
      }

      .pagination-ellipsis {
        padding: 0 8px;
        color: #999;
      }

      @media (max-width: 768px), (hover: none) and (pointer: coarse) {
        .piece-ratings-pagination {
          flex-wrap: wrap;
        }

        .pagination-btn {
          padding: 8px 16px;
          font-size: 14px;
        }

        .pagination-num {
          min-width: 36px;
          height: 36px;
          font-size: 14px;
        }
      }
      

/* ===== 4. Users List ===== */
      .piece-users-list {
        max-width: 1200px;
        margin: 4px auto;
        padding: 8px 20px 20px;
      }

      .piece-users-header {
        margin-bottom: 20px;
        padding-bottom: 16px;
        border-bottom: 2px solid #e0e0e0;
      }

      .piece-users-title {
        font-size: 20px;
        font-weight: 700;
        margin: 10px 0 0;
        color: #333;
      }

      .piece-users-back-link {
        display: inline-flex;
        align-items: center;
        align-self: flex-start;
        color: #1976d2;
        text-decoration: none;
        font-size: 12px;
        padding: 3px 10px;
        border: 1px solid #1976d2;
        border-radius: 4px;
        transition: all 0.2s;
        line-height: 1;
      }

      .piece-users-back-link:hover {
        background: #1976d2;
        color: white;
      }

      @media (min-width: 769px) {
        .piece-users-list {
          margin-top: -12px;
        }

        .piece-users-back-link {
          padding: 8px 16px;
          font-size: 14px;
        }
      }

      .piece-users-tabs {
        display: flex;
        gap: 8px;
        margin-bottom: 20px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
      }

      .piece-users-tabs::-webkit-scrollbar {
        display: none;
      }

      .piece-users-tab {
        display: inline-flex;
        align-items: center;
        padding: 7px 14px;
        border-radius: 999px;
        background: rgba(0,0,0,.05);
        text-decoration: none;
        color: #333;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
        transition: background .15s;
        font-weight: 500;
      }

      .piece-users-tab:hover:not(.is-active) {
        background: rgba(0,0,0,.1);
      }

      .piece-users-tab.is-active {
        background: #333;
        color: #fff;
        font-weight: 700;
      }

      .piece-users-list-wrapper {
        margin-top: 20px;
      }

      .piece-users-pagination {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 20px;
        margin-top: 30px;
        padding-top: 20px;
        border-top: 1px solid #e0e0e0;
      }

      .piece-users-page-link {
        color: #1976d2;
        text-decoration: none;
        padding: 8px 16px;
        border: 1px solid #1976d2;
        border-radius: 4px;
        transition: all 0.2s;
        font-weight: 500;
      }

      .piece-users-page-link:hover {
        background: #1976d2;
        color: white;
      }

      .piece-users-page-info {
        color: #666;
        font-weight: 500;
      }

      .piece-users-empty {
        text-align: center;
        color: #666;
        padding: 40px 20px;
        font-size: 16px;
      }

      .piece-users-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 16px;
      }

      .piece-user-card {
        background: #f8f9fa;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 7px 14px;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
      }

      .piece-user-card:hover {
        background: #e9ecef;
        border-color: #1976d2;
        transform: translateY(-2px);
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
      }

      .piece-user-link {
        text-decoration: none;
        color: #333;
        display: flex;
        align-items: center;
        gap: 12px;
        flex: 1;
      }

      .piece-user-avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        overflow: hidden;
        background: #e0e0e0;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
      }

      .piece-user-avatar-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }

      .piece-user-avatar-default {
        width: 24px;
        height: 24px;
        color: #999;
      }

      .piece-user-name {
        font-size: 13px;
        font-weight: 500;
        flex: 1;
      }

      .piece-user-message-btn {
        background: #1976d2;
        color: #fff;
        border: none;
        border-radius: 6px;
        padding: 8px 12px;
        font-size: 18px;
        text-decoration: none;
        cursor: pointer;
        transition: all 0.2s;
        flex-shrink: 0;
      }

      .piece-user-message-btn:hover {
        background: #1565c0;
        transform: scale(1.1);
      }

      @media (max-width: 768px), (hover: none) and (pointer: coarse) {
        .piece-users-list {
          padding: 10px;
        }

        .piece-users-title {
          font-size: 20px;
        }

        .piece-users-back-link {
          padding: 10px 16px !important;
          font-size: 14px !important;
          line-height: 1 !important;
          min-height: unset !important;
          height: auto !important;
        }

        .piece-users-tab {
          padding: 4px 12px;
        }

        .piece-users-grid {
          grid-template-columns: 1fr;
        }

        .piece-users-pagination {
          flex-direction: column;
          gap: 10px;
        }
      }
      

/* ===== 5. Videos List ===== */
      .piece-videos-page {
        max-width: 900px;
        margin: 40px auto;
        padding: 20px;
      }

      .piece-videos-header {
        margin-bottom: 30px;
        padding-bottom: 20px;
        border-bottom: 2px solid #e0e0e0;
      }

      .piece-videos-title {
        font-size: 24px;
        font-weight: 700;
        margin-bottom: 15px;
        color: #333;
      }

      .piece-videos-header-actions {
        display: flex;
        gap: 12px;
        align-items: center;
      }

      .piece-videos-back-link {
        display: inline-block;
        color: #1976d2;
        text-decoration: none;
        font-size: 14px;
        padding: 8px 16px;
        border: 1px solid #1976d2;
        border-radius: 4px;
        transition: all 0.2s;
      }

      .piece-videos-back-link:hover {
        background: #1976d2;
        color: white;
      }

      .piece-video-add-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: #6E4CD6;
        color: #fff;
        text-decoration: none;
        padding: 14px 24px;
        border-radius: 6px;
        font-size: 16px;
        font-weight: 600;
        line-height: 1.2;
        transition: all 0.2s;
      }

      .piece-video-add-btn:hover {
        background: #4f28b2;
      }

      .piece-video-success {
        background: #e8f5e9;
        border-left: 4px solid #4caf50;
        padding: 16px;
        margin-bottom: 20px;
        border-radius: 4px;
        color: #2e7d32;
        font-weight: 600;
      }

      .piece-videos-empty {
        text-align: center;
        color: #666;
        padding: 40px 20px;
        font-size: 16px;
      }

      .piece-video-item {
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 20px;
        margin-bottom: 24px;
      }

      .piece-video-player {
        position: relative;
        padding-bottom: 56.25%; /* 16:9 aspect ratio */
        height: 0;
        overflow: hidden;
        margin-bottom: 16px;
        border-radius: 4px;
        background: #000;
      }

      .piece-video-player iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border: 0;
      }

      .piece-video-meta {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        font-size: 14px;
      }

      .piece-video-meta-right {
        display: flex;
        align-items: center;
        gap: 12px;
      }

      .piece-video-user {
        display: flex;
        align-items: center;
        gap: 8px;
      }

      .piece-video-user-avatar-link {
        display: flex;
        align-items: center;
        flex-shrink: 0;
      }

      .piece-video-user-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid #e0e0e0;
      }

      .piece-video-user-avatar-default {
        width: 32px;
        height: 32px;
        color: #999;
        background: #f0f0f0;
        border-radius: 50%;
        padding: 6px;
        border: 2px solid #e0e0e0;
      }

      .piece-video-user a {
        color: #1976d2;
        text-decoration: none;
        font-weight: 500;
      }

      .piece-video-user a:hover {
        text-decoration: underline;
      }

      /* 動画タブのユーザー情報: pia-rating-user のフォントを上書き */
      .piece-video-meta .pia-rating-user {
        font-size: 14px;
        font-weight: 500;
      }

      .piece-video-meta .pia-rating-user-avatar-link {
        align-self: center;
      }

      .piece-video-date {
        color: #999;
      }

      .video-delete-form {
        margin: 0;
        padding: 0;
      }

      .video-delete-btn {
        background: none;
        border: none;
        cursor: pointer;
        font-size: 18px;
        padding: 4px 0 !important;
        opacity: 0.6;
        transition: all 0.2s;
        line-height: 1;
      }

      .video-delete-btn:hover {
        opacity: 1;
        transform: scale(1.1);
      }

      .piece-video-comment {
        color: #333;
        line-height: 1.6;
        margin-bottom: 16px;
        padding: 12px;
        background: #f8f9fa;
        border-radius: 4px;
      }

      .piece-video-actions {
        display: flex;
        gap: 24px;
        align-items: center;
        padding-top: 12px;
        border-top: 1px solid #e0e0e0;
      }

      .piece-video-like-btn {
        background: none;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 18px;
        transition: all 0.2s;
        padding: 4px 8px;
        border-radius: 4px;
      }

      .piece-video-like-btn:hover {
        background: #f5f5f5;
      }

      .piece-video-like-btn.is-liked .piece-video-like-icon {
        color: #e91e63;
      }

      .piece-video-like-icon {
        color: #999;
      }

      .piece-video-like-count {
        font-size: 14px;
        color: #666;
        font-weight: 500;
      }

      .piece-video-like-display {
        font-size: 18px;
        color: #999;
      }

      .piece-video-comments-preview {
        flex: 1;
      }

      .piece-video-comment-preview {
        font-size: 14px;
        color: #666;
        margin-bottom: 8px;
        padding: 8px 12px;
        background: #f8f9fa;
        border-radius: 4px;
      }

      .piece-video-comment-preview strong {
        color: #333;
      }

      .piece-video-comment-mine {
        background: #e3f2fd;
        border-left: 3px solid #1976d2;
      }

      .piece-video-comment-mine strong {
        color: #1976d2;
      }

      .piece-video-comments-actions {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
      }

      .piece-video-comments-link {
        color: #1976d2;
        text-decoration: none;
        font-size: 14px;
        font-weight: 500;
      }

      .piece-video-comments-link:hover {
        text-decoration: underline;
      }

      .piece-video-comment-btn {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 6px 12px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        text-decoration: none;
        border-radius: 6px;
        font-size: 13px;
        font-weight: 600;
        transition: all 0.2s;
      }

      .piece-video-comment-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
      }

      .piece-videos-pagination {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 20px;
        margin-top: 30px;
        padding-top: 20px;
        border-top: 1px solid #e0e0e0;
      }

      .piece-videos-page-link {
        color: #1976d2;
        text-decoration: none;
        padding: 8px 16px;
        border: 1px solid #1976d2;
        border-radius: 4px;
        transition: all 0.2s;
        font-weight: 500;
      }

      .piece-videos-page-link:hover {
        background: #1976d2;
        color: white;
      }

      .piece-videos-page-info {
        color: #666;
        font-weight: 500;
      }

      @media (max-width: 768px), (hover: none) and (pointer: coarse) {
        .piece-videos-page {
          padding: 10px;
        }

        .piece-videos-title {
          font-size: 20px;
        }

        .piece-videos-header-actions {
          flex-direction: column;
          align-items: flex-start;
        }

        .piece-video-actions {
          flex-direction: column;
          align-items: flex-start;
          gap: 12px;
        }

        .piece-video-comments-actions {
          flex-direction: column;
          align-items: flex-start;
          width: 100%;
        }

        .piece-video-comment-btn {
          width: 100%;
          justify-content: center;
        }
      }
      

/* ===== 6. Video Add ===== */
      .piece-video-add-page {
        max-width: 700px;
        margin: 40px auto;
        padding: 20px;
      }

      .piece-video-add-header {
        margin-bottom: 30px;
        padding-bottom: 20px;
        border-bottom: 2px solid #e0e0e0;
      }

      .piece-video-add-title {
        font-size: 24px;
        font-weight: 700;
        margin-bottom: 8px;
        color: #333;
      }

      .piece-video-add-subtitle {
        font-size: 16px;
        color: #666;
        margin-bottom: 15px;
      }

      .piece-video-add-back {
        display: inline-block;
        color: #1976d2;
        text-decoration: none;
        font-size: 14px;
        padding: 8px 16px;
        border: 1px solid #1976d2;
        border-radius: 4px;
        transition: all 0.2s;
      }

      .piece-video-add-back:hover {
        background: #1976d2;
        color: white;
      }

      .piece-video-add-form {
        background: #fff;
        padding: 32px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
      }

      .form-group {
        margin-bottom: 24px;
      }

      .form-group label {
        display: block;
        font-weight: 600;
        font-size: 15px;
        color: #333;
        margin-bottom: 8px;
      }

      .form-group input[type="url"],
      .form-group textarea {
        width: 100%;
        padding: 12px 16px;
        border: 2px solid #e0e0e0;
        border-radius: 8px;
        font-size: 15px;
        font-family: inherit;
        line-height: 1.6;
        transition: all 0.2s;
        box-sizing: border-box;
      }

      .form-group textarea {
        resize: vertical;
      }

      .form-group input[type="url"]:focus,
      .form-group textarea:focus {
        outline: none;
        border-color: #1976d2;
        box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
      }

      .form-help {
        font-size: 13px;
        color: #999;
        margin-top: 6px;
        line-height: 1.5;
      }

      .form-actions {
        display: flex;
        gap: 12px;
        align-items: center;
        margin-top: 32px;
      }

      .btn-submit {
        padding: 12px 32px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
      }

      .btn-submit:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
      }

      .btn-submit:active {
        transform: translateY(0);
      }

      .btn-cancel {
        padding: 12px 24px;
        background: #fff;
        color: #666;
        border: 2px solid #e0e0e0;
        border-radius: 8px;
        font-size: 15px;
        font-weight: 600;
        text-decoration: none;
        transition: all 0.2s;
        display: inline-block;
      }

      .btn-cancel:hover {
        background: #f5f5f5;
        border-color: #bdbdbd;
        color: #333;
      }

      @media (max-width: 768px), (hover: none) and (pointer: coarse) {
        .piece-video-add-page {
          padding: 16px;
          margin: 20px auto;
        }

        .piece-video-add-form {
          padding: 20px;
        }

        .form-actions {
          flex-direction: column;
          width: 100%;
        }

        .btn-submit,
        .btn-cancel {
          width: 100%;
          text-align: center;
        }
      }
      

/* ===== 7. Video Comments ===== */
      .piece-video-comments-page {
        max-width: 900px;
        margin: 12px auto;
        padding: 20px;
      }

      .piece-video-comments-header {
        margin-bottom: 16px;
        padding-bottom: 16px;
        border-bottom: 2px solid #e0e0e0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
      }

      .piece-video-comments-title {
        font-size: 1.1rem;
        font-weight: 700;
        margin-bottom: 0;
        color: #333;
        border-left: 4px solid #4f81bd;
        padding-left: 10px;
      }

      .piece-video-comments-actions {
        display: flex;
        gap: 12px;
        align-items: center;
      }

      .piece-video-comments-back {
        display: inline-flex;
        align-items: center;
        color: #1976d2;
        text-decoration: none;
        font-size: 13px;
        padding: 8px 14px;
        border: 1px solid #1976d2;
        border-radius: 4px;
        transition: all 0.2s;
        line-height: 1;
      }

      @media (max-width: 768px), (hover: none) and (pointer: coarse) {
        .piece-video-comments-back {
          padding: 2px 8px;
          font-size: 12px;
        }
      }

      .piece-video-comments-back:hover {
        background: #1976d2;
        color: white;
      }

      .btn-add-comment {
        background: #4caf50;
        color: white;
        text-decoration: none;
        padding: 8px 16px;
        border-radius: 4px;
        font-weight: 500;
        transition: all 0.2s;
      }

      .btn-add-comment:hover {
        background: #45a049;
      }

      .comment-success {
        background: #e8f5e9;
        border-left: 4px solid #4caf50;
        padding: 16px;
        margin-bottom: 20px;
        border-radius: 4px;
        color: #2e7d32;
        font-weight: 600;
      }

      .video-preview {
        position: relative;
        padding-bottom: 56.25%; /* 16:9 aspect ratio */
        height: 0;
        overflow: hidden;
        margin-bottom: 30px;
        background: #000;
        border-radius: 8px;
      }

      .video-preview iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border: 0;
      }

      .comments-list-title {
        font-size: 20px;
        font-weight: 600;
        margin-bottom: 20px;
        color: #333;
      }

      .comments-empty {
        text-align: center;
        color: #666;
        padding: 40px 20px;
      }

      .comment-item {
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 16px;
        margin-bottom: 16px;
      }

      .comment-item-mine {
        background: #fff;
        border: 1px solid #1976d2;
      }

      .comment-badge-mine {
        display: inline-block;
        background: #1976d2;
        color: white;
        font-size: 11px;
        padding: 2px 8px;
        border-radius: 12px;
        margin-left: 8px;
        font-weight: 600;
      }

      .comment-header {
        display: flex;
        justify-content: space-between;
        margin-bottom: 12px;
        padding-bottom: 8px;
        border-bottom: 1px solid #f0f0f0;
      }

      .comment-user {
        display: flex;
        align-items: center;
        gap: 8px;
      }

      .comment-user-avatar-link {
        display: flex;
        align-items: center;
        flex-shrink: 0;
      }

      .comment-user-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid #e0e0e0;
      }

      .comment-user-avatar-default {
        width: 32px;
        height: 32px;
        color: #999;
        background: #f0f0f0;
        border-radius: 50%;
        padding: 6px;
        border: 2px solid #e0e0e0;
      }

      .comment-user a {
        color: #1976d2;
        text-decoration: none;
        font-weight: 500;
      }

      .comment-user a:hover {
        text-decoration: underline;
      }

      .comment-header-right {
        display: flex;
        align-items: center;
        gap: 12px;
      }

      .comment-date {
        font-size: 13px;
        color: #999;
      }

      .comment-delete-form {
        margin: 0;
        padding: 0;
      }

      .comment-delete-btn {
        background: none;
        border: none;
        cursor: pointer;
        font-size: 18px;
        padding: 4px 0 !important;
        opacity: 0.6;
        transition: all 0.2s;
        line-height: 1;
      }

      .comment-delete-btn:hover {
        opacity: 1;
        transform: scale(1.1);
      }

      .comment-body {
        color: #333;
        line-height: 1.6;
      }

      /* コメントいぁE�Eボタン */
      .comment-like-section {
        margin-top: 12px;
        display: flex;
        align-items: center;
      }

      .comment-like-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        border: none;
        background: transparent;
        cursor: pointer;
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 16px;
        transition: all 0.2s;
        font-family: inherit;
      }

      .comment-like-btn:hover {
        background: #f5f5f5;
      }

      .comment-like-btn .like-icon {
        font-size: 20px;
        transition: transform 0.2s;
      }

      .comment-like-btn.liked .like-icon {
        animation: likeAnimation 0.4s ease;
      }

      .comment-like-btn .like-count {
        font-weight: 600;
        color: #666;
        font-size: 14px;
      }

      .comment-like-btn.liked .like-count {
        color: #f44336;
      }

      .comment-like-display {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 12px;
        font-size: 16px;
        color: #999;
      }

      .comment-like-display .like-icon {
        font-size: 20px;
      }

      .comment-like-display .like-count {
        font-weight: 600;
        font-size: 14px;
      }

      .comments-add-btn-wrap {
        display: flex;
        justify-content: center;
        margin: 16px 0 8px;
      }

      .piece-video-comments-page .piece-pagination,
      .piece-tab-ratings .piece-pagination,
      .piece-tab-videos .piece-pagination,
      .piece-tab-practice .piece-pagination {
        display: flex !important;
        flex-wrap: wrap;
        align-items: center !important;
        gap: 0.4rem;
      }

      .piece-video-comments-page .piece-pagination .page-numbers,
      .piece-tab-ratings .piece-pagination .page-numbers,
      .piece-tab-videos .piece-pagination .page-numbers,
      .piece-tab-practice .piece-pagination .page-numbers {
        display: inline-flex !important;
        align-items: center !important;
        align-self: center !important;
        line-height: 1 !important;
        height: auto !important;
        min-height: unset !important;
      }

      .comments-pagination {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 20px;
        margin-top: 30px;
        padding-top: 20px;
        border-top: 1px solid #e0e0e0;
      }

      .comments-page-link {
        color: #1976d2;
        text-decoration: none;
        padding: 8px 16px;
        border: 1px solid #1976d2;
        border-radius: 4px;
        transition: all 0.2s;
        font-weight: 500;
      }

      .comments-page-link:hover {
        background: #1976d2;
        color: white;
      }

      .comments-page-info {
        color: #666;
        font-weight: 500;
      }

      @media (max-width: 768px), (hover: none) and (pointer: coarse) {
        .piece-video-comments-page {
          padding: 10px;
        }

        .piece-video-comments-actions {
          flex-direction: column;
          align-items: flex-start;
        }
      }
      

/* ===== 8. Comment Add ===== */
      .piece-comment-add-page {
        max-width: 700px;
        margin: 40px auto;
        padding: 20px;
      }

      .piece-comment-add-header {
        margin-bottom: 30px;
        padding-bottom: 20px;
        border-bottom: 2px solid #e0e0e0;
      }

      .piece-comment-add-title {
        font-size: 24px;
        font-weight: 700;
        margin-bottom: 15px;
        color: #333;
      }

      .piece-comment-add-back {
        display: inline-block;
        color: #1976d2;
        text-decoration: none;
        font-size: 14px;
        padding: 8px 16px;
        border: 1px solid #1976d2;
        border-radius: 4px;
        transition: all 0.2s;
      }

      .piece-comment-add-back:hover {
        background: #1976d2;
        color: white;
      }

      .piece-comment-add-form {
        background: #fff;
        padding: 32px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
      }

      .form-group {
        margin-bottom: 24px;
      }

      .form-group label {
        display: block;
        font-weight: 600;
        font-size: 15px;
        color: #333;
        margin-bottom: 8px;
      }

      .form-group textarea {
        width: 100%;
        padding: 12px 16px;
        border: 2px solid #e0e0e0;
        border-radius: 8px;
        font-size: 15px;
        font-family: inherit;
        line-height: 1.6;
        resize: vertical;
        transition: all 0.2s;
        box-sizing: border-box;
      }

      .form-group textarea:focus {
        outline: none;
        border-color: #1976d2;
        box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
      }

      .form-actions {
        display: flex;
        gap: 12px;
        align-items: center;
      }

      .btn-submit {
        padding: 12px 32px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
      }

      .btn-submit:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
      }

      .btn-submit:active {
        transform: translateY(0);
      }

      .btn-cancel {
        padding: 12px 24px;
        background: #fff;
        color: #666;
        border: 2px solid #e0e0e0;
        border-radius: 8px;
        font-size: 15px;
        font-weight: 600;
        text-decoration: none;
        transition: all 0.2s;
        display: inline-block;
      }

      .btn-cancel:hover {
        background: #f5f5f5;
        border-color: #bdbdbd;
        color: #333;
      }

      @media (max-width: 768px), (hover: none) and (pointer: coarse) {
        .piece-comment-add-page {
          padding: 16px;
          margin: 20px auto;
        }

        .piece-comment-add-form {
          padding: 20px;
        }

        .form-actions {
          flex-direction: column;
          width: 100%;
        }

        .btn-submit,
        .btn-cancel {
          width: 100%;
          text-align: center;
        }
      }
      

/* ===== 9. Ratings Preview ===== */
    .piece-ratings-preview-action {
      display: flex;
      gap: 10px;
      justify-content: center;
      align-items: center;
      flex-wrap: wrap;
    }

    .piece-rate-button {
      display: inline-block;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: #fff;
      padding: 12px 32px;
      border: none;
      border-radius: 8px;
      text-decoration: none;
      font-weight: 600;
      font-size: 15px;
      cursor: pointer;
      transition: all 0.2s;
      box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .piece-rate-button:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(102,126,234,0.4);
    }

    @media (max-width: 768px), (hover: none) and (pointer: coarse) {
      .piece-ratings-preview-action {
        flex-direction: column;
        align-items: stretch;
      }

      .piece-rate-button {
        display: block;
        width: 100%;
        padding: 8px 16px;
        font-size: 14px;
        box-sizing: border-box;
        text-align: center;
      }
    }
    

/* ===== 10. Community Stats ===== */
/* みんなのマーク（カウント表示） */
.piece-community-stats {
  margin: 24px 0;
}

.piece-community-counts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 24px;
}

.piece-community-count-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.piece-community-count-link {
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  cursor: pointer;
}

.piece-community-count-link:hover {
  background: #e9ecef;
  border-color: #1976d2;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.piece-community-count-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.piece-community-count-disabled .piece-community-number {
  color: #999;
}

.piece-community-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.piece-community-label {
  font-size: 14px;
  color: #333;
  flex: 1;
  font-weight: 500;
}

.piece-community-number {
  font-size: 18px;
  font-weight: bold;
  color: #1976d2;
  flex-shrink: 0;
}

/* ===== Suitability Donut Chart ===== */
.suitability-chart {
  display: flex;
  align-items: center;
  gap: 24px;
}
.suitability-donut-wrap {
  position: relative;
  flex-shrink: 0;
  width: 130px;
  height: 130px;
}
.suitability-donut-svg {
  width: 100%;
  height: 100%;
}
.suitability-donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.suitability-donut-num {
  font-size: 28px;
  font-weight: 700;
  color: #333;
  line-height: 1;
}
.suitability-donut-label {
  font-size: 11px;
  color: #999;
  margin-top: 3px;
}
.suitability-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.suitability-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}
a.suitability-legend-item:hover {
  background: #f5f5f5;
}
.suitability-legend-item.is-zero {
  opacity: 0.45;
}
.suitability-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.suitability-legend-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.suitability-legend-text {
  font-size: 13px;
  color: #555;
  flex: 1;
}
.suitability-legend-count {
  font-size: 15px;
  font-weight: 700;
  color: #333;
}
@media (max-width: 480px) {
  .suitability-chart {
    gap: 12px;
  }
  .suitability-donut-wrap {
    width: 110px;
    height: 110px;
  }
  .suitability-donut-num {
    font-size: 22px;
  }
  .suitability-legend-item {
    padding: 4px 6px;
    gap: 6px;
  }
  .suitability-legend-icon {
    font-size: 13px;
  }
  .suitability-legend-text {
    font-size: 12px;
  }
  .suitability-legend-count {
    font-size: 13px;
  }
}

/* 適性ラベル */
.piece-suitability-title {
  font-size: 16px;
  font-weight: 600;
  margin: 20px 0 12px 0;
  color: #333;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 8px;
  position: relative;
}

.piece-difficulty-info-btn {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  background: none;
  color: #aaa;
  font-size: 15px;
  border: none;
  cursor: pointer;
  padding: 0 0 0 4px;
  line-height: 1;
  transition: color 0.15s;
}
.piece-difficulty-info-btn:hover { color: #667eea; }

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .piece-suitability-title {
    display: flex;
    align-items: center;
    gap: 0;
  }

  .piece-detail-wrapper .piece-difficulty-info-btn,
  .piece-difficulty-info-btn {
    width: auto !important;
    max-width: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin-left: 2px;
    line-height: 1;
  }
}

.piece-difficulty-info-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.piece-difficulty-info-popup {
  display: none;
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  transform: translateY(-50%);
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 12px 36px 12px 14px;
  font-size: 13px;
  font-weight: 400;
  color: #444;
  line-height: 1.7;
  width: max-content;
  max-width: min(300px, calc(100vw - 40px));
  z-index: 10000;
  white-space: normal;
}
.piece-difficulty-info-popup.is-open { display: block; }

.piece-difficulty-info-close {
  position: absolute !important;
  top: 8px !important;
  right: 10px !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
  display: none !important;
  background: none;
  border: none;
  color: #999;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  margin: 0 !important;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .piece-difficulty-info-popup {
    top: calc(100% + 6px);
    left: 0;
    transform: none;
    max-width: 220px;
    width: max-content;
  }

  /* .piece-detail-wrapper button (spec 0,1,1) を上回る */
  .piece-detail-wrapper .piece-difficulty-info-close {
    width: auto !important;
    max-width: none !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
}

.piece-suitability-labels {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.piece-suitability-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f5f5f5;
  border-radius: 6px;
  border: 2px solid #e0e0e0;
}

.piece-suitability-link {
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.piece-suitability-link:hover {
  background: #e3f2fd;
  border-color: #1976d2;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.piece-suitability-disabled {
  opacity: 0.5;
  cursor: default;
}

.piece-suitability-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.piece-suitability-label {
  font-size: 14px;
  color: #555;
  font-weight: 500;
}

.piece-suitability-number {
  font-size: 20px;
  font-weight: bold;
  color: #1976d2;
  margin-left: 8px;
  min-width: 30px;
  text-align: right;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .piece-community-counts {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .piece-community-count-item {
    padding: 10px 12px;
  }

  .piece-community-icon {
    font-size: 18px;
  }

  .piece-community-label {
    font-size: 13px;
  }

  .piece-community-number {
    font-size: 16px;
  }

  .piece-suitability-labels {
    flex-direction: column;
  }

  .piece-suitability-item {
    width: 100%;
  }
}

/* 動画セクション */
.piece-videos-section {
  margin: 32px 0;
}

.piece-videos-count-text {
  color: #666;
  font-size: 15px;
  margin: 12px 0 20px 0;
}

.piece-video-preview {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.piece-video-preview-header {
  margin-bottom: 12px;
}

.piece-video-preview-badge {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.piece-video-preview-player {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  margin-bottom: 12px;
  border-radius: 8px;
  background: #000;
}

.piece-video-preview-player iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.piece-video-preview-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #666;
  flex-wrap: wrap;
  gap: 8px;
}

.piece-video-preview-user {
  font-weight: 500;
}

.piece-video-preview-user a {
  color: #1976d2;
  text-decoration: none;
  transition: color 0.2s;
}

.piece-video-preview-user a:hover {
  color: #764ba2;
  text-decoration: underline;
}

.piece-video-preview-user .deleted-user {
  color: #999;
}

.piece-video-preview-date {
  color: #999;
}

.piece-videos-action {
  text-align: center;
}

.piece-videos-list-button {
  display: inline-block;
  background: #1976d2;
  color: white;
  padding: 14px 32px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.piece-videos-list-button:hover {
  background: #1565c0;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  transform: translateY(-1px);
}

.piece-videos-list-button.is-disabled,
.piece-ratings-list-button.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .piece-videos-list-button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    font-size: 14px;
    box-sizing: border-box;
    text-align: center;
  }

  .piece-video-preview {
    padding: 16px;
  }

  .piece-video-preview-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .piece-videos-section {
    margin: 24px 0;
  }
}

/* みんなの印象プレビューセクション */
.piece-ratings-preview {
  margin: 32px 0;
}

.piece-rating-preview-item {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid #d0d0d0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.piece-rating-preview-item:last-of-type {
  margin-bottom: 20px;
}

.piece-rating-preview-header {
  margin-bottom: 12px;
}

.piece-rating-preview-badge {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.piece-rating-preview-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.piece-rating-preview-user {
  font-weight: 600;
  font-size: 15px;
}

.piece-rating-preview-user a {
  color: #1976d2;
  text-decoration: none;
  transition: color 0.2s;
}

.piece-rating-preview-user a:hover {
  color: #1565c0;
  text-decoration: underline;
}

.piece-rating-preview-scores {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.piece-rating-preview-score {
  background: #f0f7ff;
  color: #1976d2;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}

.piece-rating-preview-comment {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 6px;
  color: #333;
  font-size: 14px;
  line-height: 1.6;
}

.piece-rating-preview-date {
  font-size: 13px;
  color: #999;
}

.piece-rating-preview-latest-label {
  font-size: 12px;
  color: #666;
  margin: 12px 0 4px;
  font-weight: 600;
}

.piece-rating-preview-empty {
  text-align: center;
  color: #999;
  padding: 40px 20px;
  margin: 0;
  font-size: 15px;
}

.piece-ratings-preview-action {
  text-align: center;
  margin-top: 16px;
}

.piece-ratings-list-button {
  display: inline-block;
  padding: 12px 32px;
  background: #1976d2;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s;
  border: 2px solid #1976d2;
}

.piece-ratings-list-button:hover {
  background: #1565c0;
  border-color: #1565c0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .piece-ratings-preview {
    margin: 24px 0;
  }

  .piece-rating-preview-item {
    padding: 16px;
  }

  .piece-rating-preview-scores {
    gap: 8px;
  }

  .piece-rating-preview-score {
    font-size: 13px;
    padding: 5px 10px;
  }

  .piece-ratings-list-button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    font-size: 14px;
    box-sizing: border-box;
    text-align: center;
  }
}

.piece-favorite-btn {
  cursor: pointer;
}

.piece-favorite-btn.is-off {
  background: #f8f9fa;
  color: #666;
  border: 1px solid #dee2e6;
}

.piece-favorite-btn.is-off:hover {
  background: #fff;
  color: #e74c3c;
  border-color: #e74c3c;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(231, 76, 60, 0.2);
}

.piece-favorite-btn.is-off .favorite-icon {
  color: #ccc;
}

.piece-favorite-btn.is-off:hover .favorite-icon {
  color: #e74c3c;
}

.piece-favorite-btn.is-on {
  background: #ffebee;
  color: #e74c3c;
  border: 1px solid #e74c3c;
}

.piece-favorite-btn.is-on:hover {
  background: #ffcdd2;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.piece-favorite-btn .favorite-icon {
  font-size: 16px;
  line-height: 1;
}

/* ヘッダーのお気に入りボタン */
.piece-favorite-btn-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 15px;
  white-space: nowrap;
}

.piece-favorite-btn-header:hover {
  border-color: #999;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.piece-favorite-btn-header.is-off .favorite-icon {
  color: #999;
}

.piece-favorite-btn-header.is-off:hover .favorite-icon {
  color: #ff6ea8;
}

.piece-favorite-btn-header.is-on {
  background: #fff5f8;
  border-color: #ff6ea8;
}

.piece-favorite-btn-header.is-on .favorite-icon {
  color: #ff6ea8;
}

.piece-favorite-btn-header .favorite-text {
  color: #666;
  font-weight: 500;
}

.piece-favorite-btn-header.is-on .favorite-text {
  color: #333;
}

.piece-detail-title-section {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.piece-detail-title-content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.piece-detail-title-ja {
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 8px 0;
  line-height: 1.4;
  color: #333;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.piece-detail-composer-link {
  color: #1976d2;
  text-decoration: none;
  transition: color 0.2s;
}

.piece-detail-composer-link:hover {
  color: #764ba2;
  text-decoration: underline;
}

.piece-detail-composer-name {
  color: #333;
}

.piece-detail-title-en {
  font-size: 14px;
  color: #666;
  margin: 0 0 12px 0;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.piece-detail-meta-line {
  display: flex;
  gap: 24px;
  font-size: 14px;
  color: #555;
  margin: 0;
  line-height: 1.6;
  flex-wrap: wrap;
}

.piece-detail-meta-text {
  white-space: nowrap;
}

.piece-detail-meta-link {
  color: #1976d2;
  text-decoration: none;
  transition: color 0.2s;
}

.piece-detail-meta-link:hover {
  color: #764ba2;
  text-decoration: underline;
}

/* シェアボタンのスマホ対応 */
.piece-share-section {
  display: flex;
  gap: 12px;
  margin: 12px 0 0 0;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
}

.piece-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
  transition: all 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
}

.piece-share-x {
  background: #000;
  color: #fff;
}

.piece-share-x:hover {
  background: #333;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.piece-share-facebook {
  background: #1877f2;
  color: #fff;
}

.piece-share-facebook:hover {
  background: #0d65d9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(24,119,242,0.3);
}

.piece-practice-btn {
  background: #764ba2;
  color: #fff;
}

.piece-practice-btn:hover {
  background: #5a3780;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(118,75,162,0.3);
}

.pia-flag-form-inline {
  display: inline;
  margin: 0;
}

.piece-status-btn {
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  color: #666;
}

.piece-status-btn:hover {
  background: #e3f2fd;
  border-color: #1976d2;
  color: #1976d2;
  transform: translateY(-2px);
}

.piece-status-btn.is-on {
  background: #1976d2;
  border-color: #1976d2;
  color: #fff;
}

.piece-status-btn.is-on:hover {
  background: #1565c0;
  border-color: #1565c0;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .piece-detail-title-section {
    /*flex-direction: column;*/
    gap: 12px;
  }

  .piece-favorite-btn-header {
    align-self: flex-start;
    padding: 8px 14px;
    font-size: 14px;
  }

  .piece-detail-title-ja {
    font-size: 17px;
  }

  .piece-detail-title-en {
    font-size: 13px;
  }

  .piece-detail-meta-line {
    font-size: 13px;
    gap: 4px 12px;
  }

  .piece-share-section {
    justify-content: flex-start;
    gap: 6px;
  }

  .piece-share-btn {
    font-size: 10px;
    padding: 5px 8px;
    gap: 3px;
  }

  .piece-favorite-btn .favorite-icon {
    font-size: 14px;
  }
}

/* Wikipediaリンク */
.piece-wikipedia-section {
  margin: 24px 0;
}

.piece-wikipedia-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 2px solid #dee2e6;
  border-radius: 12px;
  color: #495057;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.piece-wikipedia-link:hover {
  background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
  border-color: #1976d2;
  color: #1976d2;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(25, 118, 210, 0.2);
}

.piece-wikipedia-link svg {
  flex-shrink: 0;
}

.piece-wikipedia-link .external-icon {
  font-size: 0.9em;
  opacity: 0.7;
  margin-left: 4px;
}

/* IMSLPリンク */
.piece-imslp-section {
  margin: 24px 0;
}

.piece-imslp-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 2px solid #dee2e6;
  border-radius: 12px;
  color: #495057;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.piece-imslp-link:hover {
  background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
  border-color: #1976d2;
  color: #1976d2;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(25, 118, 210, 0.2);
}

.piece-imslp-link svg {
  flex-shrink: 0;
}

.piece-imslp-link .external-icon {
  font-size: 0.9em;
  opacity: 0.7;
  margin-left: 4px;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .piece-wikipedia-section .piece-detail-section-title,
  .piece-imslp-section .piece-detail-section-title {
    margin-bottom: 12px !important;
  }
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .piece-wikipedia-link,
  .piece-imslp-link {
    font-size: 12px;
    padding: 3px 10px;
    gap: 4px;
    border-radius: 6px;
    border-width: 1px;
    box-shadow: none;
    line-height: 1.4;
  }

  .piece-wikipedia-link svg,
  .piece-imslp-link svg {
    width: 12px;
    height: 12px;
  }
}

/* あなたの記録セクション */
.pia-flags-group {
  margin-bottom: 24px;
}

.pia-flags-group:last-child {
  margin-bottom: 0;
}

.pia-flags-group-title {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  margin: 0 0 12px 0;
  padding: 0;
}

.pia-flags-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pia-flag-btn {
  font-size: 15px;
  padding: 12px 20px;
  border: 2px solid #ddd;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.pia-flag-btn:hover {
  border-color: #1976d2;
  background: #f0f7ff;
}

.pia-flag-btn.is-on {
  background: #1976d2;
  color: #fff;
  border-color: #1976d2;
}

.pia-suitability-btn {
  flex: 1 1 auto;
  min-width: 140px;
}

/* あなたの記録ボタンのスマホ対応 */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .pia-flags-group {
    margin-bottom: 20px;
  }

  .pia-flags-group-title {
    font-size: 0.95rem;
    margin-bottom: 10px;
  }

  .pia-flags-buttons {
    gap: 8px;
  }

  .pia-flag-btn {
    font-size: 14px;
    padding: 10px 12px;
  }

  .pia-suitability-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }
}

/* みんなの印象のスマホ対応 */
.pia-ratings-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* もっと見るボタン */
.pia-ratings-more {
  margin-top: 20px;
  text-align: center;
}

.pia-ratings-more-btn {
  display: inline-block;
  padding: 12px 32px;
  background: #1976d2;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s;
  border: 2px solid #1976d2;
}

.pia-ratings-more-btn:hover {
  background: #1565c0;
  border-color: #1565c0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.pia-rating-row {
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
}

.pia-rating-row:first-child {
  border-top: 1px solid #e0e0e0;
}

.pia-rating-row.is-current-user {
  background: #fff;
  border: 1px solid #1976d2;
}

.pia-rating-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}

.pia-rating-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.rating-delete-form {
  margin: 0;
  padding: 0;
}

.rating-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 0 !important;
  opacity: 0.6;
  transition: all 0.2s;
  line-height: 1;
}

.rating-delete-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.pia-rating-user {
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pia-rating-user-avatar-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.pia-rating-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e0e0e0;
}

.pia-rating-user-avatar-default {
  width: 32px;
  height: 32px;
  color: #999;
  background: #f0f0f0;
  border-radius: 50%;
  padding: 6px;
  border: 2px solid #e0e0e0;
}

.pia-rating-user-link {
  color: #1976d2;
  text-decoration: none;
}

/* ユーザー名: PC/スマホ切り替え */
.pia-name-mobile { display: inline; }
.pia-name-pc     { display: none; }
@media (hover: hover) and (pointer: fine) {
  .pia-name-mobile { display: none; }
  .pia-name-pc     { display: inline; }
}

/* ユーザー名横のインラインステータスバッジ */
.pia-status-inline {
  font-size: 11px;
  padding: 2px 7px;
  flex-shrink: 0;
  vertical-align: middle;
}

.pia-rating-user-link:hover {
  text-decoration: underline;
}

/* 動画タブのユーザー情報: pia-rating-user のフォントを上書き */
.piece-video-meta .pia-rating-user {
  font-size: 14px;
  font-weight: 500;
}

.piece-video-meta .pia-rating-user-avatar-link {
  align-self: center;
}

.pia-rating-date {
  font-size: 13px;
  color: #666;
  white-space: nowrap;
}

/* 印象行のスコアチップ（作品検索と共通デザイン） */
.pia-rating-row .piece-scores-line {
  margin-bottom: 8px;
}

.pia-rating-comment {
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  white-space: pre-wrap;
  margin-top: 8px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 6px;
}

/* 演奏ステータスと適性バッジ */
.pia-rating-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pia-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.pia-badge-status {
  background: #e3f2fd;
  color: #1976d2;
  border: 1px solid #bbdefb;
}

.pia-badge-suitability {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffe0b2;
}

.pia-badge-suitability.is-inactive {
  background: #f5f5f5;
  color: #bbb;
  border: 1px solid #e0e0e0;
}

/* いいねボタン */
.pia-rating-like-section {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pia-rating-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 16px;
  transition: all 0.2s;
  font-family: inherit;
}

.pia-rating-like-btn:hover {
  background: #f5f5f5;
}

.pia-rating-like-btn .like-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #999;
  transition: transform 0.2s, color 0.2s;
}

.pia-rating-like-btn.liked .like-icon {
  color: #1976d2;
  animation: likeAnimation 0.4s ease;
}

@keyframes likeAnimation {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.pia-rating-like-btn .like-label {
  font-size: 13px;
  color: #666;
}

.pia-rating-like-btn.liked .like-label {
  color: #1976d2;
  font-weight: 600;
}

.pia-rating-like-btn .like-count {
  font-weight: 600;
  color: #666;
  font-size: 13px;
}

.pia-rating-like-btn.liked .like-count {
  color: #1976d2;
}

.pia-rating-like-display {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  color: #bbb;
}

.pia-rating-like-display .like-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.pia-rating-like-display .like-label {
  font-size: 13px;
}

.pia-rating-like-display .like-count {
  font-weight: 600;
  font-size: 13px;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .pia-rating-row {
    padding: 14px;
  }
}

/* いいね・報告ボタンのスマホ幅リセット
   .piece-detail-wrapper button (spec 0,1,1) を上回るため (0,2,0) のセレクタで上書き */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .piece-detail-wrapper .pia-rating-like-btn,
  .piece-detail-wrapper .pia-report-menu-btn {
    width: auto !important;
    max-width: none !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    border-radius: 20px !important;
  }
}

/* 楽譜リンクのスマホ対応 */
.pia-sheet-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pia-sheet-links li a {
  display: inline-block;
  padding: 10px 16px;
  background: #f5f5f5;
  border-radius: 8px;
  text-decoration: none;
  color: #1976d2;
  font-weight: 600;
  transition: all 0.2s;
}

.pia-sheet-links li a:hover {
  background: #e9ecef;
  transform: translateX(4px);
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .pia-sheet-links li a {
    display: block;
    text-align: center;
  }
}

/* 報告モーダルスタイル */
.pia-report-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}
.pia-report-modal.is-open {
  display: flex;
}
.pia-report-modal-content {
  background: #fff;
  border-radius: 16px;
  max-width: 360px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  position: relative;
}
.pia-report-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 4px 8px;
  line-height: 1;
}
.pia-report-modal-close:hover {
  color: #333;
}
.pia-report-modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 16px;
}
.pia-report-section {
  margin-bottom: 24px;
}
.pia-report-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: #333;
}
.pia-report-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pia-report-option {
  display: flex;
  align-items: center;
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
}
.pia-report-option:hover {
  border-color: #1976d2;
  background: #f5f5f5;
}
.pia-report-option input[type="radio"] {
  margin-right: 10px;
}
.pia-report-option.is-selected {
  border-color: #1976d2;
  background: #e3f2fd;
}
.pia-report-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}
.pia-report-btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.pia-report-btn-cancel {
  background: #f5f5f5;
  color: #666;
}
.pia-report-btn-cancel:hover {
  background: #e0e0e0;
}
.pia-report-btn-submit {
  background: #1976d2;
  color: #fff;
}
.pia-report-btn-submit:hover {
  background: #1565c0;
}
.pia-report-btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.pia-report-success {
  text-align: center;
}
.pia-report-success-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}
.pia-report-success-message {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 24px;
  color: #333;
}
.pia-report-menu {
  position: relative;
  display: inline-block;
}
.pia-report-menu-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  color: #666;
  border-radius: 4px;
  transition: all 0.2s;
}
.pia-report-menu-btn:hover {
  background: #f5f5f5;
  color: #333;
}
.pia-report-menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 140px;
  z-index: 1000;
  margin-top: 4px;
}
.pia-report-menu.is-open .pia-report-menu-dropdown {
  display: block;
}
.pia-report-menu-item {
  display: block;
  padding: 10px 16px;
  color: #333;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 0.95rem;
}
.pia-report-menu-item:hover {
  background: #f5f5f5;
}
.pia-report-menu-item:first-child {
  border-radius: 8px 8px 0 0;
}
.pia-report-menu-item:last-child {
  border-radius: 0 0 8px 8px;
}

/* 退会済みユーザー */
.deleted-user {
  color: #999 !important;
  cursor: default !important;
  pointer-events: none;
  opacity: 0.7;
}

.pia-rating-user-link.deleted-user,
.comment-user-link.deleted-user {
  text-decoration: none !important;
}

.pia-rating-user-avatar-link:not(a) {
  cursor: default;
  pointer-events: none;
}


/* ===== 11. Tab Navigation ===== */
/* タブナビゲーション */
.piece-tabs-nav {
  display: flex;
  gap: 0;
  margin: 20px 0 0 0;
  border-bottom: 2px solid #e0e0e0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.piece-tab-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  min-height: 52px;
  box-sizing: border-box;
  color: #666;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.3;
}

.piece-tab-link:hover {
  color: #667eea;
  background: rgba(102, 126, 234, 0.05);
}

.piece-tab-link.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: rgba(102, 126, 234, 0.08);
}

.piece-tab-link.is-disabled {
  color: #b5b5b5;
  cursor: default;
  pointer-events: none;
  background: transparent;
}

.piece-tab-content {
  padding-top: 12px;
}

.piece-tab-content .piece-detail-section {
  margin-top: 0;
}

/* タブ件数バッジ */
.piece-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  padding: 1px 6px;
  background: #eee;
  color: #666;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: middle;
}
.piece-tab-link.active .piece-tab-count {
  background: rgba(102, 126, 234, 0.15);
  color: #667eea;
}

/* 練習記録タブ */
.piece-practice-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 24px;
}

.piece-practice-item {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 16px;
}

.piece-practice-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.piece-practice-item-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.piece-practice-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.piece-practice-avatar--img {
  object-fit: cover;
  background: none;
}

.piece-practice-username {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  text-decoration: none;
}

a.piece-practice-username:hover {
  color: #667eea;
  text-decoration: underline;
}

.piece-practice-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.piece-practice-date {
  font-size: 13px;
  color: #999;
}

.piece-practice-duration {
  font-size: 13px;
  color: #555;
  font-weight: 600;
}

.piece-practice-title {
  font-size: 14px;
  font-weight: 500;
  color: #444;
  margin-bottom: 4px;
}

.piece-practice-location {
  font-size: 13px;
  color: #888;
  margin-bottom: 4px;
}

.piece-practice-memo {
  font-size: 13px;
  color: #555;
  line-height: 1.6;
  background: #f8f9fa;
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.piece-practice-audio {
  margin-top: 10px;
}
.piece-practice-audio audio {
  width: 100%;
  height: 36px;
  border-radius: 6px;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .piece-practice-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .piece-practice-item-meta {
    font-size: 12px;
  }
}

/* 印象タブ用ヘッダー */
.piece-ratings-header-tab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.piece-rating-add-btn-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: #6E4CD6;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.piece-rating-add-btn-tab:hover {
  background: #4f28b2;
  color: #fff;
}

/* 動画タブ用スタイル */
.piece-videos-header-tab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.piece-video-add-btn-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: #6E4CD6;
  color: #fff;
  border: none;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
}

.piece-video-add-btn-tab:hover {
  background: #4f28b2;
  color: #fff;
}

.piece-video-success-tab {
  background: #d4edda;
  color: #155724;
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 600;
  border: 2px solid #c3e6cb;
}

.piece-videos-list-tab {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.piece-videos-empty-tab {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 16px;
}

.piece-video-item-tab {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border: 1px solid #e0e0e0;
}

.piece-video-player-tab {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  background: #000;
}

.piece-video-player-tab iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.piece-video-info-tab {
  padding: 16px;
}

.piece-video-meta-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* 動画タブのユーザー情報: pia-rating-user のフォントを上書き */
.piece-video-meta-tab .pia-rating-user {
  font-size: 14px;
  font-weight: 500;
}

.piece-video-meta-tab .pia-rating-user-avatar-link {
  align-self: center;
}

.piece-video-user-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: #333;
}

.piece-video-user-avatar-link-tab {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
}

.piece-video-user-avatar-tab {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.piece-video-user-avatar-default-tab {
  width: 32px;
  height: 32px;
  color: #999;
}

.piece-video-meta-right-tab {
  display: flex;
  align-items: center;
  gap: 12px;
}

.piece-video-date-tab {
  color: #999;
  font-size: 14px;
}

.video-delete-form-tab {
  margin: 0;
  padding: 0;
}

.video-delete-btn-tab {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 0 !important;
  transition: transform 0.2s;
}

.video-delete-btn-tab:hover {
  transform: scale(1.2);
}

.piece-video-actions-tab {
  display: flex;
  align-items: stretch;
  gap: 16px;
}

.piece-video-like-btn-tab {
  padding: 6px 12px;
  border: none;
  background: transparent;
  border-radius: 20px;
  font-size: 13px;
  font-weight: normal;
}

.piece-video-like-btn-tab:hover {
  background: #f5f5f5;
}

.piece-video-like-btn-tab.liked .like-icon {
  color: #1976d2;
}

.piece-video-like-btn-tab.liked .like-label {
  color: #1976d2;
  font-weight: 600;
}

.piece-video-like-btn-tab.liked .like-count {
  color: #1976d2;
}

.piece-video-like-icon-tab {
  font-size: 16px;
}

.piece-video-like-display-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  color: #666;
  font-size: 14px;
  font-weight: 600;
}

.piece-video-comments-preview-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: stretch;
  width: 100%;
}

.video-comment-preview {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 10px 12px;
  width: 100%;
  box-sizing: border-box;
}

.video-comment-preview-user {
  display: flex;
  align-items: center;
  gap: 6px;
}

.video-comment-preview-name {
  font-size: 13px;
  font-weight: 600;
  color: #1976d2;
  text-decoration: none;
}

.video-comment-preview-name:hover {
  text-decoration: underline;
}

.video-comment-preview-divider {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 8px 0;
}

.video-comment-preview-text {
  font-size: 13px;
  color: #333;
  line-height: 1.5;
  white-space: pre-wrap;
}

.piece-video-comment-preview-tab {
  padding: 10px 14px;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.piece-video-comment-mine-tab {
  background: #e3f2fd;
  border-left: 3px solid #667eea;
}

.piece-video-comments-actions-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.piece-video-comments-link-tab {
  color: #1976d2;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.piece-video-comments-link-tab:hover {
  text-decoration: underline;
}

.piece-video-comment-btn-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.piece-video-comment-btn-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.piece-videos-pagination-tab {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

.piece-videos-page-link-tab {
  padding: 10px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s;
}

.piece-videos-page-link-tab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.piece-videos-page-info-tab {
  font-weight: 600;
  color: #333;
}

/* レスポンシブ */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .piece-tabs-nav {
    margin: 16px 0 0 0;
  }

  .piece-tab-link {
    padding: 3px 16px;
    min-height: 42px;
    font-size: 13px;
  }

  .piece-ratings-header-tab {
    flex-direction: column;
    align-items: flex-start;
  }

  .piece-rating-add-btn-tab {
    width: 100%;
    justify-content: center;
  }

  .piece-videos-header-tab {
    flex-direction: column;
    align-items: flex-start;
  }

  .piece-video-add-btn-tab {
    width: 100%;
    justify-content: center;
  }

  .piece-video-actions-tab {
    flex-direction: column;
    width: 100%;
  }

  .piece-video-like-btn-tab,
  .piece-video-like-display-tab {
    width: 100%;
    justify-content: center;
  }

  .piece-video-comments-actions-tab {
    flex-direction: column;
    width: 100%;
  }

  .piece-video-comment-btn-tab {
    width: 100%;
    justify-content: center;
  }
}


/* ===== 12. Video Add Inline ===== */
.piece-video-add-btn-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  max-width: none;
  min-height: unset;
  background: #6E4CD6;
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  line-height: normal;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 10px;
}
.piece-video-add-btn-inline:hover {
  background: #4f28b2;
}
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .piece-videos-action {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  .piece-video-add-btn-inline {
    margin-left: 0;
    text-align: center;
  }
}


/* ===== 13. Rating Modal ===== */
/* 印象モーダル固有 */
.rm-slider-row { margin-bottom: 20px; }
.rm-slider-row > label { display: block; font-weight: 600; color: #333; margin-bottom: 8px; font-size: 14px; }
.rm-slider-wrap { display: flex; align-items: center; gap: 12px; }
.rm-slider-input { flex: 1; height: 8px; border-radius: 4px; background: #e0e0e0; outline: none; appearance: none; cursor: pointer; }
.rm-slider-input::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg,#667eea,#764ba2); cursor: pointer; box-shadow: 0 2px 6px rgba(102,126,234,.4); }
.rm-slider-input::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg,#667eea,#764ba2); cursor: pointer; border: none; box-shadow: 0 2px 6px rgba(102,126,234,.4); }
.rm-slider-val { font-size: 1.4rem; font-weight: 700; color: #667eea; min-width: 36px; text-align: center; }
.rm-comment-row { margin-bottom: 20px; }
.rm-comment-row > label { display: block; font-weight: 600; color: #333; margin-bottom: 8px; font-size: 14px; }
.rm-comment-row textarea { width: 100%; padding: 10px 14px; border: 2px solid #ddd; border-radius: 8px; font-size: 14px; font-family: inherit; box-sizing: border-box; resize: vertical; min-height: 80px; transition: border-color .2s; }
.rm-comment-row textarea:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,.1); }
.rm-status-row { margin-bottom: 20px; }
.rm-status-row > label { display: block; font-weight: 600; color: #333; margin-bottom: 8px; font-size: 14px; }
.rm-status-radios { display: flex; flex-wrap: wrap; gap: 8px; }
.rm-status-radio { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border: 2px solid #e0e0e0; border-radius: 8px; cursor: pointer; transition: all .2s; font-size: 13px; }
.rm-status-radio:hover { border-color: #667eea; background: #f8f9ff; }
.rm-status-radio input { width: 16px; height: 16px; cursor: pointer; }
.rm-suit-row { margin-bottom: 20px; }
.rm-suit-row > label { display: block; font-weight: 600; color: #333; margin-bottom: 8px; font-size: 14px; }
.rm-suit-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.rm-suit-check { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border: 2px solid #e0e0e0; border-radius: 8px; cursor: pointer; transition: all .2s; font-size: 13px; }
.rm-suit-check:hover { border-color: #667eea; background: #f8f9ff; }
.rm-suit-check input { width: 16px; height: 16px; cursor: pointer; }
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .rm-status-radios, .rm-suit-checks { flex-direction: column; }
}


/* ===== 15. Practice Like Button ===== */
.piece-practice-like {
  margin-top: 8px;
}
.piece-practice-item .btn-practice-like {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  height: 40px !important;
  min-height: unset !important;
  padding: 0 12px !important;
  border: none !important;
  border-radius: 20px;
  background: transparent !important;
  cursor: pointer;
  font-size: 13px !important;
  line-height: 1 !important;
  color: #666 !important;
  width: auto !important;
  max-width: fit-content !important;
  box-sizing: border-box !important;
  transition: all 0.2s;
}
.piece-practice-item .btn-practice-like:hover {
  background: #f5f5f5 !important;
}
.piece-practice-item .btn-practice-like.is-liked {
  background: #fce4ec !important;
  color: #1976d2 !important;
}
.piece-practice-item .btn-practice-like.is-loading {
  opacity: 0.5;
  pointer-events: none;
}
.piece-practice-item .btn-practice-like .like-label { font-size: 13px !important; font-weight: normal; }
.piece-practice-item .btn-practice-like .like-count  { color: #666; font-size: 13px !important; }
.piece-practice-item .btn-practice-like.is-liked .like-count { color: #1976d2; }
.practice-like-count-display {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #e91e63;
}

/* ===== 16. Toast ===== */
.pia-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #fff;
  color: #333;
  border: 2px solid #4f81bd;
  padding: 14px 48px 14px 16px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  z-index: 200000;
  opacity: 0;
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  max-width: 90vw;
}
.pia-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.pia-toast-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  background: #4f81bd;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pia-toast-icon svg {
  width: 14px;
  height: 14px;
  fill: #fff;
}
.pia-toast-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: #aaa;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}
.pia-toast-close:hover { color: #333; }


/* ===== 16. Bottom Bar and Share Modal ===== */
/* ボトムバー */
.pia-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  box-shadow: 0 -2px 8px rgba(0,0,0,.08);
  z-index: 9999;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .pia-bottom-bar { display: flex; }
  body { padding-bottom: 60px !important; }
  /* ボトムバーと重複する要素を非表示 */
  .piece-favorite-btn-header { display: none !important; }
  .piece-share-x,
  .piece-share-facebook { display: none !important; }
  .piece-video-add-btn-tab,
  .piece-video-add-btn-inline,
  .piece-rating-add-btn-tab,
  .piece-rate-button,
  .piece-practice-btn { display: none !important; }
  /* ステータスボタンを1列に並べる（練習記録は改行） */
  .piece-share-section {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .piece-share-section .piece-status-btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
  }
  .piece-share-section .piece-practice-btn {
    display: none !important;
  }
}
.pia-bottom-bar-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 0;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  color: #666;
  font-size: 10px;
  line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
}
.pia-bottom-bar-btn:active { background: #f5f5f5; }
.pia-bottom-bar-icon { font-size: 20px; line-height: 1; }
.pia-bottom-bar-icon svg {
  display: block;
  width: 20px;
  height: 20px;
}
.pia-bottom-bar-icon-video {
  color: #ff0000;
}
.pia-bottom-bar-label { font-size: 10px; white-space: nowrap; }
.pia-bottom-bar-fav.is-on .pia-bottom-bar-icon { color: #e53935; }
.pia-bottom-bar-fav.is-off .pia-bottom-bar-icon { color: #999; }

/* 共有モーダル */
.pia-share-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 100001;
  align-items: flex-end;
  justify-content: center;
}
.pia-share-overlay.is-open { display: flex; }
.pia-share-modal {
  background: #fff;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 20px 16px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
  animation: pia-share-slide-up .25s ease-out;
}
@keyframes pia-share-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.pia-share-modal-title {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 16px;
  color: #333;
}
.pia-share-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pia-share-modal-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-size: 15px;
  color: #333;
  text-decoration: none;
  transition: background .15s;
}
.pia-share-modal-btn:hover { background: #f5f5f5; }
.pia-share-modal-btn-icon { font-size: 20px; flex-shrink: 0; width: 28px; text-align: center; display: flex; align-items: center; justify-content: center; }
.pia-share-modal-btn--x .pia-share-modal-btn-icon { color: #000; }
.pia-share-modal-btn--fb .pia-share-modal-btn-icon { color: #1877f2; }
.pia-share-modal-cancel {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 15px;
  color: #666;
  text-align: center;
}
.pia-share-modal-cancel:hover { background: #eee; }

/* ===== 練習記録コメント (ppc-*) ===== */

.ppc-wrap {
  margin-top: 6px;
}

/* トグルボタン */
.ppc-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: transparent;
  border: none;
  color: #667eea;
  font-size: 13px;
  cursor: pointer;
  border-radius: 20px;
  transition: background 0.15s;
  line-height: 1;
}
.ppc-toggle-btn:hover,
.ppc-toggle-btn.is-open {
  background: rgba(102,126,234,0.1);
}
.ppc-count { font-weight: 700; }

/* コメントコンテナ */
.ppc-container {
  display: none;
  margin-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.07);
  padding-top: 10px;
}
.ppc-container.is-open { display: block; }

/* ローディング・空・エラー */
.ppc-loading,
.ppc-empty,
.ppc-error {
  font-size: 13px;
  color: #999;
  text-align: center;
  padding: 10px 0;
}
.ppc-error { color: #e53935; }

/* コメント一覧 */
.ppc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

/* 個別コメント */
.ppc-comment {
  border-radius: 8px;
  padding: 8px 10px;
  background: #f4f5f7;
  border: 1px solid transparent;
  transition: border-color 0.15s;
}
.ppc-comment.ppc-mine {
  background: #eef0fc;
  border-color: rgba(102,126,234,0.25);
}

/* 返信（インデント） */
.ppc-replies {
  margin-top: 8px;
  margin-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 2px solid rgba(102,126,234,0.2);
  padding-left: 10px;
}
.ppc-reply {
  background: #fafafa;
}
.ppc-reply.ppc-mine {
  background: #eef0fc;
  border-color: rgba(102,126,234,0.25);
}

/* コメント内部レイアウト */
.ppc-comment-inner {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

/* アバター */
.ppc-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

/* コンテンツ部 */
.ppc-comment-content { flex: 1; min-width: 0; }

.ppc-comment-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.ppc-comment-name {
  font-size: 12px;
  font-weight: 700;
  color: #444;
}
.ppc-comment-date {
  font-size: 11px;
  color: #aaa;
}

/* 削除ボタン */
.ppc-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 1px 3px;
  margin-left: auto;
  font-size: 13px;
  opacity: 0.55;
  transition: opacity 0.15s;
  line-height: 1;
}
.ppc-delete-btn:hover { opacity: 1; }

/* コメント本文 */
.ppc-comment-body {
  font-size: 13px;
  line-height: 1.6;
  color: #333;
  word-break: break-word;
}

/* アクション（返信ボタン等） */
.ppc-comment-actions {
  margin-top: 4px;
}
.ppc-reply-btn {
  background: none;
  border: none;
  color: #667eea;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
  line-height: 1;
}
.ppc-reply-btn:hover { background: rgba(102,126,234,0.12); }

/* 返信フォームエリア */
.ppc-reply-form { margin-top: 6px; }

/* 新規コメント・返信入力フォーム */
.ppc-new-form {
  margin-top: 10px;
}
.ppc-reply-input {
  margin-top: 0;
  padding: 8px 10px;
  background: #fafafa;
  border-radius: 8px;
  border: 1px solid rgba(102,126,234,0.2);
}

.ppc-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 0.15s;
}
.ppc-textarea:focus {
  outline: none;
  border-color: #667eea;
}

.ppc-form-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.ppc-char-count {
  font-size: 11px;
  color: #bbb;
  margin-right: auto;
}

.ppc-cancel-btn {
  padding: 5px 10px;
  background: transparent;
  color: #888;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
}
.ppc-cancel-btn:hover { background: #f0f0f0; }

.ppc-submit-btn {
  padding: 5px 12px;
  background: #667eea;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
}
.ppc-submit-btn:hover { background: #5a6fd6; }
.ppc-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ログイン促進 */
.ppc-login-note {
  font-size: 12px;
  color: #888;
  text-align: center;
  padding: 8px 0 4px;
}
.ppc-login-note a { color: #667eea; text-decoration: none; }
.ppc-login-note a:hover { text-decoration: underline; }
