:root {
  --bg: #14100c;
  --bg-soft: #1d1812;
  --card: #221c15;
  --card-hi: #2b2318;
  --line: #3a3024;
  --text: #f3ece1;
  --muted: #a99a85;
  --amber: #f0a85e;
  --amber-soft: #f7c98b;
  --shadow: 0 10px 40px rgba(0,0,0,.45);
  --r: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: 110px;
}

/* 背景の揺らぎ */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-orbs span {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .25;
  animation: drift 22s ease-in-out infinite alternate;
}
.bg-orbs span:nth-child(1){ width:420px;height:420px;background:#7a3d12;top:-80px;left:-60px; }
.bg-orbs span:nth-child(2){ width:360px;height:360px;background:#244a3a;bottom:-100px;right:-40px;animation-delay:-7s; }
.bg-orbs span:nth-child(3){ width:300px;height:300px;background:#3a2c5a;top:40%;left:55%;animation-delay:-13s; }
@keyframes drift { from{transform:translate(0,0) scale(1);} to{transform:translate(40px,-30px) scale(1.15);} }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; max-width: 760px; margin: 0 auto;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-link { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; color: inherit; }
.brand-link:hover .brand-name { color: var(--amber-soft); }
.brand-mark { color: var(--amber); font-size: 26px; transform: translateY(2px); }
.brand-name { font-size: 22px; font-weight: 700; letter-spacing: .04em; }

.stage { max-width: 760px; margin: 0 auto; padding: 8px 22px 40px; }
.tagline { color: var(--muted); font-size: 15px; margin: 6px 0 26px; }
.tagline span { display: inline-block; margin-left: 6px; opacity: .7; }

/* カードグリッド */
.grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
}
@media (min-width: 560px){ .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px 16px 16px; cursor: pointer;
  transition: transform .15s ease, border-color .2s, background .2s;
  user-select: none; overflow: hidden;
}
.card:hover { transform: translateY(-2px); background: var(--card-hi); }
.card .emoji { font-size: 30px; display: block; }
.card .ic { display: block; color: #cbb89c; transition: color .2s, transform .2s; }
.card .ic svg { width: 38px; height: 38px; }
.card:hover .ic { transform: translateY(-1px); }
.card.active .ic { color: var(--amber); }
.card .name { margin-top: 12px; font-size: 16px; font-weight: 600; }
.card .hint { font-size: 11px; color: var(--muted); margin-top: 2px; }

.card.active {
  border-color: var(--amber);
  background: linear-gradient(160deg, #2e2417, #221c15);
  box-shadow: inset 0 0 0 1px rgba(240,168,94,.25);
}
.card.active::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--r);
  background: radial-gradient(120px 60px at 80% 0%, rgba(240,168,94,.18), transparent 70%);
  pointer-events: none;
}
/* アクティブ時の音量バー */
.card .vol { margin-top: 12px; display: none; }
.card.active .vol { display: block; }
.card .vol input[type=range]{ width: 100%; }

/* レンジ共通 */
input[type=range]{
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px;
  background: #4a3d2c; outline: none;
}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--amber-soft); cursor: pointer; border: 2px solid #1a140d;
}

/* プレイリスト */
.panel { margin-top: 34px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h2 { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.playlist { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.playlist li {
  display: flex; align-items: center; gap: 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.playlist .pl-play { flex: 1; text-align: left; cursor: pointer; background: none; border: 0; color: var(--text); font-size: 14px; }
.playlist .pl-tags { color: var(--muted); font-size: 12px; }
.playlist .pl-del { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 6px; }
.playlist .pl-del:hover { color: #e08; }
.empty { color: var(--muted); font-size: 13px; opacity: .7; }

.credit-link { margin-top: 38px; text-align: center; font-size: 12px; color: var(--muted); }
.credit-link a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* ボタン */
.ghost-btn {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 8px 14px; font-size: 13px; cursor: pointer; transition: border-color .2s;
}
.ghost-btn:hover { border-color: var(--amber); }
.ghost-btn.small { padding: 6px 10px; font-size: 12px; }
.primary-btn {
  width: 100%; margin-top: 14px; background: var(--amber); color: #1a120a; border: 0;
  border-radius: 12px; padding: 13px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.primary-btn:hover { background: var(--amber-soft); }

/* 再生ドック */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  max-width: 760px; margin: 0 auto; padding: 14px 18px;
  background: rgba(20,16,12,.82); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.play-toggle {
  flex: none; width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--amber); color: #1a120a; display: grid; place-items: center;
}
.play-toggle svg { width: 24px; height: 24px; fill: currentColor; }
.play-toggle .ic-pause { display: none; }
body.playing .play-toggle .ic-play { display: none; }
body.playing .play-toggle .ic-pause { display: block; }
.dock-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dock-info #nowPlaying { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-info .sub { font-size: 11px; color: var(--muted); }
.dock-btn {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 10px;
}
.dock-btn svg { width: 22px; height: 22px; fill: currentColor; }
.dock-btn:hover { color: var(--amber); }
.master-vol { display: flex; align-items: center; gap: 8px; }
.master-vol svg { width: 20px; height: 20px; fill: var(--muted); flex: none; }
.master-vol input { width: 84px; }
@media (max-width: 520px){ .master-vol input { width: 56px; } .dock { gap: 10px; } }

/* モーダル */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px); padding: 20px;
}
.modal[hidden]{ display: none; }
.modal-card {
  position: relative; width: 100%; max-width: 460px; max-height: 80vh; overflow-y: auto;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 20px;
  padding: 26px 24px; box-shadow: var(--shadow);
}
.modal-card.small { max-width: 380px; }
.modal-close {
  position: absolute; top: 14px; right: 16px; background: none; border: 0;
  color: var(--muted); font-size: 24px; cursor: pointer; line-height: 1;
}
.modal-card h2 { font-size: 18px; margin-bottom: 10px; }
.modal-lead { color: var(--muted); font-size: 13px; line-height: 1.7; margin-bottom: 16px; }
.modal-foot { color: var(--muted); font-size: 11px; margin-top: 16px; opacity: .7; }
.credits { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.credits li { font-size: 13px; line-height: 1.5; }
.credits .c-name { font-weight: 600; }
.credits .c-meta { color: var(--muted); font-size: 12px; }
.credits a { color: var(--amber); text-decoration: none; }
.text-input {
  width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px; color: var(--text); font-size: 15px;
}
.text-input:focus { outline: none; border-color: var(--amber); }

/* トースト */
.toast {
  position: fixed; bottom: 130px; left: 50%; transform: translateX(-50%);
  background: #2b2318; border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font-size: 13px; z-index: 60;
  box-shadow: var(--shadow); animation: pop .25s ease;
}
.toast[hidden]{ display: none; }
@keyframes pop { from{ opacity:0; transform: translate(-50%, 8px);} to{opacity:1;} }
