:root {
  --bg: #050816;
  --bg2: #0b1230;
  --cream: #f6f1ea;
  --muted: #b7bfd7;
  --pink: #ff6ea8;
  --pink-soft: #ffb3d0;
  --gold: #ffd36b;
  --blue: #6ebcff;
  --glass: rgba(17, 22, 44, .42);
  --line: rgba(255, 255, 255, .12);
  --display: 'DM Serif Display', serif;
  --body: 'Inter', sans-serif;
  --jp: 'Noto Sans JP', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { height: 100%; min-height: 100dvh; }
body {
  font-family: var(--body);
  color: var(--cream);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--pink); color: #fff; }
button { font-family: inherit; cursor: pointer; }

.glass-card {
  background: linear-gradient(160deg, rgba(20, 27, 54, .72), rgba(10, 14, 31, .48));
  backdrop-filter: blur(18px) saturate(1.1);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1100px 700px at 50% 12%, rgba(44, 66, 129, .45), transparent 60%),
    linear-gradient(180deg, #050816 0%, #07102a 45%, #04060f 100%);
  transition: filter .8s ease, background .8s ease;
}

.day-mode .backdrop {
  filter: brightness(1.35) saturate(.9);
  background:
    radial-gradient(1100px 700px at 50% 12%, rgba(255, 188, 125, .42), transparent 60%),
    linear-gradient(180deg, #182c58 0%, #335d83 45%, #17223e 100%);
}

.day-mode .hero-art {
  filter: brightness(1.18) saturate(1.08);
}

.night-mode .backdrop,
.night-mode .hero-art {
  filter: brightness(.84) saturate(1.16);
}

.day-mode .sky-stars { opacity: .16; }

.sky-glow,
.sky-stars,
.paper-noise {
  position: absolute;
  inset: 0;
}

.sky-glow-a {
  background: radial-gradient(700px 360px at 50% 38%, rgba(255, 172, 112, .16), transparent 62%);
}

.sky-glow-b {
  background: radial-gradient(500px 280px at 62% 18%, rgba(255, 110, 168, .15), transparent 60%);
}

.sky-stars {
  opacity: .7;
  background-image:
    radial-gradient(1px 1px at 10% 18%, #fff, transparent 50%),
    radial-gradient(1px 1px at 26% 64%, #fff, transparent 50%),
    radial-gradient(1px 1px at 44% 22%, #fff, transparent 50%),
    radial-gradient(1px 1px at 58% 34%, #fff, transparent 50%),
    radial-gradient(1px 1px at 72% 16%, #fff, transparent 50%),
    radial-gradient(1px 1px at 88% 42%, #fff, transparent 50%),
    radial-gradient(1px 1px at 82% 78%, #fff, transparent 50%),
    radial-gradient(1px 1px at 18% 86%, #fff, transparent 50%);
  animation: twinkle 6s ease-in-out infinite alternate;
}

.paper-noise {
  opacity: .08;
  background-image: linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.25) 1px, transparent 1px);
  background-size: 4px 4px;
  mix-blend-mode: soft-light;
}

@keyframes twinkle {
  from { opacity: .45; }
  to { opacity: .95; }
}

.page {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
}

.site-shell {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.topbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1140px, calc(100% - 24px));
  margin: 0;
  border-radius: 999px;
  padding: 8px 14px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  z-index: 8;
}

.top-left,
.top-center,
.top-right { display: flex; align-items: center; }

.top-left { justify-content: flex-start; }
.top-center { justify-content: center; }
.top-right { justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.clock-pill,
.listeners-pill,
.icon-btn {
  background: rgba(16, 22, 41, .78);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

.clock-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
}

.clock-pill i { color: rgba(255,255,255,.55); }

.listeners-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  text-align: center;
}

.listeners-pill strong { font-size: 15px; }
.listeners-pill small { display: block; color: rgba(255,255,255,.6); font-size: 11px; }
.listeners-jp { font-family: var(--jp); font-size: 12px; color: #fff; }

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #31e981;
  box-shadow: 0 0 10px rgba(49, 233, 129, .8);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--cream);
  display: grid;
  place-items: center;
  font-size: 16px;
}

.icon-btn.active,
.weather-btn.active {
  background: rgba(255, 110, 168, .16);
  border-color: rgba(255, 110, 168, .5);
  box-shadow: 0 0 18px rgba(255, 110, 168, .2);
}

.hero {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  min-height: 0;
  max-height: none;
  border-radius: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: clamp(80px, 10vh, 120px) clamp(24px, 4vw, 48px) clamp(150px, 18vh, 210px);
  margin: 0;
}

.hero-art {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 8, 20, .06), rgba(3, 8, 20, .4)),
    url('/audio/image.png') center center / cover no-repeat;
  transition: filter .8s ease;
}

.scene-photo {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 11, 26, .28), rgba(7, 11, 26, .44));
  backdrop-filter: saturate(1.1) contrast(1.05);
  z-index: 1;
}

.custom-background-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s ease;
}

.custom-background-media.active {
  opacity: 1;
}

.hero-copy {
  position: relative;
  z-index: 2;
  text-align: center;
  display: grid;
  gap: 14px;
  align-content: center;
  transform: translateY(-3vh);
}

.eyebrow {
  letter-spacing: .4em;
  text-transform: uppercase;
  font-size: 11px;
  color: rgba(255,255,255,.7);
}

.hero-title {
  display: grid;
  gap: 6px;
  line-height: .9;
}

.hero-title .jp {
  font-family: var(--jp);
  font-size: clamp(64px, 9vw, 110px);
  font-weight: 900;
  letter-spacing: .15em;
  color: var(--cream);
  text-shadow: 0 10px 40px rgba(0,0,0,.35);
}

.hero-title .en {
  font-family: var(--display);
  font-size: clamp(32px, 5vw, 52px);
  color: rgba(255,255,255,.9);
  letter-spacing: .45em;
}

.player-bar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(1140px, calc(100% - 24px));
  margin: 0;
  border-radius: 26px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: auto 1.4fr auto auto;
  align-items: center;
  gap: 18px;
  z-index: 8;
  min-height: 94px;
}

