/* Base */
html, body {
  height: 100%;
  margin: 0;
}

body {
  background: #000; /* 任意：全体の地色を固定して綺麗に */
  color: #fff;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;
}

/* Layout */
.page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #0b0b0b;
  z-index: 10;
}

.brand {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.brand:hover {
  color: rgba(255, 255, 255, 0.86);
}

.brand:focus-visible {
  outline: none;
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.18);
}

.icon-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.ui-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: currentColor;
  stroke: currentColor;
}

.menu-item .ui-icon,
.public-copy-btn .ui-icon,
.public-link-btn .ui-icon {
  width: 16px;
  height: 16px;
}

.user-area {
  position: relative;
  display: flex;
  align-items: center;
}

.avatar-btn {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  padding: 0;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.avatar-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.30);
}

.avatar-btn:active {
  transform: translateY(1px);
}

.avatar-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.72);
  outline-offset: 3px;
}

.avatar {
  display: none;
}

.hamburger-icon,
.hamburger-icon::before,
.hamburger-icon::after {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.hamburger-icon {
  position: relative;
  color: rgba(255, 255, 255, 0.88);
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.hamburger-icon::before {
  top: -5px;
}

.hamburger-icon::after {
  top: 5px;
}

/* Menu */
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 248px;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  overflow: hidden;
  display: none; /* JSで開閉 */
}

.menu.open {
  display: block;
}

.menu-head {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.035);
}

.menu-name {
  font-weight: 700;
  line-height: 1.25;
}

.menu-sub {
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 3px;
}

.menu-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.menu-item:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.menu-item.danger {
  color: #ffb4b4;
}

.menu-item.danger:hover {
  background: rgba(255, 80, 80, 0.12);
}

.menu-separator {
  height: 1px;
  margin: 4px 0;
  background: rgba(255, 255, 255, 0.10);
}

/* Controls */
.controls {
  padding: 12px;
}

#playlist-select {
  position: static;
}

/* selectを隠してもレイアウト上の場所は確保 */
.select-wrap{
  position: relative;
  display: inline-flex;
  align-items: center;
  width: clamp(220px, 30vw, 520px); /* 横幅を安定させる */
}

.select-wrap.is-hidden{
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-2px);
}

.select-wrap{
  transition: opacity 140ms ease, transform 140ms ease;
}

/* Deck */
#deck {
  width: 100%;
  height: 100%; /* 残り領域をそのまま使う */
  display: grid;
  gap: 0;
  grid-template-columns: repeat(6, 1fr);
  align-items: start;
  align-content: start;
}

.deck-meta {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.32);
}

.deck-meta[hidden] {
  display: none;
}

.deck-meta-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.deck-meta-title {
  font-size: 14px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
  min-width: 0;
  overflow-wrap: anywhere;
}

.deck-meta-edit-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(125, 211, 252, 0.34);
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.12);
  color: rgba(230, 246, 255, 0.92);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  flex: 0 0 auto;
}

.deck-meta-edit-btn:hover {
  background: rgba(14, 165, 233, 0.22);
  border-color: rgba(125, 211, 252, 0.54);
}

.deck-meta-edit-btn[hidden] {
  display: none;
}

.deck-meta-creator,
.deck-meta-description {
  margin: 0;
  max-width: 760px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  line-height: 1.45;
}

.deck-meta-actions {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-top: 4px;
  flex-wrap: wrap;
}

.deck-meta-source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(29, 185, 84, 0.44);
  border-radius: 999px;
  background: rgba(29, 185, 84, 0.12);
  color: rgba(235, 255, 242, 0.94);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.deck-meta-source-link:hover {
  background: rgba(29, 185, 84, 0.2);
  border-color: rgba(29, 185, 84, 0.64);
}

.deck-meta-source-link[hidden] {
  display: none;
}

.deck-save-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.deck-save-actions[hidden] {
  display: none;
}

.deck-save-btn {
  appearance: none;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(125, 211, 252, 0.36);
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.12);
  color: rgba(230, 246, 255, 0.94);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.deck-save-btn.primary {
  border-color: rgba(34, 211, 238, 0.64);
  background: rgba(6, 182, 212, 0.22);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.12);
}

.deck-save-btn:hover:not(:disabled) {
  background: rgba(14, 165, 233, 0.22);
}

