:root {
  --bg: #111318;
  --surface: #191c23;
  --surface-alt: #21252e;
  --text: #f2f2f0;
  --text-dim: #9a9fab;
  --accent: #ffaa40;
  --border: #2a2f3a;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.hidden { display: none !important; }

.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
}

#login-screen {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
}

.login-card h1 { color: var(--accent); margin-bottom: 4px; }
.login-card p { color: var(--text-dim); margin-top: 0; }

input, button {
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 12px 14px;
}

input {
  background: var(--surface);
  color: var(--text);
  width: 100%;
}

#login-screen button, #search-form button, #playlist-form button {
  background: var(--accent);
  color: #1a1200;
  border: none;
  font-weight: 600;
  margin-top: 10px;
  width: 100%;
  cursor: pointer;
}

.error { color: #ff6b6b; font-size: 14px; }

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
  padding-top: env(safe-area-inset-top);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 14px 4px;
  font-size: 14px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

main {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  padding-bottom: 100px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

#search-form, #playlist-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

#search-form input, #playlist-form input { flex: 1; }
#search-form button, #playlist-form button { width: auto; margin-top: 0; white-space: nowrap; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel-header h2 { margin: 0; font-size: 16px; color: var(--text-dim); }

.ghost-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 12px;
  font-size: 13px;
}

.track-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.track-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: 10px;
  padding: 8px 10px;
}

.track-row img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-alt);
  flex-shrink: 0;
}

.track-meta { flex: 1; min-width: 0; }

.track-title {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-sub {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-actions { display: flex; gap: 6px; flex-shrink: 0; }

.track-actions button {
  background: var(--surface-alt);
  border: none;
  color: var(--text);
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
  font-size: 15px;
}

.empty-hint {
  color: var(--text-dim);
  text-align: center;
  padding: 30px 10px;
  font-size: 14px;
}

#playlist-detail { margin-top: 16px; }

footer#now-playing {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
}

#np-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-alt);
  flex-shrink: 0;
}

.np-info { flex: 1; min-width: 0; }
.np-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-uploader { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#np-seek {
  width: 100%;
  margin-top: 4px;
  accent-color: var(--accent);
  height: 20px;
}

.np-controls { display: flex; gap: 6px; flex-shrink: 0; }

.np-controls button {
  background: var(--surface-alt);
  border: none;
  color: var(--text);
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  font-size: 16px;
}

#np-play { background: var(--accent); color: #1a1200; }