.player-art {
  width: 66px;
  height: 66px;
  border-radius: 18px;
  padding: 4px;
  background: linear-gradient(135deg, rgba(255, 110, 168, .9), rgba(255, 211, 107, .95));
  box-shadow: 0 10px 28px rgba(255, 110, 168, .25);
}

.player-thumb {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.28), transparent 22%),
    linear-gradient(180deg, rgba(10, 18, 40, .3), rgba(10, 18, 40, .8)),
    radial-gradient(circle at 50% 20%, rgba(255, 233, 175, .95), rgba(255, 111, 168, .3) 40%, rgba(11, 18, 48, .85) 70%),
    linear-gradient(135deg, #111b34, #23365e);
}

.player-meta strong {
  display: block;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-meta { min-width: 0; }

.player-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.player-progress {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.progress-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
}

.progress-track i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink), #ff95bc);
}

.player-controls,
.player-side {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-controls button,
.side-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  color: var(--cream);
  border: 1px solid rgba(255,255,255,.1);
}

.play-btn {
  width: 54px !important;
  height: 54px !important;
  background: linear-gradient(90deg, #ffdce9, #ff9bbf) !important;
  color: #1b1232 !important;
  font-size: 18px !important;
}

.primary-btn,
.ghost-btn,
.mini-controls button,
.close-btn { border: none; outline: none; }

.primary-btn,
.ghost-btn {
  min-width: 160px;
  padding: 16px 24px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.primary-btn {
  background: linear-gradient(90deg, var(--pink), #ff95bc);
  color: #fff;
  box-shadow: 0 18px 40px rgba(255, 110, 168, .28);
}

.ghost-btn {
  background: rgba(255,255,255,.06);
  color: var(--cream);
  border: 1px solid rgba(255,255,255,.14);
}

.primary-btn:hover,
.ghost-btn:hover,
.player-controls button:hover,
.side-btn:hover,
.close-btn:hover {
  transform: translateY(-2px);
}

.mini-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

.close-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  color: var(--cream);
  font-size: 24px;
  border: 1px solid rgba(255,255,255,.1);
}

.playlist-panel {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(16px);
  width: min(820px, calc(100% - 20px));
  max-height: min(82vh, 780px);
  padding: 14px 16px 12px;
  border-radius: 28px;
  display: grid;
  gap: 10px;
  overflow: hidden;
  z-index: 7;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
  background: rgba(17, 22, 44, 0.38);
  backdrop-filter: blur(18px) saturate(1.2);
}

.playlist-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.playlist-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.playlist-head h2 {
  font-size: 26px;
}

.playlist-tools {
  display: flex;
  align-items: center;
  justify-content: center;
}

.playlist-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(700px, 100%);
}

.playlist-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  flex: 1;
}