.deck-save-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.deck-save-status {
  min-height: 18px;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.deck-save-status.error {
  color: #ffb4a8;
}

.deck-save-status.success {
  color: #8ff0c8;
}

.deck-help-layer {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  flex: 0 0 auto;
}

.deck-help-btn {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 50%;
  background: rgba(0,0,0,0.62);
  color: rgba(255,255,255,0.92);
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.deck-help-btn:hover,
.deck-help-btn[aria-expanded="true"] {
  background: #fff;
  color: #111;
  border-color: #fff;
}

.deck-help-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 5;
  width: min(280px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  background: rgba(12,12,12,0.94);
  color: rgba(255,255,255,0.88);
  box-shadow: 0 16px 40px rgba(0,0,0,0.36);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.deck-help-panel[hidden] {
  display: none;
}

.deck-help-title {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 900;
}

.deck-help-list {
  margin: 0;
  padding-left: 18px;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 520px) {
  .deck-meta-actions {
    align-items: flex-start;
  }

  .deck-save-actions {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .deck-save-btn {
    flex: 1 1 0;
  }
}

.deck-load-status {
  min-height: 36px;
  padding: 10px 12px 18px;
  color: rgba(255, 255, 255, 0.56);
  font-size: 12px;
  text-align: center;
}

.deck-load-more-btn {
  appearance: none;
  min-height: 38px;
  margin: 0 auto 8px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.deck-load-more-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.deck-load-more-btn[hidden] {
  display: none;
}

.browse-page #deck {
  height: auto;
  min-height: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.browse-page #deck .cover {
  min-width: 0;
  background: rgba(255, 255, 255, 0.04);
}

.browse-page #deck .cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.browse-debug-panel {
  position: fixed;
  right: 8px;
  bottom: 8px;
  z-index: 3000;
  box-sizing: border-box;
  max-width: calc(100vw - 16px);
  max-height: 42vh;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.82);
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.browse-debug-panel[hidden] {
  display: none;
}

.site-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.52);
  font-size: 12px;
}

.site-footer-brand {
  font-weight: 900;
  color: rgba(255,255,255,0.72);
}

.site-footer-links {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.site-footer a {
  color: rgba(255,255,255,0.68);
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff;
}

body.info-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(29, 185, 84, 0.12), transparent 30%),
    linear-gradient(180deg, #080808 0%, #020202 100%);
  color: #fff;
}

.info-shell {
  box-sizing: border-box;
  width: min(820px, calc(100% - 32px));
  min-height: calc(100vh - 68px);
  margin: 0 auto;
  padding: clamp(32px, 6vw, 72px) 0;
}

.info-back-link {
  display: inline-flex;
  margin-bottom: 22px;
  color: rgba(255,255,255,0.62);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}

.info-back-link:hover {
  color: #fff;
}

.info-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.info-top-row .info-back-link {
  margin-bottom: 0;
}

.language-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
}

.language-toggle-btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255,255,255,0.68);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.language-toggle-btn.active {
  background: #fff;
  color: #111;
}

.language-toggle-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.18);
}

.info-shell h1 {
  margin: 0 0 28px;
  color: rgba(255,255,255,0.94);
  font-size: clamp(26px, 5vw, 44px);
  line-height: 1.1;
}

.about-copy[hidden] {
  display: none;
}

.about-copy p {
  margin: 0 0 18px;
  max-width: 760px;
  color: rgba(255,255,255,0.76);
  font-size: 15px;
  line-height: 1.75;
}

.support-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: 12px;
  padding: 0 16px;
  border: 1px solid rgba(29, 185, 84, 0.46);
  border-radius: 999px;
  background: rgba(29, 185, 84, 0.14);
  color: rgba(235, 255, 242, 0.96);
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
}

.support-link:hover {
  background: rgba(29, 185, 84, 0.22);
  border-color: rgba(29, 185, 84, 0.66);
}

