:root {
  --bg-0: #0b1020;
  --bg-1: #0f172a;
  --card: rgba(30, 41, 59, 0.7);
  --card-border: rgba(148, 163, 184, 0.16);
  --text: #e8eef9;
  --muted: #93a4bf;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 16px;
  --shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1100px 700px at 12% -10%, rgba(99, 102, 241, 0.22), transparent 60%),
    radial-gradient(900px 600px at 110% 10%, rgba(34, 211, 238, 0.16), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
  background-attachment: fixed;
}

.wrap { max-width: 820px; margin: 0 auto; padding: 40px 20px 60px; }

/* Cards -------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

h1, h2 { margin: 0 0 6px; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
a { color: #a5b4fc; text-decoration: none; }
a:hover { color: #c7d2fe; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; margin-bottom: 22px;
}
.topbar .actions { display: flex; gap: 10px; align-items: center; }

/* Inputs ------------------------------------------------------------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input[type=password] {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.55);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

/* Buttons ------------------------------------------------------------ */
button, .btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: #fff; border: none;
  padding: 12px 18px; border-radius: 12px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: transform .08s, filter .15s, background .15s;
}
button:hover, .btn:hover { filter: brightness(1.08); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .6; cursor: default; }
.btn-ghost {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--card-border);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(148, 163, 184, 0.2); filter: none; }
.btn-block { width: 100%; justify-content: center; }

/* Feedback ----------------------------------------------------------- */
.error { color: var(--danger); margin: 10px 0 0; font-size: 14px; }
.success { color: var(--ok); margin: 10px 0 0; font-size: 14px; }
.muted { color: var(--muted); }

/* Channel list ------------------------------------------------------- */
.channel-list { list-style: none; padding: 0; margin: 0; }
.channel-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 14px; border-radius: 12px;
  transition: background .15s;
}
.channel-list li:hover { background: rgba(148, 163, 184, 0.08); }
.channel-list .name { font-weight: 600; font-size: 15px; }
.channel-list .id { color: var(--muted); font-size: 12px; margin-left: 6px; }

.badge {
  font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.live { background: rgba(34, 197, 94, 0.16); color: #86efac; }
.badge.live .dot { animation: pulse 1.4s infinite; }
.badge.idle { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.center { text-align: center; }

/* Auth screens ------------------------------------------------------- */
.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card { width: 100%; max-width: 400px; }
.brand-emoji { font-size: 34px; }
.pin-input {
  text-align: center; letter-spacing: 12px; font-size: 24px; font-weight: 700;
}

/* Player ------------------------------------------------------------- */
.player-stage { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 14px 0 6px; }
.toggle-btn {
  width: 96px; height: 96px; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 30px -10px rgba(99, 102, 241, 0.7);
  transition: transform .12s, box-shadow .15s;
}
.toggle-btn:hover { filter: brightness(1.06); transform: translateY(-2px); }
.toggle-btn svg { width: 40px; height: 40px; fill: #fff; }
.toggle-btn .icon-pause { display: none; }
.toggle-btn.playing .icon-play { display: none; }
.toggle-btn.playing .icon-pause { display: block; }

.eq { display: flex; align-items: flex-end; gap: 4px; height: 26px; opacity: .35; }
.eq.active { opacity: 1; }
.eq span {
  width: 4px; background: var(--accent-2); border-radius: 2px; height: 6px;
}
.eq.active span { animation: eq 0.9s ease-in-out infinite; }
.eq span:nth-child(2) { animation-delay: .15s; }
.eq span:nth-child(3) { animation-delay: .3s; }
.eq span:nth-child(4) { animation-delay: .45s; }
.eq span:nth-child(5) { animation-delay: .6s; }
@keyframes eq { 0%,100% { height: 6px; } 50% { height: 24px; } }

audio { width: 100%; margin-top: 8px; }
.debug { text-align: left; font-size: 12px; white-space: pre-wrap; margin-top: 14px; color: var(--muted); }

/* Recording bar ------------------------------------------------------ */
.rec-bar { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; }
.rec-btn { background: rgba(148, 163, 184, 0.14); border: 1px solid var(--card-border); color: var(--text); }
.rec-btn:hover { background: rgba(148, 163, 184, 0.22); filter: none; }
.rec-btn:disabled { opacity: .45; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #f87171; box-shadow: 0 0 0 0 rgba(248,113,113,.6); }
.rec-btn.recording { background: rgba(248, 113, 113, 0.16); border-color: rgba(248,113,113,.5); color: #fecaca; }
.rec-btn.recording .rec-dot { animation: recpulse 1.2s infinite; }
@keyframes recpulse {
  0% { box-shadow: 0 0 0 0 rgba(248,113,113,.6); }
  70% { box-shadow: 0 0 0 9px rgba(248,113,113,0); }
  100% { box-shadow: 0 0 0 0 rgba(248,113,113,0); }
}
.rec-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: #fecaca; }

/* Recordings list ---------------------------------------------------- */
.rec-list { list-style: none; padding: 0; margin: 0; }
.rec-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 10px; border-radius: 12px; transition: background .15s;
}
.rec-item:hover { background: rgba(148, 163, 184, 0.08); }
.rec-info { display: flex; flex-direction: column; min-width: 0; }
.rec-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-meta { color: var(--muted); font-size: 12px; }
.rec-rename {
  width: 100%; max-width: 320px; padding: 6px 8px; font-size: 14px;
  border-radius: 8px; border: 1px solid var(--accent);
  background: rgba(2,6,23,.6); color: var(--text);
}
.rec-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 10px; cursor: pointer;
  background: rgba(148, 163, 184, 0.12); border: 1px solid var(--card-border);
  color: var(--text); padding: 0; text-decoration: none;
}
.icon-btn:hover { background: rgba(148, 163, 184, 0.22); }
.icon-btn.danger:hover { background: rgba(248, 113, 113, 0.2); border-color: rgba(248,113,113,.45); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
