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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface2: #1e1e1e;
  --border: #2a2a2a;
  --text: #ffffff;
  --muted: #888888;
  --accent: #c8a96e;
  --accent-dim: rgba(200, 169, 110, 0.15);
  --danger: #e05c5c;
  --radius: 12px;
  --radius-sm: 8px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Top bar ── */
.topbar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.topbar-user {
  font-size: 0.8rem;
  color: var(--muted);
}

.btn-lang {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}
.btn-lang:hover { background: var(--accent-dim); }

/* ── Bottom nav ── */
.bottomnav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  z-index: 100;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 12px 0 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}
.nav-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.nav-btn.active { color: var(--accent); }
.nav-btn:hover { color: var(--text); }

/* ── Scrollable content area ── */
.view {
  flex: 1;
  padding: 72px 16px 80px;
  overflow-y: auto;
}
.view.auth-view {
  padding-top: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
}

/* ── Auth ── */
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.auth-logo p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 10px 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus { border-color: var(--accent); }
.form-group .hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  padding: 13px;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: default; }

.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
}

/* ── Player ── */
.dj-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.dj-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.dj-say {
  font-size: 1.2rem;
  color: var(--accent);
  line-height: 1.5;
  font-style: italic;
}

.dj-mood {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 10px;
}

.songs-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.song-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.song-item:last-child { border-bottom: none; }

.song-info { flex: 1; min-width: 0; }
.song-item:hover .song-query { color: var(--accent); }
.song-query {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
  word-break: break-word;
  transition: color 0.2s;
}
.song-reason {
  font-size: 0.82rem;
  color: var(--muted);
}
.song-reason span { color: var(--accent); }

.btn-played {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  font-size: 0.8rem;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.btn-played:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-played:disabled { cursor: default; }

/* ── Ask input ── */
.ask-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: flex-end;
}
.ask-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  padding: 12px 14px;
  outline: none;
  resize: none;
  min-height: 48px;
  max-height: 120px;
  transition: border-color 0.15s;
  font-family: inherit;
}
.ask-input:focus { border-color: var(--accent); }
.btn-ask {
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 12px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
  height: 48px;
}
.btn-ask:hover { opacity: 0.9; }
.btn-ask:disabled { opacity: 0.5; cursor: default; }

.loading-text {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px 0;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Profile ── */
.profile-header {
  text-align: center;
  padding: 8px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.profile-username {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}
.profile-email {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}
.btn-logout {
  margin-top: 10px;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

.profile-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.profile-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 9px 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.profile-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.section-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 14px;
}

textarea.profile-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  padding: 12px 14px;
  outline: none;
  resize: vertical;
  min-height: 140px;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 0.15s;
}
textarea.profile-textarea:focus { border-color: var(--accent); }

.btn-save {
  margin-top: 10px;
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 24px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-save:hover { opacity: 0.9; }
.btn-save:disabled { opacity: 0.5; cursor: default; }
.save-confirm {
  display: inline-block;
  color: var(--accent);
  font-size: 0.85rem;
  margin-left: 10px;
}

.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.history-song { font-size: 0.9rem; font-weight: 600; }
.history-artist { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.history-time { font-size: 0.75rem; color: var(--muted); text-align: right; white-space: nowrap; }
.no-history { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 30px 0; }

.btn-replay {
  margin-top: 8px;
  padding: 6px 16px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
}
.btn-replay:hover { background: rgba(200, 169, 110, 0.13); }