.commerce-list {
  display: grid;
  gap: 0;
  margin: 0;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.commerce-list div {
  display: grid;
  grid-template-columns: minmax(140px, 0.35fr) 1fr;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.commerce-list dt {
  color: rgba(255,255,255,0.58);
  font-size: 13px;
  font-weight: 800;
}

.commerce-list dd {
  margin: 0;
  color: rgba(255,255,255,0.88);
  font-size: 14px;
  line-height: 1.6;
}

.cover {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.cover.pending { opacity: 0.6; }

.cover.empty {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* 追加中 */
.cover.pending { opacity: 0.6; }

#deck.deck-slide-from-right {
  animation: deck-slide-from-right 260ms ease-out;
}

#deck.deck-slide-from-left {
  animation: deck-slide-from-left 260ms ease-out;
}

@keyframes deck-slide-from-right {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes deck-slide-from-left {
  from {
    opacity: 0;
    transform: translateX(-28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Mobile */
@media (max-width: 768px) {
  #deck {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== Modal base (必須) ===== */
.modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1000;
}

.settings-panel {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1000;
}

.settings-panel.open {
  display: block;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.settings-dialog {
  position: relative;
  width: min(460px, calc(100vw - 32px));
  margin: 72px auto 0;
  padding: 22px;
  border-radius: 14px;
  background: #151515;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
}

.settings-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 24px;
  line-height: 36px;
  cursor: pointer;
}

.settings-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.settings-title {
  margin: 0;
  padding-right: 42px;
  font-size: 22px;
}

.settings-intro {
  margin: 8px 0 20px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  line-height: 1.5;
}

.settings-field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.settings-label {
  font-size: 13px;
  font-weight: 700;
}

.settings-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.settings-toggle-label input {
  width: 18px;
  height: 18px;
  accent-color: #1ed760;
}

.settings-help {
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  line-height: 1.45;
}

.settings-status {
  min-height: 18px;
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.cart-edit-panel {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cart-edit-panel.open {
  display: flex;
}

.cart-edit-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.cart-edit-dialog {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  background: rgba(14, 14, 14, 0.96);
  color: rgba(255,255,255,0.9);
  box-shadow: 0 22px 70px rgba(0,0,0,0.44);
}

.cart-edit-title {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
}

.cart-edit-intro {
  margin: 6px 0 14px;
  color: rgba(255,255,255,0.58);
  font-size: 12px;
  line-height: 1.5;
}

.cart-edit-field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.cart-edit-label {
  color: rgba(255,255,255,0.76);
  font-size: 12px;
  font-weight: 850;
}

.cart-edit-input,
.cart-edit-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.92);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.cart-edit-input {
  min-height: 38px;
  padding: 0 11px;
}

.cart-edit-textarea {
  min-height: 96px;
  padding: 10px 11px;
  resize: vertical;
}

.cart-edit-input:focus,
.cart-edit-textarea:focus {
  border-color: rgba(125, 211, 252, 0.64);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

.cart-edit-status {
  min-height: 18px;
  margin-top: 10px;
  color: #ffb4a8;
  font-size: 12px;
}

.cart-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.cart-edit-action {
  appearance: none;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.cart-edit-action.cancel {
  border: 1px solid rgba(248, 113, 113, 0.58);
  background: rgba(185, 28, 28, 0.42);
}

.cart-edit-action.cancel:hover {
  background: rgba(185, 28, 28, 0.6);
}

.cart-edit-action.save {
  border: 1px solid rgba(45, 212, 191, 0.62);
  background: rgba(13, 148, 136, 0.48);
}

.cart-edit-action.save:hover {
  background: rgba(13, 148, 136, 0.66);
}

.modal-track{
  margin-top: 6px;
  font-weight: 700;
  font-size: 13px;
  opacity: 0.9;
}

.modal-meta {
  width: min(420px, 86vw);
  color: rgba(255,255,255,0.9);
  text-align: left;
}

.modal-title {
  margin-top: 14px;
  font-size: 18px;
  font-weight: 800;
}

.modal-sub {
  margin-top: 4px;
  color: rgba(255,255,255,0.68);
  font-size: 13px;
}

.modal-source-link{
  display: inline-flex;
  align-items: center;
  margin-top: 12px;
  color: rgba(255,255,255,0.92);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.35);
}

.modal-source-link:hover{
  color: #fff;
  border-bottom-color: rgba(255,255,255,0.75);
}

.modal-track-list {
  width: min(420px, 86vw);
  max-height: min(280px, 36vh);
  margin-top: 16px;
  padding-right: 4px;
  padding-bottom: 72px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-bottom: 72px;
  -webkit-overflow-scrolling: touch;
}

.modal-track-list-title {
  margin-bottom: 8px;
  color: rgba(255,255,255,0.72);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.modal-track-list-message {
  margin: 0;
  color: rgba(255,255,255,0.62);
  font-size: 13px;
}

.modal-track-list-items {
  display: grid;
  gap: 6px;
}

.modal-track-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 5px 6px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  background: rgba(255,255,255,0.045);
}

.modal-track-row.saved {
  background: rgba(255,255,255,0.025);
}

.modal-track-number {
  color: rgba(255,255,255,0.48);
  font-size: 11px;
  text-align: right;
}

.modal-track-name {
  min-width: 0;
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-track-add {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.modal-track-add:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
}

.modal-track-add:disabled {
  cursor: default;
  opacity: 0.65;
}

.modal-track-row.saved .modal-track-add {
  background: rgba(255,80,80,0.14);
  border-color: rgba(255,120,120,0.22);
}

.modal.has-track-picker .modal-figure {
  gap: 10px;
}

.modal.has-track-picker .modal-img {
  max-width: min(46vw, 360px);
  max-height: min(40vh, 360px);
}

.modal.has-track-picker .modal-actions {
  display: none;
}

.modal.has-track-picker .modal-track-list {
  max-height: min(420px, 46vh);
  margin-top: 12px;
}

.modal.has-track-picker .modal-title {
  margin-top: 10px;
}

.modal.open{
  display: block;
}

.modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
}

.modal-close{
  position: fixed;         /* 画面右上に固定 */
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;

  border: none;
  background: transparent; /* シンプル */
  color: rgba(255,255,255,0.9);

  font-size: 28px;
  line-height: 44px;
  text-align: center;

  cursor: pointer;
  z-index: 1100;
}

.modal-close:hover{
  color: #fff;
}

.modal-close:active{
  opacity: 0.7;
}

/* 画像+ボタンを縦積み */
.modal-figure{
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.modal-media{
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin-top: 32px;
}

.modal-source-badge{
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1201;
  transform: translateY(calc(-100% - 8px));
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ボタン列：画像の“下” */
.modal-actions{
  position: static;          /* ★absoluteをやめる */
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* いままで通り画像サイズは制限（必要なら調整） */
.modal-img{
  max-width: min(86vw, 660px);
  max-height: min(62vh, 660px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 16px 60px rgba(0,0,0,0.6);
  display: block;
}

/* 背景クリックは backdrop が受け取る */
.modal-content{
  position: relative;
  height: 100%;
  width: 100%;
  display: grid;
  place-items: center;
  pointer-events: none; /* ★これが肝 */
}

.modal-nav{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 48px;

  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.92);

  font-size: 42px;
  line-height: 48px;
  text-align: center;
  cursor: pointer;

  z-index: 1200;          /* 念のため上に */
  pointer-events: auto;   /* 念のため */
}

.modal-nav:hover{
  color: #fff;
}

.modal-nav:disabled{
  opacity: 0.25;
  cursor: not-allowed;
  transform: translateY(-50%);
}

/* アートの「すぐ外側」 */
.modal-nav.prev{ left: -54px; }
.modal-nav.next{ right: -54px; }

/* 画面が狭い時ははみ出し防止で内側に寄せる */
@media (max-width: 520px){
  .modal-source-badge{
    top: 10px;
    right: 10px;
    transform: none;
  }

  .modal-nav.prev{ left: 10px; }
  .modal-nav.next{ right: 10px; }
}


/* 操作できる要素だけ戻す */
  .modal-figure,
  .modal-media,
  .modal-close,
  .modal-meta,
  .modal-nav{
  pointer-events: auto;
}

.btn{
  appearance: none;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  padding: 12px 14px;
  border-radius: 999px;                /* モダン感：ピル形 */
  cursor: pointer;
  min-width: 180px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, opacity 120ms ease;
  backdrop-filter: blur(8px);          /* 対応ブラウザで良い感じ */
}

.btn:hover{
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.10);
}

.btn:active{
  transform: translateY(0);
}

.btn.primary{
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.24);
}

.btn.danger{
  background: rgba(255,80,80,0.14);
  border-color: rgba(255,120,120,0.22);
}

.btn:disabled{
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* “Added” の見た目（Addボタンがグレーアウトしても映える） */
.btn.added{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.14);
}

/* モバイルでボタンがはみ出る場合の保険 */
@media (max-width: 480px){
  .btn{ min-width: 130px; }
}

/* ===== Controls polish ===== */
.deck-source-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 12px 4px;
}

.deck-source-title {
  color: rgba(255,255,255,0.72);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.deck-source-tabs {
  --tab-indicator-left: 4px;
  --tab-indicator-width: 0px;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
}

.deck-source-tabs::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: var(--tab-indicator-width);
  border-radius: 999px;
  background: #fff;
  transform: translateX(var(--tab-indicator-left));
  transition: transform 220ms ease, width 220ms ease;
}

.deck-source-tab {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255,255,255,0.68);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease, color 120ms ease;
}

.deck-source-tab:hover {
  color: rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.08);
}

.deck-source-tab.active {
  color: #111;
  background: transparent;
}

.deck-source-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.18);
}

.deck-source-panel[hidden] {
  display: none;
}

.deck-source-panel {
  min-height: 64px;
  padding-bottom: 4px;
}

.public-deck-controls-hidden[hidden] {
  display: none;
}

.controls{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 12px 8px;
}

.secondary-controls {
  padding-top: 0;
}

.source-control-row {
  width: 100%;
}

.cart-slot {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.shared-cart-controls {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: nowrap;
}

.cart-control-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
}

.cart-control-group #cart-wrap {
  width: clamp(220px, 24vw, 360px);
  flex: 0 1 360px;
}

.cart-control-group .btn-lite {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Playlist select (dropdown) */
.select{
  appearance: none;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);

  padding: 12px 14px; /* 右側に矢印スペース */
  border-radius: 999px;
  font-weight: 700;

  min-width: 260px;
  max-width: min(520px, 60vw);

  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* hover */
.select:hover{
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.28);
}

/* focus ring（アクセシブルでカッコいい） */
.select:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.34);
}

/* custom chevron for select */
.controls{
  position: relative;
}

.controls::after{
  content: "";
  position: absolute;
  display: none;
}

/* より確実な矢印：selectを包む */
.select-wrap{
  position: relative;
  display: inline-flex;
  align-items: center;
  width: clamp(220px, 30vw, 520px);
}

.select-wrap::after{
  content: "";
  position: absolute;
  right: 16px;
  pointer-events: none;
  opacity: 0.8;
  font-size: 14px;
}

.arrow{
  opacity: 0.6;
  font-weight: 800;
  padding: 0 2px;
}

.cart-flow-arrow {
  display: none;
  width: 100%;
  color: rgba(255, 255, 255, 0.72);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

/* 小さめの補助ボタン（Create New Cart用） */
.btn-lite{
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  padding: 12px 14px;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, opacity 120ms ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn-lite:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.28);
}

.btn-lite.cart-open{
  background: rgba(0, 174, 255, 0.18);
  border-color: rgba(0, 225, 255, 0.72);
  color: rgba(232, 251, 255, 0.98);
  box-shadow:
    0 0 0 1px rgba(0, 225, 255, 0.16) inset,
    0 0 18px rgba(0, 196, 255, 0.42);
}

.btn-lite.cart-open:hover{
  background: rgba(0, 188, 255, 0.26);
  border-color: rgba(85, 238, 255, 0.9);
  box-shadow:
    0 0 0 1px rgba(85, 238, 255, 0.22) inset,
    0 0 24px rgba(0, 204, 255, 0.56);
}

.btn-lite:disabled{
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* モバイルでは縦積み */
@media (max-width: 480px){
  .controls{
    flex-direction: column;
    align-items: stretch;
  }
  #playlist-select{
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }
}

@media (max-width: 520px){
  .modal{
    --modal-mobile-width: min(72vw, 280px);
    overflow: hidden;
  }

  .modal-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: auto;
    max-width: none;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0;
    padding: 50px 18px 28px;
    box-sizing: border-box;
  }

  .modal-close{
    position: absolute;
    top: 8px;
    right: 8px;
  }

  .modal-figure{
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 10px;
  }

  .modal-media{
    position: relative;
    display: block;
    width: var(--modal-mobile-width);
    max-width: 100%;
    margin-top: 30px;
  }

  .modal-img{
    width: 100%;
    max-width: var(--modal-mobile-width);
    max-height: 42vh;
  }

  .modal-source-badge{
    position: absolute;
    top: 0;
    right: 0;
    transform: translateY(calc(-100% - 6px));
  }

  .modal-nav{
    position: absolute;
    top: 50%;
    width: 28px;
    height: 48px;
    color: rgba(255,255,255,0.9);
    font-size: 36px;
    line-height: 48px;
  }

  .modal-nav:hover{
    color: #fff;
  }

  .modal-nav:disabled{
    opacity: 0.24;
    transform: translateY(-50%);
  }

  #modal-prev{
    left: -30px;
    transform: translateY(-50%);
  }

  #modal-next{
    right: -30px;
    transform: translateY(-50%);
  }

  .modal-actions{
    display: flex;
    justify-content: center;
    gap: 8px;
    width: min(100%, calc(var(--modal-mobile-width) + 28px));
    max-width: calc(100vw - 36px);
  }

  .modal-meta {
    width: 100%;
    max-width: calc(100vw - 36px);
  }

  .modal-actions .btn,
  .modal-actions .btn-lite{
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    padding: 11px 10px;
    box-sizing: border-box;
    font-size: 12px;
    letter-spacing: 0;
  }

  .modal-track-list {
    max-height: 34vh;
    padding-bottom: 96px;
    scroll-padding-bottom: 96px;
  }

  .modal.has-track-picker .modal-content {
    padding-top: 38px;
  }

  .modal.has-track-picker .modal-figure {
    width: 100%;
    gap: 8px;
  }

  .modal.has-track-picker .modal-media{
    width: min(64vw, 240px);
    margin-left: auto;
    margin-right: auto;
  }

  .modal.has-track-picker .modal-img{
    width: 100%;
    max-width: 100%;
    max-height: 30vh;
    border-radius: 8px;
  }

  .modal.has-track-picker .modal-nav{
    font-size: 30px;
  }

  .modal.has-track-picker #modal-prev{
    left: -28px;
  }

  .modal.has-track-picker #modal-next{
    right: -28px;
  }

  .modal.has-track-picker .modal-actions {
    display: none;
  }

  .modal.has-track-picker .modal-title {
    margin-top: 10px;
    font-size: 16px;
  }

  .modal.has-track-picker .modal-track {
    margin-top: 4px;
    font-size: 12px;
  }

  .modal.has-track-picker .modal-sub,
  .modal.has-track-picker .modal-source-link {
    font-size: 12px;
  }

  .modal.has-track-picker .modal-track-list {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    max-height: 48vh;
    margin-top: 10px;
  }
}

