* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: sans-serif;
  background: #f5f5f5;
  color: #222;
}

.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

.back-link {
  margin-bottom: 24px;
}

.back-link a {
  color: #2563eb;
  text-decoration: none;
}

.track-detail {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 32px;
  background: #fff;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  margin-bottom: 28px;
}

.cover-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ddd;
  overflow: hidden;
  border-radius: 16px;
}

.cover-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #d9d9d9, #bdbdbd);
  color: #444;
  font-size: 22px;
  font-weight: 700;
}

h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.3;
}

.meta {
  margin-bottom: 10px;
  color: #666;
  font-size: 14px;
  line-height: 1.7;
}

.genre {
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: bold;
  color: #444;
}

/* =========================
   独自プレイヤー
========================= */

#track-audio {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.custom-player {
  width: 100%;
  margin-bottom: 22px;
  border-radius: 22px;
  background: #ffffff;
  color: #111;
  overflow: hidden;
}

.custom-player-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 15px;
}

.player-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.player-left-sub {
  display: grid;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.player-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #222;
  line-height: 1;
  font-weight: 700;
}

.player-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.player-circle-button {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  border: 1px solid #c8c8c8;
  border-radius: 999px;
  background: #fff;
  color: #111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
  padding: 0;
  text-align: center;
}

.player-circle-button:hover {
  transform: translateY(-1px);
}

.player-circle-button:active {
  transform: translateY(0);
}

.player-play-button {
  font-size: 20px;
  padding-left: 2px;
}

.player-pill-button {
  min-width: 78px;
  height: 52px;
  border: 1px solid #c8c8c8;
  border-radius: 999px;
  background: #fff;
  color: #111;
  padding: 0 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.player-pill-button:hover {
  transform: translateY(-1px);
}

.player-pill-button.is-active {
  background: #111;
  color: #fff;
  border-color: #111;
}

#player-loop-button,
#player-speed-button {
  min-width: 92px;
}

#player-mute-button {
  min-width: 92px;
  width: auto;
  padding: 0 12px;
  font-size: 13px;
  letter-spacing: 0;
}

.player-seek,
.player-volume {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.player-seek {
  width: 100%;
  --seek-progress: 0%;
}

.player-seek::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #111 0%,
    #111 var(--seek-progress),
    #8d8d8d var(--seek-progress),
    #8d8d8d 100%
  );
}

.player-seek::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #8d8d8d;
}

.player-seek::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: #111;
}

.player-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  margin-top: -5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.player-seek::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.player-volume-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-volume {
  --volume-progress: 100%;
}

.player-volume-vertical {
  writing-mode: bt-lr;
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  width: 28px;
  height: 92px;
  padding: 0;
}

.player-volume-vertical::-webkit-slider-runnable-track {
  width: 6px;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    to top,
    #e19fff85 0%,
    #e19fff85 var(--volume-progress),
    #8d8d8d var(--volume-progress),
    #8d8d8d 100%
  );
}

.player-volume-vertical::-moz-range-track {
  width: 6px;
  height: 100%;
  border-radius: 999px;
  background: #8d8d8d;
}

.player-volume-vertical::-moz-range-progress {
  width: 6px;
  border-radius: 999px;
  background: #111;
}

.player-volume-vertical::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  margin-top: 0;
  margin-left: -5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.player-volume-vertical::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.player-seek:focus,
.player-volume:focus,
.player-circle-button:focus,
.player-pill-button:focus {
  outline: none;
}

.player-seek:focus-visible::-webkit-slider-thumb,
.player-volume:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.18);
}

.player-seek:focus-visible::-moz-range-thumb,
.player-volume:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.18);
}

.player-circle-button:focus-visible,
.player-pill-button:focus-visible {
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.14);
}

/* =========================
   アクション
========================= */

.track-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 26px;
}

.track-actions button,
.track-actions a.action-link {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  background: #111;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
}

.track-actions button.action-link {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  background: #111;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
}

.like-button {
  min-width: 160px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.like-button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.share-open-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.section-box {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
}

.section-box h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 24px;
}

.desc {
  line-height: 1.8;
  white-space: pre-wrap;
}

.comment-form {
  margin-bottom: 28px;
}

.comment-form textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 10px;
  font-size: 15px;
  resize: vertical;
  margin-bottom: 12px;
}

.comment-form button {
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  background: #111;
  color: #fff;
  cursor: pointer;
}

