:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-hi: #21262d;
  --row-hover: #1c2128;
  --border: #30363d;
  --border-subtle: #21262d;

  --text: #f0f6fc;
  --body: #c9d1d9;
  --muted: #8b949e;
  --tertiary: #6e7681;

  --accent: #58a6ff;
  --success: #7ee2b8;
  --warn: #ffa657;
  --danger: #ff7b72;
  --rec: #2ea043;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--body);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  background: var(--surface-hi);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--success);
  font-family: Consolas, "SF Mono", monospace;
  font-size: 0.9em;
}

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 14px;
}

/* --- login --- */
.login-card { text-align: center; max-width: 380px; width: 100%; }
.login-card h1 {
  font-size: 28px;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 8px;
}
.subtitle { color: var(--muted); font-size: 15px; margin-bottom: 22px; }

/* --- buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-hi);
  color: var(--text);
  transition: border-color .15s, background .15s, transform .1s;
}
.btn:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-discord { background: var(--accent); border-color: var(--accent); color: #06101f; }
.btn-discord:hover { background: #79b8ff; border-color: #79b8ff; }

.btn-danger { border-color: #5a2225; color: var(--danger); background: #2d1517; }
.btn-danger:hover { background: #3a1a1d; border-color: var(--danger); }

/* --- top bar --- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.user-area { display: flex; align-items: center; gap: 10px; }
.user-area .muted { font-size: 14px; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.dashboard-header h2 { margin: 0; color: var(--text); font-size: 22px; font-weight: 600; }

/* --- guild grid --- */
.guild-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.guild-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  color: var(--body);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color .15s, transform .15s;
}
.guild-card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.guild-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-hi);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.guild-icon img { width: 100%; height: 100%; object-fit: cover; }
.guild-card .track-title { color: var(--text); }

.playing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  margin-left: 6px;
  box-shadow: 0 0 8px var(--success);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.muted { color: var(--muted); }
.bot-label { margin-top: 0; color: var(--muted); font-size: 13px; }

/* --- now playing --- */
.now-playing {
  display: flex;
  gap: 18px;
  align-items: center;
}
.np-art {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-hi);
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.np-info { flex: 1; min-width: 0; }
.np-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-author { color: var(--accent); font-size: 17px; font-weight: 600; margin: 2px 0 6px; }
.np-status {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--success);
}
.np-status.paused { color: var(--warn); }

.progress-wrap { margin-top: 10px; }
.progress-bar {
  height: 6px;
  background: var(--surface-hi);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 4px;
  transition: width 1s linear;
}
.progress-times {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* --- controls --- */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ctrl-btn {
  background: var(--surface-hi);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: border-color .15s, background .15s, transform .1s;
}
.ctrl-btn:hover { border-color: var(--accent); background: var(--row-hover); transform: translateY(-1px); }
.ctrl-btn.danger:hover { border-color: var(--danger); }
.ctrl-btn.active { border-color: var(--success); color: var(--success); }

.controls select {
  background: var(--surface-hi);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  height: 44px;
}

.volume-row { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.volume-row label { color: var(--muted); font-size: 13px; }
input[type="range"] { accent-color: var(--accent); cursor: pointer; }
#volumeValue { color: var(--body); font-variant-numeric: tabular-nums; min-width: 30px; }

/* --- search --- */
#searchForm { display: flex; gap: 10px; }
#searchInput {
  flex: 1;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
#searchInput:focus { outline: none; border-color: var(--accent); }
#searchForm button {
  /* override the global button[type=submit] { width:100% } used by the
     setup forms - here the input should grow, not the button. */
  width: auto;
  flex: 0 0 auto;
  background: var(--accent);
  border: none;
  color: #06101f;
  border-radius: 8px;
  padding: 0 24px;
  margin: 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}
#searchForm button:hover { background: #79b8ff; }

/* --- queue --- */
.queue h3, .settings h3 { color: var(--text); font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.queue-list { list-style: none; }
.queue-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.queue-list li:last-child { border-bottom: none; }
.queue-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-hi);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.queue-list .track-title { color: var(--text); font-weight: 500; }
.track-title { font-weight: 600; }
.track-author { color: var(--muted); font-size: 13px; }
.queue-meta { min-width: 0; overflow: hidden; }
.queue-meta .track-title, .queue-meta .track-author {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}

/* --- forms / setup --- */
.setup-card { max-width: 600px; width: 100%; text-align: left; }
.setup-card h1 { color: var(--text); font-size: 26px; font-weight: 600; margin-bottom: 8px; }
.setup-card h2 { color: var(--text); font-size: 20px; font-weight: 600; margin-bottom: 4px; }

fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin: 0 0 18px;
}
legend { padding: 0 6px; font-weight: 600; color: var(--text); }

