/* ===== จักรวาลเพลง: ฟองกลมลอยแบบรังผึ้ง + เลนส์ทรงกลม ===== */

.bub-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 12px;
}
.bub-tools .spacer {
  flex: 1;
}
.seg-chips {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: var(--chip-bg, rgba(0, 0, 0, 0.05));
}
.chip {
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}
.bub-tools > .chip {
  background: var(--chip-bg, rgba(0, 0, 0, 0.05));
}
.chip.on,
.chip.hot {
  background: var(--lime);
  color: var(--lime-ink);
}

.bub-stage {
  position: relative;
  height: calc(100dvh - 250px);
  min-height: 380px;
  border-radius: 30px;
  overflow: hidden;
  overflow: clip;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  background:
    radial-gradient(circle at 50% 50%, var(--bub-core, rgba(255, 220, 196, 0.55)), transparent 62%),
    var(--bub-bg, rgba(255, 255, 255, 0.45));
  border: 1px solid var(--glass-line, rgba(255, 255, 255, 0.8));
  box-shadow: inset 0 0 60px var(--bub-vignette, rgba(120, 70, 40, 0.12));
}
@media (min-width: 721px) {
  .bub-stage {
    height: calc(100dvh - 210px);
  }
}
.bub-stage.grabbing {
  cursor: grabbing;
}
.bub-layer {
  position: absolute;
  inset: 0;
}

.bub {
  position: absolute;
  left: 0;
  top: 0;
  width: 76px;
  height: 76px;
  will-change: transform, opacity;
}
.bub-in {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #2b211c;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25), inset 0 0 0 2px rgba(255, 255, 255, 0.35);
  animation: bub-pop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.4) both, bub-float 5s ease-in-out infinite;
  animation-delay: calc(var(--i) * 18ms), calc(var(--i) * -0.37s);
}
.bub-in::after {
  /* แสงสะท้อนบนฟอง */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.55), transparent 38%);
  pointer-events: none;
}
.bub-in img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.35); /* ปก YouTube มีขอบดำ ซูมให้เต็มวง */
  pointer-events: none;
}
.bub-ph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  font-weight: 700;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #f6c9a8, #c8704a);
}
.bub-ph.radio {
  background: radial-gradient(circle at 35% 30%, #f3dcc0, #a8744f);
}
.bub-ph.yt {
  background: radial-gradient(circle at 35% 30%, #f7b9a2, #c9553f);
}
.bub-badge {
  position: absolute;
  right: 6px;
  bottom: 8px;
  z-index: 1;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: rgba(20, 14, 10, 0.72);
  color: #fff;
  font: 700 0.68rem/20px system-ui, sans-serif;
  text-align: center;
}
.bub-fav {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 1;
  font-size: 0.75rem;
  color: #ff6b8b;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.bub-name {
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  width: 110px;
  margin-left: -55px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.bub.near .bub-name {
  opacity: 1;
}
.bub.sel .bub-in {
  box-shadow: 0 0 0 3px var(--lime-strong), 0 0 28px var(--lime-strong), 0 6px 18px rgba(0, 0, 0, 0.25);
}
@keyframes bub-pop {
  from {
    transform: scale(0);
    opacity: 0;
  }
}
@keyframes bub-float {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -4px;
  }
}

.bub-hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--text-2);
  background: var(--chip-bg, rgba(255, 255, 255, 0.6));
  white-space: nowrap;
  pointer-events: none;
  animation: hint-out 0.6s 5s forwards;
}
@keyframes hint-out {
  to {
    opacity: 0;
  }
}
.bub-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 6px;
  color: var(--text-2);
  padding: 20px;
}

/* การ์ดรายละเอียดเพลง */
.bub-card {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 200;
  padding: 12px;
  border-radius: 22px;
  background: var(--sheet-bg, rgba(255, 255, 255, 0.92));
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-line, rgba(255, 255, 255, 0.9));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  cursor: default;
}
.bub-card.pop {
  animation: card-up 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes card-up {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}
.bub-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bub-card-face {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
}
.bub-card-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.35);
}
.bub-card-face .bub-ph {
  font-size: 1.2rem;
}
.bub-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.bub-card-main b,
.bub-card-main span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bub-card-main span {
  font-size: 0.8rem;
  color: var(--muted);
}
.bub-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
  font-size: 0.76rem;
  color: var(--text-2);
}
.bub-card-stats span {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--chip-bg, rgba(0, 0, 0, 0.05));
}
.bub-card-stats .bub-rank {
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 700;
}
.bub-card-acts {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
}

