/* ================================================================
   Kizen Music Player  ·  B&W + Amber Sequencer Lights  v2
   Left: waveform  ·  Right: 2×2 art + controls  ·  Bottom: seq
   ================================================================ */

#kmp-wrap *,
#kmp-wrap *::before,
#kmp-wrap *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Outer wrapper ───────────────────────────────────────────── */
#kmp-wrap {
  width: 100%;
  padding: 48px 20px;
  background: #fff;
  font-family: 'Courier New', Courier, monospace;
  color: #000;
}

/* ── Player outer box ────────────────────────────────────────── */
#kmp-player {
  position: relative; /* needed for logo absolute placement */
  max-width: 870px;
  margin: 0 auto;
  border: 8px solid #000;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
}

/* ── Logo corner removed ────────────────────────────────────────── */

/* ── Main row (left + right side by side) ─────────────────────── */
#kmp-main {
  display: flex;
  height: 382px;
  border-bottom: 2px solid #000;
}

/* ── Left panel ──────────────────────────────────────────────── */
#kmp-left {
  flex: 0 0 46%;
  padding: 12px;
  display: flex;
}

/* Inner rounded rectangle */
#kmp-viz-box {
  flex: 1;
  border: 2px solid #000;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#kmp-waveform {
  flex: 1;
  display: block;
  width: 100%;
  min-height: 0;
}

/* Info (Now Playing + track name + scrubber) */
#kmp-info {
  flex-shrink: 0;
  border-top: 1px solid rgba(0,0,0,0.22);
  padding: 9px 14px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kmp-now-label {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #000;
  opacity: 0.55;
  line-height: 1;
}

#kmp-track-name {
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #000;
  line-height: 1.25;
}

#kmp-progress-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

#kmp-source-note {
  margin-top: 4px;
}

.kmp-time {
  font-size: 9px;
  letter-spacing: 0.04em;
  opacity: 0.5;
  flex-shrink: 0;
  font-family: 'Courier New', Courier, monospace;
}

#kmp-scrub {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 1px;
  background: #000;
  outline: none;
  cursor: pointer;
}

#kmp-scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #000;
  cursor: pointer;
}

#kmp-scrub::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #000;
  border: none;
  cursor: pointer;
}

/* ── Right panel ──────────────────────────────────────────────── */
#kmp-right {
  flex: 1;
  border-left: 2px solid #000;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Logo display area (replaces 2×2 grid) */
#kmp-art-grid {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-bottom: 2px solid #000;
  overflow: hidden;
  min-height: 0;
  padding: 18px 20px;
}

#kmp-logo03 {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Controls bar */
#kmp-ctrl {
  flex-shrink: 0;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  background: #fff;
}

.kmp-btn {
  width: 50px;
  height: 50px;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
  color: rgba(0,0,0,0.6);
  transition: background 0.12s, color 0.12s, transform 0.1s, box-shadow 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.kmp-btn:hover {
  background: rgba(0,0,0,0.07);
  color: #000;
  transform: translateY(2px);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.12);
}

.kmp-btn:active {
  background: rgba(0,0,0,0.13);
  transform: translateY(3px);
  box-shadow: inset 0 3px 7px rgba(0,0,0,0.18);
}

.kmp-btn svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* ── Sequencer row ───────────────────────────────────────────── */
#kmp-seq-row {
  flex-shrink: 0;
  height: 72px;
}

#kmp-seq {
  display: block;
  width: 100%;
  height: 100%;
}

#kmp-sc-frame-wrap {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

#kmp-sc-frame {
  width: 1px;
  height: 1px;
  border: 0;
}

/* ================================================================
   STICKY MINI-PLAYER  —  bottom-right, glass effect, rounded
   ================================================================ */
#kmp-sticky {
  position: fixed;
  bottom: 20px;
  right: 20px;
  left: auto;
  width: auto;
  max-width: 360px;
  height: auto;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.13), 0 1.5px 4px rgba(0,0,0,0.08);
  color: #111;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  transform: translateY(calc(100% + 24px));
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
              opacity   0.28s ease;
  font-family: 'Courier New', Courier, monospace;
  pointer-events: none;
}

#kmp-sticky.kmp-sticky-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Top row: play/pause/next + title + close */
#kmp-sticky-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Track title */
#kmp-sticky-title {
  flex: 1;
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #111;
  opacity: 0.75;
  min-width: 0;
}