.comment-list {
  display: grid;
  gap: 16px;
  margin-top: 8px;
}

.comment-item {
  padding: 16px;
  border-radius: 14px;
  background: #f8f8f8;
  border: 1px solid #ececec;
}

.comment-text {
  line-height: 1.7;
  white-space: pre-wrap;
}

.actions a {
  color: #2563eb;
  text-decoration: none;
  margin-right: 16px;
}

/* ===== Share Modal ===== */

.share-modal[hidden] {
  display: none;
}

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.share-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.share-dialog {
  position: relative;
  z-index: 2;
  width: min(92vw, 560px);
  margin: 8vh auto 0;
  background: #fff;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
}

.share-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: #f2f2f2;
  color: #111;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
}

.share-track-card {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  align-items: center;
  margin-top: 18px;
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 18px;
  background: #f8f8f8;
  border: 1px solid #ececec;
}

.share-track-image {
  width: 110px;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: #ddd;
}

.share-track-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.share-track-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #444;
  background: linear-gradient(135deg, #d9d9d9, #bdbdbd);
}

.share-track-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 6px;
  word-break: break-word;
}

.share-track-artist,
.share-track-genre {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
}

.share-text-preview {
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 16px;
  background: #f5f5f5;
  color: #222;
  font-size: 14px;
  line-height: 1.8;
  word-break: break-word;
  border: 1px solid #ececec;
}

.share-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.share-icon-button {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  text-align: center;
}

.share-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.share-name {
  display: block;
  font-size: 12px;
  color: #444;
  line-height: 1.4;
}

body.share-modal-open {
  overflow: hidden;
}

.share-svg {
  width: 28px;
  height: 28px;
  display: block;
}

#share-line .share-svg {
  width: 30px;
  height: 30px;
}

#share-bluesky .share-svg {
  width: 48px;
  height: 48px;
}

.favorite-button {
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
}

.favorite-button.is-active {
  font-weight: bold;
}

.author-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.author-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-link {
  text-decoration: none;
  color: inherit;
}

.author-row.profile-link:hover .author-text {
  text-decoration: underline;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.comment-author-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.comment-author-icon {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px;
  min-height: 34px;
  max-width: 34px;
  max-height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
  background: #eee;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.comment-author-name {
  font-size: 14px;
  color: #333;
  word-break: break-word;
}

.comment-date {
  font-size: 12px;
  color: #777;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .track-detail {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  h1 {
    font-size: 28px;
  }

  .section-box {
    padding: 18px;
  }

  .custom-player-main {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .player-left {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .player-left-sub {
    justify-content: center;
  }

  .player-right {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .player-volume-group {
    gap: 8px;
  }

  .player-volume-vertical {
    height: 72px;
  }

  .share-dialog {
    width: min(94vw, 560px);
    margin-top: 5vh;
    padding: 20px;
    border-radius: 20px;
  }

  .share-track-card {
    grid-template-columns: 84px 1fr;
  }

  .share-track-image {
    width: 84px;
  }

  .share-track-title {
    font-size: 17px;
  }

  .share-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ===== Player visual fix ===== */

/* LOOP / 1x を再生ボタンと同じ白丸に寄せる */
#player-loop-button,
#player-speed-button {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  padding: 0;
  border-radius: 999px;
  background: #fff;
  color: #111;
  border: 1px solid #c8c8c8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

/* MUTE は文字が長いので少しだけ横長 */
#player-mute-button {
  width: 92px;
  min-width: 92px;
  height: 52px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff;
  color: #111;
  border: 1px solid #c8c8c8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

/* アクティブ時 */
#player-loop-button.is-active,
#player-speed-button.is-active,
#player-mute-button.is-active {
  background: #111;
  color: #fff;
  border-color: #111;
}

/* 再生ボタンの記号位置を少しだけ中央寄せ */
.player-play-button {
  padding-left: 1px;
}

/* 音量バーの丸ズレ補正を強める */
.player-volume-vertical {
  width: 30px;
  height: 92px;
  margin-left: 2px;
}

.player-volume-vertical::-webkit-slider-runnable-track {
  width: 6px;
  height: 100%;
  border-radius: 999px;
}

.player-volume-vertical::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  margin-top: 0;
  margin-left: -4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.player-volume-vertical::-moz-range-track {
  width: 6px;
  height: 100%;
  border-radius: 999px;
}

.player-volume-vertical::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

/* ボタン並びを少し均等に見せる */
.player-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.player-volume-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* スマホ時の崩れ防止 */
@media (max-width: 768px) {
  #player-loop-button,
  #player-speed-button {
    width: 52px;
    min-width: 52px;
  }

  #player-mute-button {
    width: 84px;
    min-width: 84px;
    font-size: 10px;
  }
}

.player-volume-vertical::-webkit-slider-thumb {
  margin-left: 100px;
}

/* ===== final player override ===== */

.player-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

#player-loop-button,
#player-speed-button,
#player-mute-button {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  padding: 0;
  border-radius: 999px;
  background: #fff;
  color: #111;
  border: 1px solid #c8c8c8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

#player-mute-button {
  width: 78px;
  min-width: 78px;
  font-size: 10px;
  letter-spacing: 0;
}

