@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #000;
  --fg: #F2F2EF;
  --fg2: #B5B5B0;
  --fg3: #7A7A76;
  --line: #2A2A28;
  --line2: #3C3C39;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: "Inter", -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.2vh;
  padding: max(env(safe-area-inset-top), 16px) max(env(safe-area-inset-right), 20px) max(env(safe-area-inset-bottom), 12px) max(env(safe-area-inset-left), 20px);
  max-width: 520px;
  margin: 0 auto;
}

/* Clock */
.clock {
  text-align: center;
  flex: none;
  padding-top: 0.5vh;
}
.date {
  font-size: clamp(15px, 2.4vh, 20px);
  color: var(--fg2);
  font-weight: 400;
}
.time {
  font-size: clamp(48px, 8vh, 72px);
  font-weight: 250;
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-top: 0.2vh;
}
.time .ap {
  font-size: 0.38em;
  font-weight: 400;
  color: var(--fg2);
  margin-left: 0.3em;
  letter-spacing: 0.02em;
}

/* Now playing */
.now-playing {
  display: flex;
  gap: 16px;
  align-items: center;
  flex: none;
  padding: 1vh 0;
}
#art {
  width: clamp(90px, 16vh, 140px);
  height: clamp(90px, 16vh, 140px);
  border-radius: 12px;
  object-fit: cover;
  background: #111;
  flex: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.np-meta {
  min-width: 0;
  flex: 1;
}
.title {
  font-size: clamp(20px, 3.2vh, 28px);
  font-weight: 500;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.artist {
  font-size: clamp(15px, 2.2vh, 20px);
  color: var(--fg2);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prog {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  margin-top: 1.2vh;
  overflow: hidden;
}
.prog i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--fg);
  transition: width 0.4s linear;
}
.ptimes {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg3);
  margin-top: 4px;
}

/* Controls */
.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(24px, 6vw, 48px);
  flex: none;
  padding: 1vh 0 1.5vh;
}
.controls button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line2);
  transition: background 0.2s, transform 0.15s;
}
.controls button:active {
  transform: scale(0.94);
  background: #1a1a19;
}
.controls svg {
  width: 22px;
  height: 22px;
  fill: var(--fg);
}
#play {
  width: 68px;
  height: 68px;
  background: var(--fg);
  border-color: var(--fg);
}
#play svg { fill: #000; width: 26px; height: 26px; }
#play .i-pause { display: none; }
#play.is-playing .i-play { display: none; }
#play.is-playing .i-pause { display: block; }

/* Lyrics */
.lyrics {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
  opacity: 0;
  transition: opacity 0.6s;
  -webkit-mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent);
}
.lyrics.on { opacity: 1; }
.lyr-list {
  transition: transform 0.5s var(--ease);
  will-change: transform;
  padding: 20% 0;
}
.ly {
  font-size: clamp(18px, 2.8vh, 26px);
  font-weight: 500;
  color: var(--fg3);
  padding: 0.35em 8% 0.35em 0;
  line-height: 1.25;
  transform-origin: left center;
  transition: color 0.35s, transform 0.45s var(--ease), opacity 0.35s;
  opacity: 0.5;
}
.ly[data-d="0"] {
  color: var(--fg);
  transform: scale(1.06);
  opacity: 1;
}
.ly[data-d="1"], .ly[data-d="-1"] { opacity: 0.75; }
.ly[data-d="2"], .ly[data-d="-2"] { opacity: 0.55; }

/* On deck */
.on-deck {
  flex: none;
  border-top: 1px solid var(--line);
  padding-top: 1.2vh;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}
.on-deck-art {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  background: #111;
  flex: none;
}
.on-deck-meta {
  min-width: 0;
  flex: 1;
}
.on-deck-label {
  font-size: 11px;
  color: var(--fg3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.on-deck-title {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.on-deck-artist {
  font-size: 13px;
  color: var(--fg2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Auth / setup */
.setup, .connect {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding: 20px;
}
.setup h1, .connect h1 {
  font-size: 28px;
  font-weight: 300;
  margin: 0;
}
.setup p, .connect p {
  color: var(--fg2);
  font-size: 15px;
  max-width: 320px;
  line-height: 1.4;
  margin: 0;
}
input {
  background: #111;
  border: 1px solid var(--line2);
  border-radius: 10px;
  color: var(--fg);
  font: inherit;
  padding: 12px 16px;
  width: min(320px, 90%);
  font-size: 15px;
}
.btn {
  background: var(--fg);
  color: #000;
  border-radius: 99px;
  padding: 12px 28px;
  font-weight: 500;
  font-size: 16px;
  min-height: 48px;
}
.btn.secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line2);
}

/* Compact / corner mode on larger screens when window is small */
@media (min-width: 600px) {
  #app {
    max-width: 420px;
  }
}

/* Phone / iPad split friendly already by max-width + full height */
@media (max-height: 700px) {
  .time { font-size: clamp(36px, 7vh, 56px); }
  #art { width: 80px; height: 80px; }
}