/* Sticky buttons — ghost circle */
.kmp-sticky-btn {
  width: 32px; height: 32px;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: rgba(0,0,0,0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
  transition: background 0.12s, color 0.12s, transform 0.1s, box-shadow 0.1s;
}

.kmp-sticky-btn:hover  { background: rgba(0,0,0,0.07); color: #000; transform: translateY(2px); box-shadow: inset 0 2px 4px rgba(0,0,0,0.12); }
.kmp-sticky-btn:active { background: rgba(0,0,0,0.13); transform: translateY(3px); box-shadow: inset 0 3px 7px rgba(0,0,0,0.18); }
.kmp-sticky-btn svg    { width: 14px; height: 14px; display: block; }

/* Bottom row: 16 amber seq dots */
#kmp-sticky-seq {
  display: flex;
  align-items: center;
  gap: 3px;
}

.kmp-sticky-dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(0,0,0,0.12);
  transition: background 0.05s;
}

.kmp-sticky-dot.active {
  background: #FF9500;
  box-shadow: 0 0 5px rgba(255,149,0,0.7);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  #kmp-wrap    { padding: 24px 10px; }
  #kmp-player  { border-width: 5px; border-radius: 8px; }
  #kmp-main    { flex-direction: column; height: auto; }
  #kmp-left    { flex: none; height: 220px; }
  #kmp-right   { border-left: none; border-top: 2px solid #000; flex: none; }
  #kmp-art-grid { height: 160px; }
  #kmp-ctrl    { height: 76px; gap: 14px; }
  .kmp-btn     { padding: 8px 10px; }
  .kmp-btn svg { width: 22px; height: 22px; }
  #kmp-play svg { width: 26px; height: 26px; }
  #kmp-seq-row { height: 82px; }
  #kmp-logo-wrap { width: 44px; height: 44px; top: 7px; right: 9px; }
  #kmp-sticky { right: 12px; bottom: 12px; max-width: calc(100vw - 24px); }
}

/* ================================================================
   SCROLLING TRACK LABEL
   Marquee applied by player.js only when the text overflows.
   ================================================================ */
#kmp-track-name,
#kmp-sticky-title {
  overflow: hidden;
  white-space: nowrap;
}

#kmp-track-name.kmp-scrolling,
#kmp-sticky-title.kmp-scrolling {
  display: flex;
  gap: 48px;
  text-overflow: clip;
}

.kmp-scroll-inner {
  display: inline-block;
  white-space: nowrap;
}

.kmp-scrolling .kmp-scroll-inner {
  flex: none;
  animation: kmp-marquee var(--kmp-scroll-time, 12s) linear infinite;
}

@keyframes kmp-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-1 * var(--kmp-scroll-dist, 100%))); }
}

@media (prefers-reduced-motion: reduce) {
  .kmp-scrolling .kmp-scroll-inner { animation: none; }
  #kmp-track-name.kmp-scrolling,
  #kmp-sticky-title.kmp-scrolling { display: block; text-overflow: ellipsis; }
  #kmp-track-name.kmp-scrolling .kmp-scroll-inner[aria-hidden],
  #kmp-sticky-title.kmp-scrolling .kmp-scroll-inner[aria-hidden] { display: none; }
}

/* ================================================================
   MINI-ONLY MODE  ·  [kizen_music_player mini="1"]
   The sticky bar is position:fixed, so the wrapper must not take up
   any space or paint a background in the normal flow.
   ================================================================ */
#kmp-wrap.kmp-mini-only {
  padding: 0;
  margin: 0;
  height: 0;
  min-height: 0;
  background: transparent;
  overflow: visible;
}

/* Clear the iPhone home indicator. */
#kmp-sticky {
  bottom: max(20px, env(safe-area-inset-bottom));
}

@media (max-width: 640px) {
  #kmp-sticky {
    bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* ================================================================
   MINI-PLAYER SIZING  (overrides earlier rules in this file)
   A fixed width is load-bearing, not cosmetic: with width:auto the
   bar resized per track AND the title could never overflow, so the
   marquee in player.js never triggered.
   ================================================================ */
#kmp-sticky {
  width: 340px;
  max-width: calc(100vw - 24px);
  padding: 9px 12px;
}

#kmp-sticky-top {
  gap: 4px;
}

/* Condensed controls — reclaimed width goes to the title. */
.kmp-sticky-btn {
  width: 24px;
  height: 24px;
}

.kmp-sticky-btn svg {
  width: 12px;
  height: 12px;
}

#kmp-sticky-title {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 4px;
}

@media (max-width: 640px) {
  #kmp-sticky {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }
}
