/* ── Font ────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Moonlight Shadow';
  src: url('/static/fonts/moonlight-shadow.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ── Reset & Base ────────────────────────────────────────────────────────── */

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

:root {
  --bg: #69917f;
  --fg: #e0e0e0;
  --dim: #333;
  --accent: #fff;
  --border: #333;
  --bar-bg: #1a1a1a;
  --bar-fill: #e0e0e0;
  --state-silent: #333;
  --state-gap: #555;
  --state-playing: #e0e0e0;
  --font: 'Moonlight Shadow', monospace;
}

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Overlay ─────────────────────────────────────────────────────────────── */

#overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: pointer;
}

#overlay.hidden {
  display: none;
}

.overlay-inner {
  text-align: center;
}

.overlay-title {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.overlay-sub {
  color: var(--dim);
  font-size: 18px;
  margin-bottom: 40px;
}

#play-btn {
  background: none;
  border: 1px solid var(--fg);
  color: var(--fg);
  font-family: inherit;
  font-size: 20px;
  padding: 14px 56px;
  cursor: pointer;
  letter-spacing: 0.15em;
  transition: background 0.15s, color 0.15s;
}

#play-btn:hover {
  background: var(--fg);
  color: var(--bg);
}

/* ── App Layout ──────────────────────────────────────────────────────────── */

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px;
  max-width: 600px;
  margin: 0 auto;
  margin-top: 44px;
}

#app.hidden {
  display: none;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 16px;
  margin-bottom: 24px;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.header-right {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.status {
  font-size: 16px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.status.on-air {
  color: var(--accent);
}

.status.on-air::before {
  content: '●';
  display: inline-block;
  margin-right: 6px;
  animation: pulse 2s ease-in-out infinite;
}

.status.reconnecting {
  color: #aa6633;
}

.status.reconnecting::before {
  content: '○';
  display: inline-block;
  margin-right: 6px;
  animation: pulse 0.5s ease-in-out infinite;
}

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

.uptime {
  color: var(--dim);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

/* ── Layers ──────────────────────────────────────────────────────────────── */

#layers {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.layer {
  padding: 10px 0;
  transition: opacity 333ms ease, transform 333ms ease;
}

.layer.entering {
  opacity: 0;
  transform: translateY(16px);
}

.layer.visible {
  opacity: 1;
  transform: translateY(0);
}

.layer.leaving {
  opacity: 0;
  transform: translateY(-12px);
}

.layer-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 4px;
}

.layer-sender {
  font-weight: 700;
  font-size: 20px;
  color: var(--accent);
}

.layer-date {
  color: var(--dim);
  font-size: 16px;
}

.layer-file {
  color: var(--dim);
  font-size: 15px;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 0.05s linear;
}

/* Progress bar */
.layer-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.layer-progress-bar {
  flex: 1;
  height: 3px;
  background: var(--bar-bg);
}

.layer-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--bar-fill);
  transition: width 0.3s linear;
}

.layer-time {
  color: var(--dim);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 90px;
  text-align: right;
}

/* ── Footer / Stats ──────────────────────────────────────────────────────── */

footer {
  padding-top: 16px;
  margin-top: 24px;
  margin-bottom: 64px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 16px;
  color: var(--dim);
}

.stat-sep {
  color: var(--border);
}

#stat-listeners {
  color: var(--fg);
}

/* ── Admin Link ─────────────────────────────────────────────────────────── */

.admin-link {
  color: var(--dim);
  text-decoration: none;
  transition: color 0.15s;
}

.admin-link:hover {
  color: var(--fg);
}

/* ── Password Modal ─────────────────────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-box {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-box input {
  background: var(--bg);
  border: 1px solid var(--fg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 20px;
  padding: 14px 24px;
  letter-spacing: 0.1em;
  text-align: center;
  outline: none;
  width: 280px;
}

.modal-box input::placeholder {
  color: var(--dim);
}

.modal-error {
  color: #aa6633;
  font-size: 14px;
  text-align: center;
  min-height: 20px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  #app {
    padding: 16px;
  }

  header {
    flex-direction: column;
    gap: 8px;
  }

  .layer-meta {
    flex-direction: column;
    gap: 2px;
  }

  .stats {
    flex-direction: column;
    gap: 4px;
  }

  .stat-sep {
    display: none;
  }
}
