/* ══════════════════════════════════════
   FUJION Player — style.css
   Fujitsu arrows風 ダーク/ライトモード対応
══════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --bg:       #090b10;
  --surface:  #111520;
  --surface2: #191e2d;
  --border:   rgba(255,255,255,.07);
  --text:     #e4e7f0;
  --muted:    #616880;
  --accent:   #00d4aa;
  --accent2:  #0088ff;
  --glow:     rgba(0,212,170,.22);
  --glow2:    rgba(0,136,255,.18);
  --card:     #141824;
  --btn:      #1c2135;
  --track:    #252b3e;
  --shadow:   0 8px 40px rgba(0,0,0,.55);
  --font:     'DM Sans', 'Noto Sans JP', sans-serif;
  --mono:     'Space Mono', monospace;
  --r:        16px;
}

[data-theme="light"] {
  --bg:       #edf0f7;
  --surface:  #ffffff;
  --surface2: #f4f6fc;
  --border:   rgba(0,0,0,.08);
  --text:     #0d1020;
  --muted:    #8890a8;
  --accent:   #009e7e;
  --accent2:  #005ec4;
  --glow:     rgba(0,158,126,.14);
  --glow2:    rgba(0,94,196,.14);
  --card:     #ffffff;
  --btn:      #eaecf5;
  --track:    #d0d4e8;
  --shadow:   0 8px 40px rgba(0,0,0,.10);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  transition: background .3s, color .3s;
  -webkit-font-smoothing: antialiased;
}
button { font-family: var(--font); }
a { color: var(--accent); }

/* ── App Grid ── */
.app {
  display: grid;
  grid-template-columns: 264px 1fr;
  grid-template-rows: 52px 1fr 134px;
  height: 100vh;
}

/* ════════════════════
   TOP BAR
════════════════════ */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}
.logo {
  font-family: var(--mono);
  font-size: .8rem;
  letter-spacing: .2em;
  font-weight: 700;
  color: var(--accent);
  user-select: none;
}
.logo span { color: var(--text); font-weight: 400; }

.topbar-r {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Output Device */
.out-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--btn);
  border-radius: 9px;
  padding: 0 8px;
  height: 32px;
}
.out-icon { color: var(--muted); flex-shrink: 0; }
.out-select {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: .72rem;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
  max-width: 160px;
  -webkit-appearance: none;
  appearance: none;
}
.out-select option { background: var(--surface); color: var(--text); }

/* Bluetooth */
.bt-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  transition: .3s;
  flex-shrink: 0;
}
.bt-dot.connected  { background: #4ade80; box-shadow: 0 0 7px #4ade80; }
.bt-dot.scanning   { background: var(--accent); animation: blink 1s infinite; }
.bt-name {
  font-size: .7rem;
  color: var(--muted);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@keyframes blink { 0%,100% { opacity:1 } 50% { opacity:.2 } }

/* Icon button */
.ibtn {
  background: var(--btn);
  border: none;
  color: var(--muted);
  border-radius: 9px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, color .2s, transform .15s;
  flex-shrink: 0;
}
.ibtn:hover, .ibtn.on { background: var(--accent); color: var(--bg); }
.ibtn:active { transform: scale(.93); }

/* Upload button */
.upload-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 9px;
  padding: 7px 14px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font);
  transition: opacity .15s, transform .15s;
  user-select: none;
  white-space: nowrap;
}
.upload-btn:hover { opacity: .85; transform: translateY(-1px); }
.upload-btn:active { transform: scale(.96); }
#fileInput { display: none; }