/* ไอคอนในคลังเพลง: ฟอง 4 ลูก */
.bub-ico {
  position: relative;
}
.bub-ico i {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3ea, #d4845a);
  animation: bub-float 3s ease-in-out infinite;
}
.bub-ico i:nth-child(1) { width: 18px; height: 18px; left: 7px; top: 9px; }
.bub-ico i:nth-child(2) { width: 13px; height: 13px; left: 24px; top: 6px; animation-delay: -1s; }
.bub-ico i:nth-child(3) { width: 11px; height: 11px; left: 23px; top: 23px; animation-delay: -2s; }
.bub-ico i:nth-child(4) { width: 8px; height: 8px; left: 10px; top: 29px; animation-delay: -0.5s; }

@media (prefers-reduced-motion: reduce) {
  .bub-in,
  .bub-ico i {
    animation: none !important;
  }
}

/* ป้ายชื่อเพลงใต้ฟองตรงกลาง + ปุ่มปิดในการ์ด */
.bub-name {
  width: 150px;
  margin-left: -75px;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(40, 25, 18, 0.72);
  color: #fff;
  z-index: 2;
}
.bub.near {
  z-index: 150 !important;
}
.bub-card .icon-btn {
  background: rgba(0, 0, 0, 0.05);
  border: 0;
  box-shadow: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
}
@media (max-width: 720px) {
  .bub-stage {
    height: calc(100dvh - 330px);
  }
}

/* ===== ปุ่มสลับโหมดบนปุ่มหมุน (เสียง / เลือกเพลง) ===== */
.vol-modes {
  position: absolute;
  top: 38px;
  right: 14px;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(120, 80, 50, 0.08);
  pointer-events: auto;
}
.vol-modes button {
  width: 32px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: none;
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
}
.vol-modes button.on {
  background: var(--lime);
  color: var(--lime-ink);
}
.vol-modes svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.vol-modes svg .fill {
  fill: currentColor;
  stroke: none;
}

/* ===== วงล้อเลือกเพลง ===== */
.qwheel {
  position: fixed;
  right: 0;
  top: 50%;
  z-index: 52;
  width: min(92vw, 380px);
  height: min(78vh, 620px);
  display: flex;
  flex-direction: column;
  border-radius: 34px 0 0 34px;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: -14px 16px 44px rgba(90, 50, 25, 0.22);
  transform: translate(105%, -50%);
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.1);
  overflow: hidden;
  overflow: clip;
}
.qwheel.open {
  transform: translate(0, -50%);
}
.qw-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 6px 16px;
}
.qw-top b {
  flex: 1;
  font-size: 1.05rem;
}
.vol-modes.in-wheel {
  position: static;
}
.qw-x {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
  cursor: pointer;
}
.qw-ring {
  position: relative;
  flex: 1;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  -webkit-mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
}
.qw-item {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 300px;
  padding: 6px 8px 6px 4px;
  border-radius: 999px;
  transform-origin: 36px 50%;
  will-change: transform, opacity;
  transition: background 0.25s, box-shadow 0.25s;
}
.qw-disc {
  flex: none;
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle, #3a2b25 0 30%, #241a16 31%);
  box-shadow: 0 8px 18px rgba(60, 30, 15, 0.3), inset 0 0 0 3px rgba(255, 255, 255, 0.5);
  display: grid;
  place-items: center;
  color: #fff;
}
.qw-disc img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.35);
}
.qw-disc::after {
  /* รูกลางแผ่นเสียง */
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f5efe8;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}
.qw-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.qw-text b,
.qw-text small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qw-text b {
  font-size: 0.98rem;
  color: var(--text);
}
.qw-text small {
  font-size: 0.78rem;
  color: var(--muted);
}
.qw-play {
  display: none;
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--lime);
  color: var(--lime-ink);
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(200, 120, 70, 0.3);
}
.qw-item.center {
  background: #fff;
  box-shadow: 0 10px 28px rgba(90, 50, 25, 0.16);
}
.qw-item.center .qw-play {
  display: block;
}
.qw-item.center .qw-disc {
  animation: spin 3.5s linear infinite;
}
.qw-item.now .qw-text small {
  color: var(--primary);
  font-weight: 600;
}
.qw-foot {
  padding: 6px 16px 14px;
  font-size: 0.74rem;
  color: var(--muted);
  text-align: center;
}
@media (prefers-reduced-motion: reduce) {
  .qw-item.center .qw-disc {
    animation: none;
  }
}

