:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --text: #eef1f6;
  --muted: #8b93a3;
  --accent: #4ade80;
  --accent-dim: rgba(74, 222, 128, 0.14);
  --danger: #f87171;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Vazirmatn", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  line-height: 1.6;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 18px 140px;
  min-height: 100vh;
}

/* Header */
.head {
  text-align: center;
  margin-bottom: 26px;
}
.head h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.5px;
}
.head h1::before {
  content: "📻 ";
}
.head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 300;
}

/* Form */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field span {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 500;
}
.field input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.18s, background 0.18s;
}
.field input::placeholder { color: #5a6070; }
.field input:focus {
  border-color: var(--accent);
  background: #20252f;
}

.form-err {
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 500;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.btn {
  flex: 1;
  padding: 12px;
  border-radius: 11px;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, filter 0.18s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: #0a1f12;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
  flex: 0 0 auto;
  padding: 12px 18px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn-ghost:hover { color: var(--text); }

/* List */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Station row */
.station {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  transition: border-color 0.2s, background 0.2s;
}
.station-active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.icon {
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
}
.icon-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border: 1px solid var(--border);
}

.station-info {
  flex: 1;
  min-width: 0;
}
.station-name {
  font-weight: 700;
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 7px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: pulse 1.4s ease-in-out infinite;
}
.station-site {
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: none;
}
.station-site:hover { color: var(--accent); }

.station-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.act {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, transform 0.12s, color 0.18s, border-color 0.18s;
}
.act:active { transform: scale(0.92); }
.act.play {
  background: var(--surface-2);
  border-color: var(--border);
}
.act.play.on {
  background: var(--accent);
  color: #0a1f12;
  border-color: var(--accent);
}
.act.del:hover { color: var(--danger); border-color: var(--danger); }
.act.del.confirm {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  font-size: 0.78rem;
  font-weight: 700;
  min-width: 64px;
}

/* Empty */
.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}
.empty-emoji {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.7;
}
.empty-text {
  font-weight: 700;
  color: var(--text);
  font-size: 1rem;
}
.empty-sub {
  font-size: 0.85rem;
  margin-top: 4px;
}

/* Now playing bar */
.bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(23, 26, 33, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.bar-name {
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-play {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.12s, background 0.18s;
}
.bar-play:active { transform: scale(0.92); }
.bar-play.on {
  background: var(--accent);
  color: #0a1f12;
}
.bar-vol {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.bar-vol input {
  width: 78px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Spinner */
.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 20;
  animation: rise 0.25s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* Footer */
.foot {
  text-align: center;
  padding: 28px 0 0;
}
.foot a {
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: none;
  opacity: 0.65;
}
.foot a:hover { opacity: 1; text-decoration: underline; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}