/* ════════════════════
   SIDEBAR
════════════════════ */
.sidebar {
  grid-row: 2;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-hd {
  padding: 14px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .65rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.track-count {
  font-size: .68rem;
  background: var(--btn);
  border-radius: 8px;
  padding: 2px 7px;
  letter-spacing: 0;
  text-transform: none;
}

/* Playlist */
.playlist {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.playlist::-webkit-scrollbar { width: 3px; }
.playlist::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.pl-empty {
  text-align: center;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.7;
  padding: 32px 16px;
}

/* Track item */
.titem {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
  border: 1px solid transparent;
  position: relative;
}
.titem:hover { background: var(--surface2); }
.titem.active {
  background: var(--glow);
  border-color: rgba(0,212,170,.22);
}
[data-theme="light"] .titem.active {
  background: rgba(0,158,126,.1);
  border-color: rgba(0,158,126,.2);
}
.tnum {
  width: 18px;
  text-align: center;
  font-family: var(--mono);
  font-size: .62rem;
  color: var(--muted);
  flex-shrink: 0;
}
.titem.active .tnum { display: none; }
.play-bars {
  display: none;
  align-items: flex-end;
  gap: 1.5px;
  height: 12px;
  width: 18px;
  flex-shrink: 0;
}
.titem.active .play-bars { display: flex; }
.play-bars span {
  width: 2.5px;
  background: var(--accent);
  border-radius: 1.5px;
  height: 100%;
  animation: pbar .55s ease-in-out infinite alternate;
}
.play-bars span:nth-child(1) { animation-delay: 0s; }
.play-bars span:nth-child(2) { animation-delay: .18s; height: 65%; }
.play-bars span:nth-child(3) { animation-delay: .36s; height: 80%; }
@keyframes pbar { from { transform: scaleY(1) } to { transform: scaleY(.25) } }
.titem.active.paused .play-bars span { animation-play-state: paused; }

.tcov {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--border);
}
.tcov img { width: 100%; height: 100%; object-fit: cover; }
.tmeta { flex: 1; min-width: 0; }
.tname {
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.tartist {
  font-size: .7rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.demo-tag {
  font-size: .56rem;
  background: var(--glow);
  color: var(--accent);
  border-radius: 3px;
  padding: 1px 4px;
  font-weight: 700;
  margin-left: 4px;
  letter-spacing: .05em;
  vertical-align: middle;
}

/* ════════════════════
   MAIN CONTENT
════════════════════ */
.main {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 20px;
  gap: 14px;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Now Playing card */
.npcard {
  width: 100%;
  max-width: 390px;
  background: var(--card);
  border-radius: 22px;
  padding: 22px 22px 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.npcard::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 40% at 50% -10%, var(--glow), transparent);
  pointer-events: none;
}

/* Album art */
.art-wrap { position: relative; }
.art {
  width: 156px;
  height: 156px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--surface2), var(--btn));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 36px rgba(0,0,0,.45);
  border: 1px solid var(--border);
  transition: box-shadow .4s;
  flex-shrink: 0;
}
.art.playing {
  box-shadow: 0 10px 36px rgba(0,0,0,.45), 0 0 32px var(--glow);
  animation: artPulse 3s ease-in-out infinite;
}
@keyframes artPulse {
  0%,100% { box-shadow: 0 10px 36px rgba(0,0,0,.45), 0 0 20px var(--glow); }
  50%      { box-shadow: 0 10px 36px rgba(0,0,0,.45), 0 0 44px var(--glow); }
}
.art-emoji { font-size: 3.2rem; z-index: 1; }
.art-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
  z-index: 2;
}
.art-ripple {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: radial-gradient(circle, rgba(0,212,170,.25), transparent 70%);
  opacity: 0;
  transition: opacity .4s;
  z-index: 3;
  pointer-events: none;
}
.art.playing .art-ripple { opacity: 1; animation: ripple 2s ease-in-out infinite; }
@keyframes ripple { 0%,100% { transform: scale(1); opacity:.4 } 50% { transform: scale(1.06); opacity:.1 } }

/* Song info */
.song-info { text-align: center; width: 100%; }
.song-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-artist { font-size: .8rem; color: var(--muted); }

/* Visualizer */
.vizwrap {
  width: 100%;
  height: 54px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface2);
  position: relative;
  border: 1px solid var(--border);
}
#viz { width: 100%; height: 100%; display: block; }
.viz-label {
  position: absolute;
  top: 5px;
  right: 8px;
  font-family: var(--mono);
  font-size: .52rem;
  color: var(--muted);
  letter-spacing: .12em;
  pointer-events: none;
}
.viz-idle {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--muted);
  transition: opacity .3s;
}
.vizwrap.active .viz-idle { opacity: 0; }

/* Lyrics card */
.lyric-card {
  width: 100%;
  max-width: 390px;
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  max-height: 140px;
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.lyric-card::-webkit-scrollbar { width: 3px; }
.lyric-card::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.lc-label {
  font-size: .6rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.lc-lines { display: flex; flex-direction: column; gap: 0; }
.lline {
  font-size: .82rem;
  line-height: 2;
  color: var(--muted);
  transition: color .25s, font-size .2s;
  cursor: default;
}
.lline.active {
  color: var(--accent);
  font-weight: 500;
  font-size: .87rem;
}

/* ════════════════════
   PLAYER BAR
════════════════════ */
.playerbar {
  grid-column: 1 / -1;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 22px 13px;
}

/* Seek row */
.seek-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}
.time {
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--muted);
  min-width: 36px;
  white-space: nowrap;
}
#durTime { text-align: right; }
.seek-wrap { flex: 1; }

/* Sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 3px;
  background: var(--track);
  outline: none;
  cursor: pointer;
  transition: background .1s;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px var(--glow);
  transition: transform .15s, box-shadow .15s;
}
input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.3);
  box-shadow: 0 0 12px var(--glow);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 6px var(--glow);
}
.vol-slider {
  width: 80px;
  height: 3px;
}
.vol-slider::-webkit-slider-thumb {
  width: 11px;
  height: 11px;
  box-shadow: none;
}

/* Control row */
.ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ctrl-l, .ctrl-r {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.ctrl-r { justify-content: flex-end; }
.ctrl-c { display: flex; align-items: center; gap: 12px; }

.cbtn {
  background: var(--btn);
  border: none;
  color: var(--text);
  border-radius: 11px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, color .2s, transform .15s;
  flex-shrink: 0;
}
.cbtn:hover { background: var(--surface2); color: var(--accent); transform: scale(1.06); }
.cbtn:active { transform: scale(.94); }
.cbtn.sm { width: 32px; height: 32px; border-radius: 9px; }
.cbtn.on { color: var(--accent); }
.play-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 4px 18px var(--glow);
}
.play-btn:hover {
  background: var(--accent);
  color: var(--bg);
  transform: scale(1.1) !important;
  box-shadow: 0 6px 26px var(--glow);
}

.vol-grp { display: flex; align-items: center; gap: 5px; }
.vol-ico { color: var(--muted); flex-shrink: 0; }

.key-hints {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: .58rem;
  color: var(--muted);
  line-height: 1.4;
}

/* ════════════════════
   TOAST
════════════════════ */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 10px;
  font-size: .8rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ════════════════════
   RESPONSIVE / MOBILE
════════════════════ */
@media (max-width: 680px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 52px 1fr 150px;
  }
  .sidebar { display: none; }
  .main { padding: 16px 12px; gap: 12px; justify-content: flex-start; }
  .npcard { padding: 18px 14px; max-width: 100%; }
  .art { width: 130px; height: 130px; border-radius: 14px; }
  .lyric-card { max-width: 100%; }
  .playerbar { padding: 10px 14px 16px; }
  .ctrl-row { gap: 8px; }
  .key-hints { display: none; }
  .out-select { max-width: 120px; }
}

@media (max-width: 380px) {
  .vol-grp { display: none; }
  .ctrl-l { gap: 4px; }
}
