:root {
  --deep-blue: #1E2A5A;
  --deep-blue-ink: #131c3d;
  --earth: #A65F46;
  --gold: #D4A02A;
  --paper: #FBFAF7;
  --ink: #1b1f2a;
  --muted: #626b80;
  --line: rgba(30, 42, 90, 0.12);
  --live: #2e9e6b;
  --warn: #C4762A;
  --dead: #B3402F;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Tamil", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: clamp(20px, 5vw, 56px) clamp(16px, 4vw, 32px);
  background-image:
    radial-gradient(1200px 600px at 50% -10%, rgba(30, 42, 90, 0.10), transparent 70%),
    radial-gradient(700px 400px at 100% 100%, rgba(212, 160, 42, 0.10), transparent 70%);
}

.shell {
  width: 100%;
  max-width: 780px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--deep-blue);
  color: #fff;
  padding: 12px 18px;
  border-radius: 0 0 10px 0;
  z-index: 10;
}
.skip:focus { left: 0; }

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: clamp(20px, 4vw, 34px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(212, 160, 42, 0.22);
}

.brand-name {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--deep-blue);
}

.brand-sub {
  margin-left: 8px;
  color: var(--earth);
  font-weight: 500;
  letter-spacing: 0.16em;
}

.tagline {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
  font-style: italic;
}

/* ---------- player ---------- */

.player {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 38px);
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 34px);
  box-shadow: 0 18px 50px -30px rgba(19, 28, 61, 0.45);
}

.art-frame {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(150deg, var(--deep-blue), var(--deep-blue-ink) 60%, #2b3a72);
}

.art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.art--fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(212, 160, 42, 0.85);
  font-size: clamp(48px, 12vw, 78px);
  font-family: "Noto Sans Tamil", ui-sans-serif, sans-serif;
}

.meta { min-width: 0; }

.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--earth);
}

.track-title {
  margin: 0;
  font-size: clamp(21px, 3.4vw, 29px);
  line-height: 1.22;
  font-weight: 680;
  color: var(--deep-blue);
  overflow-wrap: anywhere;
}

.track-artist {
  margin: 7px 0 0;
  font-size: 15px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ---------- controls ---------- */

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.play {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 13px 24px;
  background: var(--deep-blue);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}

.play:hover:not(:disabled) { background: #26356e; }
.play:active:not(:disabled) { transform: translateY(1px); }
.play:disabled { opacity: 0.5; cursor: not-allowed; }

.play:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.icon {
  width: 17px;
  height: 17px;
  fill: currentColor;
  flex: none;
}

.icon--pause { display: none; }
.play[data-playing="true"] .icon--play { display: none; }
.play[data-playing="true"] .icon--pause { display: inline-block; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.dot[data-state="playing"] {
  background: var(--live);
  animation: pulse 2.4s ease-in-out infinite;
}

.dot[data-state="connecting"] {
  background: var(--warn);
  animation: pulse 1s ease-in-out infinite;
}

.dot[data-state="reconnecting"] {
  background: var(--warn);
  animation: pulse 0.8s ease-in-out infinite;
}

.dot[data-state="dead"] { background: var(--dead); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.32; }
}

@media (prefers-reduced-motion: reduce) {
  .dot[data-state] { animation: none; }
}

.listeners {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.recovery {
  margin: 16px 0 0;
  padding: 13px 15px;
  border-left: 3px solid var(--dead);
  background: rgba(179, 64, 47, 0.06);
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: #6d2a20;
}

.recovery a { color: var(--deep-blue); }

/* ---------- history ---------- */

.history {
  margin-top: clamp(22px, 4vw, 34px);
  padding: clamp(18px, 3vw, 26px) clamp(20px, 4vw, 34px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.history h2 {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--earth);
}

.history-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1px;
  background: var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.history-list li {
  background: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
}

.history-list .h-title {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.history-list .h-artist {
  color: var(--muted);
  font-size: 13px;
}

.history-list .h-time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.history-empty {
  color: var(--muted);
  font-size: 13.5px;
}

/* ---------- foot ---------- */

.foot {
  margin-top: 26px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

.foot p { margin: 0 0 6px; }
.foot a { color: var(--deep-blue); }

.rights {
  color: var(--earth);
  font-style: italic;
}

/* ---------- narrow ---------- */

@media (max-width: 620px) {
  .player {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .art-frame { width: min(64vw, 240px); }
  .meta { width: 100%; }
  .controls { justify-content: center; }
  .history-list li { flex-wrap: wrap; }
}