/* วงล้อ: ซ่อนด้วยการตัดภาพ (ไม่เลื่อนออกนอกจอ) — ไม่งั้นหน้าแอพบนมือถือจะกว้างเกินจอ */
.qwheel {
  transform: translate(0, -50%) !important;
  clip-path: inset(0 0 0 100% round 34px 0 0 34px);
  opacity: 0;
  pointer-events: none;
  transition: clip-path 0.45s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.25s;
}
.qwheel.open {
  clip-path: inset(0 0 0 0 round 34px 0 0 34px);
  opacity: 1;
  pointer-events: auto;
}

/* ===== ปุ่มหมุน 2 โหมด: สวิตช์เลื่อน + แผ่นเพลงรอบวง ===== */
.vol {
  height: 540px !important;
}
.vol-switch {
  pointer-events: auto;
  position: absolute;
  right: 14px;
  top: 14px;
  width: 152px;
  height: 50px;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 24px rgba(30, 40, 50, 0.18);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  font: inherit;
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.3s, transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.vol.open .vol-switch {
  opacity: 1;
  transform: none;
}
.vol:not(.open) .vol-switch {
  pointer-events: none;
}
.vs-knob {
  position: absolute;
  left: 4px;
  top: 4px;
  width: calc(50% - 4px);
  height: 42px;
  border-radius: 999px;
  background: var(--lime);
  box-shadow: 0 4px 12px rgba(30, 40, 50, 0.18);
  transition: transform 0.35s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.mode-song .vs-knob {
  transform: translateX(100%);
}
.vs-opt {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.3s;
}
.vs-opt i {
  font-style: normal;
}
.vs-opt svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.vs-opt svg .fill {
  fill: currentColor;
  stroke: none;
}
.vol:not(.mode-song) .vs-vol,
.mode-song .vs-song {
  color: var(--lime-ink);
}

/* โหมดเลือกเพลง: ซ่อนเข็มเสียง แสดงแผ่นเพลง */
.dial-songs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.mode-song .dial-songs {
  opacity: 1;
}
.mode-song .vol-fill,
.mode-song .vol-knob {
  opacity: 0;
}
.vol-fill,
.vol-knob {
  transition: opacity 0.3s;
}
.ds-disc {
  position: absolute;
  left: 0;
  top: 0;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle, #3a2b25 0 30%, #241a16 31%);
  box-shadow: 0 6px 14px rgba(20, 20, 30, 0.3), inset 0 0 0 2px rgba(255, 255, 255, 0.6);
  display: grid;
  place-items: center;
  color: #fff;
  will-change: transform, opacity;
}
.ds-disc img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.35);
}
.ds-disc::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}
.ds-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 1;
}
.ds-play svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}
.ds-play svg .fill {
  fill: #fff;
}
.ds-disc.sel {
  box-shadow: 0 0 0 3px var(--lime-strong), 0 8px 20px rgba(20, 20, 30, 0.35);
}
.ds-disc.sel .ds-play {
  opacity: 1;
}
.ds-disc.now:not(.sel) {
  box-shadow: 0 0 0 2px var(--lime), 0 6px 14px rgba(20, 20, 30, 0.3);
}
.mode-song .vol-read b {
  font-size: 2rem;
}
.mode-song .vol-read small {
  font-size: 0.72rem;
  text-align: center;
}
/* ปุ่มสลับแบบเก่า / วงล้อแบบเก่า ไม่ใช้แล้ว */
.vol-modes,
.qwheel {
  display: none !important;
}