/* ===== Playlist search ===== */

.playlist-search-block,
.playlist-url-block,
.itunes-search-block,
.artist-search-block,
.playlist-shuffle-block {
  width: 100%;
  padding: 12px 12px 12px;
  box-sizing: border-box;
}

.playlist-shuffle-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.shuffle-cta-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.shuffle-first-run-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
  animation: shuffleTipFloat 1400ms ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}

.shuffle-first-run-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fff;
}

.shuffle-first-run-tip[hidden] {
  display: none;
}

@keyframes shuffleTipFloat {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -4px); }
}

@media (prefers-reduced-motion: reduce) {
  .shuffle-first-run-tip {
    animation: none;
  }
}

.playlist-search-row,
.itunes-search-row,
.artist-search-row,
.playlist-url-row {
  width: 100%;
  max-width: 100%;
  margin: 0;

  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;

  box-sizing: border-box;
}

.playlist-search-input {
  flex: 1;
  min-width: 220px;
  height: 40px;
  padding: 0 14px;

  border: 1px solid #333;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 14px;

  box-sizing: border-box;
}

.playlist-search-input::placeholder {
  color: #777;
}

.playlist-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;

  border: 1px solid #333;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;

  box-sizing: border-box;
}

.playlist-random-btn {
  border-color: rgba(29, 185, 84, 0.48);
  background: rgba(29, 185, 84, 0.14);
  color: rgba(235, 255, 242, 0.96);
  animation: shuffleButtonPulse 3.2s ease-in-out infinite;
}

