* {
  box-sizing: border-box;
}

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --primary: #58a6ff;
  --primary-hover: #79b8ff;
  --green: #3fb950;
  --red: #f85149;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

header {
  margin-bottom: 2rem;
}

header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
}

.subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.hidden {
  display: none !important;
}

.error {
  color: var(--red);
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 500;
}

.btn-primary {
  background: var(--primary);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-play {
  background: var(--green);
  color: #fff;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
}

.btn-play:hover {
  filter: brightness(1.1);
}

.link {
  color: var(--primary);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

#user-name {
  font-weight: 500;
}

section {
  margin-bottom: 2rem;
}

section h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.playlist-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.playlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.playlist-item:hover {
  border-color: var(--primary);
}

.playlist-item.selected {
  border-color: var(--primary);
  background: rgba(88, 166, 255, 0.1);
}

.stream-form-section {
  margin-top: 2rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.icecast-form {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  align-items: center;
  max-width: 420px;
  margin-top: 0.75rem;
}

.icecast-form label {
  grid-column: 1;
}

.icecast-form input {
  grid-column: 2;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

.icecast-form button {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
  justify-self: start;
}

.stream-result {
  margin-top: 1rem;
  font-size: 0.95rem;
}

.stream-result.success {
  color: var(--green);
}

.stream-result.error {
  color: var(--red);
}

.stream-result a {
  color: var(--primary);
  word-break: break-all;
}

.playlist-info {
  flex: 1;
  min-width: 0;
}

.playlist-name {
  font-weight: 500;
}

.playlist-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.stream-info {
  padding: 1rem;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.stream-info p {
  margin: 0.5rem 0;
}

#listen-url {
  word-break: break-all;
}

.streams-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stream-card {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.stream-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.stream-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.stream-row select {
  min-width: 200px;
  padding: 0.4rem 0.5rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.stream-row .stream-link {
  font-size: 0.85rem;
  color: var(--muted);
}

.stream-row .stream-link a {
  color: var(--primary);
}