form label {
  display: block;
  margin: 12px 0 4px;
  font-size: 13px;
  color: var(--muted);
}
form input[type="text"],
form input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
form input:focus { outline: none; border-color: var(--accent); }

button[type="submit"] {
  width: 100%;
  margin-top: 8px;
  border: none;
  font-size: 15px;
}

.setup-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.setup-header-row .btn { padding: 8px 16px; }
.setup-form-actions { display: flex; gap: 10px; margin-top: 8px; }
.setup-form-actions button { width: auto; flex: 1; }

.bot-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.bot-card {
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.bot-card-name { font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.bot-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.bot-badge-primary { background: rgba(88,166,255,.15); color: var(--accent); }
.bot-badge-disabled { background: rgba(139,148,158,.15); color: var(--muted); }
.bot-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bot-card-actions button, .bot-card-actions a { width: auto; padding: 6px 12px; font-size: 13px; }

/* --- home / landing --- */
.hero {
  display: flex;
  gap: 22px;
  align-items: center;
  background: linear-gradient(135deg, #161b22 0%, #0f1f30 100%);
}
.hero-icon { width: 88px; height: 88px; border-radius: 18px; flex-shrink: 0; border: 1px solid var(--border); }
.hero-title { font-size: 30px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.hero-tagline { font-size: 17px; color: var(--body); margin-bottom: 8px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.section-h {
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  margin: 26px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.guide-step { position: relative; }
.guide-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #06101f;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.callout {
  background: var(--surface);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 14px 18px;
  margin: 16px 0;
}
.callout-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.callout-body { font-size: 14px; color: var(--body); }

.cmd-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
}
.cmd-table td { padding: 11px 14px; border-bottom: 1px solid var(--border-subtle); color: var(--body); }
.cmd-table tr:last-child td { border-bottom: none; }
.cmd-table tr:hover td { background: var(--row-hover); }
.cmd-table td:first-child { white-space: nowrap; width: 1%; }
.cmd-table code { background: var(--surface-hi); }

.site-footer {
  max-width: 1100px;
  margin: 20px auto 0;
  padding: 20px 24px 32px;
  border-top: 1px solid var(--border);
  color: var(--tertiary);
  font-size: 13px;
  text-align: center;
}

/* --- misc --- */
.settings input[type="text"] { max-width: 140px; }
.settings select { max-width: 260px; }

.admin-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.admin-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}
.admin-list .track-title { font-size: 14px; }
.admin-list code { font-size: 12px; }

.error-banner {
  background: #2d1517;
  border: 1px solid #5a2225;
  color: #ffa198;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

@media (max-width: 600px) {
  .container { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .now-playing { flex-direction: column; text-align: center; align-items: center; }
  .np-info { width: 100%; }
  .np-title { white-space: normal; font-size: 22px; }
  .volume-row { margin-left: 0; width: 100%; }
  .guild-grid { grid-template-columns: 1fr; }
  .hero { flex-direction: column; text-align: center; }
  .hero-actions { justify-content: center; }
  .user-area .btn { padding: 8px 12px; font-size: 13px; }
}