.playlist-random-btn:hover {
  background: rgba(29, 185, 84, 0.22);
  border-color: rgba(29, 185, 84, 0.68);
}

@keyframes shuffleButtonPulse {
  0%,
  100% {
    border-color: rgba(29, 185, 84, 0.44);
    box-shadow: 0 0 0 rgba(29, 185, 84, 0);
    filter: brightness(1);
  }

  50% {
    border-color: rgba(29, 185, 84, 0.82);
    box-shadow: 0 0 18px rgba(29, 185, 84, 0.34);
    filter: brightness(1.12);
  }
}

@media (prefers-reduced-motion: reduce) {
  .playlist-random-btn {
    animation: none;
  }
}

.playlist-search-results {
  width: 640px;
  max-width: 100%;
  max-height: min(420px, 48vh);
  margin: 12px 0 0;
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.playlist-url-message {
  width: 640px;
  max-width: 100%;
  min-height: 18px;
  margin: 8px 0 0;
  box-sizing: border-box;
}

.saved-deck-discovery {
  width: 640px;
  max-width: 100%;
  margin-top: 12px;
}

.public-decks-list {
  margin-top: 8px;
}

.public-deck-card {
  width: 100%;
  min-height: 54px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  text-align: left;
}

.public-deck-card:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.22);
}

