/* 閲覧サイトだけの見た目。共通の見た目（色・ボタン・入力・アイコン・断面の絵など）は /base.css（web-ui/styles/base.css）。
   CSP の style-src 'self' のため、見た目はすべて CSS のファイルに書く（HTML に style 属性を書かない）。 */

/* ---- ログイン・招待・申請 ---- */

.apply-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.apply-form > .button {
  align-self: flex-start;
}

.agreement {
  background: linear-gradient(90deg, rgb(74 91 255 / 0.1), rgb(139 92 246 / 0.08));
  border: 1px solid #3d3a6d;
  border-radius: 12px;
  padding: 4px 16px;
}

.agreement h2 {
  margin-top: 12px;
}

.agreement ul {
  margin: 0 0 12px;
  padding-left: 1.2em;
}

/* ---- 一覧 ---- */

.search-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.search-form__actions {
  display: flex;
}

.search-form__actions .button {
  width: 100%;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

/* 絞り込み中の条件の札（創造の青） */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.8125rem;
}

.chip__remove {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: #ffffff;
  font: inherit;
  cursor: pointer;
}

.chip__remove:hover {
  background: rgb(255 255 255 / 0.18);
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* テンプレのカード：角の丸み14px、形の絵は一段明るい地に */
.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: var(--line-2);
}

.card__shape {
  display: block;
  padding: 10px;
  border-radius: 10px;
  background: var(--surface-2);
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 2px 2px;
}

/* テンプレの名前は利用者が入れる文字なので、見出しのフォントにはしない（M PLUS 1p の太字） */
.card__name {
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
}

.card__name:hover {
  text-decoration: underline;
}

.card__author,
.info-list__author {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.card__tags,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card__stats {
  color: var(--muted);
  font-size: 0.75rem;
}

/* 元の楽曲のタグは金色 */
.tag--song {
  background: rgb(224 195 106 / 0.12);
  color: var(--gold);
}

/* ---- 詳細 ---- */

.back-link {
  margin: 0 0 16px;
}

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.detail__shape {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.detail__shape-note {
  margin: 8px 0 0;
  font-size: 0.875rem;
}

.detail__name {
  margin-bottom: 12px;
}

.favorite {
  margin-bottom: 16px;
}

/* お気に入りに入れているとき（破壊の赤） */
.button--favorited {
  border-color: #6d2a3a;
  background: rgb(229 72 95 / 0.12);
  color: #ffb3c0;
}

.button--favorited:hover {
  border-color: var(--destruction);
  color: #ffd0d8;
}

.info-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
}

.info-list dt {
  color: var(--muted);
}

.info-list dd {
  margin: 0;
  min-width: 0;
}

.versions__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.version {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.version:hover {
  border-color: var(--creation);
}

.version--selected {
  border-color: var(--creation);
  background: var(--surface-2);
}

.version__number {
  font-weight: 700;
}

/* ---- 作者の名前（作者ページへのリンク） ---- */

.author-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

/* ---- 一覧の見出しと、並び・タブの切り替え ---- */

.list-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 8px 0 16px;
}

.list-heading h2 {
  margin: 0;
}

.sort-toggle,
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ---- 作者ページ・楽曲のページの帯 ---- */

.profile-band {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 28px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, rgb(74 91 255 / 0.14), rgb(139 92 246 / 0.1) 50%, rgb(229 72 95 / 0.1)), var(--surface);
}

.profile-band__text {
  min-width: 0;
}

/* 帯の中の名前は、大きな見出しの帯の形にはしない（パネルの中に、左寄せで大きく） */
.profile-band__name {
  margin: 0;
  padding: 0;
  clip-path: none;
  background: none;
  font-size: 1.75rem;
  text-align: left;
}

.profile-band__text p {
  margin: 2px 0 0;
}

.profile-band__mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 88px;
  height: 88px;
  border-radius: 999px;
  background: rgb(224 195 106 / 0.14);
  color: var(--gold);
  font-size: 2.25rem;
}

/* ---- 楽曲から探す ---- */

.song-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.song-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.song-list__name {
  min-width: 0;
  color: var(--gold);
  font-weight: 700;
}

/* ---- マイページ ---- */

.mypage {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
}

.mypage__profile {
  flex: 1 1 340px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mypage__profile h2 {
  margin: 0;
}

.mypage__side {
  flex: 999 1 480px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mypage__side .panel h2 {
  margin-top: 0;
}

.mypage__name {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mypage__actions {
  display: flex;
  justify-content: flex-end;
}

/* 公開されることの注意（金） */
.public-note {
  margin: 0;
  color: var(--gold);
  font-size: 0.8125rem;
}

.avatar-section__current {
  display: flex;
  align-items: center;
  gap: 18px;
}

.avatar-section__buttons {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.avatar-section p {
  margin: 8px 0 0;
}

/* 「画像を選ぶ」：ファイルの入力欄は見えなくして、ボタンの形の label で開く */
.file-button {
  cursor: pointer;
}

.file-button:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.avatar-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.avatar-editor p {
  margin: 0;
}

.avatar-editor__body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

/* 切り抜きの見本（canvas）。丸く見せて、アイコンの見え方に近づける */
.avatar-editor__preview {
  width: 200px;
  height: 200px;
  flex: none;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  cursor: grab;
  touch-action: none;
}

.avatar-editor__preview:active {
  cursor: grabbing;
}

.avatar-editor__controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 160px;
  min-width: 0;
}

.avatar-editor__controls input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.avatar-editor__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-list {
  display: flex;
  flex-direction: column;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.link-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}

.link-list__name {
  width: 120px;
  font-weight: 700;
}

.link-list__action {
  margin-left: auto;
}

/* ---- テンプレ詳細の「あなたのテンプレ」 ---- */

.owner-actions {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.owner-actions h2 {
  margin-top: 0;
}

.owner-actions__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.owner-actions__buttons > .button {
  flex: 1 1 auto;
}

.owner-actions p {
  margin: 10px 0 0;
}

.owner-edit {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.owner-edit__actions {
  display: flex;
  gap: 8px;
}

/* ---- スマホの幅 ---- */

@media (max-width: 720px) {
  .detail {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-band {
    gap: 14px;
    padding: 16px;
  }

  .profile-band__name {
    font-size: 1.35rem;
  }

  .mypage__profile {
    max-width: none;
  }
}

@media (max-width: 420px) {
  .template-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .card__shape,
  .card__body {
    padding: 8px;
  }

  .info-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .info-list dd {
    margin-bottom: 8px;
  }
}