.playlist-search span {
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
}

.playlist-search input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--cream);
  outline: none;
  font: inherit;
}

.playlist-search input::placeholder { color: rgba(255,255,255,.45); }

.mini-search {
  min-width: 110px;
  padding: 12px 14px;
  border-radius: 999px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: 11px;
}

.playlist-status {
  display: block;
  font-size: 12px;
  color: rgba(255,255,255,.72);
}

.track-item .track-play { border: none; }

.playlist-list {
  overflow: auto;
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr;
  align-content: start;
  max-height: calc(82vh - 140px);
}

.background-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 18;
  width: min(500px, calc(100% - 28px));
  padding: 24px;
  border-radius: 28px;
  transform: translate(-50%, -46%) scale(.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

.background-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.background-help {
  margin: 2px 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.upload-dropzone {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px 18px;
  border: 1px dashed rgba(255,255,255,.3);
  border-radius: 20px;
  background: rgba(255,255,255,.05);
  text-align: center;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.upload-dropzone:hover {
  background: rgba(255,110,168,.1);
  border-color: rgba(255,110,168,.65);
  transform: translateY(-1px);
}

.upload-dropzone strong { font-size: 14px; }
.upload-dropzone small { color: var(--muted); font-size: 11px; }

.upload-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,110,168,.95), rgba(255,211,107,.9));
  color: #1b1232;
  font-size: 22px;
}

.background-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.background-status {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.weather-fx {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
}

.instagram-follow {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 18px;
  text-decoration: none;
  color: var(--cream);
}

.instagram-follow strong {
  display: block;
  font-size: 14px;
  line-height: 1.1;
}

.instagram-follow small {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,.68);
}

.instagram-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(255, 110, 168, .95), rgba(255, 211, 107, .9));
  color: #1b1232;
  font-size: 18px;
}

.action-toast {
  position: fixed;
  left: 50%;
  bottom: 192px;
  z-index: 20;
  max-width: min(90vw, 420px);
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(17, 22, 44, .9);
  color: var(--cream);
  box-shadow: 0 14px 34px rgba(0,0,0,.32);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .2s ease, transform .2s ease;
  font-size: 12px;
  text-align: center;
}

.action-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.track-item {
  display: grid;
  grid-template-columns: 34px 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.05);
  border: 1px solid transparent;
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
  min-height: 66px;
  height: 66px;
}

.track-item:hover,
.track-item.active {
  background: rgba(255, 110, 168, .12);
  border-color: rgba(255, 110, 168, .28);
  transform: translateY(-1px);
}

.track-num {
  font-family: var(--display);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.track-thumb {
  width: 58px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.12);
}

.track-info strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-info span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.track-dur {
  font-size: 12px;
  color: var(--muted);
}

.track-play {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  color: var(--cream);
  border: 1px solid rgba(255,255,255,.1);
  font-size: 11px;
}

.equalizer {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 18px;
  margin-left: 8px;
  opacity: 0;
  transition: opacity .2s ease;
}