.public-deck-card-title {
  font-size: 13px;
  font-weight: 850;
}

.public-deck-card-meta {
  margin-top: 3px;
  color: rgba(255,255,255,0.58);
  font-size: 12px;
}

.search-message {
  margin: 8px 0 0;
  color: rgba(255,255,255,0.72);
  font-size: 13px;
}

.search-message.error {
  color: #ff9b9b;
}

.search-fallback-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-top: 10px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.search-fallback-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

.search-fallback-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-top: 10px;
  margin-right: 8px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.search-fallback-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.playlist-result-card {
  width: 100%;
  margin-top: 8px;
  padding: 8px;

  display: flex;
  align-items: center;
  gap: 10px;

  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.92);

  cursor: pointer;
  text-align: left;
}

.playlist-result-card:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.22);
}

.playlist-load-more-btn {
  width: 100%;
  min-height: 38px;
  margin-top: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.86);
  font-weight: 800;
  cursor: pointer;
}

.playlist-load-more-btn:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.26);
}

.playlist-load-more-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.playlist-result-img {
  width: 48px;
  height: 48px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center center;
  display: block;
  border-radius: 8px;
  flex: 0 0 48px;
  background: rgba(255,255,255,0.08);
}

.playlist-result-img-empty {
  display: block;
}