#player-loop-button.is-active,
#player-speed-button.is-active,
#player-mute-button.is-active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.player-play-button {
  padding-left: 1px;
}

.player-volume-group {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
}

.player-volume-vertical {
  -webkit-appearance: slider-vertical;
  appearance: auto;
  width: 28px;
  height: 92px;
  padding: 0;
  margin: 0;
  writing-mode: vertical-lr;
  direction: rtl;
}

.player-volume-vertical::-webkit-slider-runnable-track {
  width: 6px;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    to top,
    #111 0%,
    #111 var(--volume-progress),
    #8d8d8d var(--volume-progress),
    #8d8d8d 100%
  );
}

.player-volume-vertical::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  margin-top: 0;
  margin-left: -5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.player-volume-vertical::-moz-range-track {
  width: 6px;
  height: 100%;
  border-radius: 999px;
  background: #8d8d8d;
}

.player-volume-vertical::-moz-range-progress {
  width: 6px;
  border-radius: 999px;
  background: #111;
}

.player-volume-vertical::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

@media (max-width: 768px) {
  #player-loop-button,
  #player-speed-button {
    width: 52px;
    min-width: 52px;
  }

  #player-mute-button {
    width: 78px;
    min-width: 78px;
    font-size: 10px;
  }
}

/* ===== final override 2 ===== */

/* LOOP / 1x / MUTE を全部まん丸に統一 */
#player-loop-button,
#player-speed-button,
#player-mute-button {
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  min-height: 52px !important;
  padding: 0 !important;
  border-radius: 999px !important;
  background: #fff !important;
  color: #111 !important;
  border: 1px solid #c8c8c8 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  line-height: 1 !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
}

/* 文字サイズだけ個別調整 */
#player-loop-button {
  font-size: 12px !important;
}

#player-speed-button {
  font-size: 14px !important;
}

#player-mute-button {
  font-size: 8px !important;
  letter-spacing: 0 !important;
}

/* アクティブ時 */
#player-loop-button.is-active,
#player-speed-button.is-active,
#player-mute-button.is-active {
  background: #111 !important;
  color: #fff !important;
  border-color: #111 !important;
}

/* 音量バーの箱をきっちり中央寄せ */
.player-volume-group {
  width: 24px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  margin-left: 2px !important;
}

/* 縦スライダー本体 */
.player-volume-vertical {
  -webkit-appearance: none !important;
  appearance: none !important;
  writing-mode: vertical-lr !important;
  direction: rtl !important;
  width: 24px !important;
  height: 92px !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
}

/* Chrome / Edge 系 */
.player-volume-vertical::-webkit-slider-runnable-track {
  width: 6px !important;
  height: 100% !important;
  border-radius: 999px !important;
  background: linear-gradient(
    to top,
    #111 0%,
    #111 var(--volume-progress),
    #8d8d8d var(--volume-progress),
    #8d8d8d 100%
  ) !important;
}

.player-volume-vertical::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 16px !important;
  height: 16px !important;
  border-radius: 50% !important;
  background: #fff !important;
  border: 2px solid #111 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18) !important;
  margin-top: 0 !important;
  margin-left: -5px !important;
}

/* Firefox */
.player-volume-vertical::-moz-range-track {
  width: 6px !important;
  height: 100% !important;
  border-radius: 999px !important;
  background: #8d8d8d !important;
}

.player-volume-vertical::-moz-range-progress {
  width: 6px !important;
  border-radius: 999px !important;
  background: #111 !important;
}

.player-volume-vertical::-moz-range-thumb {
  width: 16px !important;
  height: 16px !important;
  border-radius: 50% !important;
  background: #fff !important;
  border: 2px solid #111 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18) !important;
}