.equalizer span {
  display: block;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd36b, #ff6ea8);
  animation: pulse-bar 1s ease-in-out infinite alternate;
}

.equalizer span:nth-child(2) { animation-delay: .12s; }
.equalizer span:nth-child(3) { animation-delay: .24s; }
.equalizer span:nth-child(4) { animation-delay: .36s; }

.track-item.active .equalizer {
  opacity: 1;
}

@keyframes pulse-bar {
  0% { height: 5px; opacity: .5; }
  100% { height: 16px; opacity: 1; }
}

#youtubePlayer {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.close-btn {
  width: 46px;
  height: 46px;
  font-size: 24px;
}

audio { display: none; }

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: 1fr;
    border-radius: 24px;
    top: 10px;
  }

  .top-center,
  .top-right { justify-content: center; }

  .hero {
    padding: 86px 16px 168px;
  }

  .player-bar {
    width: calc(100% - 18px);
    grid-template-columns: 54px minmax(0, 1fr);
    grid-template-areas:
      'art meta'
      'controls controls'
      'side side';
  }

  .player-art { grid-area: art; }
  .player-meta { grid-area: meta; }
  .player-controls { grid-area: controls; justify-content: center; flex-wrap: wrap; }
  .player-side { grid-area: side; display: flex; justify-content: center; }

  .player-progress {
    grid-template-columns: auto 1fr auto;
  }

  .playlist-panel {
    bottom: 184px;
    width: calc(100% - 16px);
    max-height: calc(100dvh - 202px);
  }

  .instagram-follow {
    right: 12px;
    bottom: 12px;
  }

  .playlist-list {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 310px);
  }

}

@media (max-width: 520px) {
  .action-toast { bottom: 194px; }
  .instagram-follow { display: none; }
  .topbar {
    width: calc(100% - 12px);
    padding: 7px 8px;
    gap: 7px;
  }

  .clock-pill { padding: 9px 12px; font-size: 12px; }
  .listeners-pill { padding: 8px 10px; gap: 5px; }
  .listeners-pill small { display: none; }
  .listeners-jp { font-size: 10px; }
  .top-right { gap: 5px; }
  .icon-btn { width: 36px; height: 36px; font-size: 14px; }

  .hero { padding: 150px 12px 210px; }

  .player-bar {
    bottom: max(8px, env(safe-area-inset-bottom));
    width: calc(100% - 12px);
    padding: 10px;
    gap: 8px;
    border-radius: 20px;
    min-height: 194px;
  }
  .player-art { width: 54px; height: 54px; border-radius: 14px; }
  .player-thumb { border-radius: 10px; }
  .player-meta strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .player-controls, .player-side { gap: 6px; }
  .player-controls { flex-wrap: nowrap; }
  .player-controls button, .side-btn { width: 36px; height: 36px; }
  .play-btn { width: 44px !important; height: 44px !important; }

  .playlist-panel {
    bottom: calc(202px + env(safe-area-inset-bottom));
    max-height: calc(100dvh - 220px);
    padding: 12px 10px 10px;
    border-radius: 20px;
  }
  .playlist-search-wrap { gap: 6px; }
  .playlist-search { min-width: 0; padding: 8px 9px; }
  .playlist-search span { display: none; }
  .mini-search { min-width: 82px; padding: 11px 10px; }
  .playlist-list { max-height: calc(100dvh - 334px); }
  .track-item { grid-template-columns: 24px 44px minmax(0, 1fr) auto; gap: 7px; padding: 8px; height: 58px; min-height: 58px; }
  .track-thumb { width: 44px; height: 40px; }
  .track-dur { display: none; }

  .playlist-list {
    grid-template-columns: 1fr;
  }

  .hero-title .jp {
    font-size: 56px;
  }

  .hero-title .en {
    font-size: 34px;
  }

  .primary-btn,
  .ghost-btn {
    width: 100%;
  }

  .hero-actions { width: 100%; }
}