.playlist-result-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.playlist-result-name {
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-result-owner,
.playlist-result-count {
  font-size: 12px;
  color: rgba(255,255,255,0.62);
}

/* ===== Mobile fix ===== */
@media (max-width: 520px) {
  body {
    overflow-x: hidden;
  }

  .topbar {
    min-width: 0;
  }

  .brand {
    min-width: 0;
    max-width: calc(100vw - 64px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .controls {
    width: 100%;
    box-sizing: border-box;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
    overflow: hidden;
  }

  .cart-control-group {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .cart-control-group #cart-wrap {
    width: 100%;
    flex: none;
  }

  .cart-slot,
  .shared-cart-controls {
    width: 100%;
  }

  .shared-cart-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .btn-lite {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .select-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .arrow {
    display: none;
  }

  .cart-flow-arrow {
    display: block;
    margin: 0 auto 2px;
  }

  .playlist-search-block,
  .playlist-url-block,
  .itunes-search-block,
  .artist-search-block,
  .playlist-shuffle-block {
    width: 100%;
    padding: 10px 12px;
    box-sizing: border-box;
    overflow: hidden;
  }

  .playlist-search-row,
  .itunes-search-row,
  .artist-search-row,
  .playlist-url-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .playlist-search-input {
    min-width: 0;
    width: 100%;
    flex-basis: 100%;
  }

  .playlist-search-btn {
    flex: 1;
    flex-shrink: 0;
    padding: 0 10px;
  }

  .playlist-search-results,
  .playlist-url-message {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .playlist-search-results {
    max-height: min(360px, 42vh);
  }

  .playlist-result-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .playlist-result-meta {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .playlist-result-name,
  .playlist-result-owner,
  .playlist-result-count {
    max-width: 100%;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ===== Auto hide toolbar on mobile ===== */

.deck-toolbar {
  position: sticky;
  top: 48px; /* topbarの高さに近い値 */
  z-index: 9;
  background: #000;
  transition:
    transform 220ms ease,
    opacity 180ms ease;
  will-change: transform;
}

.deck-toolbar.is-hidden {
  transform: translateY(calc(-100% - 8px));
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 520px) {
  .info-top-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .commerce-list div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer-links {
    justify-content: flex-start;
  }

  .deck-toolbar {
    top: 48px;
  }

  .deck-toolbar.is-hidden {
    transform: translateY(calc(-100% - 8px));
  }

  .deck-source-header {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .deck-source-title {
    white-space: normal;
  }

  .deck-source-tabs {
    width: 100%;
    box-sizing: border-box;
  }

  .deck-source-tab {
    flex: 1;
    padding: 8px 6px;
    font-size: 12px;
  }
}

/* ===== Public deck ===== */
body.public-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 122, 89, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(46, 134, 222, 0.16), transparent 30%),
    linear-gradient(180deg, #090909 0%, #020202 100%);
  background-color: #020202;
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  color: #f8f6ef;
}

body.public-page.public-theme-midnight {
  background:
    radial-gradient(circle at top left, rgba(255, 122, 89, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(46, 134, 222, 0.16), transparent 30%),
    linear-gradient(180deg, #090909 0%, #020202 100%);
  background-color: #020202;
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

body.public-page.public-theme-signal {
  background:
    radial-gradient(circle at top left, rgba(30, 215, 96, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(35, 176, 255, 0.14), transparent 34%),
    linear-gradient(180deg, #07120d 0%, #020706 100%);
  background-color: #020706;
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

body.public-page.public-theme-ember {
  background:
    radial-gradient(circle at top left, rgba(255, 92, 57, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(255, 201, 71, 0.12), transparent 28%),
    linear-gradient(180deg, #130807 0%, #050202 100%);
  background-color: #050202;
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

body.public-page.public-theme-recordshop {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.58), rgba(0, 0, 0, 0.72)),
    radial-gradient(circle at 18% 20%, rgba(29, 185, 84, 0.14), transparent 22%),
    radial-gradient(circle at 86% 16%, rgba(255, 255, 255, 0.08), transparent 18%),
    url("./DigDeck_BG1.jpg") center center / cover no-repeat;
  background-color: #050505;
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
}

.public-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) 0 56px;
}

.public-hero {
  display: grid;
  gap: 14px;
  margin-bottom: 28px;
}

.public-eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(248, 246, 239, 0.66);
}

.public-title {
  margin: 0;
  font-size: clamp(32px, 7vw, 68px);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.public-creator,
.public-description {
  margin: 0;
  max-width: 720px;
}

.public-creator {
  font-size: 16px;
  font-weight: 700;
  color: rgba(248, 246, 239, 0.82);
}

.public-description {
  font-size: 15px;
  line-height: 1.7;
  color: rgba(248, 246, 239, 0.72);
}

.public-meta-row,
.public-actions,
.public-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.public-pill,
.public-source-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 246, 239, 0.92);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

a.public-source-badge {
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

a.public-source-badge:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.public-pill-muted {
  color: rgba(248, 246, 239, 0.72);
  background: rgba(255, 255, 255, 0.04);
}

.public-share-panel {
  display: grid;
  gap: 10px;
  max-width: 720px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.public-share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.public-share-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(248, 246, 239, 0.62);
}

.public-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 246, 239, 0.94);
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.public-copy-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.26);
}

.public-copy-btn-muted {
  color: rgba(248, 246, 239, 0.72);
  background: rgba(255, 255, 255, 0.04);
}

.public-link-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(248, 246, 239, 0.88);
  font-size: 13px;
}

.public-link-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(248, 246, 239, 0.62);
}

.public-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 246, 239, 0.94);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.public-link-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.public-deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.public-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.public-cover-wrap {
  aspect-ratio: 1 / 1;
  background: rgba(255, 255, 255, 0.03);
}

.public-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.public-card-meta {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.public-card-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
}

.public-card-artist {
  color: rgba(248, 246, 239, 0.72);
  font-size: 13px;
  line-height: 1.45;
}

.public-card-footer {
  justify-content: flex-start;
  margin-top: auto;
}

.public-source-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
}

body.public-density-compact .public-deck-grid {
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 10px;
}

body.public-density-compact .public-card-meta {
  gap: 7px;
  padding: 10px;
}

body.public-density-compact .public-card-title {
  font-size: 14px;
}

body.public-density-compact .public-card-artist {
  font-size: 12px;
}

.public-edit-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(22px, 4vw, 44px) 0 56px;
}

.public-edit-head {
  display: grid;
  gap: 18px;
  margin-bottom: 28px;
}

.public-edit-back {
  width: fit-content;
  color: rgba(248, 246, 239, 0.82);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.public-edit-back:hover {
  color: #fff;
}

.public-edit-layout {
  display: grid;
  grid-template-columns: minmax(280px, 400px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.public-edit-form,
.public-edit-preview {
  min-width: 0;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.public-edit-form {
  position: sticky;
  top: 72px;
  display: grid;
  gap: 16px;
  padding: 18px;
}

.public-edit-input,
.public-edit-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.26);
  color: #fff;
  font: inherit;
}

.public-edit-input {
  min-height: 42px;
  padding: 0 12px;
}

.public-edit-textarea {
  resize: vertical;
  min-height: 112px;
  padding: 12px;
  line-height: 1.55;
}

.public-edit-options,
.public-edit-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.public-edit-options .settings-field {
  min-width: 0;
}

.public-edit-options .select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.public-edit-share {
  padding: 12px;
}

.public-edit-preview {
  padding: 18px;
}

.public-edit-preview-hero {
  margin-bottom: 18px;
}

.public-edit-preview .public-title {
  font-size: clamp(30px, 5vw, 56px);
}

@media (max-width: 640px) {
  .public-shell {
    width: min(100%, calc(100% - 24px));
    padding-top: 20px;
  }

  .public-deck-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .public-share-head {
    align-items: stretch;
    flex-direction: column;
  }

  .public-copy-btn {
    width: 100%;
  }

  .public-card-footer {
    align-items: flex-start;
  }

  .public-edit-shell {
    width: min(100%, calc(100% - 24px));
    padding-top: 20px;
  }

  .public-edit-layout {
    grid-template-columns: 1fr;
  }

  .public-edit-form {
    position: static;
  }

  .public-edit-options,
  .public-edit-actions {
    grid-template-columns: 1fr;
  }
}

/* ===== Landing page ===== */
body.landing-page {
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  background: #050505;
}

body.landing-page::before,
body.landing-page::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body.landing-page::before {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.56), rgba(0, 0, 0, 0.68)),
    radial-gradient(circle at 18% 20%, rgba(29, 185, 84, 0.14), transparent 22%),
    radial-gradient(circle at 86% 16%, rgba(255, 255, 255, 0.08), transparent 18%),
    url("./DigDeck_BG1.jpg") center center / cover no-repeat;
  transform: scale(1.02);
}

body.landing-page::after {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.16)),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 120px
    );
  mix-blend-mode: screen;
  opacity: 0.28;
}

.landing-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.landing-hero {
  box-sizing: border-box;
  width: min(980px, 100%);
  padding: clamp(28px, 6vw, 72px);
  text-align: center;
}

.landing-beta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  margin-bottom: 18px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.52);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.landing-title {
  margin: 0;
  color: #fff;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  text-shadow: 0 18px 38px rgba(0, 0, 0, 0.32);
}

.landing-title-main,
.landing-title-sub {
  display: block;
  letter-spacing: 0;
}

.landing-title-main {
  font-size: 84px;
  font-weight: 800;
  line-height: 0.92;
}

.landing-title-sub {
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.18;
}

.landing-actions {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(360px, 100%);
  margin: 52px auto 0;
}

.landing-disclosure {
  max-width: 720px;
  margin: 26px auto 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

.landing-disclosure p {
  margin: 0;
}

.landing-disclosure p + p {
  margin-top: 8px;
}

.landing-login-status {
  min-height: 18px;
  margin: 14px auto 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

.landing-primary-btn,
.landing-spotify-btn,
.landing-secondary-btn {
  box-sizing: border-box;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 0 28px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease, background 140ms ease;
}

.landing-primary-btn,
.landing-spotify-btn {
  background: rgba(255, 255, 255, 0.92);
  color: #050505;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.44);
}

.landing-secondary-btn {
  background: rgba(0, 0, 0, 0.26);
  color: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.landing-secondary-btn:disabled {
  cursor: wait;
  opacity: 0.64;
}

.landing-primary-btn:hover,
.landing-spotify-btn:hover,
.landing-secondary-btn:hover {
  transform: translateY(-1px);
}

.landing-primary-btn:hover,
.landing-spotify-btn:hover {
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  filter: brightness(1.02);
}

.landing-secondary-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.landing-primary-btn:active,
.landing-spotify-btn:active,
.landing-secondary-btn:active {
  transform: translateY(0);
}

.landing-primary-btn:focus-visible,
.landing-spotify-btn:focus-visible,
.landing-secondary-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.12),
    0 18px 42px rgba(0, 0, 0, 0.34);
}

@media (max-width: 640px) {
  .landing-shell {
    padding: 16px;
  }

  .landing-hero {
    padding: 22px 12px 30px;
  }

  .landing-actions {
    margin-top: 30px;
  }

  .landing-title-main {
    font-size: 56px;
  }

  .landing-title-sub {
    margin-top: 10px;
    font-size: 22px;
  }

  .landing-disclosure {
    font-size: 10px;
    line-height: 1.5;
    text-align: left;
  }

  .landing-primary-btn,
  .landing-spotify-btn,
  .landing-secondary-btn {
    width: 100%;
  }
}

/* ===== Browse page ===== */
.browse-page {
  background:
    radial-gradient(circle at top left, rgba(29, 185, 84, 0.12), transparent 30%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.08), transparent 24%),
    #050505;
}

.browse-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(24px, 4vw, 44px) 0 56px;
}

.browse-hero {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.browse-title {
  margin: 0;
  color: #fff;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 0.95;
}

.browse-copy {
  max-width: 720px;
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 15px;
  line-height: 1.65;
}

.browse-search-block {
  padding-left: 0;
  padding-right: 0;
}

.browse-collection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.browse-collection-actions .btn-lite {
  min-height: 36px;
}

.browse-back-link,
.browse-login-link {
  color: rgba(255, 255, 255, 0.84);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.browse-back-link:hover,
.browse-login-link:hover {
  color: #fff;
}

@media (max-width: 640px) {
  .browse-collection-actions .btn-lite {
    flex: 1 1 100%;
  }
}
